PySide.QtGui.QListWidget'对象没有属性'setItemSelected'

时间:2018-01-19 19:57:41

标签: python pyside qlistwidget

这里非常困惑...试图选择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