PDA

View Full Version : Qt on Meego



reshmasp
9th December 2010, 16:09
Hello All,

I had a question on how to display Qt menu's on Meego platform?
Following code snippet works on Symbian and Maemo platforms but doesn't work on Meego. Can anyone help with this issue?


QMenu* menu = new QMenu(this);
m_clearAllAction = new QAction(tr("Clear all history"), this);
connect(m_clearAllAction,SIGNAL(triggered()), this, SLOT(clearSearchHistory()) );
menu->addAction(m_clearAllAction);

menu->addAction(tr("About"), this, SLOT(about()));
m_clearAllAction->setEnabled(false);

QAction* myMenuKey = new QAction(tr("Options"), this);
myMenuKey->setSoftKeyRole(QAction::PositiveSoftKey);
myMenuKey->setMenu(menu);
addAction(myMenuKey );

QAction* exitAction = new QAction(tr("Exit"), this);
exitAction->setSoftKeyRole(QAction::NegativeSoftKey);
addAction(exitAction );
connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

Thanks in advance,
Reshma

wysota
9th December 2010, 21:36
How exactly are you trying to display the menu? What is myMenuKey?

reshmasp
10th December 2010, 09:57
Hi,

myMenuKey is a QAction. As in my code snippet, I am trying to add two menu options "Clear All History" and "About" using QMenu::addAction()

And I am creating two new QAction for "Options" and "Exit" as below and setting the two menu actions "Clear All History" and "About" to "Options"

QAction* myMenuKey = new QAction(tr("Options"), this);
myMenuKey->setSoftKeyRole(QAction::PositiveSoftKey);
myMenuKey->setMenu(menu);
addAction(myMenuKey );

QAction* exitAction = new QAction(tr("Exit"), this);
exitAction->setSoftKeyRole(QAction::NegativeSoftKey);
addAction(exitAction );

Thanks in advance,
Reshma

wysota
10th December 2010, 22:18
I can see it's a QAction. But where do you put it after you create it? What's the "this" object?

reshmasp
12th December 2010, 18:40
Hi,

"this" is a QWidget. QActions are added to the QWidget.

Regards,
Reshma

wysota
12th December 2010, 20:00
I know it's a widget but what widget is it? I'm not asking about the class name but the role it has in your program. Also, does the "Exit" action work? Maybe the problem is with the soft keys?

reshmasp
13th December 2010, 13:56
Hi Wysota,

Yes exactly, problem is with softkeys. I can't see them on the Meego device. The same Qt piece of code works for Symbian devices and I see the softkeys. How can I get this to work for Meego?
QWidget is the main widget in my application. I want to add some softkeys to this widget to perform certain actions.

Thanks in advance,
Reshma

wysota
13th December 2010, 16:49
As far as I understand it soft keys are only supported on Symbian. At least that's what the docs are suggesting.