summaryrefslogtreecommitdiff
path: root/lsmaterialmodel.cpp
blob: 37f8f586b816b3b4925b7abf89fddc7fbe3b078e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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();
}