Saturday, 15 September 2012

python - Signal when an item is added or removed to a QListWidget -


I dynamically add and remove objects on a QListWidget based on user selections in the application. Is there a signal that is emitted when items are added or QListWidget is removed? What I see in the documentation does not mention anything for adding or removing the rest of the signals when it is interacted with individual objects.

How can I be informed if an item is added to my QListWidget?

A very simple example: PyQt4.QtGui import from * Import Sys app = QApplication (sys.argv) to listWidget = I in category for QListWidget (): Item = QListWidgetItem ("item% i"% i) listWidget.addItem (item) # ^^^ What do I want to do to control the addItem event?

You have to capture the contained object object in the widget :

  model = ListWidget.model ()  

has a identification of rows that you can connect to .


No comments:

Post a Comment