thefatladysingsopera
2nd September 2011, 18:42
I have created two sub menus in my save button using the code below.
QMenu *menu = new QMenu(this);
QAction *saveAction = menu->addAction("Save New");
QAction *editAction = menu->addAction("Save Edits");
ui.saveButton->setMenu(menu);
connect(saveAction, SIGNAL(triggered()), this, SLOT(saveNew()));
connect(editAction, SIGNAL(triggered()), this, SLOT(saveEdits()));
The project compiles without any errors but when i click any of the sub-menus i have created,the saveAction or the editAction slots won't execute.
What i am i doing wrong?.
QMenu *menu = new QMenu(this);
QAction *saveAction = menu->addAction("Save New");
QAction *editAction = menu->addAction("Save Edits");
ui.saveButton->setMenu(menu);
connect(saveAction, SIGNAL(triggered()), this, SLOT(saveNew()));
connect(editAction, SIGNAL(triggered()), this, SLOT(saveEdits()));
The project compiles without any errors but when i click any of the sub-menus i have created,the saveAction or the editAction slots won't execute.
What i am i doing wrong?.