Fix empty page added when showing OOB dialog (#4849)

This commit is contained in:
nerix 2023-10-01 08:40:34 +02:00 committed by GitHub
parent ad8f960a8e
commit 2fc7fdd91a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 6 deletions

View file

@ -16,6 +16,7 @@
- Bugfix: Fixed input in reply thread popup losing focus when dragging. (#4815) - 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 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 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: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
- Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767) - 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) - Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774)

View file

@ -1439,6 +1439,11 @@ SplitContainer *SplitNotebook::getOrAddSelectedPage()
return this->addPage(); return this->addPage();
} }
SplitContainer *SplitNotebook::getSelectedPage()
{
return dynamic_cast<SplitContainer *>(Notebook::getSelectedPage());
}
void SplitNotebook::select(QWidget *page, bool focusPage) void SplitNotebook::select(QWidget *page, bool focusPage)
{ {
// If there's a previously selected page, go through its splits and // If there's a previously selected page, go through its splits and

View file

@ -209,6 +209,8 @@ public:
SplitContainer *addPage(bool select = false); SplitContainer *addPage(bool select = false);
SplitContainer *getOrAddSelectedPage(); SplitContainer *getOrAddSelectedPage();
/// Returns `nullptr` when no page is selected.
SplitContainer *getSelectedPage();
void select(QWidget *page, bool focusPage = true) override; void select(QWidget *page, bool focusPage = true) override;
void themeChangedEvent() override; void themeChangedEvent() override;

View file

@ -109,7 +109,7 @@ bool Window::event(QEvent *event)
} }
case QEvent::WindowDeactivate: { case QEvent::WindowDeactivate: {
auto page = this->notebook_->getOrAddSelectedPage(); auto *page = this->notebook_->getSelectedPage();
if (page != nullptr) if (page != nullptr)
{ {
@ -119,12 +119,8 @@ bool Window::event(QEvent *event)
{ {
split->updateLastReadMessage(); split->updateLastReadMessage();
} }
}
if (SplitContainer *container = page->hideResizeHandles();
dynamic_cast<SplitContainer *>(page))
{
container->hideResizeHandles();
} }
} }
break; break;