summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-09-07 17:23:27 +0200
committerMikolaj Boc <mikolaj.boc@qt.io>2022-09-07 21:59:30 +0200
commitfc7805993409ce52d21d21f8575635fddc66b83c (patch)
treee599884157267800485c392f25606bebe9424e9c /examples/widgets
parent5d4178ff47b318ccf375cfc5e7c82ac747ba9a30 (diff)
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>
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/graphicsview/diagramscene/diagramitem.cpp2
-rw-r--r--examples/widgets/mainwindows/mainwindow/colorswatch.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/widgets/graphicsview/diagramscene/diagramitem.cpp b/examples/widgets/graphicsview/diagramscene/diagramitem.cpp
index ae764371ae..fe9e7584e3 100644
--- a/examples/widgets/graphicsview/diagramscene/diagramitem.cpp
+++ b/examples/widgets/graphicsview/diagramscene/diagramitem.cpp
@@ -97,7 +97,7 @@ void DiagramItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
scene()->clearSelection();
setSelected(true);
- myContextMenu->exec(event->screenPos());
+ myContextMenu->popup(event->screenPos());
}
//! [5]
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
index edd792730c..678f00054c 100644
--- a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
+++ b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
@@ -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