mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Move QT_FONT_DPI workaround to Qt patches
This commit is contained in:
parent
391a3a77f6
commit
0a876226fe
2 changed files with 2 additions and 11 deletions
|
@ -22,7 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtGui/QDesktopServices>
|
#include <QtGui/QDesktopServices>
|
||||||
#include <QtCore/QStandardPaths>
|
#include <QtCore/QStandardPaths>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <qpa/qplatformscreen.h>
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -44,10 +43,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) {
|
||||||
p.setColor(QPalette::Window, QColor(255, 255, 255));
|
p.setColor(QPalette::Window, QColor(255, 255, 255));
|
||||||
setPalette(p);
|
setPalette(p);
|
||||||
|
|
||||||
const auto dpi = screen()->handle()->logicalDpi().second;
|
_size = QFontMetrics(font()).height();
|
||||||
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);
|
int paddingVertical = (_size / 2);
|
||||||
int paddingHorizontal = _size;
|
int paddingHorizontal = _size;
|
||||||
|
|
|
@ -31,7 +31,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtCore/QLockFile>
|
#include <QtCore/QLockFile>
|
||||||
#include <QtGui/QSessionManager>
|
#include <QtGui/QSessionManager>
|
||||||
#include <QtGui/QScreen>
|
#include <QtGui/QScreen>
|
||||||
#include <qpa/qplatformscreen.h>
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -219,11 +218,7 @@ void Sandbox::launchApplication() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sandbox::setupScreenScale() {
|
void Sandbox::setupScreenScale() {
|
||||||
constexpr auto processDpi = [](const QDpi &dpi) {
|
const auto dpi = Sandbox::primaryScreen()->logicalDotsPerInch();
|
||||||
return (dpi.first + dpi.second) * 0.5;
|
|
||||||
};
|
|
||||||
const auto dpi = processDpi(
|
|
||||||
Sandbox::primaryScreen()->handle()->logicalDpi());
|
|
||||||
LOG(("Primary screen DPI: %1").arg(dpi));
|
LOG(("Primary screen DPI: %1").arg(dpi));
|
||||||
if (dpi <= 108) {
|
if (dpi <= 108) {
|
||||||
cSetScreenScale(100); // 100%: 96 DPI (0-108)
|
cSetScreenScale(100); // 100%: 96 DPI (0-108)
|
||||||
|
|
Loading…
Add table
Reference in a new issue