diff options
author | Eike Ziller <eike.ziller@qt.io> | 2022-03-21 15:52:35 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2022-03-22 11:52:10 +0000 |
commit | 22c67db406ec02d42e34dc182741ad473ba714fb (patch) | |
tree | 8b181134a3b2fbaef7948ea2d2d0605d760d1055 | |
parent | 70c44acdd88efdff3e51eede3f2ce00faf26a028 (diff) | |
download | qt-creator-22c67db406ec02d42e34dc182741ad473ba714fb.tar.gz |
Fix double-clicking in Projects view to open file in extra window
When you have an external editor window open (Window > Open in New
Window):
- make sure that the editor has focus in the main window
- switch to the external window
- double-click a file in Projects, Open Documents, or File System view
The file is supposed to open in the external window.
The problem is that clicking into e.g. Projects view activates the main
window, which changes focus, and the current editor.
Something changed in the event order in Qt (also Qt 5), so the existing
workaround that delayed setting the current editor view in that case by
just one event loop cycle doesn't work anymore. Delay be the double-
click interval instead, so the double-click can be processed before the
main window's editor view is made current.
Fixes: QTCREATORBUG-26773
Change-Id: I56efd5a50a8bb986563c8c15d340756dace06494
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r-- | src/plugins/coreplugin/editormanager/editormanager.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 150d5d957b..60a81aa027 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -2395,8 +2395,9 @@ void EditorManagerPrivate::handleContextChange(const QList<IContext *> &context) // the locator line edit) first activates the window and sets focus to its focus widget. // Only afterwards the focus is shifted to the widget that received the click. d->m_scheduledCurrentEditor = editor; - QMetaObject::invokeMethod(d, &EditorManagerPrivate::setCurrentEditorFromContextChange, - Qt::QueuedConnection); + QTimer::singleShot(QApplication::doubleClickInterval() + 10, + d, + &EditorManagerPrivate::setCurrentEditorFromContextChange); } else { updateActions(); } |