Issue
Extremely confused here... trying to select all items in a QListWidget. Strangely enough I have done this before fine with this code, but this time it is barking back at me?
# 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
Solution
QListWidget doesn't have a setItemSelected
:
- https://srinikom.github.io/pyside-docs/PySide/QtGui/QListWidget.html#PySide.QtGui.QListWidget
- http://doc.qt.io/archives/qt-4.8/qlistwidget.html#selectedItems
You can do this though:
item.setSelected(true)
- http://doc.qt.io/qt-5/qlistwidgetitem.html#setSelected
You might also need to review the selection mode:
Answered By - kaliatech
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.