Fix VersionProxyModel.cpp

Signed-off-by: PandaNinjas <admin@malwarefight.wip.la>
This commit is contained in:
PandaNinjas 2023-07-04 17:19:08 -04:00 committed by GitHub
parent 4509fde410
commit 817ecf8225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -191,36 +191,21 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
} }
} }
case Qt::ToolTipRole: { case Qt::ToolTipRole:
{
if (column == Name && hasRecommended) { if (column == Name && hasRecommended) {
auto recommendedValue = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole); auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole);
if(recommendedValue.toBool()) { if (value.toBool()) {
return tr("Recommended"); return tr("Recommended");
} } else if(hasLatest) {
else if(hasLatest) { auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
auto latestValue = sourceModel()->data(parentIndex, BaseVersionList::LatestRole); if(value.toBool()) {
if(latestValue.toBool()) return tr("Latest");
{
auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole);
if(value.toBool())
{
return tr("Recommended");
}
else if(hasLatest)
{
auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
if(value.toBool())
{
return tr("Latest");
}
}
} }
} }
else if(index.row() == 0) { } else {
return tr("Latest"); return sourceModel()->data(parentIndex, BaseVersionList::VersionIdRole);
}
} }
return sourceModel()->data(parentIndex, BaseVersionList::VersionIdRole);
} }
case Qt::DecorationRole: case Qt::DecorationRole:
{ {
@ -255,20 +240,10 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const
return pixmap; return pixmap;
} }
} }
else if(index.row() == 0) { default:
return APPLICATION->getThemedIcon("bug"); {
return QVariant();
} }
QPixmap pixmap;
QPixmapCache::find("placeholder", &pixmap);
if(!pixmap) {
QPixmap px(16,16);
px.fill(Qt::transparent);
QPixmapCache::insert("placeholder", px);
return px;
}
return pixmap;
} else {
return QVariant();
} }
} }
default: default: