diff options
-rw-r--r-- | src/libs/installer/componentmodel.cpp | 8 | ||||
-rw-r--r-- | src/libs/installer/componentmodel.h | 1 | ||||
-rw-r--r-- | src/libs/installer/componentselectionpage_p.cpp | 11 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp index e60ba92ae..8407e5f2d 100644 --- a/src/libs/installer/componentmodel.cpp +++ b/src/libs/installer/componentmodel.cpp @@ -47,6 +47,8 @@ namespace QInstaller { This enum value holds the checked state of the components available for installation. + \value Empty + The model does not contain any components. \value AllChecked All components are checked. \value AllUnchecked @@ -400,7 +402,7 @@ void ComponentModel::reset(QList<Component *> rootComponents) m_uncheckable.clear(); m_indexByNameCache.clear(); m_rootComponentList.clear(); - m_modelState = DefaultChecked; + m_modelState = !rootComponents.isEmpty() ? DefaultChecked : Empty; // Initialize these with an empty set for every possible state, cause we compare the hashes later in // updateAndEmitModelState(). The comparison than might lead to wrong results if one of the checked @@ -491,6 +493,10 @@ void ComponentModel::postModelReset() void ComponentModel::updateModelState() { + if (m_rootComponentList.isEmpty()) { + m_modelState = ComponentModel::Empty; + return; + } m_modelState = ComponentModel::DefaultChecked; if (m_initialCheckedState != m_currentCheckedState) m_modelState = ComponentModel::PartiallyChecked; diff --git a/src/libs/installer/componentmodel.h b/src/libs/installer/componentmodel.h index f9fbae47a..001753055 100644 --- a/src/libs/installer/componentmodel.h +++ b/src/libs/installer/componentmodel.h @@ -49,6 +49,7 @@ class INSTALLER_EXPORT ComponentModel : public QAbstractItemModel public: enum ModelStateFlag { + Empty = -0x01, AllChecked = 0x01, AllUnchecked = 0x02, DefaultChecked = 0x04, diff --git a/src/libs/installer/componentselectionpage_p.cpp b/src/libs/installer/componentselectionpage_p.cpp index 0dcdc2de9..42b9c2a86 100644 --- a/src/libs/installer/componentselectionpage_p.cpp +++ b/src/libs/installer/componentselectionpage_p.cpp @@ -455,6 +455,11 @@ void ComponentSelectionPagePrivate::updateWidgetVisibility(bool show) if (QAbstractButton *bspButton = q->gui()->button(QWizard::CustomButton2)) bspButton->setEnabled(!show); + if (show) { + q->gui()->button(QWizard::NextButton)->setEnabled(false); + q->gui()->button(QWizard::BackButton)->setEnabled(false); + } + // In macOS 10.12 the widgets are not hidden if those are not updated immediately #ifdef Q_OS_MACOS q->repaint(); @@ -537,6 +542,12 @@ void ComponentSelectionPagePrivate::selectDefault() void ComponentSelectionPagePrivate::onModelStateChanged(QInstaller::ComponentModel::ModelState state) { + if (state.testFlag(ComponentModel::Empty)) { + m_checkAll->setEnabled(false); + m_uncheckAll->setEnabled(false); + m_checkDefault->setEnabled(false); + return; + } q->setModified(state.testFlag(ComponentModel::DefaultChecked) == false); // If all components in the checked list are only checkable when run without forced // installation, set ComponentModel::AllUnchecked as well, as we cannot uncheck anything. |