Results 1 to 3 of 3

Thread: QCheckbox - how to set next state after clicking "partially checked"?

  1. #1
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QCheckbox - how to set next state after clicking "partially checked"?

    Hi all,

    I have a QCheckbox with a "partially checked"-state. When clicked, it sets "checked"-state. But I want to set "unchecked" instead. How to do that?

    thanks in advance!
    Felix

  2. #2
    Join Date
    May 2009
    Location
    Canada
    Posts
    163
    Thanks
    7
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows Android

    Default Re: QCheckbox - how to set next state after clicking "partially checked"?

    Have you tried connecting QCheckbox::stateChanged() to a custom slot that tests QCheckbox::checkState() and sets to unchecked as appropriate?

  3. The following user says thank you to Urthas for this useful post:

    FelixB (2nd March 2012)

  4. #3
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QCheckbox - how to set next state after clicking "partially checked"?

    in the meantine, yes. But I don't use checkState(), instead I check if the condition for "partially checked" is still true - in my case: not all elements of a group are selected. If so, I set the state to "unchecked" before proceeding the rest of the checkState()-method.

Similar Threads

  1. Replies: 2
    Last Post: 3rd March 2012, 06:59
  2. How to get the color of "checked" QPushButton
    By ScottBell in forum Newbie
    Replies: 2
    Last Post: 21st November 2011, 21:15
  3. Replies: 0
    Last Post: 4th October 2010, 21:53
  4. Replies: 3
    Last Post: 17th March 2010, 16:47
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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.