#include#include int main(int argc, char *argv[]) { QActionGroup *group = new QActionGroup(); QAction *action1 = new QAction("Action 1"); QAction *action2 = new QAction("Action 2"); group->addAction(action1); group->addAction(action2); // More code... }
#includeIn this example, a default QAction object is set by using the setChecked method on one of the QAction objects added to the group. Package Library: Qt Core.#include int main(int argc, char *argv[]) { QActionGroup *group = new QActionGroup(); QAction *action1 = new QAction("Action 1"); QAction *action2 = new QAction("Action 2"); group->addAction(action1); group->addAction(action2); action1->setChecked(true); // More code... }