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. Problem in adding Qactions to frame.
Forum Updated to NodeBB v4.3 + New Features

Problem in adding Qactions to frame.

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 241 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.
  • S Offline
    S Offline
    SId7117
    wrote on last edited by
    #1

    Hi,
    I am trying to create a toolbar like structure using a qframe by adding some q actions with icons to it. But Qt doesnt seem to display the created actions on the GUI. Please correct me if i'm doing it wrong. Code is attached.

    QIcon LEDicon;
    LEDicon.addPixmap(QPixmap(":/Images/DILow.png"), QIcon::Normal, QIcon::Off);
    LEDicon.addPixmap(QPixmap(":/Images/DIHigh.png"), QIcon::Normal, QIcon::On);

                //Create actions.
                QAction *DIOLine0 = new QAction(LEDicon, "DIOLine0", this);
                DIOLine0->setCheckable(true);
                QAction *DIOLine1 = new QAction(LEDicon, "DIOLine1", this);
                DIOLine1->setCheckable(true);
    
                QActionGroup  *DIOStatus = new QActionGroup(this);
                
                //Adding Actions to the group
               
                DIOStatus->addAction(DIOLine0);
                DIOStatus->addAction(DIOLine1);
                
                //Adding Actions to the frame.
                ui->frame->addActions(DIOStatus->actions());
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      QAction has no visual representation. Typically QToolBar will create QToolButtons out of the information provided by QAction.

      Adding QAction objects to a widget simply allows to trigger their associated shortcut when said widget has focus.

      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
      3

      • Login

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