Important: Please read the Qt Code of Conduct -

Problem in adding Qactions to frame.

  • 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);
                QAction *DIOLine1 = new QAction(LEDicon, "DIOLine1", this);
                QActionGroup  *DIOStatus = new QActionGroup(this);
                //Adding Actions to the group
                //Adding Actions to the frame.

  • Lifetime Qt Champion


    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.

Log in to reply