Override contextMenuEvent in QTreeWidget and populate your custom menu at the clicked position.