Fixed width of username label with right button in profile section.

This commit is contained in:
23rd 2024-09-10 11:07:24 +03:00
parent f6b9cc5ce1
commit fdcbe3cf3a

View file

@ -1102,21 +1102,25 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
usernameLine.subtext->overrideLinkClickHandler(callback); usernameLine.subtext->overrideLinkClickHandler(callback);
usernameLine.text->setContextMenuHook(hook); usernameLine.text->setContextMenuHook(hook);
usernameLine.subtext->setContextMenuHook(hook); usernameLine.subtext->setContextMenuHook(hook);
const auto usernameLabel = usernameLine.text;
if (user) { if (user) {
const auto copyUsername = user->isBot() const auto usernameLabel = usernameLine.text;
? Ui::CreateChild<Ui::IconButton>( const auto parent = usernameLabel->parentWidget();
usernameLabel->parentWidget(), const auto copyUsername = Ui::CreateChild<Ui::IconButton>(
st::infoProfileLabeledButtonCopy) parent,
: Ui::CreateChild<Ui::IconButton>( user->isBot()
usernameLabel->parentWidget(), ? st::infoProfileLabeledButtonCopy
st::infoProfileLabeledButtonQr); : st::infoProfileLabeledButtonQr);
result->sizeValue( result->sizeValue(
) | rpl::start_with_next([=] { ) | rpl::start_with_next([=] {
const auto s = usernameLabel->parentWidget()->size(); const auto s = parent->size();
copyUsername->moveToRight( copyUsername->moveToRight(
0, 0,
(s.height() - copyUsername->height()) / 2); (s.height() - copyUsername->height()) / 2);
usernameLabel->resizeToWidth(
s.width()
- usernameLabel->geometry().left()
- st::lineWidth * 2
- copyUsername->width());
}, copyUsername->lifetime()); }, copyUsername->lifetime());
copyUsername->setClickedCallback([=] { copyUsername->setClickedCallback([=] {
if (!user->isBot()) { if (!user->isBot()) {