From fc7805993409ce52d21d21f8575635fddc66b83c Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Wed, 7 Sep 2022 17:23:27 +0200 Subject: [PATCH] Use popup() instead of exec() in examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- examples/widgets/graphicsview/diagramscene/diagramitem.cpp | 2 +- examples/widgets/mainwindows/mainwindow/colorswatch.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/widgets/graphicsview/diagramscene/diagramitem.cpp b/examples/widgets/graphicsview/diagramscene/diagramitem.cpp index ae764371aea..fe9e7584e3a 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 edd792730cc..678f00054c5 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