Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QCheckBox - how to have and not have tristate at the same time? ;)
Qt 6.11 is out! See what's new in the release blog

QCheckBox - how to have and not have tristate at the same time? ;)

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 558 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wodzu
    wrote on last edited by
    #1

    Hello,

    In my application sometimes I need to set up QCheckBox to Qt::PartiallyChecked. It works fine, however when user clicks on QCheckBox I don't want to give him possibility to set up this state. User should be able to setcheckbox only to Qt::Unchecked or Qt::Checked. What is the best way to implement this?

    Thanks for your help.

    As above so below...

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Connect to stateChanged(int state) signal and if the param is anything but Qt::PartiallyChecked call setTristate(false).

      1 Reply Last reply
      3
      • W Offline
        W Offline
        Wodzu
        wrote on last edited by
        #3

        Works like a charm, thank you.

        As above so below...

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved