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>bb10
parent
8adb0dde19
commit
2dc46c0902
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue