diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-01 12:24:57 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 15:38:18 +0100 |
| commit | e02ba3b26d30ffb5010394992c69e94b287eacd7 (patch) | |
| tree | 7b24f7a0654cf19246bf4e2f0e1afaedc86042de /src/modconflicticondelegate.cpp | |
| parent | 73b4a590ca4403b0c07590f426f9b962c4c0ec6a (diff) | |
Some cleaning. Avoid using Qt::UserRole.
Diffstat (limited to 'src/modconflicticondelegate.cpp')
| -rw-r--r-- | src/modconflicticondelegate.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modconflicticondelegate.cpp b/src/modconflicticondelegate.cpp index 2ccf3363..9680aca3 100644 --- a/src/modconflicticondelegate.cpp +++ b/src/modconflicticondelegate.cpp @@ -1,4 +1,5 @@ #include "modconflicticondelegate.h" +#include "modlist.h" #include <log.h> #include <QList> @@ -96,7 +97,7 @@ QList<QString> ModConflictIconDelegate::getIconsForFlags( QList<QString> ModConflictIconDelegate::getIcons(const QModelIndex &index) const { - QVariant modid = index.data(Qt::UserRole + 1); + QVariant modid = index.data(ModList::IndexRole); if (modid.isValid()) { ModInfo::Ptr info = ModInfo::getByIndex(modid.toInt()); @@ -127,7 +128,7 @@ QString ModConflictIconDelegate::getFlagIcon(ModInfo::EConflictFlag flag) size_t ModConflictIconDelegate::getNumIcons(const QModelIndex &index) const { - unsigned int modIdx = index.data(Qt::UserRole + 1).toInt(); + unsigned int modIdx = index.data(ModList::IndexRole).toInt(); if (modIdx < ModInfo::getNumMods()) { ModInfo::Ptr info = ModInfo::getByIndex(modIdx); std::vector<ModInfo::EConflictFlag> flags = info->getConflictFlags(); @@ -145,7 +146,7 @@ size_t ModConflictIconDelegate::getNumIcons(const QModelIndex &index) const QSize ModConflictIconDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &modelIndex) const { size_t count = getNumIcons(modelIndex); - unsigned int index = modelIndex.data(Qt::UserRole + 1).toInt(); + unsigned int index = modelIndex.data(ModList::IndexRole).toInt(); QSize result; if (index < ModInfo::getNumMods()) { result = QSize(static_cast<int>(count) * 40, 20); |
