mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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 font = st::boxTextFont;
|
||||||
const auto maxPhraseWidth = [&] {
|
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(
|
const auto maxPhrase = ranges::max_element(
|
||||||
phrases,
|
phrases,
|
||||||
std::less<>(),
|
std::less<>(),
|
||||||
[&](const QString &s) { return font->width(s); });
|
[&](const QString &s) { return mf.horizontalAdvance(s); });
|
||||||
return font->width(*maxPhrase) + font->spacew * 2;
|
return std::ceil(mf.horizontalAdvance(*maxPhrase));
|
||||||
}();
|
}();
|
||||||
const auto itemHeight = st::historyMessagesTTLPickerItemHeight;
|
const auto itemHeight = st::historyMessagesTTLPickerItemHeight;
|
||||||
auto paintCallback = [=](
|
auto paintCallback = [=](
|
||||||
|
|
Loading…
Add table
Reference in a new issue