diff options
author | kh1 <karsten.heimrich@digia.com> | 2014-04-11 16:27:17 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2014-05-16 10:29:39 +0200 |
commit | ffa1ceb12086bf20d70acf27501cd91e3e2c544a (patch) | |
tree | 17fc97f6a7cc9d5e29fc602cf5a3ddc193459324 /src | |
parent | be321571a79467292828e37c5b77c1cc5b5bc8dc (diff) |
Fix component still visible after it's set "Virtual".
Task-number: QTIFW-466
Change-Id: I6a5e4d0d20703e2d4e867bb2619c82dac0b8a64c
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Niels Weber <niels.weber@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/component.cpp | 5 | ||||
-rw-r--r-- | src/libs/installer/component.h | 1 | ||||
-rw-r--r-- | src/libs/installer/componentmodel.cpp | 12 | ||||
-rw-r--r-- | src/libs/installer/componentmodel.h | 1 |
4 files changed, 19 insertions, 0 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 1b37cc12c..91b22563c 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -1395,6 +1395,11 @@ void Component::updateModelData(const QString &key, const QString &data) if (key == scVirtual) { if (data.toLower() == scTrue) setData(d->m_core->virtualComponentsFont(), Qt::FontRole); + if (Component *const parent = parentComponent()) { + parent->removeComponent(this); + parent->appendComponent(this); + } + emit virtualStateChanged(); } if (key == scRemoteDisplayVersion) diff --git a/src/libs/installer/component.h b/src/libs/installer/component.h index eefe41ebb..3ff814a30 100644 --- a/src/libs/installer/component.h +++ b/src/libs/installer/component.h @@ -224,6 +224,7 @@ public Q_SLOTS: Q_SIGNALS: void loaded(); + void virtualStateChanged(); void selectedChanged(bool selected); void valueChanged(const QString &key, const QString &value); diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp index 080e84d85..14be1e259 100644 --- a/src/libs/installer/componentmodel.cpp +++ b/src/libs/installer/componentmodel.cpp @@ -338,6 +338,7 @@ void ComponentModel::setRootComponents(QList<QInstaller::Component*> rootCompone // show virtual components only in case we run as updater or if the core engine is set to show them const bool showVirtuals = m_core->isUpdater() || m_core->virtualComponentsVisible(); foreach (Component *const component, rootComponents) { + connect(component, SIGNAL(virtualStateChanged()), this, SLOT(onVirtualStateChanged())); if ((!showVirtuals) && component->isVirtual()) continue; m_rootComponentList.append(component); @@ -396,6 +397,7 @@ void ComponentModel::slotModelReset() foreach (Component *const component, components) { if (component->checkState() == Qt::Checked) checked.insert(component); + connect(component, SIGNAL(virtualStateChanged()), this, SLOT(onVirtualStateChanged())); } updateCheckedState(checked, Qt::Checked); @@ -409,6 +411,16 @@ void ComponentModel::slotModelReset() updateAndEmitModelState(); // update the internal state } +void ComponentModel::onVirtualStateChanged() +{ + // If the virtual state of a component changes, force a reset of the component model. + // Make sure to pass the right components list depending on the package manager run mode. + if (m_core->isUpdater()) + setRootComponents(m_core->updaterComponents()); + else + setRootComponents(m_core->rootComponents()); +} + // -- private diff --git a/src/libs/installer/componentmodel.h b/src/libs/installer/componentmodel.h index a691906a4..0931e7ebc 100644 --- a/src/libs/installer/componentmodel.h +++ b/src/libs/installer/componentmodel.h @@ -108,6 +108,7 @@ Q_SIGNALS: private Q_SLOTS: void slotModelReset(); + void onVirtualStateChanged(); private: void updateAndEmitModelState(); |