[poll-view] Fixed vertical area for voted poll options without media.

This commit is contained in:
23rd
2026-03-26 13:29:59 +03:00
parent 0d003967e8
commit da6956df3d
@@ -554,15 +554,22 @@ QSize Poll::countOptimalSize() {
+ st::historyPollAnswerPadding.right());
}
const auto show = showVotes();
const auto answersHeight = ranges::accumulate(ranges::views::all(
_answers
) | ranges::views::transform([](const Answer &answer) {
) | ranges::views::transform([show](const Answer &answer) {
const auto media = answer.thumbnail ? PollAnswerMediaSize() : 0;
const auto &padding = answer.thumbnail
? st::historyPollAnswerPadding
: st::historyPollAnswerPaddingNoMedia;
const auto fillingWithChoice = show
? (st::historyPollPercentFont->height
+ st::historyPollFillingTop
+ (st::historyPollFillingHeight
+ st::historyPollChoiceRight.height()) / 2)
: 0;
return padding.top()
+ std::max(answer.text.minHeight(), media)
+ std::max({ answer.text.minHeight(), media, fillingWithChoice })
+ padding.bottom();
}), 0);
@@ -704,8 +711,18 @@ int Poll::countAnswerHeight(
const auto &padding = answer.thumbnail
? st::historyPollAnswerPadding
: st::historyPollAnswerPaddingNoMedia;
const auto fillingWithChoice = showVotes()
? (st::historyPollPercentFont->height
+ st::historyPollFillingTop
+ (st::historyPollFillingHeight
+ st::historyPollChoiceRight.height()) / 2)
: 0;
return padding.top()
+ std::max(answer.text.countHeight(textWidth), media)
+ std::max({
answer.text.countHeight(textWidth),
media,
fillingWithChoice,
})
+ padding.bottom();
}