NOISSUE when there is a version added already, preselect it in the version select dialog

This commit is contained in:
Petr Mrázek
2017-12-09 01:30:23 +01:00
parent 57accb1cbb
commit ef2cbe16e6
7 changed files with 73 additions and 3 deletions

View File

@@ -369,6 +369,24 @@ QModelIndex VersionProxyModel::getRecommended() const
return index(recommended, 0);
}
QModelIndex VersionProxyModel::getVersion(const QString& version) const
{
int found = -1;
for (int i = 0; i < rowCount(); i++)
{
auto value = sourceModel()->data(mapToSource(index(i, 0)), BaseVersionList::VersionRole);
if (value.toString() == version)
{
found = i;
}
}
if(found == -1)
{
return QModelIndex();
}
return index(found, 0);
}
void VersionProxyModel::clearFilters()
{
m_filters.clear();