我想消除我的 textureIconChart QListWidget 中我的 QListWidget 项目之间的差距。它填充了用像素图图标设置的项目。我正在使用设置为 QHBoxLayout 的 QListWidget,它设置为 QVBoxLayout。
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()