summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qhighdpiscaling.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-25 14:14:36 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-30 12:38:55 +0000
commitd6813d00410a79e133ee58d1197feb5dee877974 (patch)
tree4027ef4ee21e0fee742df4516b1fca73190a75a3 /src/gui/kernel/qhighdpiscaling.cpp
parent7809e77f2e6163de892afb99cb3a4a8f259f4709 (diff)
Add application attribute to disable highDPI scaling
Main use case is for KDE Plasma, which needs to know about real window system coordinates. Can also be used by applications that do all the scaling manually, and that do not want to have Qt scale the coordinate systems and painters. Change-Id: Ic595131c5e2fb4c0af95e9b5bd3e40beee86760b Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/gui/kernel/qhighdpiscaling.cpp')
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index e574a79370..46c9f671df 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -142,6 +142,11 @@ QDpi QHighDpiScaling::m_logicalDpi; // The scaled logical DPI of the primary scr
*/
void QHighDpiScaling::initHighDpiScaling()
{
+ if (QCoreApplication::testAttribute(Qt::AA_NoHighDpiScaling)) {
+ m_factor = 1;
+ m_active = false;
+ return;
+ }
m_factor = initialScaleFactor();
bool usePlatformPluginPixelDensity = qEnvironmentVariableIsSet(autoScreenEnvVar)
|| qgetenv(legacyDevicePixelEnvVar).toLower() == "auto";
@@ -157,6 +162,9 @@ void QHighDpiScaling::initHighDpiScaling()
void QHighDpiScaling::updateHighDpiScaling()
{
+ if (QCoreApplication::testAttribute(Qt::AA_NoHighDpiScaling))
+ return;
+
if (m_usePixelDensity && !m_pixelDensityScalingActive) {
Q_FOREACH (QScreen *screen, QGuiApplication::screens()) {
if (!qFuzzyCompare(screenSubfactor(screen->handle()), qreal(1))) {