summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/installer/component.cpp5
-rw-r--r--src/libs/installer/component.h1
-rw-r--r--src/libs/installer/componentmodel.cpp12
-rw-r--r--src/libs/installer/componentmodel.h1
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();