Specifying Softkeys for the QWidget with Focus
This article shows how to specify the softkey options used when a QWidget has focus.
The following articles also provide guidance on using menus in Qt applications:
The article shows that if you register context actions for a QWidget class and those actions have softKeyRole properly set, they will replace the default softkeys when the QWidget is on focus.
Sometimes you may not want to replace both softkeys. In the example given below you leave the left softkey as it is and change only the right softkey:
However, if you do this in your central widget as the Nokia Developer example hints, you are in trouble: Qt will replace the right softkey, but wipe off the left softkey and leave it empty.
So how do we replace only the right softkey and still keep the nice menu that we create in the Qt Designer IDE?
The answer is simple, instead adding your custom QAction in the central widget, do it in the main window
Now, if you are as lazy as I'm, and you use Qt Designer, you can force uic (ui compiler) to create this code from a properly formatted XML in your .ui file:
<widget class="QMainWindow" name="mainWindow">
This should force the uic to generate similar code in your ui_xxxxxxxxxxxxx.h file
If all is fine, this is how the sofkeys should look: