Commit a569b9c6 authored by Ivan Čukić's avatar Ivan Čukić 👁
Browse files

Define names for useful roles

Currently, the EntityTreeModel exposes only a few roles to QML.
This patch adds names to useful roles like collection URL, collection
ID, etc.
parent 3ac34d49
Pipeline #21827 failed with stage
in 14 minutes and 25 seconds
......@@ -131,11 +131,21 @@ void EntityTreeModel::clearAndReset()
QHash<int, QByteArray> EntityTreeModel::roleNames() const
{
QHash<int, QByteArray> names = QAbstractItemModel::roleNames();
names.insert(EntityTreeModel::UnreadCountRole, "unreadCount");
names.insert(EntityTreeModel::FetchStateRole, "fetchState");
names.insert(EntityTreeModel::ItemIdRole, "itemId");
return names;
return {
{ Qt::DecorationRole, "decoration" },
{ Qt::DisplayRole, "display" },
{ EntityTreeModel::ItemIdRole, "itemId" },
{ EntityTreeModel::CollectionIdRole, "collectionId" },
{ EntityTreeModel::UnreadCountRole, "unreadCount" },
// TODO: expose when states for reporting of fetching payload parts of items is changed
// { EntityTreeModel::FetchStateRole, "fetchState" },
{ EntityTreeModel::EntityUrlRole, "url" },
{ EntityTreeModel::RemoteIdRole, "remoteId" },
{ EntityTreeModel::IsPopulatedRole, "isPopulated" },
{ EntityTreeModel::CollectionRole, "collection" }
};
}
int EntityTreeModel::columnCount(const QModelIndex &parent) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment