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. How to have checkbox or Toggle behavior for QAction in QActionGroup
Forum Updated to NodeBB v4.3 + New Features

How to have checkbox or Toggle behavior for QAction in QActionGroup

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.9k Views 1 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    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-worxR 1 Reply Last reply
    0
    • Q Qt Enthusiast

      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-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @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
      0
      • Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by
        #3

        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

        RatzzR raven-worxR 2 Replies Last reply
        0
        • Q Qt Enthusiast

          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

          RatzzR Offline
          RatzzR Offline
          Ratzz
          wrote on last edited by
          #4

          @Qt-Enthusiast
          But doc says

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

          --Alles ist gut.

          1 Reply Last reply
          0
          • Q Qt Enthusiast

            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

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by raven-worx
            #5

            @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
            1
            • Q Offline
              Q Offline
              Qt Enthusiast
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0
              • Q Offline
                Q Offline
                Qt Enthusiast
                wrote on last edited by
                #7

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

                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