Use popup() instead of exec() in examples

popup() is generally better but it has a certain advantage that it does
not require a run loop to work, therefore platforms (like WASM) can use
it without resorting to extra measures (like asyncify).

Task-id: QTBUG-106389
Backport-to: 6.4 6.4.0
Change-Id: I87bde677f84048af82cc9aadd982284bdba41e69
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Mikolaj Boc 2022-09-07 17:23:27 +02:00
parent 5d4178ff47
commit fc78059934
2 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@ void DiagramItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
scene()->clearSelection();
setSelected(true);
myContextMenu->exec(event->screenPos());
myContextMenu->popup(event->screenPos());
}
//! [5]

View File

@ -446,7 +446,7 @@ void ColorSwatch::tabInto(QAction *action)
void ColorSwatch::contextMenuEvent(QContextMenuEvent *event)
{
event->accept();
menu->exec(event->globalPos());
menu->popup(event->globalPos());
}
#endif // QT_NO_CONTEXTMENU