To set keyboard focus on QMenu item pragrammatically
i am developing a Qt based GUI software.Whenever this software starts up, focus is set to the mainwindow.And there is no way to access the menu bar unless you are setting the focus to the menu by clicking the mouse on it.But my software requirements restricted the use of the mouse(only keyboard will be used as the medium of interaction with users);plz advise how
can i do that
Here is my existing code.
main.cpp
Code:
#include <QApplication>
#include <QMainWindow>
#include <QMenuBar>
int main(int argc, char **argv)
{
window
->setWindowTitle
(QString::fromUtf8("Test:QMenu"));
window->resize(336, 227);
fileMenu = window->menuBar()->addMenu("&File");
fileMenu->addAction(newAct);
fileMenu->addAction(openAct);
fileMenu->addAction(saveAct);
window->show();
fileMenu
->popup
(QPoint(10,
10));
return app.exec();
}
Re: To set keyboard focus on QMenu item pragrammatically
Set keyboard accelerators on your menus.
Re: To set keyboard focus on QMenu item pragrammatically
You might consider looking into tab order?