diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 1ff677847a..1a8006944b 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -99,9 +99,7 @@ public: #ifndef QT_NO_CONTEXTMENU void contextMenuEvent(QContextMenuEvent * e) override { - QMenu *menu = createStandardContextMenu(); - if (menu) - { + if (QMenu *menu = createStandardContextMenu()) { menu->setAttribute(Qt::WA_DeleteOnClose); menu->popup(e->globalPos()); }