2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix name width in accounts list. Fixes #25116.

This commit is contained in:
John Preston
2022-10-14 12:01:53 +04:00
parent b68ffcd75d
commit 9b0cae9c97
2 changed files with 7 additions and 4 deletions

View File

@@ -134,22 +134,25 @@ ComposedBadge::ComposedBadge(
}
}, lifetime());
auto textWidth = _text.value() | rpl::map([=] {
return button->fullTextWidth();
});
rpl::combine(
_unreadWidth.events_starting_with(_unread ? _unread->width() : 0),
_premiumWidth.events_starting_with(_badge.widget()
? _badge.widget()->width()
: 0),
_text.value(),
std::move(textWidth),
button->sizeValue()
) | rpl::start_with_next([=](
int unreadWidth,
int premiumWidth,
const QString &text,
int textWidth,
const QSize &buttonSize) {
const auto &st = button->st();
const auto skip = st.style.font->spacew;
const auto textRightPosition = st.padding.left()
+ st.style.font->width(text)
+ textWidth
+ skip;
const auto minWidth = unreadWidth + premiumWidth + skip;
const auto maxTextWidth = buttonSize.width()