well yes, I solved the problem using qt Designer. But, now, I have problem accessing the QActions defined in the menus.
because I wanted to have a separate menu class and add it to the main window, in my code, i created a function to which mainwindow uses to send the menu pointers to the Menu class:
before that this is what happens inside mainwindow constructor:
myMenu = new Menu();
myMenu->setList(ui->menuVideo, ui->menuSettings, ui->menuHelp);
myMenu = new Menu();
myMenu->setList(ui->menuVideo, ui->menuSettings, ui->menuHelp);
To copy to clipboard, switch view to plain text mode
inside Menu class
{
videoMenu = video;
settingsMenu = setting;
helpMenu = help;
connect(settingsMenu,
SIGNAL(triggered
(QAction*)),
this,
SLOT(Func_CAM_IRCorrection_standard
(QAction *)));
}
void Menu::setList(QMenu *video, QMenu *setting, QMenu *help)
{
videoMenu = video;
settingsMenu = setting;
helpMenu = help;
connect(settingsMenu, SIGNAL(triggered(QAction*)), this, SLOT(Func_CAM_IRCorrection_standard(QAction *)));
}
To copy to clipboard, switch view to plain text mode
the above variables are defined in the Menu class:
QMenu *menuCAM_IRCorrectionMenu;
QAction *actionCAM_IRCorrection_standard;
QAction *actionCAM_IRCorrection_IRLight;
QMenu *videoMenu;
QMenu *helpMenu;
QMenu *settingsMenu;
QMenu *menuCAM_IRCorrectionMenu;
QAction *actionCAM_IRCorrection_standard;
QAction *actionCAM_IRCorrection_IRLight;
To copy to clipboard, switch view to plain text mode
the problem I have is here:
connect(settingsMenu,
SIGNAL(triggered
(QAction*)),
this,
SLOT(Func_CAM_IRCorrection_standard
(QAction *)));
connect(settingsMenu, SIGNAL(triggered(QAction*)), this, SLOT(Func_CAM_IRCorrection_standard(QAction *)));
To copy to clipboard, switch view to plain text mode
when I call the two QActions of the CAM_IRCorrectionMenu to their own individual slots, all QActions trigger that slot!
what I want is every individual QAction should trigger its own specified slot, but here all QActions trigger that slot, or simply whenever any of the settingsmenu item is clicked!
I know the above connect is not correct, I wrote it because there is no way to call the QAction of a specific QMenu
any idea how I can solve it?
Bookmarks