From d64ebc0f8b3911bb0f292059150cf1c35df5d417 Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Mon, 7 Sep 2020 12:48:07 +0200 Subject: [PATCH] Fix easing-curve-editor context menu for macOS Change-Id: I99eac383dbd247e42392424712eed001e2750008 Reviewed-by: Thomas Hartmann --- .../components/timelineeditor/preseteditor.cpp | 9 +++++---- .../components/timelineeditor/splineeditor.cpp | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp b/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp index 8ea7692e3d1..2ef68f24b48 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp @@ -348,18 +348,19 @@ void PresetList::contextMenuEvent(QContextMenuEvent *event) if (m_scope == QSettings::SystemScope) return; - QMenu menu; + auto *menu = new QMenu(this); - QAction *addAction = menu.addAction(tr("Add Preset")); + QAction *addAction = menu->addAction(tr("Add Preset")); connect(addAction, &QAction::triggered, [&]() { createItem(); }); if (selectionModel()->hasSelection()) { - QAction *removeAction = menu.addAction(tr("Delete Selected Preset")); + QAction *removeAction = menu->addAction(tr("Delete Selected Preset")); connect(removeAction, &QAction::triggered, [&]() { removeSelectedItem(); }); } - menu.exec(event->globalPos()); + menu->exec(event->globalPos()); + menu->deleteLater(); } void PresetList::dataChanged(const QModelIndex &topLeft, diff --git a/src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp b/src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp index e6d6be4fb60..3431e5c7a7a 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp @@ -253,6 +253,7 @@ void SplineEditor::contextMenuEvent(QContextMenuEvent *e) }); menu->exec(e->globalPos()); + menu->deleteLater(); e->accept(); }