Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Unsolved How to have checkbox or Toggle behavior for QAction in QActionGroup

    General and Desktop
    3
    7
    1498
    Loading More Posts
    • 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.
    • Q
      Qt Enthusiast last edited by

      I have QActionGroup in Which I adding various Qactions

      QAction d_actionView1 = new QAction();
      QAction d_actionView2 = new QAction();
      QActionGroup_viewGroup = new IN_CURRENT_POOL QActionGroup(this);
      d_viewGroup->addAction(d_actionView1);
      d_viewGroup->addAction(d_actionView2);

      I want to have toggle behaviour for each d_actionView1 and d_actionView2 . Can we have check boxes for the same to have toggle behaviour for the same

      raven-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @Qt Enthusiast last edited by

        @Qt-Enthusiast
        set the action group to exclusive.
        The widget which then displays (using the platform style) decides how to present it.

        A menu for example should draw radiobuttons IIRC

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 0
        • Q
          Qt Enthusiast last edited by

          I want a checkbox so that user can select multiple actions at one time . For example

          QAction d_actionView1 = new QAction();
          QAction d_actionView2 = new QAction();

          user should be able to select d_actionView1 and d_actionView2 at same one time

          Ratzz raven-worx 2 Replies Last reply Reply Quote 0
          • Ratzz
            Ratzz @Qt Enthusiast last edited by

            @Qt-Enthusiast
            But doc says

            only one of these actions should be active at any one time.

            --Alles ist gut.

            1 Reply Last reply Reply Quote 0
            • raven-worx
              raven-worx Moderators @Qt Enthusiast last edited by raven-worx

              @Qt-Enthusiast
              well this is very special application logic i would say. So you need to take care of it.
              Connect to QActionGroup's triggered(QAction*) signal and check the action. Then you can set the other action also to de-/selected.

              @Ratzz
              yes, only when it's set to exclusive.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              1 Reply Last reply Reply Quote 1
              • Q
                Qt Enthusiast last edited by

                is it possible to change the bacground color of the QAction when want to show the toggled behavior

                1 Reply Last reply Reply Quote 0
                • Q
                  Qt Enthusiast last edited by

                  so default we can have mutiple QActions selected at one time . does they behave a radio buttons if yes why

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post