diff options
Diffstat (limited to 'libs/installer_bsplugins/src/GUI/GenericIconDelegate.cpp')
| -rw-r--r-- | libs/installer_bsplugins/src/GUI/GenericIconDelegate.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libs/installer_bsplugins/src/GUI/GenericIconDelegate.cpp b/libs/installer_bsplugins/src/GUI/GenericIconDelegate.cpp new file mode 100644 index 0000000..9e5f31c --- /dev/null +++ b/libs/installer_bsplugins/src/GUI/GenericIconDelegate.cpp @@ -0,0 +1,29 @@ +#include "GenericIconDelegate.h" + +namespace GUI +{ + +GenericIconDelegate::GenericIconDelegate(QTreeView* parent, int role, int logicalIndex, + int compactSize) + : IconDelegate(parent, logicalIndex, compactSize), m_Role{role} +{} + +QList<QString> GenericIconDelegate::getIcons(const QModelIndex& index) const +{ + QList<QString> result; + if (index.isValid()) { + for (const QVariant& var : index.data(m_Role).toList()) { + if (!compact() || !var.toString().isEmpty()) { + result.append(var.toString()); + } + } + } + return result; +} + +int GenericIconDelegate::getNumIcons(const QModelIndex& index) const +{ + return index.data(m_Role).toList().count(); +} + +} // namespace GUI |
