繁体   English   中英

如何在QListWidget中增加缩略图的大小

[英]How to increase the size of a thumbnail in QListWidget

问题 =>我想创建一个QlistWidgetItem对象,该对象包含一个图像列表以及其缩略图的列表,其尺寸比当前的尺寸要大(类似于Windows资源管理器中的“中号图标”或“大图标”选项)

到目前为止的进度 =>我设法找到了如何创建列表的方法,除了图标之外,其他所有图标都太小了。

我尝试过的操作 =>我尝试更改列表项的字体大小,并假定cld也使字体成比例地变大。 没用 我还尝试根据另一位在线博客作者使用(PIL的图像)设置缩略图的大小,但是效果也不好。

代码段 =>#从PIL导入了Image和ImageQt,还导入了QtGui和QtCore

    testimages = glob.glob(dirname +  "/*.jpg")
    # Create a list item for each image file,
    # setting the text and icon appropriately
    for image in testimages:
        picture = Image.open(image)
        picture.thumbnail((128,128), Image.ANTIALIAS)
        icon = QIcon(QPixmap.fromImage(ImageQt.ImageQt(picture)))
        item = QListWidgetItem(image, self)
        item.setIcon(icon)
        fonter = QFont("Times New Roman")
        fonter.setPointSize(14)
        item.setFont(fonter)

希望你们能帮助我。 :)

使用QListWidget上的setIconSize定义所需的大小。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM