tags:

views:

23

answers:

1

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

+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
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?
The documentation isn't clear on that. I would expect in that case, itemAt() would either return null or the root item.
Arnold Spence