summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2017-05-19 08:10:22 +0300
committerKatja Marttila <katja.marttila@qt.io>2017-05-22 09:09:13 +0000
commiteef1ebfb60bc4fe24790e5d9ab87bc00722030ae (patch)
tree2c73bca88d113a32b0794f80ad2b4355a1f5dc6b
parentc0700c1a780542ed81a188f2bf6c8a04b1d1a4fa (diff)
Change 'Checkable' element behavior
Althogh 'Checkable' value is set to package, that can contain packages to install. Enabling the install of components using 'Checkable' value. Change-Id: I05d65fe2da65644872d46bdef3accd5e3f16ad31 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
-rw-r--r--doc/installerfw.qdoc3
-rw-r--r--examples/doc/hidecheckbox.qdoc3
-rw-r--r--examples/hidecheckbox/README2
-rw-r--r--src/libs/installer/componentmodel.cpp8
-rw-r--r--tests/auto/installer/componentmodel/tst_componentmodel.cpp33
5 files changed, 27 insertions, 22 deletions
diff --git a/doc/installerfw.qdoc b/doc/installerfw.qdoc
index f387c1544..cc15efb36 100644
--- a/doc/installerfw.qdoc
+++ b/doc/installerfw.qdoc
@@ -691,8 +691,7 @@
\li Checkable
\li Set to \c false if you want to hide the checkbox for an item. This is useful
when only a few subcomponents should be selected instead of all. Optional.
- \note The content from the data directory is not installed if \c Checkable
- is \c false unless \c ForcedInstallation is set to \c true.
+
\endtable
\section2 Component Dependencies
diff --git a/examples/doc/hidecheckbox.qdoc b/examples/doc/hidecheckbox.qdoc
index cdcc506c1..81f5a5a10 100644
--- a/examples/doc/hidecheckbox.qdoc
+++ b/examples/doc/hidecheckbox.qdoc
@@ -51,8 +51,7 @@
component directory: componentF, componentF.subcomponent1, and
componentF.subcomponent1.subcomponent1. We also specify the component name and description
in each of them. The top level item, componentF, has \c <Checkable> set to \c false,
- so it cannot be selected. It also does not install the package, for that
- you will need to set \c <ForceInstallation> to \c true.
+ so it cannot be selected.
\quotefile hidecheckbox/packages/componentF/meta/package.xml
diff --git a/examples/hidecheckbox/README b/examples/hidecheckbox/README
index 22619bf9c..bf6259aa2 100644
--- a/examples/hidecheckbox/README
+++ b/examples/hidecheckbox/README
@@ -1,4 +1,4 @@
-Shows how to disable top level item, allowing the installation of child items.
+Shows how to hide top level item's checkbox.
Generate installer with
diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp
index 88465b85b..e0cc3fcd8 100644
--- a/src/libs/installer/componentmodel.cpp
+++ b/src/libs/installer/componentmodel.cpp
@@ -575,7 +575,13 @@ QSet<QModelIndex> ComponentModel::updateCheckedState(const ComponentSet &compone
// we can start in descending order to check node and tri-state nodes properly
for (int i = sortedNodes.count(); i > 0; i--) {
Component * const node = sortedNodes.at(i - 1);
- if (!node->isCheckable() || !node->isEnabled() || !node->autoDependencies().isEmpty())
+
+ bool checkable = true;
+ if (node->value(scCheckable, scTrue).toLower() == scFalse) {
+ checkable = false;
+ }
+
+ if ((!node->isCheckable() && checkable) || !node->isEnabled() || !node->autoDependencies().isEmpty())
continue;
Qt::CheckState newState = state;
diff --git a/tests/auto/installer/componentmodel/tst_componentmodel.cpp b/tests/auto/installer/componentmodel/tst_componentmodel.cpp
index 5d86103a9..d5cae916c 100644
--- a/tests/auto/installer/componentmodel/tst_componentmodel.cpp
+++ b/tests/auto/installer/componentmodel/tst_componentmodel.cpp
@@ -199,11 +199,12 @@ private slots:
model.setRootComponents(rootComponents);
testDefaultInheritedModelBehavior(&model, 1);
- // select all possible components. As one is uncheckable should result in partial check.
+ // select all possible components.
+ // Also uncheckable is checked as that is only 'visually' uncheckedable.
model.setCheckedState(ComponentModel::AllChecked);
- QCOMPARE(model.checkedState(), ComponentModel::PartiallyChecked);
- testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked,
- QStringList(), m_uncheckable);
+ QCOMPARE(model.checkedState(), ComponentModel::AllChecked);
+ testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked + m_uncheckable,
+ QStringList(), QStringList());
// deselect all possible components
// as the first root is a forced install, should result in partially checked state
@@ -234,12 +235,12 @@ private slots:
model.setRootComponents(rootComponents);
testDefaultInheritedModelBehavior(&model, 1);
- // select all possible components. As one is uncheckable should result to partially check
+ // select all possible components.
model.setCheckedState(ComponentModel::AllChecked);
- QCOMPARE(model.checkedState(), ComponentModel::PartiallyChecked);
- testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked
+ QCOMPARE(model.checkedState(), ComponentModel::AllChecked);
+ testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked + m_uncheckable
+ QStringList(vendorSecondProductVirtual) << vendorThirdProductVirtual, QStringList(),
- m_uncheckable);
+ QStringList());
// deselect all possible components
// as the first root is a forced install, should result in partially checked state
@@ -272,11 +273,11 @@ private slots:
model.setRootComponents(rootComponents);
testDefaultInheritedModelBehavior(&model, 1);
- // select all possible components. As one is uncheckable should result to partially check
+ // select all possible components.
model.setCheckedState(ComponentModel::AllChecked);
- QCOMPARE(model.checkedState(), ComponentModel::PartiallyChecked);
- testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked,
- QStringList(), m_uncheckable);
+ QCOMPARE(model.checkedState(), ComponentModel::AllChecked);
+ testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked+ m_uncheckable,
+ QStringList(), QStringList());
// deselect all possible components
model.setCheckedState(ComponentModel::AllUnchecked);
@@ -307,12 +308,12 @@ private slots:
model.setRootComponents(rootComponents);
testDefaultInheritedModelBehavior(&model, 1);
- // select all possible components. As one is uncheckable should result to partially check
+ // select all possible components.
model.setCheckedState(ComponentModel::AllChecked);
- QCOMPARE(model.checkedState(), ComponentModel::PartiallyChecked);
- testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked
+ QCOMPARE(model.checkedState(), ComponentModel::AllChecked);
+ testModelState(&model, m_defaultChecked + m_defaultPartially + m_defaultUnchecked +m_uncheckable
+ QStringList(vendorSecondProductVirtual) << vendorThirdProductVirtual, QStringList(),
- m_uncheckable);
+ QStringList());
// deselect all possible components
model.setCheckedState(ComponentModel::AllUnchecked);