summaryrefslogtreecommitdiffstats
path: root/application/VersionProxyModel.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-12-09 01:30:23 +0100
committerPetr Mrázek <peterix@gmail.com>2017-12-09 01:30:23 +0100
commitef2cbe16e611da68f3cb529f87f4ecb3038af161 (patch)
tree7e9c6f9ab45ae90891e64cc245547c4b8cb79b66 /application/VersionProxyModel.cpp
parent57accb1cbb4a2deee050ded9f541faeacfbcc787 (diff)
downloadMultiMC-ef2cbe16e611da68f3cb529f87f4ecb3038af161.tar
MultiMC-ef2cbe16e611da68f3cb529f87f4ecb3038af161.tar.gz
MultiMC-ef2cbe16e611da68f3cb529f87f4ecb3038af161.tar.lz
MultiMC-ef2cbe16e611da68f3cb529f87f4ecb3038af161.tar.xz
MultiMC-ef2cbe16e611da68f3cb529f87f4ecb3038af161.zip
NOISSUE when there is a version added already, preselect it in the version select dialog
Diffstat (limited to 'application/VersionProxyModel.cpp')
-rw-r--r--application/VersionProxyModel.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/application/VersionProxyModel.cpp b/application/VersionProxyModel.cpp
index 96bdc9ab..0dbc4ef6 100644
--- a/application/VersionProxyModel.cpp
+++ b/application/VersionProxyModel.cpp
@@ -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();