summaryrefslogtreecommitdiff
path: root/lsmaterialmodel.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-05 01:36:57 +0200
committerTreeki <treeki@gmail.com>2012-09-05 01:36:57 +0200
commitf928869357765e3a73501064408bb7bc0ee363ef (patch)
tree1c75962f64e4a7bfc38315c21ccadd83092aa0d4 /lsmaterialmodel.cpp
parent824b2fa6b700ec7b50f0388b649480a689cf22f3 (diff)
downloadLayoutStudio-f928869357765e3a73501064408bb7bc0ee363ef.tar.gz
LayoutStudio-f928869357765e3a73501064408bb7bc0ee363ef.zip
improving the material editor
Diffstat (limited to '')
-rw-r--r--lsmaterialmodel.cpp23
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();
+}