diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-08-31 14:01:12 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-08-31 19:14:55 +0200 |
commit | 90358f6042d1fe2db849e17e1b0c875fb0560b20 (patch) | |
tree | 493e57226970f613c18871d086ae88031b091fde /src | |
parent | 8028474e62c584ed3d5bb0f662b9690ca029f028 (diff) |
Deprecate and remove uses of AA_DisableHighDpiScaling
Change-Id: Ibadce68775858c524b998aacad310905ba2c2e8e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qnamespace.h | 8 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 10 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qhighdpiscaling.cpp | 10 | ||||
-rw-r--r-- | src/testlib/doc/src/qttestlib-manual.qdoc | 3 | ||||
-rw-r--r-- | src/testlib/qtest.h | 2 |
6 files changed, 10 insertions, 24 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 86afa623a9..9b5af17f7c 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -470,9 +470,13 @@ namespace Qt { AA_ShareOpenGLContexts = 18, AA_SetPalette = 19, #if QT_DEPRECATED_SINCE(6, 0) - AA_EnableHighDpiScaling Q_DECL_ENUMERATOR_DEPRECATED = 20, + AA_EnableHighDpiScaling Q_DECL_ENUMERATOR_DEPRECATED_X( + "High-DPI scaling is always enabled. " \ + "This attribute no longer has any effect.") = 20, + AA_DisableHighDpiScaling Q_DECL_ENUMERATOR_DEPRECATED_X( + "High-DPI scaling is always enabled. " \ + "This attribute no longer has any effect.") = 21, #endif - AA_DisableHighDpiScaling = 21, AA_UseStyleSheetPropagationInWidgetStyles = 22, AA_DontUseNativeDialogs = 23, AA_SynthesizeMouseForUnhandledTabletEvents = 24, diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index b96d8e0656..b5830173f8 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -208,15 +208,6 @@ \value AA_SetPalette Indicates whether a palette was explicitly set on the QGuiApplication. This value was added in Qt 5.5. - \value AA_DisableHighDpiScaling Disables high-DPI scaling in Qt, exposing window - system coordinates. Note that the window system may do its own scaling, - so this does not guarantee that QPaintDevice::devicePixelRatio() will - be equal to 1. In addition, scale factors set by QT_SCALE_FACTOR will not - be affected. This corresponds to setting the - QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to 0. - This attribute must be set before QGuiApplication is constructed. - This value was added in Qt 5.6. - \value AA_UseStyleSheetPropagationInWidgetStyles By default, Qt Style Sheets disable regular QWidget palette and font propagation. When this flag is enabled, font and palette changes propagate as though the user had @@ -291,6 +282,7 @@ \omitvalue AA_AttributeCount \omitvalue AA_EnableHighDpiScaling \omitvalue AA_UseHighDpiPixmaps + \omitvalue AA_DisableHighDpiScaling */ /*! diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index f9bd7bb63b..9892680109 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -951,7 +951,6 @@ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on) if (Q_UNLIKELY(QCoreApplicationPrivate::is_app_running)) { #endif switch (attribute) { - case Qt::AA_DisableHighDpiScaling: case Qt::AA_PluginApplication: case Qt::AA_UseDesktopOpenGL: case Qt::AA_UseOpenGLES: diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 816c3ccc4b..023e19ad9c 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -208,10 +208,8 @@ static inline qreal initialGlobalScaleFactor() factor based on display density information. These platforms include X11, Windows, and Android. - There are two APIs for enabling or disabling this behavior: + There is one API for enabling or disabling this behavior: - The QT_AUTO_SCREEN_SCALE_FACTOR environment variable. - - The AA_EnableHighDpiScaling and AA_DisableHighDpiScaling - application attributes Enabling either will make QHighDpiScaling call QPlatformScreen::pixelDensity() and use the value provided as the scale factor for the screen in @@ -265,9 +263,6 @@ static inline bool usePixelDensity() // reported by the platform plugin. There are several enablers and several // disablers. A single disable may veto all other enablers. - // Check if there is an explicit disable - if (QCoreApplication::testAttribute(Qt::AA_DisableHighDpiScaling)) - return false; bool screenEnvValueOk; const int screenEnvValue = qEnvironmentVariableIntValue(legacyAutoScreenEnvVar, &screenEnvValueOk); if (screenEnvValueOk && screenEnvValue < 1) @@ -488,9 +483,6 @@ void QHighDpiScaling::initHighDpiScaling() void QHighDpiScaling::updateHighDpiScaling() { - if (QCoreApplication::testAttribute(Qt::AA_DisableHighDpiScaling)) - return; - m_usePixelDensity = usePixelDensity(); if (m_usePixelDensity && !m_pixelDensityScalingActive) { diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index 8ff82ba28f..87ac565278 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -129,8 +129,7 @@ Finally, if the test class has a static public \c{void initMain()} method, it is called by the QTEST_MAIN macros before the QApplication object - is instantiated. For example, this allows for setting application - attributes like Qt::AA_DisableHighDpiScaling. This was added in 5.14. + is instantiated. This was added in 5.14. For more examples, refer to the \l{Qt Test Tutorial}. diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index fa439130d9..6c80ff3a4d 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -465,7 +465,7 @@ bool compareSequence(ActualIterator actualIt, ActualIterator actualEnd, #if defined(TESTCASE_LOWDPI) void disableHighDpi() { - QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + qputenv("QT_ENABLE_HIGHDPI_SCALING", "0"); } Q_CONSTRUCTOR_FUNCTION(disableHighDpi); #endif |