Commit 8beee8e1 authored by Carl Schwan's avatar Carl Schwan 🚴
Browse files

Add roleNames to AgentTypeModel for easier interfacing with QML

parent 2e2e8b1b
Pipeline #64526 passed with stage
in 11 minutes and 18 seconds
......@@ -72,6 +72,17 @@ int AgentTypeModel::rowCount(const QModelIndex & /*parent*/) const
return d->mTypes.count();
}
QHash<int, QByteArray> AgentTypeModel::roleNames() const
{
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
roles.insert(TypeRole, QByteArrayLiteral("type"));
roles.insert(IdentifierRole, QByteArrayLiteral("identifier"));
roles.insert(DescriptionRole, QByteArrayLiteral("description"));
roles.insert(MimeTypesRole, QByteArrayLiteral("mimeTypes"));
roles.insert(CapabilitiesRole, QByteArrayLiteral("capabilities"));
return roles;
}
QVariant AgentTypeModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid()) {
......
......@@ -66,6 +66,7 @@ public:
Q_REQUIRED_RESULT QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
Q_REQUIRED_RESULT QModelIndex parent(const QModelIndex &index) const override;
Q_REQUIRED_RESULT Qt::ItemFlags flags(const QModelIndex &index) const override;
Q_REQUIRED_RESULT QHash<int, QByteArray> roleNames() const override;
private:
/// @cond PRIVATE
......
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