mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Fixed width of time picker for different scales.
This commit is contained in:
parent
580e15dc21
commit
18b9bba21c
1 changed files with 5 additions and 2 deletions
|
@ -35,11 +35,14 @@ Fn<TimeId()> TimePickerBox(
|
|||
|
||||
const auto font = st::boxTextFont;
|
||||
const auto maxPhraseWidth = [&] {
|
||||
// We have to use QFontMetricsF instead of
|
||||
// FontData::width for more precise calculation.
|
||||
const auto mf = QFontMetricsF(font->f);
|
||||
const auto maxPhrase = ranges::max_element(
|
||||
phrases,
|
||||
std::less<>(),
|
||||
[&](const QString &s) { return font->width(s); });
|
||||
return font->width(*maxPhrase) + font->spacew * 2;
|
||||
[&](const QString &s) { return mf.horizontalAdvance(s); });
|
||||
return std::ceil(mf.horizontalAdvance(*maxPhrase));
|
||||
}();
|
||||
const auto itemHeight = st::historyMessagesTTLPickerItemHeight;
|
||||
auto paintCallback = [=](
|
||||
|
|
Loading…
Add table
Reference in a new issue