Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty page added when showing OOB dialog #4849

Merged
merged 3 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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)
Expand Down
5 changes: 5 additions & 0 deletions src/widgets/Notebook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,11 @@ SplitContainer *SplitNotebook::getOrAddSelectedPage()
return this->addPage();
}

SplitContainer *SplitNotebook::getSelectedPage()
{
return dynamic_cast<SplitContainer *>(Notebook::getSelectedPage());
}

void SplitNotebook::select(QWidget *page, bool focusPage)
{
// If there's a previously selected page, go through its splits and
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/Notebook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 2 additions & 6 deletions src/widgets/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -119,12 +119,8 @@ bool Window::event(QEvent *event)
{
split->updateLastReadMessage();
}
}

if (SplitContainer *container =
dynamic_cast<SplitContainer *>(page))
{
container->hideResizeHandles();
page->hideResizeHandles();
}
}
break;
Expand Down