diff options
| author | Tannin <devnull@localhost> | 2013-03-27 12:32:23 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-03-27 12:32:23 +0100 |
| commit | 10485e15e4de3e1a6c30733ad2d4850591d31509 (patch) | |
| tree | d4ca59328823e5d6ff8be6f403f0eb8c5c7cf05a /src/icondelegate.cpp | |
| parent | ec0ea9df8dabe686d3256665c7ed638660309915 (diff) | |
- some cleanup to hookdll
- exchanged grouping proxies with existing solution from the kde project
Diffstat (limited to 'src/icondelegate.cpp')
| -rw-r--r-- | src/icondelegate.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/icondelegate.cpp b/src/icondelegate.cpp index 05a5c0c3..2540e1d5 100644 --- a/src/icondelegate.cpp +++ b/src/icondelegate.cpp @@ -23,8 +23,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QPainter> -IconDelegate::IconDelegate(QAbstractProxyModel *proxyModel, QObject *parent) - : QStyledItemDelegate(parent), m_ProxyModel(proxyModel) +IconDelegate::IconDelegate(QObject *parent) + : QStyledItemDelegate(parent) { } @@ -48,11 +48,11 @@ QIcon IconDelegate::getFlagIcon(ModInfo::EFlag flag) const void IconDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyledItemDelegate::paint(painter, option, index); - QModelIndex sourceIndex = m_ProxyModel->mapToSource(index); - if (!sourceIndex.isValid()) { + QVariant modid = index.data(Qt::UserRole + 1); + if (!modid.isValid()) { return; } - ModInfo::Ptr info = ModInfo::getByIndex(sourceIndex.row()); + ModInfo::Ptr info = ModInfo::getByIndex(modid.toInt()); std::vector<ModInfo::EFlag> flags = info->getFlags(); int x = 4; @@ -70,7 +70,7 @@ void IconDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, QSize IconDelegate::sizeHint(const QStyleOptionViewItem&, const QModelIndex &modelIndex) const { - unsigned int index = m_ProxyModel->mapToSource(modelIndex).row(); + unsigned int index = modelIndex.data(Qt::UserRole + 1).toInt(); if (index < ModInfo::getNumMods()) { ModInfo::Ptr info = ModInfo::getByIndex(index); return QSize(info->getFlags().size() * 20, 20); |
