From 676daa62f66eae9a297416c435f5dc32dcbc836f Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sat, 30 Sep 2023 19:54:37 +0200 Subject: [PATCH 1/2] fix: empty page added when showing dialog --- src/widgets/Notebook.cpp | 5 +++++ src/widgets/Notebook.hpp | 2 ++ src/widgets/Window.cpp | 8 ++------ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 3ff3648a759..9cd483ab764 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -1440,6 +1440,11 @@ SplitContainer *SplitNotebook::getOrAddSelectedPage() return this->addPage(); } +SplitContainer *SplitNotebook::getSelectedPage() +{ + return dynamic_cast(Notebook::getSelectedPage()); +} + void SplitNotebook::select(QWidget *page, bool focusPage) { // If there's a previously selected page, go through its splits and diff --git a/src/widgets/Notebook.hpp b/src/widgets/Notebook.hpp index e6cd7d62f7d..c4382582d50 100644 --- a/src/widgets/Notebook.hpp +++ b/src/widgets/Notebook.hpp @@ -209,6 +209,8 @@ class SplitNotebook : public Notebook SplitContainer *addPage(bool select = false); SplitContainer *getOrAddSelectedPage(); + /// Returns `nullptr` when no page is selected. + SplitContainer *getSelectedPage(); void select(QWidget *page, bool focusPage = true) override; void themeChangedEvent() override; diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index 39ae451df46..0193b435950 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -109,7 +109,7 @@ bool Window::event(QEvent *event) } case QEvent::WindowDeactivate: { - auto page = this->notebook_->getOrAddSelectedPage(); + auto *page = this->notebook_->getSelectedPage(); if (page != nullptr) { @@ -119,12 +119,8 @@ bool Window::event(QEvent *event) { split->updateLastReadMessage(); } - } - if (SplitContainer *container = - dynamic_cast(page)) - { - container->hideResizeHandles(); + page->hideResizeHandles(); } } break; From ba5d186435a9aa5c61e51568de4dafe7c361652f Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sat, 30 Sep 2023 20:04:38 +0200 Subject: [PATCH 2/2] chore: add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34d073cb9b4..6c9ad34f476 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Bugfix: Fixed input in reply thread popup losing focus when dragging. (#4815) - Bugfix: Fixed the Quick Switcher (CTRL+K) from sometimes showing up on the wrong window. (#4819) - Bugfix: Fixed too much text being copied when copying chat messages. (#4812, #4830, #4839) +- Bugfix: Fixed empty page being added when showing out of bounds dialog. (#4849) - Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791) - Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767) - Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774)