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. Use the push button as a check button and use the grouping function
Forum Updated to NodeBB v4.3 + New Features

Use the push button as a check button and use the grouping function

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 332 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.
  • I Offline
    I Offline
    IknowQT
    wrote on 9 Feb 2022, 08:47 last edited by
    #1

    I know that I need to put setchakable(true) to use the pushbutton as a radio button.

    Is there a way to automatically check each other's click status when creating multiple chakable buttons?

    For example in C# you can group radio buttons so that only one is selected. Does qt provide the same functionality like this one?

    J 1 Reply Last reply 9 Feb 2022, 09:21
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 9 Feb 2022, 08:52 last edited by
      #2

      Write it by yourself - a simple for loop isn't that hard.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      I 1 Reply Last reply 9 Feb 2022, 09:04
      1
      • C Christian Ehrlicher
        9 Feb 2022, 08:52

        Write it by yourself - a simple for loop isn't that hard.

        I Offline
        I Offline
        IknowQT
        wrote on 9 Feb 2022, 09:04 last edited by
        #3

        @Christian-Ehrlicher

        There seems to be such a thing as a button group, how about applying it?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 9 Feb 2022, 09:10 last edited by
          #4

          @IknowQT said in Use the push button as a check button and use the grouping function:

          how about applying it?

          What apply? Instantiate it, add buttons via addButton() and look if it works the way you want.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • I IknowQT
            9 Feb 2022, 08:47

            I know that I need to put setchakable(true) to use the pushbutton as a radio button.

            Is there a way to automatically check each other's click status when creating multiple chakable buttons?

            For example in C# you can group radio buttons so that only one is selected. Does qt provide the same functionality like this one?

            J Offline
            J Offline
            JonB
            wrote on 9 Feb 2022, 09:21 last edited by JonB 2 Sept 2022, 09:23
            #5

            @IknowQT said in Use the push button as a check button and use the grouping function:

            For example in C# you can group radio buttons so that only one is selected. Does qt provide the same functionality like this one?

            Yes QButtonGroup has that functionality. Note it says:

            QButtonGroup provides an abstract container into which button widgets can be placed. It does not provide a visual representation of this container (see QGroupBox for a container widget), but instead manages the states of each of the buttons in the group.

            So you still add your buttons onto whatever widgets like QGroupBox for visual layout, you also add the buttons onto the (non-visual) QButtonGroup for the behaviour (like exclusivity) you want.

            1 Reply Last reply
            1

            1/5

            9 Feb 2022, 08:47

            • Login

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