From 715623e7905e5f64f5b331f4523642aab1aedd34 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 27 Jul 2014 18:34:32 +0200 Subject: - browser dialog now has a hidden url-field (for testing only) - loot_cli is no longer part of this project. I will probably create a fork of loot that allows command-line usage instead - loot integration now works with such a modified loot version - integrated loot will now also integrate incompatibility messages in the MO UI - overwrite-markers are now updated as the list order is changed - fnis checker will now always allow the user to ignore fnis errors - plugin interface now has a function to wait for handles returned from startApplication (which can be job or process handles) - bugfix: non-mo mods sharing the name with regular mods now have a different internal name - bugfix: using hotkeys the vanilla game-plugins could be moved --- src/genericicondelegate.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/genericicondelegate.cpp (limited to 'src/genericicondelegate.cpp') diff --git a/src/genericicondelegate.cpp b/src/genericicondelegate.cpp new file mode 100644 index 00000000..c3471735 --- /dev/null +++ b/src/genericicondelegate.cpp @@ -0,0 +1,39 @@ +#include "genericicondelegate.h" +#include "pluginlist.h" +#include + + +GenericIconDelegate::GenericIconDelegate(QObject *parent, int role, int logicalIndex, int compactSize) + : IconDelegate(parent) + , m_Role(role) + , m_LogicalIndex(logicalIndex) + , m_CompactSize(compactSize) + , m_Compact(false) +{ +} + +void GenericIconDelegate::columnResized(int logicalIndex, int, int newSize) +{ + if (logicalIndex == m_LogicalIndex) { + m_Compact = newSize < m_CompactSize; + } +} + +QList GenericIconDelegate::getIcons(const QModelIndex &index) const +{ + QList result; + if (index.isValid()) { + foreach (const QVariant &var, index.data(m_Role).toList()) { + QIcon icon = var.value(); + if (!m_Compact || !icon.isNull()) { + result.append(icon); + } + } + } + return result; +} + +size_t GenericIconDelegate::getNumIcons(const QModelIndex &index) const +{ + return index.data(m_Role).toList().count(); +} -- cgit v1.3.1