Creating a menu
-
I'm trying to create a menu, so I tried this.
@
ui->setupUi(this);//Creating actions insert = new QAction(tr("Insert"),this); connect(insert, SIGNAL(triggered()), this, SLOT(on_InsertButton_clicked())); detect = new QAction(tr("Check"),this); connect(detect, SIGNAL(triggered()), this, SLOT(on_DetectButton_clicked())); about = new QAction(tr("About"),this); connect(about, SIGNAL(triggered()), this, SLOT(on_AboutPushButton_clicked())); //Creating menu eyemenu = new QMenu("Options", this); eyemenu->addAction(insert); eyemenu->addAction(detect); eyemenu->addSeparator(); eyemenu->addAction(about);
@
But, nothing show up on the left side of the menu on Symbian. Just the right 'Exit' button.
Is there any mistake on this? Thanks. -
If you are using a QMainWindow you should use a menuBar() variable in order to add the menu there like:
@
ui->menubar->addMenu(eyemenu);
@ -
if you wish to add a popup menu yuo can do something like this
@
void ListWidget::customContentsMenu( const QPoint &pos )
{
QPoint globalPos = this->mapToGlobal(pos);
menu->exec( globalPos );
}
@ -
I don't know if it's a bug or a feature but the steps for removing the actions option are:
Go to the Qt Designer (you can do this in the code as well)
Select every Widget in your form
In the properties pane find contextMenuPolicy and change it to NoContextMenu for every widget inside your form (could be a QWidget, QDialog or a QMainWindow).
See the screenshot below
-
I probably have to write a wiki article on how to remove the strange actions menu.
-
[quote author="Milot Shala" date="1295900993"]I don't know if it's a bug or a feature but the steps for removing the actions option are:
Go to the Qt Designer (you can do this in the code as well)
Select every Widget in your form
In the properties pane find contextMenuPolicy and change it to NoContextMenu for every widget inside your form (could be a QWidget, QDialog or a QMainWindow).
See the screenshot below
!http://i.imgur.com/07z8J.png(pic)![/quote]
That's great :)
-
We have also a wiki page for this. I will improve it in the near future: "http://developer.qt.nokia.com/wiki/Remove_actions_options_menu_in_Symbian":http://developer.qt.nokia.com/wiki/Remove_actions_options_menu_in_Symbian