PDA

View Full Version : Two context menu for a treewidget



phillip_Qt
24th November 2009, 04:53
Hi All,
I ve a tree widget. If i right click on that treewidget, a contextmenu is poping up. I've added two action to that context menu, Add parent and Add child. Afetr adding parents and children to perticular parent, if i right click on a child or parent I need a new popup action which should ask If i want to delete parent. How to do this.? plz help me.

wysota
24th November 2009, 09:01
Reimplement QWidget::contextMenuEvent() and use QAbstractItemView::indexAt() to check the index that was clicked or use the one that was current (QAbstractItemView::currentIndex()), detect what kind of item is that and do your stuff accordingly.

phillip_Qt
24th November 2009, 11:06
Reimplement QWidget::contextMenuEvent() and use QAbstractItemView::indexAt() to check the index that was clicked or use the one that was current (QAbstractItemView::currentIndex()), detect what kind of item is that and do your stuff accordingly.

Thank u. I'll try this way.