Hi d_stranz,
Thank your suggestion.
I review the document you said.
Then I set the context menu policy as Qt::ActionsContextMenu
and DO NOT overwrite the contextMenuEvent().
It works
TabletCanvas::TabletCanvas()
{
connect(zorderAct, SIGNAL(triggered()), this, SLOT(itemZorder()));
addAction(zorderAct);
[COLOR="#FF0000"]setContexMenuPolicy(Qt::ActionsContextMenu);[/COLOR]
}
TabletCanvas::TabletCanvas()
{
QAction* zorderAct= new QAction(tr("bring to front"), this);
connect(zorderAct, SIGNAL(triggered()), this, SLOT(itemZorder()));
addAction(zorderAct);
[COLOR="#FF0000"]setContexMenuPolicy(Qt::ActionsContextMenu);[/COLOR]
}
To copy to clipboard, switch view to plain text mode
Although I still not understand why Qt:eaultContextMenu and overwrite contextMenuEvent can not work.
It should be another solution in the document
Bookmarks