From 10485e15e4de3e1a6c30733ad2d4850591d31509 Mon Sep 17 00:00:00 2001 From: Tannin Date: Wed, 27 Mar 2013 12:32:23 +0100 Subject: - some cleanup to hookdll - exchanged grouping proxies with existing solution from the kde project --- src/icondelegate.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/icondelegate.cpp') 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 . #include -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 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); -- cgit v1.3.1