diff options
author | jkobus <jaroslaw.kobus@theqtcompany.com> | 2014-11-20 10:36:48 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@theqtcompany.com> | 2014-11-20 10:58:26 +0100 |
commit | 948888ea8384515d7c674bd036e9c5fae838ac9a (patch) | |
tree | 7ffb727a85df7ebd5b7a0576b47aa760cc0d962c /src/libs/installer/componentmodel.cpp | |
parent | 7aac98fdafdd7c33f4ce5356f3852513967849c7 (diff) |
Fix checkbox management in component tree
Qt 5.2 introduced a behavior change (QTBUG-40060)
which broke the checkbox management in component tree.
Whenever Qt wants to set PartiallyChecked state
for any node, we toggle the state instead.
Change-Id: I4d8c8300e52b886060395cda86b238a7c1619c3f
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Diffstat (limited to 'src/libs/installer/componentmodel.cpp')
-rw-r--r-- | src/libs/installer/componentmodel.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp index fae562516..a452829fd 100644 --- a/src/libs/installer/componentmodel.cpp +++ b/src/libs/installer/componentmodel.cpp @@ -194,7 +194,12 @@ bool ComponentModel::setData(const QModelIndex &index, const QVariant &value, in if (role == Qt::CheckStateRole) { ComponentSet nodes = component->childItems().toSet(); - QSet<QModelIndex> changed = updateCheckedState(nodes << component, Qt::CheckState(value.toInt())); + Qt::CheckState newValue = Qt::CheckState(value.toInt()); + if (newValue == Qt::PartiallyChecked) { + const Qt::CheckState oldValue = component->checkState(); + newValue = (oldValue == Qt::Checked) ? Qt::Unchecked : Qt::Checked; + } + QSet<QModelIndex> changed = updateCheckedState(nodes << component, newValue); foreach (const QModelIndex &index, changed) { emit dataChanged(index, index); emit checkStateChanged(index); |