forked from qt-creator/qt-creator
Core: Fix saving document after showing editor context menu
The editor context menu generated for the drag mark contains actions that also gets the same shortcut as the global save command, to make them visible in the menu. This leads to ambiguous shortcut events if these actions are still taken into account after closing the context menu. Avoid this by removing the actions from the context menu again when hiding it. This was previously done before the menu was shown again, so this just does it earlier. Fixes: QTCREATORBUG-31205 Change-Id: I49490c2d6cbd3b000c717f35373e7f9b6b5393e4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -193,9 +193,13 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
|
||||
menu.exec(d->m_editorList->mapToGlobal(p));
|
||||
});
|
||||
connect(d->m_dragHandleMenu, &QMenu::aboutToShow, this, [this] {
|
||||
d->m_dragHandleMenu->clear();
|
||||
fillListContextMenu(d->m_dragHandleMenu);
|
||||
});
|
||||
connect(d->m_dragHandleMenu, &QMenu::aboutToHide, this, [this] {
|
||||
// Remove actions from context menu, to avoid any shortcuts set on them
|
||||
// for the display in the menu interfering with global actions
|
||||
d->m_dragHandleMenu->clear();
|
||||
});
|
||||
connect(d->m_lockButton, &QAbstractButton::clicked, this, &EditorToolBar::makeEditorWritable);
|
||||
connect(d->m_closeEditorButton, &QAbstractButton::clicked,
|
||||
this, &EditorToolBar::closeEditor, Qt::QueuedConnection);
|
||||
|
Reference in New Issue
Block a user