Move QT_FONT_DPI workaround to Qt patches

This commit is contained in:
Ilya Fedin 2022-05-31 13:06:19 +04:00 committed by John Preston
parent 391a3a77f6
commit 0a876226fe
2 changed files with 2 additions and 11 deletions

View File

@ -22,7 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/QDesktopServices>
#include <QtCore/QStandardPaths>
#include <QtCore/QTimer>
#include <qpa/qplatformscreen.h>
namespace {
@ -44,10 +43,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) {
p.setColor(QPalette::Window, QColor(255, 255, 255));
setPalette(p);
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();
_size = QFontMetrics(font()).height();
int paddingVertical = (_size / 2);
int paddingHorizontal = _size;

View File

@ -31,7 +31,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QLockFile>
#include <QtGui/QSessionManager>
#include <QtGui/QScreen>
#include <qpa/qplatformscreen.h>
namespace Core {
namespace {
@ -219,11 +218,7 @@ void Sandbox::launchApplication() {
}
void Sandbox::setupScreenScale() {
constexpr auto processDpi = [](const QDpi &dpi) {
return (dpi.first + dpi.second) * 0.5;
};
const auto dpi = processDpi(
Sandbox::primaryScreen()->handle()->logicalDpi());
const auto dpi = Sandbox::primaryScreen()->logicalDotsPerInch();
LOG(("Primary screen DPI: %1").arg(dpi));
if (dpi <= 108) {
cSetScreenScale(100); // 100%: 96 DPI (0-108)