Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Regarding context menu
Indrajeet last edited by
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.
connect(treewidgetptr,SIGNAL(customContextMenuRequested ( const QPoint & pos ) ),this,SLOT(contextMenuEvent(QContextMenuEvent * event )));@
JohanSolo last edited by JohanSolo
The signal and the slot must have the same arguments, here you have QPoint and QContextMenuEvent types.
From the doc: "The signals and slots mechanism is type safe: The signature of a signal must match the signature of the receiving slot."
lgeyer last edited by
In addition, you should not pass any parameter names, just types.
octal last edited by
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