From c4c62f2796b48f787905287dee779cd1a6b856ab Mon Sep 17 00:00:00 2001 From: nerix Date: Sun, 14 Jan 2024 12:06:52 +0100 Subject: [PATCH] fix: restore focus of last split when restoring (#5080) --- CHANGELOG.md | 1 + src/widgets/Notebook.cpp | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a62c787b2..a0553e7c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ - Bugfix: Fixed avatar in usercard and moderation button triggering when releasing the mouse outside their area. (#5052) - Bugfix: Fixed moderator-only topics being subscribed to for non-moderators. (#5056) - Bugfix: Fixed a bug where buttons would remain in a hovered state after leaving them. (#5077) +- Bugfix: Fixed splits not retaining their focus after minimizing. (#5080) - Dev: Run miniaudio in a separate thread, and simplify it to not manage the device ourselves. There's a chance the simplification is a bad idea. (#4978) - Dev: Change clang-format from v14 to v16. (#4929) - Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791) diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 2aa02e722..c6e1c1713 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -1332,13 +1332,19 @@ SplitNotebook::SplitNotebook(Window *parent) }); } -void SplitNotebook::showEvent(QShowEvent *) +void SplitNotebook::showEvent(QShowEvent * /*event*/) { - if (auto page = this->getSelectedPage()) + if (auto *page = this->getSelectedPage()) { - if (auto split = page->findChild()) + auto *split = page->getSelectedSplit(); + if (!split) { - split->setFocus(Qt::FocusReason::OtherFocusReason); + split = page->findChild(); + } + + if (split) + { + split->setFocus(Qt::OtherFocusReason); } } }