diff options
-rw-r--r-- | src/corelib/global/qnamespace.h | 6 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 3 | ||||
-rw-r--r-- | src/gui/image/qicon.cpp | 34 | ||||
-rw-r--r-- | src/gui/image/qiconloader.cpp | 5 | ||||
-rw-r--r-- | src/gui/image/qimagereader.cpp | 2 | ||||
-rw-r--r-- | src/testlib/qtest.h | 1 | ||||
-rw-r--r-- | tests/manual/dialogs/main.cpp | 4 | ||||
-rw-r--r-- | tests/manual/highdpi/main.cpp | 34 | ||||
-rw-r--r-- | tests/manual/widgets/styles/main.cpp | 1 |
10 files changed, 17 insertions, 81 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 diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp index 07df8f5cf4..2676ceeb52 100644 --- a/tests/manual/dialogs/main.cpp +++ b/tests/manual/dialogs/main.cpp @@ -126,10 +126,6 @@ void MainWindow::aboutDialog() int main(int argc, char *argv[]) { -#if QT_VERSION >= 0x050600 - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); -#endif - for (int a = 1; a < argc; ++a) { if (!qstrcmp(argv[a], "-n")) { qDebug("AA_DontUseNativeDialogs"); diff --git a/tests/manual/highdpi/main.cpp b/tests/manual/highdpi/main.cpp index 4d70198d29..95036d881f 100644 --- a/tests/manual/highdpi/main.cpp +++ b/tests/manual/highdpi/main.cpp @@ -749,9 +749,6 @@ public: int maxSize = 64; int sizeIncrement = 5; - // Disable high-dpi icons - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, false); - // normal icon for (int size = minSize; size < maxSize; size += sizeIncrement) { QPainter p(this); @@ -771,36 +768,6 @@ public: y+=dy; x = ((x + dx) % maxX); } - - x = 10; - y+=dy; - - // Enable high-dpi icons - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); - - // normal icon - for (int size = minSize; size < maxSize; size += sizeIncrement) { - QPainter p(this); - p.drawPixmap(x, y, iconNormalDpi->pixmap(size, size)); - if (x + dx > maxX) - y+=dy; - x = ((x + dx) % maxX); - } - x = 10; - y+=dy; - - // high-dpi icon (draw point) - for (int size = minSize; size < maxSize; size += sizeIncrement) { - QPainter p(this); - p.drawPixmap(x, y, iconHighDPI->pixmap(size, size)); - if (x + dx > maxX) - y+=dy; - x = ((x + dx) % maxX); - } - - x = 10; - y+=dy; - } private: @@ -1471,7 +1438,6 @@ int main(int argc, char **argv) } QApplication app(argc, argv); - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QCoreApplication::setApplicationVersion(QT_VERSION_STR); QCommandLineParser parser; diff --git a/tests/manual/widgets/styles/main.cpp b/tests/manual/widgets/styles/main.cpp index 3a20c3228c..a2b4ff8228 100644 --- a/tests/manual/widgets/styles/main.cpp +++ b/tests/manual/widgets/styles/main.cpp @@ -295,7 +295,6 @@ void MainWindow::updateDescription() int main(int argc, char *argv[]) { - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication app(argc, argv); MainWindow mw; mw.show(); |