mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +02:00
Passthrough QT_FONT_DPI in crash report window just like in the main scaling engine
This commit is contained in:
parent
d11885d48c
commit
62a2277f43
1 changed files with 13 additions and 1 deletions
|
@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QtGui/QDesktopServices>
|
||||
#include <QtCore/QStandardPaths>
|
||||
#include <QtCore/QTimer>
|
||||
#include <qpa/qplatformscreen.h>
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -43,7 +44,18 @@ PreLaunchWindow::PreLaunchWindow(QString title) {
|
|||
p.setColor(QPalette::Window, QColor(255, 255, 255));
|
||||
setPalette(p);
|
||||
|
||||
_size = QFontMetrics(QGuiApplication::font()).height();
|
||||
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));
|
||||
|
||||
_size = QFontMetrics(font).height();
|
||||
|
||||
int paddingVertical = (_size / 2);
|
||||
int paddingHorizontal = _size;
|
||||
|
|
Loading…
Add table
Reference in a new issue