fix: rendering artists from cartographer

Thanks @g-fb. Resolves #32.
This commit is contained in:
Joshua Strobl 2024-10-28 19:20:35 +02:00
parent d95cfa3f36
commit 8ff470989b
6 changed files with 14 additions and 12 deletions

View file

@ -1,5 +1,7 @@
#include "structs.hpp"
KotoArtistModel::KotoArtistModel(const QList<KotoArtist*>& artists, QObject* parent) : QAbstractListModel(parent), m_artists(artists) {}
KotoArtistModel::~KotoArtistModel() {
this->beginResetModel();
this->m_artists.clear();
@ -21,7 +23,9 @@ QVariant KotoArtistModel::data(const QModelIndex& index, int role) const {
if (index.row() >= this->m_artists.size()) { return {}; }
if (role == KotoArtistRoles::NameRole) {
if (role == Qt::DisplayRole) {
return this->m_artists.at(index.row())->getName();
} else if (role == KotoArtistRoles::NameRole) {
return this->m_artists.at(index.row())->getName();
} else if (role == KotoArtistRoles::PathRole) {
return this->m_artists.at(index.row())->getPath();