Results 1 to 1 of 1

Thread: Detect clicking on checkbox inside a dynamic-populated QTreeWidget

  1. #1
    Join Date
    Dec 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Detect clicking on checkbox inside a dynamic-populated QTreeWidget

    I've a QTreeWidget whereby the QTreeWidgetItems are added using web-services.
    I've reimplemented the mousePressEvent to detect whether the expansion sign of a QTreeWidgetItem is being clicked. If so, a custom signal will be emitted, connecting to a slot. In this slot, I will check for this item's isExpanded(). If it is not expanded, I will use web service to retrieve the data to add as QTreeWidgetItem inside this item.
    The population part is working. However, every QTreeQidgetItem has a checkbox. I need to detect when a checkbox is clicked. This is because I want to recursively check all child checkboxes if a parent checkbox is clicked. And recursively uncheck all parent checkboxes if a child checkbox is clicked.
    I cannot use itemChanged signal as it will be emitted whenever a change occurs. Therefore adding QTreeWidgetItem will emit itemChanged.

    Any idea of how to detect when a checkbox in a QTreeWidget is clicked? Is there a way to detect only checkbox click during mousePressEvent?
    Last edited by tkm; 11th January 2011 at 09:11.

Similar Threads

  1. CheckBox inside a QTableView
    By voilier92 in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2010, 05:04
  2. How to add a checkBox to the headerItem of QTreeWidget
    By candela in forum Qt Programming
    Replies: 1
    Last Post: 20th August 2009, 05:31
  3. QTreeWidget row updates inside QDialog
    By innerhippy in forum Qt Programming
    Replies: 4
    Last Post: 19th December 2008, 18:32
  4. Replies: 2
    Last Post: 5th June 2008, 21:32
  5. eventFilter and clicking inside QSpinBox
    By T4ng10r in forum Qt Programming
    Replies: 2
    Last Post: 6th March 2007, 21:02

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.