Add scaledPixmap() override

QAbstractFileIconEngine implements the QIconEngine interface
and creates a new interface where subclasses override the
filePixmap() function.

QIconEngine subclasses must now also override scaledPixmap();
add implementation which forwards to filePixmap().

(The intermediate implementation in QPixmapIconEngine is not
used by QAbstractFileIconEngine.)

Pick-to: 6.1
Task-number: QTBUG-91104
Change-Id: I229e3a003ad0c3fff768eac7e75c59fe7145fcaa
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Johan Sørvig 2021-02-16 14:39:06 +01:00
parent 24b07b2b2d
commit bb110cee5d
2 changed files with 7 additions and 0 deletions

View File

@ -85,6 +85,12 @@ QPixmap QAbstractFileIconEngine::pixmap(const QSize &size, QIcon::Mode mode,
return result;
}
QPixmap QAbstractFileIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
{
Q_UNUSED(scale); // (size is pre-multiplied by scale)
return pixmap(size, mode, state);
}
QSize QAbstractFileIconEngine::actualSize(const QSize &size, QIcon::Mode mode,
QIcon::State state)
{

View File

@ -64,6 +64,7 @@ public:
: QPixmapIconEngine(), m_fileInfo(info), m_options(opts) {}
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State) override;
QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State, qreal scale) override;
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
QFileInfo fileInfo() const { return m_fileInfo; }