Regarding context menu
General and Desktop
4
Posts
4
Posters
2.1k
Views
1
Watching
-
Hi All
I have created a Qwidget window on which i have place QTreeWidget.
Then i have created a context menu,& on right click of mouse i tried to show this context menu.
But I am not able to connect my signal to the slot.SIGNAL:
@
connect(treewidgetptr,SIGNAL(customContextMenuRequested ( const QPoint & pos ) ),this,SLOT(contextMenuEvent(QContextMenuEvent * event )));@ -
-
If your context menu is based on QAction, you just can set the contextMenuPolicy to Qt::ActionsContextMenu.
Then, all you need to do is insering your actions with "QWidget::addAction":http://doc.qt.nokia.com/latest/qwidget.html#addAction