One Shortcut for all Actions in a menu
i am pretty noob in Qt things and hope you can help me with my problem.
My menu in the menubar is Camera.
Inside i have a submenu called "Mode".
In Mode i have 3 actions: follow main object, detached and follow specified object.
Now i want that if the user press "C" => the camera mode will switch in a loop like : main -> detached -> specified -> main ...
I can´t find anything like that via Google.
Thanks in advance,
Hi, seems a QShortcut is enough for you.
thanks for your answer. i will try to find out how to get it works with QShortcut.
I can't find out the way, how to activate 3 actions with 1 shortcut using QShortcut. Can you pls detail the hint?
i found the answer:
if you want to do that you can write a protected method. looks like this:
@void MainWindow::keyPressEvent( QKeyEvent *e )
bool consumed = false;
switch ( e->key() )
To write the shortcut to the menu, you only have to write the code like this:
@cameraModeMenu = cameraMenu->addMenu(tr("&Switch camera mode\tC "));@
The method above works for Linux and Windows but not for mac.
So if anyone has an other idea, i would appreciate to read it.