diff options
Diffstat (limited to 'examples/qtcpp/generator/templates/structmodel.h')
-rw-r--r-- | examples/qtcpp/generator/templates/structmodel.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/qtcpp/generator/templates/structmodel.h b/examples/qtcpp/generator/templates/structmodel.h index ba78e5e..85ed16b 100644 --- a/examples/qtcpp/generator/templates/structmodel.h +++ b/examples/qtcpp/generator/templates/structmodel.h @@ -1,4 +1,5 @@ {# Copyright (c) Pelagicore AB 2016 #} +{% set class = 'Qml{0}Model'.format(struct) %} /**************************************************************************** ** This is an auto-generated file. ** Do not edit! All changes made to it will be lost. @@ -8,19 +9,19 @@ #include <QtCore> -#include "{{struct|lower}}.h" +#include "qml{{struct|lower}}.h" -class {{struct}}Model : public QAbstractListModel +class {{class}} : public QAbstractListModel { Q_OBJECT Q_PROPERTY(int count READ count NOTIFY countChanged) public: enum Roles { {{struct.fields|map('upperfirst')|join(', ')}} }; - {{struct}}Model(QObject *parent=0); - Q_INVOKABLE {{struct}} get(int index); + {{class}}(QObject *parent=0); + Q_INVOKABLE Qml{{struct}} get(int index); int count() const; - Q_INVOKABLE void insert{{struct}}(int row, const {{struct}} &{{struct|lower}}); - Q_INVOKABLE void update{{struct}}(int row, const {{struct}} &{{struct|lower}}); + Q_INVOKABLE void insert{{struct}}(int row, const Qml{{struct}} &{{struct|lower}}); + Q_INVOKABLE void update{{struct}}(int row, const Qml{{struct}} &{{struct|lower}}); Q_INVOKABLE void remove{{struct}}(int row); public: // from QAbstractListModel virtual int rowCount(const QModelIndex &parent) const; @@ -29,7 +30,7 @@ public: // from QAbstractListModel Q_SIGNALS: void countChanged(int count); private: - QList<{{struct}}> m_data; + QList<Qml{{struct}}> m_data; QHash<int, QByteArray> m_roleNames; }; |