Deprecate QIcon API which take a QWindow pointer

- pixmap(QWindow * ...)
    Use pixmap(size, dpr) instead
- actualSize(QWindow *, ...)
    Use actualSize(size) instead

Task-number: QTBUG-85885
Change-Id: Ia2d73eec9f040cd659f39c854463e3cd3ba72b93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Johan Sørvig 2020-08-11 21:09:08 +02:00 committed by Tor Arne Vestbø
parent 4a0140832d
commit 1719be99a7
2 changed files with 15 additions and 0 deletions

View File

@ -875,6 +875,7 @@ QPixmap QIcon::pixmap(const QSize &size, qreal devicePixelRatio, Mode mode, Stat
/*!
\since 5.1
\deprecated
Returns a pixmap with the requested \a window \a size, \a mode, and \a
state, generating one if necessary.
@ -883,8 +884,12 @@ QPixmap QIcon::pixmap(const QSize &size, qreal devicePixelRatio, Mode mode, Stat
a high-dpi display the pixmap can be larger. In that case it will have
a devicePixelRatio larger than 1.
\obsolete Use the overload which takes qreal devicePixelRatio instead.
\sa actualSize(), paint()
*/
#if QT_DEPRECATED_SINCE(6, 0)
QPixmap QIcon::pixmap(QWindow *window, const QSize &size, Mode mode, State state) const
{
if (!d)
@ -893,6 +898,7 @@ QPixmap QIcon::pixmap(QWindow *window, const QSize &size, Mode mode, State state
qreal devicePixelRatio = qt_effective_device_pixel_ratio(window);
return pixmap(size, devicePixelRatio, mode, state);
}
#endif
/*! Returns the actual size of the icon for the requested \a size, \a
@ -920,6 +926,8 @@ QSize QIcon::actualSize(const QSize &size, Mode mode, State state) const
\sa actualSize(), pixmap(), paint()
*/
#if QT_DEPRECATED_SINCE(6, 0)
QSize QIcon::actualSize(QWindow *window, const QSize &size, Mode mode, State state) const
{
if (!d)
@ -934,6 +942,7 @@ QSize QIcon::actualSize(QWindow *window, const QSize &size, Mode mode, State sta
QSize actualSize = d->engine->actualSize(size * devicePixelRatio, mode, state);
return actualSize / d->pixmapDevicePixelRatio(devicePixelRatio, size, actualSize);
}
#endif
/*!
Uses the \a painter to paint the icon with specified \a alignment,

View File

@ -83,10 +83,16 @@ public:
inline QPixmap pixmap(int extent, Mode mode = Normal, State state = Off) const
{ return pixmap(QSize(extent, extent), mode, state); }
QPixmap pixmap(const QSize &size, qreal devicePixelRatio, Mode mode = Normal, State state = Off) const;
#if QT_DEPRECATED_SINCE(6, 0)
QT_DEPRECATED_VERSION_X_6_0("Use pixmap(size, devicePixelRatio) instead")
QPixmap pixmap(QWindow *window, const QSize &size, Mode mode = Normal, State state = Off) const;
#endif
QSize actualSize(const QSize &size, Mode mode = Normal, State state = Off) const;
#if QT_DEPRECATED_SINCE(6, 0)
QT_DEPRECATED_VERSION_X_6_0("Use actualSize(size) instead")
QSize actualSize(QWindow *window, const QSize &size, Mode mode = Normal, State state = Off) const;
#endif
QString name() const;