From ecf9faa21d0ae480773828851e50c94d59094bb7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 6 Jan 2025 10:38:19 +0400 Subject: [PATCH] Fix usernames and QR overlap. --- .../info/profile/info_profile_actions.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 253c5979a..baf8cfe92 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -71,6 +71,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/controls/userpic_button.h" #include "ui/painter.h" #include "ui/rect.h" +#include "ui/ui_utility.h" #include "ui/text/format_values.h" #include "ui/text/text_utilities.h" // Ui::Text::ToUpper #include "ui/text/text_variant.h" @@ -1242,19 +1243,18 @@ object_ptr DetailsFiller::setupInfo() { not_null label, int rightSkip) { const auto parent = label->parentWidget(); + const auto container = result.data(); rpl::combine( - result->widthValue(), + container->widthValue(), label->geometryValue(), button->sizeValue() ) | rpl::start_with_next([=](int width, QRect, QSize buttonSize) { button->moveToRight( rightSkip, (parent->height() - buttonSize.height()) / 2); - label->resizeToWidth(width - - rightSkip - - label->geometry().left() - - st::lineWidth * 2 - - buttonSize.width()); + const auto x = Ui::MapFrom(container, label, QPoint(0, 0)).x(); + const auto s = Ui::MapFrom(container, button, QPoint(0, 0)).x(); + label->resizeToWidth(s - x); }, button->lifetime()); }; const auto controller = _controller->parentController(); @@ -1373,7 +1373,7 @@ object_ptr DetailsFiller::setupInfo() { const auto qrButton = Ui::CreateChild( usernameLine.text->parentWidget(), st::infoProfileLabeledButtonQr); - const auto rightSkip = st::infoProfileLabeledButtonQrRightSkip; + const auto rightSkip = 0;// st::infoProfileLabeledButtonQrRightSkip; fitLabelToButton(qrButton, usernameLine.text, rightSkip); fitLabelToButton(qrButton, usernameLine.subtext, rightSkip); qrButton->setClickedCallback([=] { @@ -1451,7 +1451,7 @@ object_ptr DetailsFiller::setupInfo() { const auto qr = Ui::CreateChild( linkLine.text->parentWidget(), st::infoProfileLabeledButtonQr); - const auto rightSkip = st::infoProfileLabeledButtonQrRightSkip; + const auto rightSkip = 0;// st::infoProfileLabeledButtonQrRightSkip; fitLabelToButton(qr, linkLine.text, rightSkip); fitLabelToButton(qr, linkLine.subtext, rightSkip); qr->setClickedCallback([=, peer = _peer] {