Re: [Interest] How to pass parameter from Menu/Action to SLOT()

2021-01-05 Thread Nicholas Yue
Thanks David. It works. I ended up with this approach. ``` specialistMenuAction[specialistMenuActionIndex]->setData(QVariant(QString(iter->first.c_str(; ``` void MainWindow::specialistMenuHandler() { QAction *actionP(qobject_cast(QObject::sender())); if (actionP) { QStr

Re: [Interest] How to pass parameter from Menu/Action to SLOT()

2021-01-05 Thread David M. Cotter
in your handler you can call this: > QAction *actionP(qobject_cast(QObject::sender())); and you'll get the action that caused the sending. you can have previously stuffed something interesting into the objectName of the action, then recover it in your handler does that make sense? > On J

[Interest] How to pass parameter from Menu/Action to SLOT()

2021-01-05 Thread Nicholas Yue
Hi, I am programmatically generating a menu, each menu item has a unique name/label How can I determine which of the generated menu was clicked ? ``` void MainWindow::init() { : : QMenu *specialists = menuBar()->addMenu("&Specialists"); if (!_engine.getSpecialistsManager().registeredSpeciali