┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/serviceitemdelegate.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/serviceitemdelegate.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/serviceitemdelegate.cpp')
-rw-r--r--src/settings/serviceitemdelegate.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/settings/serviceitemdelegate.cpp b/src/settings/serviceitemdelegate.cpp
index 97fafc631..929e699d8 100644
--- a/src/settings/serviceitemdelegate.cpp
+++ b/src/settings/serviceitemdelegate.cpp
@@ -74,7 +74,7 @@ void ServiceItemDelegate::updateItemWidgets(const QList<QWidget *> &widgets, con
if (!iconName.isEmpty()) {
checkBox->setIcon(QIcon::fromTheme(iconName));
}
- checkBox->setChecked(model->data(index, Qt::CheckStateRole).toBool());
+ checkBox->setChecked(model->data(index, Qt::CheckStateRole).value<Qt::CheckState>() == Qt::Checked);
const bool configurable = model->data(index, ServiceModel::ConfigurableRole).toBool();
@@ -98,7 +98,7 @@ void ServiceItemDelegate::updateItemWidgets(const QList<QWidget *> &widgets, con
void ServiceItemDelegate::slotCheckBoxClicked(bool checked)
{
QAbstractItemModel *model = const_cast<QAbstractItemModel *>(focusedIndex().model());
- model->setData(focusedIndex(), checked, Qt::CheckStateRole);
+ model->setData(focusedIndex(), checked ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
}
void ServiceItemDelegate::slotConfigureButtonClicked()