From f928869357765e3a73501064408bb7bc0ee363ef Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 5 Sep 2012 01:36:57 +0200 Subject: improving the material editor --- lsmaterialmodel.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lsmaterialmodel.cpp (limited to 'lsmaterialmodel.cpp') 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(); +} -- cgit v1.2.3