From aea51a08763d81ce82326b2b875ace8a0039fb1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 28 Apr 2015 09:01:37 +0200 Subject: GH-328 overhaul all relevant version lists --- logic/BaseVersionList.cpp | 57 +++++++++-------------------------------------- 1 file changed, 10 insertions(+), 47 deletions(-) (limited to 'logic/BaseVersionList.cpp') diff --git a/logic/BaseVersionList.cpp b/logic/BaseVersionList.cpp index 7752b14c..fe17a905 100644 --- a/logic/BaseVersionList.cpp +++ b/logic/BaseVersionList.cpp @@ -50,63 +50,26 @@ QVariant BaseVersionList::data(const QModelIndex &index, int role) const switch (role) { - case Qt::DisplayRole: - switch (index.column()) - { - case NameColumn: - return version->name(); - - case TypeColumn: - return version->typeString(); + case VersionPointerRole: + return qVariantFromValue(version); - default: - return QVariant(); - } + case VersionRole: + return version->name(); - case Qt::ToolTipRole: + case VersionIdRole: return version->descriptor(); - case VersionPointerRole: - return qVariantFromValue(version); + case TypeRole: + return version->typeString(); default: return QVariant(); } } -QVariant BaseVersionList::headerData(int section, Qt::Orientation orientation, int role) const +BaseVersionList::RoleList BaseVersionList::providesRoles() { - switch (role) - { - case Qt::DisplayRole: - switch (section) - { - case NameColumn: - return tr("Name"); - - case TypeColumn: - return tr("Type"); - - default: - return QVariant(); - } - - case Qt::ToolTipRole: - switch (section) - { - case NameColumn: - return tr("The name of the version."); - - case TypeColumn: - return tr("The version's type."); - - default: - return QVariant(); - } - - default: - return QVariant(); - } + return {VersionPointerRole, VersionRole, VersionIdRole, TypeRole}; } int BaseVersionList::rowCount(const QModelIndex &parent) const @@ -117,5 +80,5 @@ int BaseVersionList::rowCount(const QModelIndex &parent) const int BaseVersionList::columnCount(const QModelIndex &parent) const { - return 2; + return 1; } -- cgit v1.2.3