Results 1 to 1 of 1

Thread: [SOLVED] QCheckBox Tristate

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: [SOLVED] QCheckBox Tristate

    I have a Properties table I am creating and I have some fields that are boolean values. I use a QCheckBox for the user to toggle between these values. One of the features I would like to add is to allow the user to select multiple items and checking the checkbox on would set all the selected elements to TRUE for that property.

    However, if the selection has some elements with the property as TRUE and other elements have the property as FALSE, I would like to display the PartiallyChecked status to alert the user that not all the elements have the same value. Then when the user modifies this, I would only like them to choose Checked or Unchecked.

    So is there a way to make a QCheckBox have Tristate capabilities but to make PartiallyChecked only accessible by the program and not the user?

    Thanks and let me know if you need any further clarification!
    Todd

    EDIT:

    I was able to solve this by quickly subclassing QCheckBox and overriding the nextCheckState( ) function to set the check state to Qt::Unchecked if it was Checked, and Checked otherwise.
    Last edited by ToddAtWSU; 15th January 2014 at 20:12.

Similar Threads

  1. tristate
    By mickey in forum Qt Programming
    Replies: 3
    Last Post: 1st December 2014, 09:37
  2. CheckStateRole and TriState
    By BreakBad in forum Qt Programming
    Replies: 1
    Last Post: 6th September 2013, 22:47
  3. QCheckBox
    By sajis997 in forum Qt Programming
    Replies: 1
    Last Post: 2nd May 2012, 14:15
  4. QCheckBox value
    By Koas in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2009, 13:33
  5. Tristate Flag ignored in QListWidgetItem
    By ghoust26 in forum Qt Programming
    Replies: 0
    Last Post: 16th April 2008, 08:21

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.