[PyQt] Context menu on items in QTreeView

Andreas Pakulat apaku at gmx.de
Tue Oct 14 21:44:41 BST 2008


On 14.10.08 22:30:03, Filip Gruszczyński wrote:
> I would like to pop up a menu on items in QTreeView. I decided to
> intercept pressed(const QModelIndex&) signal, because contextMenuEvent
> doesn't provide information about the tree view chosen index.

But you don't need that, just make sure you have access to the treeview.
With that you can access the selection model, which gives you the current
index - or selection if there can be multiple items selected.

Andreas

-- 
Someone whom you reject today, will reject you tomorrow.


More information about the PyQt mailing list