1 #include "uilistelement.h"
3 uiListElement::uiListElement(QString name,QString file,QObject *parent): QObject(parent)
9 uiListElement::uiListElement(const uiListElement &ui)
15 uiListElement::uiListElement(QObject *parent): QObject(parent)
19 uiListModel::uiListModel(QObject *parent)
20 : QAbstractListModel(parent)
22 QHash<int, QByteArray> roles;
23 roles[NameRole] = "name";
24 roles[TextRole] = "text";
25 roles[FileRole] = "file";
29 void uiListModel::addUI(uiListElement *ui)
31 beginInsertRows(QModelIndex(), rowCount(), rowCount());
36 int uiListModel::rowCount(const QModelIndex & parent) const {
37 return m_uiList.count();
40 QVariant uiListModel::data(const QModelIndex & index, int role) const {
41 if (index.row() < 0 || index.row() > m_uiList.count())
43 qDebug() << "uiListModel::data" << index << role;
44 const uiListElement *ui = m_uiList[index.row()];
46 if (role == NameRole ||role == TextRole ) {
47 qDebug() << "uiListModel::data" << index << role << ui->name();
50 else if (role == FileRole) {
51 qDebug() << "uiListModel::data" << index << role << ui->file();