Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QCheckBox, setting custom values for states?
Qt 6.12 LTS is out! See what's new in the release blog

QCheckBox, setting custom values for states?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 985 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    Is it possible to set or associate values to a checkbox so when it is clicked it has one value and when it isn't it has another?

    Kind Regards,
    Sy

    JonBJ 2 Replies Last reply
    0
    • SPlattenS SPlatten

      Is it possible to set or associate values to a checkbox so when it is clicked it has one value and when it isn't it has another?

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @SPlatten
      QCheckBox itself has a boolean/tristate value. Derive from QCheckBox and add your own property/return result.

      1 Reply Last reply
      1
      • SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #3

        Done it already :)

        Kind Regards,
        Sy

        JonBJ 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          What kind of values do you have in mind ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • SPlattenS SPlatten

            Done it already :)

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #5

            @SPlatten
            Yeah well that's because it was only a one-liner, right? :)

            1 Reply Last reply
            0
            • SPlattenS Offline
              SPlattenS Offline
              SPlatten
              wrote on last edited by
              #6

              One day soon I'll create a post to share what I've been working on, not quite ready yet but soon.

              Kind Regards,
              Sy

              1 Reply Last reply
              0
              • SPlattenS SPlatten

                Is it possible to set or associate values to a checkbox so when it is clicked it has one value and when it isn't it has another?

                JonBJ Online
                JonBJ Online
                JonB
                wrote on last edited by
                #7

                @SPlatten
                You could choose to use QObject::property(const char *name), and change its value when the check changes, to implement something which could be exposable to the outside world. If you wanted.

                1 Reply Last reply
                2

                • Login

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