┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/servicemodel.cpp
diff options
context:
space:
mode:
authorNicolas Fella <[email protected]>2023-07-08 22:34:08 +0200
committerNicolas Fella <[email protected]>2023-07-09 00:11:23 +0200
commit31a8866ac0aa3966cd77e87e14974f0a6a66f940 (patch)
tree85df580684c1467808d02b9b182091e4b453f907 /src/settings/servicemodel.cpp
parent88ebcd42db91466ac32fa4a43482ee96e599bf7c (diff)
Fix usage of Qt::CheckStateRole in preview model
Qt::CheckStateRole expects an enum, not a bool Also set the flag that the item it user checkable, otherwise it can't be changed BUG: 471999
Diffstat (limited to 'src/settings/servicemodel.cpp')
-rw-r--r--src/settings/servicemodel.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/settings/servicemodel.cpp b/src/settings/servicemodel.cpp
index 07a804e33..5333e88b9 100644
--- a/src/settings/servicemodel.cpp
+++ b/src/settings/servicemodel.cpp
@@ -29,7 +29,7 @@ bool ServiceModel::insertRows(int row, int count, const QModelIndex &parent)
beginInsertRows(parent, row, row + count - 1);
for (int i = 0; i < count; ++i) {
ServiceItem item;
- item.checked = false;
+ item.checked = Qt::Unchecked;
item.configurable = false;
m_items.insert(row, item);
}
@@ -47,7 +47,7 @@ bool ServiceModel::setData(const QModelIndex &index, const QVariant &value, int
switch (role) {
case Qt::CheckStateRole:
- m_items[row].checked = value.toBool();
+ m_items[row].checked = value.value<Qt::CheckState>();
break;
case ConfigurableRole:
m_items[row].configurable = value.toBool();
@@ -105,4 +105,9 @@ void ServiceModel::clear()
endRemoveRows();
}
+Qt::ItemFlags ServiceModel::flags(const QModelIndex &index) const
+{
+ return QAbstractListModel::flags(index) | Qt::ItemIsUserCheckable;
+}
+
#include "moc_servicemodel.cpp"