mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Convet font point size to pixel size more like Qt does in the crash reporter
This commit is contained in:
parent
2b383a4236
commit
e3f65d2346
1 changed files with 3 additions and 11 deletions
|
@ -44,17 +44,9 @@ PreLaunchWindow::PreLaunchWindow(QString title) {
|
||||||
p.setColor(QPalette::Window, QColor(255, 255, 255));
|
p.setColor(QPalette::Window, QColor(255, 255, 255));
|
||||||
setPalette(p);
|
setPalette(p);
|
||||||
|
|
||||||
constexpr auto processDpi = [](const QDpi &dpi) {
|
const auto dpi = screen()->handle()->logicalDpi().second;
|
||||||
return (dpi.first + dpi.second) * 0.5;
|
auto font = this->font();
|
||||||
};
|
font.setPixelSize(base::SafeRound(std::floor(font.pointSizeF() * dpi / 72. * 100. + 0.5) / 100.));
|
||||||
|
|
||||||
const auto screen = QGuiApplication::primaryScreen();
|
|
||||||
const auto scale = processDpi(screen->handle()->logicalDpi())
|
|
||||||
/ processDpi(screen->handle()->logicalBaseDpi());
|
|
||||||
|
|
||||||
auto font = QGuiApplication::font();
|
|
||||||
font.setPixelSize(base::SafeRound(font.pointSize() * scale));
|
|
||||||
|
|
||||||
_size = QFontMetrics(font).height();
|
_size = QFontMetrics(font).height();
|
||||||
|
|
||||||
int paddingVertical = (_size / 2);
|
int paddingVertical = (_size / 2);
|
||||||
|
|
Loading…
Add table
Reference in a new issue