forked from qt-creator/qt-creator
Examples: Make sure to select some example set if available
In the case of the bug report, there is no previously selected index, and no valid Qt version, so setting the index to the highest Qt version doesn't result in anything. Make sure to select something in the dropdown, if we have any item there at all, even if our heuristics don't come up with an optimal selection. Fixes: QTCREATORBUG-26791 Change-Id: I2327594f0fd36e312aa71d1990e8ccab4a488367 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -555,6 +555,9 @@ void ExampleSetModel::updateQtVersionList()
|
||||
newQtVersion = findHighestQtVersion(versions);
|
||||
currentIndex = indexForQtVersion(newQtVersion);
|
||||
} // nothing to do for extra example sets
|
||||
// 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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user