c++ - qt中使用图片不能铺满窗口
高洛峰
高洛峰 2017-04-17 13:49:06
0
3
785

我尝试在窗口中添加图片并且铺满窗口,

但是在实际运行过程中显示成了这样

尝试改变目标矩形的大小也没有作用

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

全員に返信(3)
小葫芦

你应该对QPixmap做下缩放吧,该函数有方法scaledToWidth和scaledToHeight

QPixmap QPixmap::scaledToWidth(int width, Qt::TransformationMode mode = Qt::FastTransformation) const

Returns a scaled copy of the image. The returned image is scaled to the given width using the specified transformation mode. The height of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.

If width is 0 or negative, a null pixmap is returned.

缩放图片后再进行绘制

いいねを押す +0
左手右手慢动作

你这里的QPainter painter(this)中的this是你wuziqi这个窗口吗?

いいねを押す +0
Ty80

你的那个qipan的控件就没有铺满窗口……

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!