From 936d4004ff19c1be91389ea35fb528786bf39e62 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 10 Nov 2021 12:53:29 +0400 Subject: [PATCH] Update controls geometry in MainWindow according to body changes --- Telegram/SourceFiles/window/main_window.cpp | 9 +++++---- Telegram/SourceFiles/window/main_window.h | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 597f45853b..ec152fc161 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -318,6 +318,11 @@ MainWindow::MainWindow(not_null controller) Ui::Toast::SetDefaultParent(_body.data()); + body()->sizeValue( + ) | rpl::start_with_next([=](QSize size) { + updateControlsGeometry(); + }, lifetime()); + if (_outdated) { _outdated->heightValue( ) | rpl::filter([=] { @@ -749,10 +754,6 @@ void MainWindow::attachToTrayIcon(not_null icon) { }); } -void MainWindow::resizeEvent(QResizeEvent *e) { - updateControlsGeometry(); -} - rpl::producer<> MainWindow::leaveEvents() const { return _leaveEvents.events(); } diff --git a/Telegram/SourceFiles/window/main_window.h b/Telegram/SourceFiles/window/main_window.h index c1a0a87c83..fe6d9fc9fc 100644 --- a/Telegram/SourceFiles/window/main_window.h +++ b/Telegram/SourceFiles/window/main_window.h @@ -131,7 +131,6 @@ public: } protected: - void resizeEvent(QResizeEvent *e) override; void leaveEventHook(QEvent *e) override; void savePosition(Qt::WindowState state = Qt::WindowActive);