这里非常困惑...试图选择QListWidget中的所有项目。奇怪的是,我在使用这段代码之前已经做到了这一点,但这一次是在向我咆哮?
# Error: 'PySide.QtGui.QListWidget' object has no attribute 'setItemSelected'
# Traceback (most recent call last):
# File "<maya console>", line 2, in <module>
# ...............
# self.locListWidget.setItemSelected(item, True)
# AttributeError: 'PySide.QtGui.QListWidget' object has no attribute 'setItemSelected' #
if (sizeDimensionLocators > 0):
for loc in dimensionLocators:
self.locListWidget.addItem(loc)
for i in range(self.locListWidget.count()):
item = self.locListWidget.item(i)
self.locListWidget.setItemSelected(item, True) <---------- Issue Here
答案 0 :(得分:2)
QListWidget没有setItemSelected
:
你可以这样做:
item.setSelected(true)
您可能还需要查看选择模式: