diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 7bfb5f18853..01a8b1e0a2c 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -111,7 +111,7 @@ ExampleSetModel::ExampleSetModel() } } -void ExampleSetModel::recreateModel() +void ExampleSetModel::recreateModel(const QList &qtVersions) { beginResetModel(); clear(); @@ -129,7 +129,7 @@ void ExampleSetModel::recreateModel() extraManifestDirs.insert(set.manifestPath); } - foreach (BaseQtVersion *version, QtVersionManager::versions()) { + foreach (BaseQtVersion *version, qtVersions) { // sanitize away qt versions that have already been added through extra sets if (extraManifestDirs.contains(version->documentationPath())) { if (debugExamples()) { @@ -484,7 +484,7 @@ void ExampleSetModel::updateQtVersionList() if (defaultVersion && versions.contains(defaultVersion)) versions.move(versions.indexOf(defaultVersion), 0); - recreateModel(); + recreateModel(versions); int currentIndex = m_selectedExampleSetIndex; if (currentIndex < 0) // reset from settings @@ -494,7 +494,7 @@ void ExampleSetModel::updateQtVersionList() if (currentType == ExampleSetModel::InvalidExampleSet) { // select examples corresponding to 'highest' Qt version - BaseQtVersion *highestQt = findHighestQtVersion(); + BaseQtVersion *highestQt = findHighestQtVersion(versions); currentIndex = indexForQtVersion(highestQt); } else if (currentType == ExampleSetModel::QtExampleSet) { // try to select the previously selected Qt version, or @@ -502,17 +502,16 @@ void ExampleSetModel::updateQtVersionList() int currentQtId = getQtId(currentIndex); BaseQtVersion *newQtVersion = QtVersionManager::version(currentQtId); if (!newQtVersion) - newQtVersion = findHighestQtVersion(); + newQtVersion = findHighestQtVersion(versions); currentIndex = indexForQtVersion(newQtVersion); } // nothing to do for extra example sets selectExampleSet(currentIndex); emit selectedExampleSetChanged(currentIndex); } -BaseQtVersion *ExampleSetModel::findHighestQtVersion() const +BaseQtVersion *ExampleSetModel::findHighestQtVersion(const QList &versions) const { BaseQtVersion *newVersion = nullptr; - const QList versions = QtVersionManager::versions(); for (BaseQtVersion *version : versions) { if (!newVersion) { newVersion = version; diff --git a/src/plugins/qtsupport/exampleslistmodel.h b/src/plugins/qtsupport/exampleslistmodel.h index e98c5844bb9..e6d1a252c99 100644 --- a/src/plugins/qtsupport/exampleslistmodel.h +++ b/src/plugins/qtsupport/exampleslistmodel.h @@ -74,10 +74,10 @@ private: int getQtId(int index) const; int getExtraExampleSetIndex(int index) const; - BaseQtVersion *findHighestQtVersion() const; + BaseQtVersion *findHighestQtVersion(const QList &versions) const; int indexForQtVersion(BaseQtVersion *qtVersion) const; - void recreateModel(); + void recreateModel(const QList &qtVersions); void updateQtVersionList(); void qtVersionManagerLoaded();