Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Akonadi
Commits
8beee8e1
Commit
8beee8e1
authored
Jun 06, 2021
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/core/models/agenttypemodel.cpp
View file @
8beee8e1
...
...
@@ -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
())
{
...
...
src/core/models/agenttypemodel.h
View file @
8beee8e1
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment