diff options
Diffstat (limited to 'src/gui/image/qicon.cpp')
-rw-r--r-- | src/gui/image/qicon.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 681e7e3f79..1e4a9ebe8c 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -989,10 +989,16 @@ void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state) QImageWriter::supportedImageFormats() functions to retrieve a complete list of the supported file formats. - Note: When you add a non-empty filename to a QIcon, the icon becomes + If a high resolution version of the image exists (identified by + the suffix \c @2x on the base name), it is automatically loaded + and added with the \e{device pixel ratio} set to a value of 2. + This can be disabled by setting the environment variable + \c QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING (see QImageReader). + + \note When you add a non-empty filename to a QIcon, the icon becomes non-null, even if the file doesn't exist or points to a corrupt file. - \sa addPixmap() + \sa addPixmap(), QPixmap::devicePixelRatio() */ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State state) { @@ -1321,8 +1327,20 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QIcon &i) { - dbg.nospace() << "QIcon(" << i.name() << ')'; - return dbg.space(); + QDebugStateSaver saver(dbg); + dbg.resetFormat(); + dbg.nospace(); + dbg << "QIcon("; + if (i.isNull()) { + dbg << "null"; + } else { + if (!i.name().isEmpty()) + dbg << i.name() << ','; + dbg << "availableSizes[normal,Off]=" << i.availableSizes() + << ",cacheKey=" << showbase << hex << i.cacheKey() << dec << noshowbase; + } + dbg << ')'; + return dbg; } #endif |