summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-29 22:28:34 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-08-31 14:29:01 +0200
commit2dc46c09026362cc267b1183faf09fb29479ef93 (patch)
tree7da9a47745e2fdb213ffa5830f4c867c0c25cd61 /src
parent8adb0dde1984438d52de4bcb610e4139558bd1a0 (diff)
Deprecate and remove all uses of AA_UseHighDpiPixmaps
High-DPI pixmaps are always enabled, and cannot be disabled. Change-Id: I01a006b404e5431582b64ef812974c1c022b39ae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qnamespace.h6
-rw-r--r--src/corelib/global/qnamespace.qdoc8
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp3
-rw-r--r--src/gui/image/qicon.cpp34
-rw-r--r--src/gui/image/qiconloader.cpp5
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/testlib/qtest.h1
7 files changed, 17 insertions, 42 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index dbd0c20282..86afa623a9 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -458,7 +458,11 @@ namespace Qt {
// AA_X11InitThreads = 10,
AA_SynthesizeTouchForUnhandledMouseEvents = 11,
AA_SynthesizeMouseForUnhandledTouchEvents = 12,
- AA_UseHighDpiPixmaps = 13,
+#if QT_DEPRECATED_SINCE(6, 0)
+ AA_UseHighDpiPixmaps Q_DECL_ENUMERATOR_DEPRECATED_X(
+ "High-DPI pixmaps are always enabled. " \
+ "This attribute no longer has any effect.") = 13,
+#endif
AA_ForceRasterWidgets = 14,
AA_UseDesktopOpenGL = 15,
AA_UseOpenGLES = 16,
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index b8c9854555..b96d8e0656 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -172,13 +172,6 @@
to left button mouse events instead. This attribute is enabled
by default.
- \value AA_UseHighDpiPixmaps Make QIcon::pixmap() generate high-dpi pixmaps
- that can be larger than the requested size. Such pixmaps will have
- \l {QPixmap::devicePixelRatio}{devicePixelRatio()} set to a value higher than 1.
- After setting this attribute, application code that uses pixmap
- sizes in layout geometry calculations should typically divide by
- \l {QPixmap::devicePixelRatio}{devicePixelRatio()} to get device-independent layout geometry.
-
\value AA_ForceRasterWidgets Make top-level widgets use pure raster surfaces,
and do not support non-native GL-based child widgets.
@@ -297,6 +290,7 @@
\omitvalue AA_AttributeCount
\omitvalue AA_EnableHighDpiScaling
+ \omitvalue AA_UseHighDpiPixmaps
*/
/*!
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 3bda921820..f9bd7bb63b 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -350,8 +350,7 @@ QAbstractEventDispatcher *QCoreApplicationPrivate::eventDispatcher = nullptr;
QCoreApplication *QCoreApplication::self = nullptr;
uint QCoreApplicationPrivate::attribs =
(1 << Qt::AA_SynthesizeMouseForUnhandledTouchEvents) |
- (1 << Qt::AA_SynthesizeMouseForUnhandledTabletEvents) |
- (1 << Qt::AA_UseHighDpiPixmaps);
+ (1 << Qt::AA_SynthesizeMouseForUnhandledTabletEvents);
struct QCoreApplicationData {
QCoreApplicationData() noexcept {
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index a4f6369fd2..2278eb8201 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -128,15 +128,9 @@ static void qt_cleanup_icon_cache()
Returns the effective device pixel ratio, using
the provided window pointer if possible.
-
- if Qt::AA_UseHighDpiPixmaps is not set this function
- returns 1.0 to keep non-hihdpi aware code working.
*/
static qreal qt_effective_device_pixel_ratio(QWindow *window = nullptr)
{
- if (!qApp->testAttribute(Qt::AA_UseHighDpiPixmaps))
- return qreal(1.0);
-
if (window)
return window->devicePixelRatio();
@@ -190,11 +184,8 @@ QPixmapIconEngine::~QPixmapIconEngine()
void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
{
- qreal dpr = 1.0;
- if (QCoreApplication::testAttribute(Qt::AA_UseHighDpiPixmaps)) {
- auto paintDevice = painter->device();
- dpr = paintDevice ? paintDevice->devicePixelRatioF() : qApp->devicePixelRatio();
- }
+ auto paintDevice = painter->device();
+ qreal dpr = paintDevice ? paintDevice->devicePixelRatioF() : qApp->devicePixelRatio();
const QSize pixmapSize = rect.size() * dpr;
QPixmap px = pixmap(pixmapSize, mode, state);
painter->drawPixmap(rect, px);
@@ -800,11 +791,8 @@ qint64 QIcon::cacheKey() const
/*!
Returns a pixmap with the requested \a size, \a mode, and \a
state, generating one if necessary. The pixmap might be smaller than
- requested, but never larger.
-
- Setting the Qt::AA_UseHighDpiPixmaps application attribute enables this
- function to return pixmaps that are larger than the requested size. Such
- images will have a devicePixelRatio larger than 1.
+ requested, but never larger, unless the device-pixel ratio of the returned
+ pixmap is larger than 1.
\sa actualSize(), paint()
*/
@@ -822,11 +810,8 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const
\overload
Returns a pixmap of size QSize(\a w, \a h). The pixmap might be smaller than
- requested, but never larger.
-
- Setting the Qt::AA_UseHighDpiPixmaps application attribute enables this
- function to return pixmaps that are larger than the requested size. Such
- images will have a devicePixelRatio larger than 1.
+ requested, but never larger, unless the device-pixel ratio of the returned
+ pixmap is larger than 1.
*/
/*!
@@ -835,11 +820,8 @@ QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const
\overload
Returns a pixmap of size QSize(\a extent, \a extent). The pixmap might be smaller
- than requested, but never larger.
-
- Setting the Qt::AA_UseHighDpiPixmaps application attribute enables this
- function to return pixmaps that are larger than the requested size. Such
- images will have a devicePixelRatio larger than 1.
+ than requested, but never larger, unless the device-pixel ratio of the returned
+ pixmap is larger than 1.
*/
/*!
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 250e695574..51a9632dcc 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -641,10 +641,7 @@ void QIconLoaderEngine::ensureLoaded()
void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect,
QIcon::Mode mode, QIcon::State state)
{
- const qreal dpr = !qApp->testAttribute(Qt::AA_UseHighDpiPixmaps) ?
- qreal(1.0) : painter->device()->devicePixelRatioF();
-
- QSize pixmapSize = rect.size() * dpr;
+ QSize pixmapSize = rect.size() * painter->device()->devicePixelRatioF();
painter->drawPixmap(rect, pixmap(pixmapSize, mode, state));
}
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 0702e2bb23..611cbb1df1 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -102,7 +102,7 @@
\c QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING.
\sa QImageWriter, QImageIOHandler, QImageIOPlugin, QMimeDatabase, QColorSpace
- \sa QImage::devicePixelRatio(), QPixmap::devicePixelRatio(), QIcon, QPainter::drawPixmap(), QPainter::drawImage(), Qt::AA_UseHighDpiPixmaps
+ \sa QImage::devicePixelRatio(), QPixmap::devicePixelRatio(), QIcon, QPainter::drawPixmap(), QPainter::drawImage()
*/
/*!
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 935fbf9b05..fa439130d9 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -466,7 +466,6 @@ bool compareSequence(ActualIterator actualIt, ActualIterator actualEnd,
void disableHighDpi()
{
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, false);
}
Q_CONSTRUCTOR_FUNCTION(disableHighDpi);
#endif