forked from qt-creator/qt-creator
CompilerExplorer: Fix display of selected library
Change-Id: I44085ef914930a16f14a2fc79e2941852dc2e4fb Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -189,10 +189,20 @@ void LibrarySelectionAspect::addToLayout(Layouting::LayoutItem &parent)
|
|||||||
QStringList libs;
|
QStringList libs;
|
||||||
for (int i = 0; i < m_model->rowCount(); i++) {
|
for (int i = 0; i < m_model->rowCount(); i++) {
|
||||||
QModelIndex idx = m_model->index(i, 0);
|
QModelIndex idx = m_model->index(i, 0);
|
||||||
if (idx.data(SelectedVersion).isValid()) {
|
if (idx.data(LibraryData).isValid() && idx.data(SelectedVersion).isValid()) {
|
||||||
libs.append(QString("%1 %2")
|
auto libData = idx.data(LibraryData).value<Api::Library>();
|
||||||
.arg(idx.data().toString())
|
auto id = idx.data(SelectedVersion).toString();
|
||||||
.arg(idx.data(SelectedVersion).toString()));
|
|
||||||
|
auto versionIt = std::find_if(libData.versions.begin(),
|
||||||
|
libData.versions.end(),
|
||||||
|
[id](const Api::Library::Version &v) {
|
||||||
|
return v.id == id;
|
||||||
|
});
|
||||||
|
const QString versionName = versionIt == libData.versions.end()
|
||||||
|
? id
|
||||||
|
: versionIt->version;
|
||||||
|
|
||||||
|
libs.append(QString("%1 %2").arg(libData.name).arg(versionName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (libs.empty())
|
if (libs.empty())
|
||||||
|
Reference in New Issue
Block a user