Qt Code:
  1. void MyTreeWidget::contextMenuEvent(QContextMenuEvent* event)
  2. {
  3. QTreeWidgetItem* item = itemAt(event->pos());
  4. if (item)
  5. {
  6. // an item exists under the requested position
  7. QMenu menu(this);
  8. menu.addAction (chatAction);
  9. menu.exec(event->globalPos());
  10. }
  11. else
  12. {
  13. // there is no item under the requested position
  14. }
  15. }
To copy to clipboard, switch view to plain text mode 

I've subclassed QTreeWidget in order to create a context menu and what I want to do is to exclude some commands from the context menu in case an item from the tree is expandable. Like I have an item that's a group and its subitems are users and I don't want to have the option "Rename" on the user item but I want it on the group item.
So is there like a item->isExpandable () method, or is there any way I could implement something like that? I know there's a isExpanded () method but it checks whether the item is expanded not expandable.

I've checked here and didn't find anything useful.

I hope I made my question clear enough.

Thanks.