Hey guys, I'm doing PySide, I hope that's not a problem for this forum? Since it's very close to PyQt I will try.
first I disconnect the previous function associated with the QListWidget click command
I'm chaging the selection mode for my QListWidget and calling a new function on click
(first question, do I also need to disconnect the old selection mode that was assigned or is setSelectionMode overriding the old one?)
self.listWidget_lights.itemClicked.disconnect(self.funcUpdateLights)
self.listWidget_filters.itemClicked.connect(self.connectingFiltersFunc)
self.listWidget_lights.itemClicked.disconnect(self.funcUpdateLights)
self.listWidget_filters.setSelectionMode (QtGui.QAbstractItemView.MultiSelection)
self.listWidget_filters.itemClicked.connect(self.connectingFiltersFunc)
To copy to clipboard, switch view to plain text mode
then I call:
def connectingFiltersFunc(self):
print item
print self.listWidget_filters.indexFromItem(item).row()
def connectingFiltersFunc(self):
item = QtGui.QListWidgetItem(self.listWidget_filters)
print item
print self.listWidget_filters.indexFromItem(item).row()
To copy to clipboard, switch view to plain text mode
and this is already behaving weird.
If I click on one of my items in the widget multiple times to select or deselect it needs two clicks to select or deselect.
Now even when I click the same item I always get a different result as pointer.
print item returns when the same item is clicked:
<PySide.QtGui.QListWidgetItem object at 0x000000009B61D348>
<PySide.QtGui.QListWidgetItem object at 0x000000009B61D988>
<PySide.QtGui.QListWidgetItem object at 0x000000009B61D808>
<PySide.QtGui.QListWidgetItem object at 0x000000009B61D4C8>
<PySide.QtGui.QListWidgetItem object at 0x000000009B61DC88>
<PySide.QtGui.QListWidgetItem object at 0x000000009B61D788>
<PySide.QtGui.QListWidgetItem object at 0x000000009B61DC48>
<PySide.QtGui.QListWidgetItem object at 0x000000009B61D708>
<PySide.QtGui.QListWidgetItem object at 0x000000009B61DD88>
<PySide.QtGui.QListWidgetItem object at 0x000000009B61D5C8>
self.listWidget_filters.indexFromItem(item).row()
this one looks in a dictionary to find the right entry and return what entry was just selected.
this returns no matter what Item I select or deselect:
19
20
21
22
23
24
25
26
27
28
.
.
.
anyone any idea what's going on?
I really just started with Pyside /qt
thank you
Bookmarks