Commit 6433e714 authored by Christoph Cullmann's avatar Christoph Cullmann 🍨
Browse files

ensure to better pass focus back to right widget

the toolviews can steal the focus, before we always passed it back
to the central area

but that might steal focus of fast opened search panes and such

try to pass back to old focus widget


(cherry picked from commit 74029f21)
parent 1372167c
Pipeline #271718 passed with stage
in 5 minutes and 16 seconds
......@@ -22,6 +22,7 @@
#include <KWindowConfig>
#include <KXMLGUIFactory>
#include <QApplication>
#include <QContextMenuEvent>
#include <QDomDocument>
#include <QHBoxLayout>
......@@ -1580,12 +1581,19 @@ void MainWindow::finishRestore()
// Expand again to trigger splitter sync tabs/tools, but for any reason works this sometimes only after enough delay
QTimer::singleShot(400, this, [this]() {
// ensure we don't steal the focus, remember old focus widget
QPointer<QWidget> oldFocusWidget(QApplication::focusWidget());
for (auto &sidebar : m_sidebars) {
sidebar->updateSidebar();
}
// ensure focus is not stolen
triggerFocusForCentralWidget();
// ensure focus is not stolen, pass back to widget or at least central area
if (oldFocusWidget) {
oldFocusWidget->setFocus();
} else {
triggerFocusForCentralWidget();
}
});
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment