diff options
| author | Tannin <devnull@localhost> | 2014-07-21 19:14:24 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-07-21 19:14:24 +0200 |
| commit | 0050cb07409d775efe14e728c1cef4a2c33aa1db (patch) | |
| tree | ed3eb9363aa35617f0dd92c4746bf14e032d010f /src/pluginflagicondelegate.cpp | |
| parent | f6ef5477e718b14af99bd22436f66dee0b9d22cd (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.cpp | 27 |
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();
}
-
|
