Hi Christian,

Implement the context menu on the QTreeWidget but when the context
menu signal (customContextMenuRequested(QPoint)) is triggered get the
item under the point with QTreeWidget.itemAt(QPoint) if the item is
None don't show any menu and return immediately otherwise show your
properly formatted menu according to whatever item is under the point.

Don't forget to remap your point's position when/before showing the
menu. The point coming into the slot is in widget coordinates while
you should show the menu according to global coordinates (look into
Widget.mapToGlobal(QPoint))

Cheers,
Patrick



On Wed, Apr 8, 2009 at 8:20 PM, Christian Aubert <[email protected]> wrote:
> I currently have a context menu for the whole QTreeWidget but I need
> finer-grained control on a per item basis. Has anyone implemented context
> menus for QTreeWidgetItems? Any pointers?
>
> Christian
>
> _______________________________________________
> PyQt mailing list    [email protected]
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to