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()

@ -1 +1 @@
Subproject commit f450dcf2c5fa1dfa0ad1fda483421c6548ff4fbb
Subproject commit 9ab11ccb36b7d03a3a24ebcd18d2f13b03fc3682