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. Tri states checkable button
Forum Updated to NodeBB v4.3 + New Features

Tri states checkable button

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 990 Views
  • 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.
  • D Offline
    D Offline
    DavidM29
    wrote on last edited by
    #1

    Hello,
    I would like to make a Tri states checkable button.
    How can I achieve this ?

    My goal here is to have a picture and when the user click on it, it change and show different functions and I want to be able to switch between 3 different mode at only one place. Maybe I have a bad idea of how doing it, if so please tell me the best solution.

    Thanks

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Alain38 0
      wrote on last edited by
      #2

      Hi,
      use a QCheckBox it is a tri-state button.

      D 1 Reply Last reply
      1
      • A Alain38 0

        Hi,
        use a QCheckBox it is a tri-state button.

        D Offline
        D Offline
        DavidM29
        wrote on last edited by
        #3

        @Alain38-0
        What does the checkState() method on this kind of checkbox ?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Alain38 0
          wrote on last edited by
          #4

          If you create a QCheckBox, and then set it as tri-state button (you have to call the function setTriState as explained in the class documentation), the checkState returns three possible values: Checked, Unchecked, and PartiallyChecked. For more details, please refer to the documentation of QCheckBox

          D 1 Reply Last reply
          2
          • A Alain38 0

            If you create a QCheckBox, and then set it as tri-state button (you have to call the function setTriState as explained in the class documentation), the checkState returns three possible values: Checked, Unchecked, and PartiallyChecked. For more details, please refer to the documentation of QCheckBox

            D Offline
            D Offline
            DavidM29
            wrote on last edited by
            #5

            @Alain38-0
            Thank you for your answer and your time.

            If you still have time for me is there a way to make a X-states button/checkbox ? (Just because I'm interested)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Alain38 0
              wrote on last edited by
              #6

              QCheckBox is derived from QAbstractButton. As QAbstractButton is normally for two-states buttons and QCheckBox adds a new state, I think that it should be possible to create its own x-state button. For this you will have to override the protected function nextCheckState.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                DavidM29
                wrote on last edited by
                #7

                Ok if one day I have to do something like this I'll try. Thank you

                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