hello all
quick question
im using in Treewidget the customContextMenuRequested signal and using using popup with qmenu
How can I get the item pointer / object / reference that just bean right clicked before the popup executed
I need to make some validation on the item
views:
23answers:
1
+2
A:
That signal contains a QPoint
, QWidget::customContextMenuRequested(const QPoint & pos)
, which you can pass to QTreeWidget::itemAt(const QPoint & p)
which returns a QTreeWidgetItem
.
Arnold Spence
2010-10-22 22:47:24
one problem remains when i right click not on tree node i still trigger the customContextMenuRequested SLOT function , how can i check there is its QTreeWidgetItem object?
2010-10-23 13:12:19
The documentation isn't clear on that. I would expect in that case, itemAt() would either return null or the root item.
Arnold Spence
2010-10-23 16:18:25