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
#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();
}
#include <QApplication>
#include <QMainWindow>
#include <QMenuBar>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QMainWindow *window = new QMainWindow();
window->setWindowTitle(QString::fromUtf8("Test:QMenu"));
window->resize(336, 227);
QAction *newAct = new QAction("&New",window);
QAction *openAct = new QAction("&Open",window);
QAction *saveAct = new QAction("&Save",window);
QMenu *fileMenu;
fileMenu = window->menuBar()->addMenu("&File");
fileMenu->addAction(newAct);
fileMenu->addAction(openAct);
fileMenu->addAction(saveAct);
window->show();
fileMenu->popup(QPoint(10,10));
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks