diff options
author | Eike Ziller <eike.ziller@qt.io> | 2023-08-28 12:30:03 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2023-08-28 14:22:29 +0000 |
commit | db49f3af71876992104ff4022a1b82efd3560542 (patch) | |
tree | a718240f60de26e13a62b9dd1a8b86f321d14085 /src/plugins/qtsupport/exampleslistmodel.cpp | |
parent | edee2afe11b18a3a8be3a944044e20c1db09669f (diff) |
QtSupport: Avoid an unneeded update of examples
When starting Qt Creator with the examples page visible.
Avoid emitting the selectedExampleSetChanged signal twice in a row, but
guarantee it once.
Change-Id: I6a2c4032a53d531a8e7d2ac612e88d4b4bdbb6b5
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'src/plugins/qtsupport/exampleslistmodel.cpp')
-rw-r--r-- | src/plugins/qtsupport/exampleslistmodel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index dc71d42cbb..0def03b90b 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -450,8 +450,8 @@ void ExampleSetModel::updateQtVersionList() // Make sure to select something even if the above failed if (currentIndex < 0 && rowCount() > 0) currentIndex = 0; // simply select first - selectExampleSet(currentIndex); - emit selectedExampleSetChanged(currentIndex); + if (!selectExampleSet(currentIndex)) + emit selectedExampleSetChanged(currentIndex); // ensure running updateExamples in any case } QtVersion *ExampleSetModel::findHighestQtVersion(const QtVersions &versions) const @@ -534,7 +534,7 @@ QStringList ExampleSetModel::exampleSources(QString *examplesInstallPath, return sources; } -void ExampleSetModel::selectExampleSet(int index) +bool ExampleSetModel::selectExampleSet(int index) { if (index != m_selectedExampleSetIndex) { m_selectedExampleSetIndex = index; @@ -546,7 +546,9 @@ void ExampleSetModel::selectExampleSet(int index) m_selectedQtTypes.clear(); } emit selectedExampleSetChanged(m_selectedExampleSetIndex); + return true; } + return false; } void ExampleSetModel::qtVersionManagerLoaded() |