NOISSUE Add world icons and world icon reset button

This commit is contained in:
Petr Mrázek
2020-08-22 01:34:55 +02:00
parent c6c9feb3a2
commit 8a0027c73a
7 changed files with 108 additions and 2 deletions

View File

@@ -136,6 +136,19 @@ bool WorldList::deleteWorlds(int first, int last)
return true;
}
bool WorldList::resetIcon(int row)
{
if (row >= worlds.size() || row < 0)
return false;
World &m = worlds[row];
if(m.resetIcon()) {
emit dataChanged(index(row), index(row), {WorldList::IconFileRole});
return true;
}
return false;
}
int WorldList::columnCount(const QModelIndex &parent) const
{
return 3;
@@ -195,6 +208,10 @@ QVariant WorldList::data(const QModelIndex &index, int role) const
{
return world.lastPlayed();
}
case IconFileRole:
{
return world.iconFile();
}
default:
return QVariant();
}