From e97ae3d537476befc5c058c1f08fafa0415c4a9c Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 24 Nov 2025 15:59:50 +0300 Subject: [PATCH] Fixed display of QR button in info profile when no usernames. --- .../info/profile/info_profile_actions.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index c3701d8397..ced91a9389 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -1516,13 +1516,20 @@ object_ptr DetailsFiller::setupInfo() { rpl::combine( container->widthValue(), label->geometryValue(), - button->sizeValue() - ) | rpl::start_with_next([=](int width, QRect, QSize buttonSize) { + button->sizeValue(), + button->shownValue() + ) | rpl::start_with_next([=]( + int width, + QRect, + QSize buttonSize, + bool buttonShown) { button->moveToRight( rightSkip, (parent->height() - buttonSize.height()) / 2); const auto x = Ui::MapFrom(container, label, QPoint(0, 0)).x(); - const auto s = Ui::MapFrom(container, button, QPoint(0, 0)).x(); + const auto s = buttonShown + ? Ui::MapFrom(container, button, QPoint(0, 0)).x() + : width; label->resizeToWidth(s - x); }, button->lifetime()); }; @@ -1642,6 +1649,9 @@ object_ptr DetailsFiller::setupInfo() { const auto qrButton = Ui::CreateChild( usernameLine.text->parentWidget(), st::infoProfileLabeledButtonQr); + UsernamesValue(_peer) | rpl::start_with_next([=](const auto &u) { + qrButton->setVisible(!u.empty()); + }, qrButton->lifetime()); const auto rightSkip = st::infoProfileLabeledButtonQrRightSkip; fitLabelToButton(qrButton, usernameLine.text, rightSkip); fitLabelToButton(qrButton, usernameLine.subtext, rightSkip); @@ -1719,6 +1729,9 @@ object_ptr DetailsFiller::setupInfo() { const auto qr = Ui::CreateChild( linkLine.text->parentWidget(), st::infoProfileLabeledButtonQr); + UsernamesValue(_peer) | rpl::start_with_next([=](const auto &u) { + qr->setVisible(!u.empty()); + }, qr->lifetime()); const auto rightSkip = st::infoProfileLabeledButtonQrRightSkip; fitLabelToButton(qr, linkLine.text, rightSkip); fitLabelToButton(qr, linkLine.subtext, rightSkip);