Commit e9f3a33f authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Nate Graham
Browse files

SourcesPage: Address how we show the checked state

Do not use data() as it won't refresh as the model changes, we never
actually set the checked property anyway. Just call set and let the
checked property be updated by the model.

Alternatively we had 2 actors updating the value and it didn't work

BUG: 406295

(cherry picked from commit 4c7c4036)
parent 2a659ba2
...@@ -208,7 +208,7 @@ DiscoverPage { ...@@ -208,7 +208,7 @@ DiscoverPage {
id: enabledBox id: enabledBox
readonly property variant idx: sourcesView.model.index(index, 0) readonly property variant idx: sourcesView.model.index(index, 0)
readonly property variant modelChecked:, Qt.CheckStateRole) readonly property variant modelChecked: model.checkState
checked: modelChecked !== Qt.Unchecked checked: modelChecked !== Qt.Unchecked
enabled: sourcesView.model.flags(idx) & Qt.ItemIsUserCheckable enabled: sourcesView.model.flags(idx) & Qt.ItemIsUserCheckable
onClicked: { onClicked: {
...@@ -34,6 +34,7 @@ QHash<int, QByteArray> SourcesModel::roleNames() const ...@@ -34,6 +34,7 @@ QHash<int, QByteArray> SourcesModel::roleNames() const
roles.insert(AbstractSourcesBackend::IdRole, "sourceId"); roles.insert(AbstractSourcesBackend::IdRole, "sourceId");
roles.insert(Qt::DisplayRole, "display"); roles.insert(Qt::DisplayRole, "display");
roles.insert(Qt::ToolTipRole, "toolTip"); roles.insert(Qt::ToolTipRole, "toolTip");
roles.insert(Qt::CheckStateRole, "checkState");
roles.insert(SourceNameRole, "sourceName"); roles.insert(SourceNameRole, "sourceName");
roles.insert(SourcesBackend, "sourcesBackend"); roles.insert(SourcesBackend, "sourcesBackend");
roles.insert(ResourcesBackend, "resourcesBackend"); roles.insert(ResourcesBackend, "resourcesBackend");
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