i have a QTableView , and i need to show a popup menu that shows the item properties .
i need to set the context menu to apear only when you right click over a particular items in that tableview.
but coudln’t find a way to do it . i can set the context menu to appear when your over the table .
i cant have it for each item .
so how do i set the context menu over items in the tableview ?
please tell me if the idea was not clear enough
thanks in advance
Assuming you’re in control of when the menu pops up, then you’ll want to use the indexAt(QPoint) member function in order to determine what item the mouse is over.
If you’re not currently in control of when the menu shows up, you’ll need to set the view’s contextMenuPolicy to something that will give you control over it.
For example, if you subclass and override contextMenuEvent the implementation might look something like the following:
You could also install an event handler to avoid subclassing.