#include#include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QToolBar toolBar; QAction* action = new QAction("Action", &toolBar); toolBar.addActions(QList () << action); toolBar.show(); return a.exec(); }
#includeThese examples demonstrate the use of the addActions method in the Qt library. The Qt library is a comprehensive C++ application development framework that provides a set of GUI, networking, and other tools for building cross-platform applications.#include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QToolBar toolBar; QActionGroup* actionGroup = new QActionGroup(&toolBar); QAction* action1 = new QAction("Action 1", actionGroup); QAction* action2 = new QAction("Action 2", actionGroup); QAction* action3 = new QAction("Action 3", actionGroup); action2->setCheckable(true); action2->setChecked(true); actionGroup->addActions(QList () << action1 << action2 << action3); toolBar.addActions(actionGroup); toolBar.show(); return a.exec(); }