diff options
Diffstat (limited to 'lsmaterialmodel.cpp')
-rw-r--r-- | lsmaterialmodel.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lsmaterialmodel.cpp b/lsmaterialmodel.cpp new file mode 100644 index 0000000..37f8f58 --- /dev/null +++ b/lsmaterialmodel.cpp @@ -0,0 +1,23 @@ +#include "lsmaterialmodel.h" + +LSMaterialModel::LSMaterialModel(LYTMaterialContainer *container, QObject *parent) : + QAbstractListModel(parent) +{ + m_container = container; +} + + +int LSMaterialModel::rowCount(const QModelIndex &parent) const { + return m_container->count(); +} + +QVariant LSMaterialModel::data(const QModelIndex &index, int role) const { + if (index.isValid()) { + switch (role) { + case Qt::DisplayRole: + return m_container->getNameOfIndex(index.row()); + } + } + + return QVariant(); +} |