Results 1 to 4 of 4

Thread: QListWidgetItem with checkboxes: detecting when state changed

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default QListWidgetItem with checkboxes: detecting when state changed

    Is there a signal emitted when the user changes the state of the checkbox? As far as I can tell it's not any of these:
    Qt Code:
    1. // QTreeWidget
    2. void currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
    3. void itemActivated(QTreeWidgetItem *,int);
    4. void itemChanged(QTreeWidgetItem * item, int column);
    5. void itemClicked(QTreeWidgetItem *, int);
    6. void itemCollapsed(QTreeWidgetItem *);
    7. void itemDoubleClicked(QTreeWidgetItem *,int);
    8. void itemEntered(QTreeWidgetItem *, int);
    9. void itemExpanded(QTreeWidgetItem *);
    10. void itemPressed(QTreeWidgetItem *, int);
    11. void itemSelectionChanged();
    12. // Signals inherited from QTreeView
    13. void collapsed(const QModelIndex &);
    14. void expanded(const QModelIndex &);
    15. // Signals inherited from QAbstractItemView
    16. void activated(const QModelIndex &);
    17. void clicked(const QModelIndex &);
    18. void doubleClicked(const QModelIndex &);
    19. void entered(const QModelIndex &);
    20. void pressed(const QModelIndex &);
    21. void viewportEntered();
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QListWidgetItem with checkboxes: detecting when state changed

    J-P Nurmi

  3. #3
    Join Date
    Mar 2006
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QListWidgetItem with checkboxes: detecting when state changed

    After further experimentation, I think QTreeWidget is emitting a itemChanged signal. In my original test code, I had inadvertently connected the itemChanged and itemPressed signals to the same slot.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QListWidgetItem with checkboxes: detecting when state changed

    Hmm, somewhy I thought you were after a signal which would be emitted only in consequence of check state change..
    Yes, the itemChanged() signal is emitted when the check state changes. Though, it it also emitted whenever any item's value changes. This includes values of any item data role.
    J-P Nurmi

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.