2
* Copyright (C) 2015 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
18
#ifndef LOPARTSMODEL_H
19
#define LOPARTSMODEL_H
21
#include <QAbstractListModel>
32
class LOPartsModel : public QAbstractListModel
35
Q_DISABLE_COPY(LOPartsModel)
36
Q_PROPERTY(LODocument* document READ document WRITE setDocument NOTIFY documentChanged)
37
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
45
explicit LOPartsModel(QAbstractListModel *parent = 0);
48
LODocument* document() { return m_document; }
49
void setDocument(LODocument* document);
51
QHash<int, QByteArray> roleNames() const;
53
int rowCount(const QModelIndex & parent = QModelIndex()) const;
54
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
56
Q_INVOKABLE QVariantMap get(int index) const;
59
void documentChanged();
66
LODocument* m_document;
67
QList<LOPartEntry> m_entries;
70
#endif // LOPARTSMODEL_H