views:

127

answers:

1

Hello,I would like to know how can we set context menu for a qtreewidgetitem that is if i right click on each item in my qtreewidget,i should have some options like edit,delete ..i would like to know how can we implement this.thanks in advance

A: 

create several Action's such as "Edit", "Delete",...
call myTreeWidget->addAction( actionEdit )
call myTreeWidget->setContextMenuPolicy( Qt::ActionsContextMenu )

Connect a slot to the QAction::triggered signal, retrieve the item-selection from there and execute your code.

Pieter