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. ActionGroup and Toolbar
Qt 6.11 is out! See what's new in the release blog

ActionGroup and Toolbar

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 762 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
    django.Reinhard
    wrote on last edited by
    #1

    Hi,

    I create some QActions like this:

    QActionGroup ag(this);
    QAction* a = new QAction( ... );
    
    a->setCheckable(true);
    ag->addAction(a);
    
    QAction* b = new QAction( ... );
    b->setCheckable(true);
    ag->addAction(b);
    
    ...
    

    later on I create toolbars, where I add those actions

    QToolBar* tb = new QToolBar("check", this);
    
    tb->addAction(a);
    tb->addAction(b);
    

    but when I switch a toolbarbutton, nothing happens to respect of group behaviour of the other button.

    Am I missing something, or are QActionGroup not intended to work with toolbars?

    eyllanescE 1 Reply Last reply
    0
    • D django.Reinhard

      Hi,

      I create some QActions like this:

      QActionGroup ag(this);
      QAction* a = new QAction( ... );
      
      a->setCheckable(true);
      ag->addAction(a);
      
      QAction* b = new QAction( ... );
      b->setCheckable(true);
      ag->addAction(b);
      
      ...
      

      later on I create toolbars, where I add those actions

      QToolBar* tb = new QToolBar("check", this);
      
      tb->addAction(a);
      tb->addAction(b);
      

      but when I switch a toolbarbutton, nothing happens to respect of group behaviour of the other button.

      Am I missing something, or are QActionGroup not intended to work with toolbars?

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @django-Reinhard Change to QActionGroup *ag = new QActionGroup(this);

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      1
      • D Offline
        D Offline
        django.Reinhard
        wrote on last edited by
        #3

        Thanks a lot! That did the trick.
        Interesting! Wasn't aware of that difference.

        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