From fa58d971e9371008bb87ee99e29874c9e547ff4e Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 12 Jul 2026 10:45:54 +0300 Subject: [PATCH] Fixed peer name width on profile tab buttons toggle. --- .../info/profile/info_profile_top_bar.cpp | 52 +++++++++++-------- .../info/profile/info_profile_top_bar.h | 1 + 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp index 067cd5905c..c3b82fea17 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp @@ -1795,6 +1795,32 @@ void TopBar::updateLabelsPosition() { }(); const auto progressCurrent = _progress.current(); + updateTitlePosition(progressCurrent); + updateStatusPosition(progressCurrent); + + if (_badgeTooltip) { + _badgeTooltip->setOpacity(progressCurrent); + } + + { + const auto userpicRect = userpicGeometry(); + if (_userpicButton) { + _userpicButton->setGeometry(userpicGeometry()); + } + + updateGiftButtonsGeometry(progressCurrent, userpicRect); + } + + updateRightButtonsPosition(); + updateTabSwapVisibility(); + updateTabSelectionGeometry(); + updateTabSearchGeometry(); +} + +void TopBar::updateTitlePosition(float64 progressCurrent) { + if (width() <= 0) { + return; + } const auto rightButtonsWidth = calculateRightButtonsWidth(); const auto reservedRight = anim::interpolate( @@ -1827,8 +1853,8 @@ void TopBar::updateLabelsPosition() { - reservedRight - badgesWidth; - if (titleWidth > 0 && _title->textMaxWidth() > titleWidth) { - _title->resizeToWidth(titleWidth); + if (titleWidth > 0) { + _title->resizeToNaturalWidth(titleWidth); } const auto titleTop = anim::interpolate( @@ -1879,26 +1905,6 @@ void TopBar::updateLabelsPosition() { badgeTop, badgeBottom); } - - updateStatusPosition(progressCurrent); - - if (_badgeTooltip) { - _badgeTooltip->setOpacity(progressCurrent); - } - - { - const auto userpicRect = userpicGeometry(); - if (_userpicButton) { - _userpicButton->setGeometry(userpicGeometry()); - } - - updateGiftButtonsGeometry(progressCurrent, userpicRect); - } - - updateRightButtonsPosition(); - updateTabSwapVisibility(); - updateTabSelectionGeometry(); - updateTabSearchGeometry(); } void TopBar::updateStatusPosition(float64 progressCurrent) { @@ -2391,6 +2397,8 @@ void TopBar::updateTabSwapVisibility() { } if (togglesChanged) { updateRightButtonsPosition(); + updateTitlePosition(_progress.current()); + updateStatusPosition(_progress.current()); } if (!_tabSubtitle && !swap) { return; diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.h b/Telegram/SourceFiles/info/profile/info_profile_top_bar.h index 02b71e09ac..cad155cd26 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.h +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.h @@ -198,6 +198,7 @@ private: void setupStoryOutline(const QRect &geometry = QRect()); void updateStoryOutline(std::optional edgeColor); void paintStoryOutline(QPainter &p, const QRect &geometry); + void updateTitlePosition(float64 progressCurrent); void updateStatusPosition(float64 progressCurrent); void applyTabBindings(TabTopBarBindings &&bindings); void updateTabSwapVisibility();