forked from qt-creator/qt-creator
Wizards: scale smaller icons if necessary
Change-Id: I26b51668b1f2d1be1b96e43bbc42f49d39249e83 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -91,6 +91,21 @@ public:
|
||||
|
||||
return true;
|
||||
}
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
|
||||
{
|
||||
if (role == Qt::DecorationRole) {
|
||||
// scale too small icons to have one size for all
|
||||
QIcon icon = qvariant_cast<QIcon>(QSortFilterProxyModel::data(index, role));
|
||||
if (!icon.isNull()) {
|
||||
QPixmap pixmap(icon.pixmap(ICON_SIZE, ICON_SIZE));
|
||||
if (pixmap.size() != QSize(ICON_SIZE, ICON_SIZE))
|
||||
return pixmap.scaled(ICON_SIZE, ICON_SIZE, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
}
|
||||
|
||||
return QSortFilterProxyModel::data(index, role);
|
||||
}
|
||||
|
||||
private:
|
||||
Core::Id m_platform;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user