added Image column size hint

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-10-20 19:08:56 +03:00
parent 7b62d14683
commit 5d926582c7
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
3 changed files with 16 additions and 12 deletions

View File

@ -127,21 +127,15 @@ QVariant ModFolderModel::data(const QModelIndex& index, int role) const
if (column == NAME_COLUMN && (at(row)->isSymLinkUnder(instDirPath()) || at(row)->isMoreThanOneHardLink()))
return APPLICATION->getThemedIcon("status-yellow");
if (column == ImageColumn) {
QSize size(32, 32);
auto icon = at(row)->icon(size, Qt::AspectRatioMode::KeepAspectRatioByExpanding);
if (icon.isNull()) {
QPixmap transparent_image(size);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
transparent_image.fill(QColorConstants::Transparent);
#else
transparent_image.fill(QColor(0, 0, 0, 0));
#endif
return transparent_image;
}
return icon;
return at(row)->icon({ 32, 32 }, Qt::AspectRatioMode::KeepAspectRatioByExpanding);
}
return {};
}
case Qt::SizeHintRole:
if (column == ImageColumn) {
return QSize(32, 32);
}
return {};
case Qt::CheckStateRole:
switch (column) {
case ActiveColumn:

View File

@ -117,6 +117,11 @@ QVariant ResourcePackFolderModel::data(const QModelIndex& index, int role) const
}
return m_resources[row]->internal_id();
}
case Qt::SizeHintRole:
if (column == ImageColumn) {
return QSize(32, 32);
}
return {};
case Qt::CheckStateRole:
switch (column) {
case ActiveColumn:

View File

@ -104,6 +104,11 @@ QVariant TexturePackFolderModel::data(const QModelIndex& index, int role) const
}
return {};
}
case Qt::SizeHintRole:
if (column == ImageColumn) {
return QSize(32, 32);
}
return {};
case Qt::CheckStateRole:
if (column == ActiveColumn) {
return m_resources[row]->enabled() ? Qt::Checked : Qt::Unchecked;