summaryrefslogtreecommitdiff
path: root/src/pluginflagicondelegate.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-07-21 19:14:24 +0200
committerTannin <devnull@localhost>2014-07-21 19:14:24 +0200
commit9879aae5757e0c2ca930b38c6b7a4aeb4715d2d9 (patch)
tree43ccc85bf5998c4e37abc7cdb627b49276cc441b /src/pluginflagicondelegate.cpp
parentcc9827cdda5776a4fd540a2ab0fb8a08ec9f75a7 (diff)
- download-list will no longer show a file as having incomplete data if there is no file version
- added a new mod column with icons displaying the content of the mod - MO now differentiates between mods using an internal name that disambiguates between foreign and regular mods
Diffstat (limited to 'src/pluginflagicondelegate.cpp')
-rw-r--r--src/pluginflagicondelegate.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/pluginflagicondelegate.cpp b/src/pluginflagicondelegate.cpp
index 761555d7..a4f66c04 100644
--- a/src/pluginflagicondelegate.cpp
+++ b/src/pluginflagicondelegate.cpp
@@ -3,24 +3,37 @@
#include <QList>
-PluginFlagIconDelegate::PluginFlagIconDelegate(QObject *parent)
+GenericIconDelegate::GenericIconDelegate(QObject *parent, int role, int logicalIndex, int compactSize)
: IconDelegate(parent)
+ , m_Role(role)
+ , m_LogicalIndex(logicalIndex)
+ , m_CompactSize(compactSize)
+ , m_Compact(false)
{
}
-QList<QIcon> PluginFlagIconDelegate::getIcons(const QModelIndex &index) const
+void GenericIconDelegate::columnResized(int logicalIndex, int, int newSize)
+{
+ if (logicalIndex == m_LogicalIndex) {
+ m_Compact = newSize < m_CompactSize;
+ }
+}
+
+QList<QIcon> GenericIconDelegate::getIcons(const QModelIndex &index) const
{
QList<QIcon> result;
if (index.isValid()) {
- foreach (const QVariant &var, index.data(Qt::UserRole + 1).toList()) {
- result.append(var.value<QIcon>());
+ foreach (const QVariant &var, index.data(m_Role).toList()) {
+ QIcon icon = var.value<QIcon>();
+ if (!m_Compact || !icon.isNull()) {
+ result.append(icon);
+ }
}
}
return result;
}
-size_t PluginFlagIconDelegate::getNumIcons(const QModelIndex &index) const
+size_t GenericIconDelegate::getNumIcons(const QModelIndex &index) const
{
- return index.data(Qt::UserRole + 1).toList().count();
+ return index.data(m_Role).toList().count();
}
-