找回密码
 立即注册
收起左侧

Label显示图片尺寸变大

3
回复
8601
查看
[复制链接]
累计签到:12 天
连续签到:1 天
来源: 2017-6-19 21:16:01 显示全部楼层 |阅读模式
1Qter豆
唔,原谅我还很菜,实在不知道问题应该怎么描述才精确

向大家请教一个问题,我在GridLayout里放了一个label显示图片,给GridLayout设置了横竖比,大概是这样:
但是读取图片以后缩略图所在的label就不按我设置的GridLayout横竖比例显示了,占了整个界面的1/3,大了很多。
这是为什么,需要去看哪部分的知识



附件: 您需要 登录 才可以下载或查看,没有帐号?立即注册

最佳答案

查看完整内容

Image 对象的这个属性,应该是你要的东西! fillMode : enumeration Set this property to define what happens when the source image has a different size than the item. Image.Stretch - the image is scaled to fit Image.PreserveAspectFit - the image is scaled uniformly to fit without cropping Image.PreserveAspectCrop - the image is scaled uniformly to fill, cropping if necessary Image.Tile - the image i ...
回复

使用道具 举报

累计签到:742 天
连续签到:1 天
2017-6-19 21:16:02 显示全部楼层
Image 对象的这个属性,应该是你要的东西!

fillMode : enumeration

Set this property to define what happens when the source image has a different size than the item.
Image.Stretch - the image is scaled to fit
Image.PreserveAspectFit - the image is scaled uniformly to fit without cropping
Image.PreserveAspectCrop - the image is scaled uniformly to fill, cropping if necessary
Image.Tile - the image is duplicated horizontally and vertically
Image.TileVertically - the image is stretched horizontally and tiled vertically
Image.TileHorizontally - the image is stretched vertically and tiled horizontally
Image.Pad - the image is not transformed
回复

使用道具 举报

累计签到:12 天
连续签到:1 天
2017-6-20 16:41:30 显示全部楼层
Since 发表于 2017-6-20 08:34
Image 对象的这个属性,应该是你要的东西!

fillMode : enumeration

先谢谢!唔,没用QML,有其它方法吗?
回复

使用道具 举报

累计签到:12 天
连续签到:1 天
2017-6-20 21:27:22 显示全部楼层
如果不用QML,找到了解决途径,http://blog.csdn.net/emdfans/article/details/52936637
谢谢回答的人了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了