QActionGroup* group = new QActionGroup(this); QAction* action1 = new QAction("Action 1", this); QAction* action2 = new QAction("Action 2", this); QAction* action3 = new QAction("Action 3", this); group->addAction(action1); group->addAction(action2); group->addAction(action3);
QActionGroup* group = new QActionGroup(this); QAction* action1 = new QAction("Action 1", this); QAction* action2 = new QAction("Action 2", this); QAction* action3 = new QAction("Action 3", this); action1->setCheckable(true); action2->setCheckable(true); action3->setCheckable(true); group->setExclusive(true); group->addAction(action1); group->addAction(action2); group->addAction(action3);
QActionGroup* group = new QActionGroup(this); QAction* action1 = new QAction("Action 1", this); QAction* action2 = new QAction("Action 2", this); QAction* action3 = new QAction("Action 3", this); group->addAction(action1); group->addAction(action2); group->addAction(action3); connect(group, SIGNAL(triggered(QAction*)), this, SLOT(onActionTriggered(QAction*)));The above examples demonstrate how QActionGroup can be used to manage a group of related actions in a Qt application. The Qt framework provides a rich set of classes for building cross-platform desktop applications. The QActionGroup class is included in the Qt Widgets module, which is a part of the Qt package library.