path: root/src/gui/image/qicon.h
diff options
authorMorten Johan Sørvig <>2013-03-01 12:15:34 +0100
committerThe Qt Project <>2013-03-23 08:32:17 +0100
commit6ec9b34cbb5fa6b1214cc6551002f46f732ba72f (patch)
treef65eb91af5b3138ee2b0f8912b44536093332827 /src/gui/image/qicon.h
parent7067c3268a6838fcfa7d2e7584f4296e71d947ec (diff)
Make QIcon generate high-dpi pixmaps.
QIcon::pixmap() can now return pixmaps that are larger than the requested size, This is a behavior change that may require updating existing application code, and is enabled by setting Qt::AA_UseHighDPIIamges. Add new pixmap() and actualSize() overloads that take a window pointer. For 100% correctness you want to target pixmap generation to a specific window, in case the system has a mix of normal and high-dpi displays. (The non-window versions uses QGuiApplication:: devicePixelRatio(), which returns the ratio for the "best" display on the system.) actualSize now returns the size in device-independent pixels - not the pixmap pixel size. This matches its intended use case which is layout calculations. Change-Id: I2eefc4ed4aa48b036a7019446694e56213070efa Reviewed-by: Gabriel de Dietrich <>
Diffstat (limited to 'src/gui/image/qicon.h')
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index cda2360bed..e81bea69d6 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -79,8 +79,10 @@ public:
{ return pixmap(QSize(w, h), mode, state); }
inline QPixmap pixmap(int extent, Mode mode = Normal, State state = Off) const
{ return pixmap(QSize(extent, extent), mode, state); }
+ QPixmap pixmap(QWindow *window, const QSize &size, Mode mode = Normal, State state = Off) const;
QSize actualSize(const QSize &size, Mode mode = Normal, State state = Off) const;
+ QSize actualSize(QWindow *window, const QSize &size, Mode mode = Normal, State state = Off) const;
QString name() const;