mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +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));
|
||||
setPalette(p);
|
||||
|
||||
constexpr auto processDpi = [](const QDpi &dpi) {
|
||||
return (dpi.first + dpi.second) * 0.5;
|
||||
};
|
||||
|
||||
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));
|
||||
|
||||
const auto dpi = screen()->handle()->logicalDpi().second;
|
||||
auto font = this->font();
|
||||
font.setPixelSize(base::SafeRound(std::floor(font.pointSizeF() * dpi / 72. * 100. + 0.5) / 100.));
|
||||
_size = QFontMetrics(font).height();
|
||||
|
||||
int paddingVertical = (_size / 2);
|
||||
|
|
Loading…
Add table
Reference in a new issue