summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-11-10 12:31:08 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-11-11 09:39:19 +0200
commit2f2a7c52ebf172cf1462121f8b35d016dde2adde (patch)
tree88963ffbdd8ce643f8e11750e58095019765df3e
parent785007b6bc1fed0a74dabcd377c6514fcbc5e87d (diff)
Fix enabled navigation buttons while metadata fetch is still in progress
This allowed the user to erroneously proceed forward with the installation even when the metadata fetch for newly selected categories was not finished. Task-number: QTIFW-2849 Change-Id: If552b85b3aa8c3ee9246328f12a72fbdaba8b797 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
-rw-r--r--src/libs/installer/componentmodel.cpp8
-rw-r--r--src/libs/installer/componentmodel.h1
-rw-r--r--src/libs/installer/componentselectionpage_p.cpp11
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.