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/modflagicondelegate.cpp | |
| parent | 73b4a590ca4403b0c07590f426f9b962c4c0ec6a (diff) | |
Some cleaning. Avoid using Qt::UserRole.
Diffstat (limited to 'src/modflagicondelegate.cpp')
| -rw-r--r-- | src/modflagicondelegate.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modflagicondelegate.cpp b/src/modflagicondelegate.cpp index bec3c97d..3ac1085e 100644 --- a/src/modflagicondelegate.cpp +++ b/src/modflagicondelegate.cpp @@ -1,4 +1,5 @@ #include "modflagicondelegate.h"
+#include "modlist.h"
#include <log.h>
#include <QList>
@@ -39,7 +40,7 @@ QList<QString> ModFlagIconDelegate::getIconsForFlags( QList<QString> ModFlagIconDelegate::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());
@@ -71,7 +72,7 @@ QString ModFlagIconDelegate::getFlagIcon(ModInfo::EFlag flag) size_t ModFlagIconDelegate::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::EFlag> flags = info->getFlags();
@@ -85,7 +86,7 @@ size_t ModFlagIconDelegate::getNumIcons(const QModelIndex &index) const QSize ModFlagIconDelegate::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);
|
