QListWidget项目/图标之间的差距

时间:2018-06-06 20:09:27

标签: python pyside2

我想删除textureIconChart QListWidget中我的QListWidget项之间的差距。它填充了使用像素图标设置的项目。我正在使用QListWidget设置为QHBoxLayout,它设置为QVBoxLayout。

enter image description here

import maya.cmds as cmds
import os
import maya.OpenMayaUI as mui
from PySide2 import QtWidgets,QtCore,QtGui
import shiboken2


class texture_replacer():

    def texture_linker_UI(self):        
        windowName = "name"
        if cmds.window(windowName,exists = True):
            cmds.deleteUI(windowName, wnd = True)           
        pointer = mui.MQtUtil.mainWindow()
        parent = shiboken2.wrapInstance(long(pointer),QtWidgets.QWidget)
        window = QtWidgets.QMainWindow(parent)
        window.setObjectName(windowName)
        window.setWindowTitle(windowName)       
        window.setMinimumSize(450,650)
        window.setMaximumSize(600,400)
        mainWidget = QtWidgets.QWidget()
        window.setCentralWidget(mainWidget)
        verticalLayout = QtWidgets.QVBoxLayout(mainWidget)                                    
        self.textureIconChartLayout = QtWidgets.QVBoxLayout()
        textureIconsLayout = QtWidgets.QHBoxLayout()        
        self.textureIconChartLayout.addLayout(textureIconsLayout)
        verticalLayout.addLayout(self.textureIconChartLayout)       
        self.textureIconChart = QtWidgets.QListWidget()       
        self.textureIconChart.setViewMode(QtWidgets.QListWidget.IconMode)
        self.textureIconChart.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)        
        self.textureIconChart.setDragEnabled(0)
        self.textureIconChart.setMaximumWidth(290)
        self.populateListWidget()                            
        textureIconsLayout.addWidget(self.textureIconChart)

        textureIconsLayout.setSpacing(0)
        textureIconsLayout.setContentsMargins(0,0,0,0)


tr = texture_replacer()
tr.texture_linker_UI()

0 个答案:

没有答案