aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow/mainwindow.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-05-06 00:17:39 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-05-06 00:17:39 +0200
commitd40815a568c4dce58360659c098f928789500d18 (patch)
tree41454c2734e40d53793659c836c7d2f49a6b2c4e /src/mainwindow/mainwindow.cpp
parentBump cmake version (diff)
downloadsmolbote-d40815a568c4dce58360659c098f928789500d18.tar.xz
QTBUG-18665 workaround
Diffstat (limited to 'src/mainwindow/mainwindow.cpp')
-rw-r--r--src/mainwindow/mainwindow.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp
index f83c2a7..eba02c6 100644
--- a/src/mainwindow/mainwindow.cpp
+++ b/src/mainwindow/mainwindow.cpp
@@ -84,7 +84,17 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> &config, QWidget *parent)
auto *searchShortcut = new QShortcut(QKeySequence(config->value<std::string>("mainwindow.shortcuts.search").value().c_str()), this);
connect(searchShortcut, &QShortcut::activated, this, [=]() {
- searchBox->setVisible(!searchBox->isVisible());
+ /* QTBUG-18665
+ * When focusing out of the search box and hiding it, the first
+ * (or earlier?) subwindow gets activated for some reason.
+ */
+ if(searchBox->isVisible()) {
+ auto *w = mdiArea->currentSubWindow();
+ searchBox->hide();
+ mdiArea->setActiveSubWindow(w);
+ } else {
+ searchBox->show();
+ }
});
}