[Qt-interest] Set seperate context menus for QTreeWidgetItems
Stephen Kelly
steveire at gmail.com
Tue Oct 18 12:51:59 CEST 2011
Jothy wrote:
> Hi all,
>
> How can I seup seperate context menus for each QTreeWidgetItem. There seem
> to be no method in the class QTreeWidgetItem->addAction. I tried setting
> the contextMenuPolicy to actionContextMenu. But it adds the menu for all
> the items.
>
> Thanks
>
> Jothy
Use Qt::CustomContextMenu, connect to the signal, use QTreeWidget::itemAt,
and use the QTreeWidgetItem::type() to determine which actions to show.
More information about the Qt-interest-old
mailing list