From f682f82db5d8ba514e927c9d7e88107348d5c32a Mon Sep 17 00:00:00 2001 From: Tannin Date: Fri, 29 Mar 2013 10:25:38 +0100 Subject: some improvements to the grouped modlist views --- src/modlist.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/modlist.cpp') diff --git a/src/modlist.cpp b/src/modlist.cpp index 9b99b488..06f468b1 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -197,7 +197,21 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const return QVariant(Qt::AlignCenter | Qt::AlignVCenter); } } else if (role == Qt::UserRole) { - return modInfo->getNexusID(); + if (column == COL_CATEGORY) { + QVariantList categoryNames; + std::set categories = modInfo->getCategories(); + CategoryFactory &categoryFactory = CategoryFactory::instance(); + for (auto iter = categories.begin(); iter != categories.end(); ++iter) { + categoryNames.append(categoryFactory.getCategoryName(categoryFactory.getCategoryIndex(*iter))); + } + if (categoryNames.count() != 0) { + return categoryNames; + } else { + return QVariant(); + } + } else { + return modInfo->getNexusID(); + } } else if (role == Qt::UserRole + 1) { return modIndex; } else if (role == Qt::FontRole) { @@ -590,6 +604,13 @@ QModelIndex ModList::parent(const QModelIndex&) const return QModelIndex(); } +QMap ModList::itemData(const QModelIndex &index) const +{ + QMap result = QAbstractItemModel::itemData(index); + result[Qt::UserRole] = data(index, Qt::UserRole); + return result; +} + QString ModList::getColumnName(int column) { -- cgit v1.3.1