PDA

View Full Version : Creating a Symbian's like Application Menu



dieend
6th May 2011, 05:31
Hello, I wanted to make an app which is when started it shows a menu. It is just like when you open a Messaging app in S60. Here is a screenshot http://bit.ly/jVDiXo.

How do I make it? I have tried to make the centralWidget of the QMainWindow as QMenu, and adding QAction to the QMenu. But when I'm running it, the app don't show anything. And I have tried to make the QMenu using QMenuBar. And it is show okay. But I can't use the up/down key to select menu in the device. And when I press the options key (Qt::PositiveSoftKey), the menubar shows up too. And I didn't even add that to menuBar() which is owned by QMainWindow.

Here is my first code:


QAction* act1= new QAction(tr("act1"),this);
QObject::connect(tes,SIGNAL(triggered()),this,SLOT (close()));
QAction* act2= new QAction(tr("act2"),this);
QObject::connect(tes,SIGNAL(triggered()),this,SLOT (close()));
QMenu* menu = new QMenu(this);
menu->addAction(act1);
menu->addAction(act2);
setCentralWidget(menu);

It shows nothing at the apps.

And here is my second try:


QAction* act1= new QAction(tr("act1"),this);
QObject::connect(tes,SIGNAL(triggered()),this,SLOT (close()));
QAction* act2= new QAction(tr("act2"),this);
QObject::connect(tes,SIGNAL(triggered()),this,SLOT (close()));
QMenuBar* menubar = new QMenuBar(this);
QMenu* menu = menubar->addMenu(tr("menu"));
menu->addAction(act1);
menu->addAction(act2);
setCentralWidget(menu);

It shows the menu. But when I deploy to the device, I can't use the keypad to select the menu. And at the simulator, if I click other place than the QAction item, the menu lost.

What is the correct way to do this? Or is my way correct? What should I do next then?

mbkitine
8th June 2012, 12:50
Try this:
http://www.developer.nokia.com/Community/Wiki/CS001351_-_Adding_Options_menu,_panes,_and_icon_to_a_Qt_for_ Symbian_application