QMenu or QToolBar with a common action slot?
Hello,
I managed having my QToolBar and QMenu work nicely in the Qt framework using the signal/slot mechanism (with QAction). However, since I am porting a rather large application from MFC where I used a common message handling routine for toolbar presses, menu selections, etc., I want to reuse it.
Practically this means that for any toolbutton press (or menu selection), the same slot should be called, and then inside that slot routine, I need to identify which button was pressed. A little bit something like:
- void aToolbarButtonWasPressed(int toolbarButtonID)
- { // This would be called when any toolbar button is pressed
- if (toolbarButtonID==1)
- clearScene();
- if (toolbarButtonID==2)
- openScene();
- ...
- }
Any idea how I can achieve this?
2 replies
Look at QSignalMapper [doc.qt.nokia.com] class
You must log in to post a reply. Not a member yet? Register here!
