aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/ivigenerator/templates_frontend
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2018-06-22 14:16:31 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2018-07-16 06:25:31 +0000
commita060afede95b2d87b3ba24963a36d50158fd2a6b (patch)
tree88b5f48a9d0f01ebaa4ec369fba2925c222b5441 /src/tools/ivigenerator/templates_frontend
parentea17f5cf9b5029101876c97c956d468e93e8f969 (diff)
Use the new QIviPagingModel for the model type in qface files
This extends the templates to return a QIviPagingModel for all model types and also generate the backend interface for all the models in the backend_simulator template. The test template is extended to also generate a test for the model where an item is fetched from the frontend and the data provided by the backend. Task-number: AUTOSUITE-421 Change-Id: I1eb26ddcf6d448559221925dd69701e137e5f8a0 Reviewed-by: Antti Hölttä <ahoelttae@luxoft.com>
Diffstat (limited to 'src/tools/ivigenerator/templates_frontend')
-rw-r--r--src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl5
-rw-r--r--src/tools/ivigenerator/templates_frontend/interface.cpp.tpl57
-rw-r--r--src/tools/ivigenerator/templates_frontend/interface.h.tpl7
-rw-r--r--src/tools/ivigenerator/templates_frontend/interface_p.h.tpl3
-rw-r--r--src/tools/ivigenerator/templates_frontend/module.cpp.tpl5
-rw-r--r--src/tools/ivigenerator/templates_frontend/module.h.tpl4
-rw-r--r--src/tools/ivigenerator/templates_frontend/module.pri.tpl3
-rw-r--r--src/tools/ivigenerator/templates_frontend/struct.cpp.tpl3
-rw-r--r--src/tools/ivigenerator/templates_frontend/structmodel.cpp.tpl222
-rw-r--r--src/tools/ivigenerator/templates_frontend/structmodel.h.tpl95
-rw-r--r--src/tools/ivigenerator/templates_frontend/structmodel_p.h.tpl79
11 files changed, 56 insertions, 427 deletions
diff --git a/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl b/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl
index 83aeb58..c38abe1 100644
--- a/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl
+++ b/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl
@@ -62,6 +62,7 @@
#include <QtIviCore/{{base_class}}>
#include <QtIviCore/QIviPendingReply>
+#include <QtIviCore/QIviPagingModelInterface>
QT_BEGIN_NAMESPACE
@@ -73,7 +74,7 @@ public:
~{{class}}();
{% for property in interface.properties %}
-{% if not property.readonly and not property.const %}
+{% if not property.readonly and not property.const and not property.type.is_model %}
virtual {{ivi.prop_setter(property, zoned = interface.tags.config.zoned)}} = 0;
{% endif %}
{% endfor %}
@@ -86,7 +87,7 @@ Q_SIGNALS:
{{ivi.signal(signal, zoned = interface.tags.config.zoned)}};
{% endfor %}
{% for property in interface.properties %}
- {{ivi.prop_notify(property, zoned = interface.tags.config.zoned)}};
+ {{ivi.prop_notify(property, zoned = interface.tags.config.zoned, model_interface = true)}};
{% endfor %}
};
diff --git a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
index 1344082..2ee21f2 100644
--- a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
+++ b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
@@ -44,14 +44,9 @@
#include "{{class|lower}}_p.h"
#include "{{class|lower}}backendinterface.h"
-{% for property in interface.properties %}
-{% if property.type.is_model %}
-#include "{{property|model_type|lower}}.h"
-{% endif %}
-{% endfor %}
-
#include <QQmlEngine>
#include <QIviServiceObject>
+#include <QIviProxyServiceObject>
QT_BEGIN_NAMESPACE
@@ -133,6 +128,12 @@ const {{class}}Private *{{class}}Private::get(const {{class}} *v)
void {{class}}Private::clearToDefaults()
{
{% for property in interface.properties %}
+{% if property.type.is_model %}
+ if (m_{{property}}) {
+ delete m_{{property}}->serviceObject();
+ delete m_{{property}};
+ }
+{% endif %}
m_{{property}} = {{property|default_type_value}};
{% endfor %}
}
@@ -140,7 +141,7 @@ void {{class}}Private::clearToDefaults()
{% for property in interface.properties %}
/*! \internal */
{% if interface.tags.config.zoned %}
-void {{class}}Private::on{{property|upperfirst}}Changed({{property|parameter_type}}, const QString &zone)
+{{ivi.on_prop_changed(property, class+"Private", interface.tags.config.zoned, true)}}
{
auto q = getParent();
auto f = qobject_cast<{{class}}*>(q->zoneAt(zone));
@@ -148,7 +149,7 @@ void {{class}}Private::on{{property|upperfirst}}Changed({{property|parameter_typ
f = q;
if (f->zone() != zone)
return;
-{% if not module.tags.config.disablePrivateIVI %}
+{% if not module.tags.config.disablePrivateIVI and not property.type.is_model %}
if (Q_UNLIKELY(m_propertyOverride)) {
const int pi = f->metaObject()->indexOfProperty("{{property}}");
if (m_propertyOverride->isOverridden(pi)) {
@@ -158,19 +159,55 @@ void {{class}}Private::on{{property|upperfirst}}Changed({{property|parameter_typ
}
}
{% endif %}
+{% if property.type.is_model %}
+ {{property|return_type}} old = {{class}}Private::get(f)->m_{{property}};
+ if ({{property}}) {
+ auto model = new QIviPagingModel();
+ model->setServiceObject(new QIviProxyServiceObject({ {QIviPagingModel_iid, {{property}} } }));;
+ {{class}}Private::get(f)->m_{{property}} = model;
+ emit f->{{property}}Changed(model);
+ } else {
+ {{class}}Private::get(f)->m_{{property}} = nullptr;
+ emit f->{{property}}Changed(nullptr);
+ }
+ if (old) {
+ delete old->serviceObject();
+ delete old;
+ }
+{% else %}
if ({{class}}Private::get(f)->m_{{property}} != {{property}}) {
{{class}}Private::get(f)->m_{{property}} = {{property}};
emit f->{{property}}Changed({{property}});
}
+{% endif %}
}
{% else %}
-void {{class}}Private::on{{property|upperfirst}}Changed({{property|parameter_type}})
+{{ivi.on_prop_changed(property, class+"Private", interface.tags.config.zoned, true)}}
{
+{% if property.type.is_model %}
+ {{property|return_type}} old = m_{{property}};
+ if ({{property}}) {
+ auto model = new QIviPagingModel();
+ model->setServiceObject(new QIviProxyServiceObject({ {QIviPagingModel_iid, {{property}} } }));
+ m_{{property}} = model;
+ auto q = getParent();
+ emit q->{{property}}Changed(model);
+ } else {
+ m_{{property}} = nullptr;
+ auto q = getParent();
+ emit q->{{property}}Changed(nullptr);
+ }
+ if (old) {
+ delete old->serviceObject();
+ delete old;
+ }
+{% else %}
if (m_{{property}} != {{property}}) {
auto q = getParent();
m_{{property}} = {{property}};
emit q->{{property}}Changed({{property}});
}
+{% endif %}
}
{% endif %}
@@ -301,7 +338,7 @@ void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minor
{% endif %}
return d->m_{{property}};
}
-{% if not property.readonly and not property.const %}
+{% if not property.readonly and not property.const and not property.type.is_model %}
{{ivi.prop_setter(property, class)}}
{
diff --git a/src/tools/ivigenerator/templates_frontend/interface.h.tpl b/src/tools/ivigenerator/templates_frontend/interface.h.tpl
index 6db880a..9688336 100644
--- a/src/tools/ivigenerator/templates_frontend/interface.h.tpl
+++ b/src/tools/ivigenerator/templates_frontend/interface.h.tpl
@@ -62,6 +62,7 @@
#include <QtIviCore/{{base_class}}>
#include <QtIviCore/QIviPendingReply>
+#include <QtIviCore/QIviPagingModel>
QT_BEGIN_NAMESPACE
@@ -96,7 +97,7 @@ public Q_SLOTS:
{{ ivi.operation(operation) }};
{% endfor %}
{% for property in interface.properties %}
-{% if not property.readonly and not property.const %}
+{% if not property.readonly and not property.const and not property.type.is_model %}
{{ivi.prop_setter(property)}};
{% endif %}
{% endfor %}
@@ -125,9 +126,9 @@ private:
{% else %}
{% for property in interface.properties %}
{% if interface.tags.config.zoned %}
- Q_PRIVATE_SLOT(d_func(), void on{{property|upperfirst}}Changed({{property|parameter_type}}, const QString &))
+ Q_PRIVATE_SLOT(d_func(), {{ivi.on_prop_changed(property, "", true, true)}})
{% else %}
- Q_PRIVATE_SLOT(d_func(), void on{{property|upperfirst}}Changed({{property|parameter_type}}))
+ Q_PRIVATE_SLOT(d_func(), {{ivi.on_prop_changed(property, "", false, true)}})
{% endif %}
{% endfor %}
Q_DECLARE_PRIVATE({{class}})
diff --git a/src/tools/ivigenerator/templates_frontend/interface_p.h.tpl b/src/tools/ivigenerator/templates_frontend/interface_p.h.tpl
index b51c749..eb39306 100644
--- a/src/tools/ivigenerator/templates_frontend/interface_p.h.tpl
+++ b/src/tools/ivigenerator/templates_frontend/interface_p.h.tpl
@@ -67,6 +67,7 @@
{% else %}
#include <QtIviCore/private/{{base_class|lower}}_p.h>
{% endif %}
+#include <QIviPagingModelInterface>
QT_BEGIN_NAMESPACE
@@ -96,7 +97,7 @@ public:
void clearToDefaults();
{% for property in interface.properties %}
- {{ivi.on_prop_changed(property, zoned = interface.tags.config.zoned)}};
+ {{ivi.on_prop_changed(property, zoned = interface.tags.config.zoned, model_interface = true)}};
{% endfor %}
{% for signal in interface.signals %}
void on{{signal|upperfirst}}({{ivi.join_params(signal, zoned = interface.tags.config.zoned)}});
diff --git a/src/tools/ivigenerator/templates_frontend/module.cpp.tpl b/src/tools/ivigenerator/templates_frontend/module.cpp.tpl
index 96c9e4e..0431aa5 100644
--- a/src/tools/ivigenerator/templates_frontend/module.cpp.tpl
+++ b/src/tools/ivigenerator/templates_frontend/module.cpp.tpl
@@ -45,9 +45,6 @@
{% for interface in module.interfaces %}
#include "{{interface|lower}}.h"
{% endfor %}
-{% for struct in module.structs %}
-#include "{{struct|lower}}model.h"
-{% endfor %}
#include <QtIviCore/QIviPendingReply>
#include <QQmlEngine>
#include <QDebug>
@@ -113,10 +110,8 @@ void {{class}}::registerTypes()
{% endfor %}
{% for struct in module.structs %}
qRegisterMetaType<{{struct}}>();
- qRegisterMetaType<{{struct}}Model*>();
qRegisterMetaTypeStreamOperators<{{struct}}>();
qIviRegisterPendingReplyType<{{struct}}>();
- qIviRegisterPendingReplyType<{{struct}}Model*>();
{% endfor %}
}
diff --git a/src/tools/ivigenerator/templates_frontend/module.h.tpl b/src/tools/ivigenerator/templates_frontend/module.h.tpl
index 12c1dcb..5595eaa 100644
--- a/src/tools/ivigenerator/templates_frontend/module.h.tpl
+++ b/src/tools/ivigenerator/templates_frontend/module.h.tpl
@@ -53,10 +53,6 @@
QT_BEGIN_NAMESPACE
-{% for struct in module.structs %}
-class {{struct}}Model;
-{% endfor %}
-
class {{exportsymbol}} {{class}} : public QObject {
Q_OBJECT
public:
diff --git a/src/tools/ivigenerator/templates_frontend/module.pri.tpl b/src/tools/ivigenerator/templates_frontend/module.pri.tpl
index 839b8ca..61b772e 100644
--- a/src/tools/ivigenerator/templates_frontend/module.pri.tpl
+++ b/src/tools/ivigenerator/templates_frontend/module.pri.tpl
@@ -49,8 +49,6 @@ HEADERS += \
{% endfor %}
{% for struct in module.structs %}
$$PWD/{{struct|lower}}.h \
- $$PWD/{{struct|lower}}model.h \
- $$PWD/{{struct|lower}}model_p.h \
{% endfor %}
$$PWD/{{module.module_name|lower}}module.h \
$$PWD/{{module.module_name|lower}}modulefactory.h \
@@ -63,7 +61,6 @@ SOURCES += \
{% endfor %}
{% for struct in module.structs %}
$$PWD/{{struct|lower}}.cpp \
- $$PWD/{{struct|lower}}model.cpp \
{% endfor %}
$$PWD/{{module.module_name|lower}}module.cpp \
$$PWD/{{module.module_name|lower}}modulefactory.cpp
diff --git a/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl b/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl
index 16b8d16..43ec933 100644
--- a/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl
+++ b/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl
@@ -142,7 +142,6 @@ bool operator==(const {{class}} &left, const {{class}} &right) Q_DECL_NOTHROW
{
if (left.d == right.d)
return true;
- //FIX me for inheritance
return (
{% for field in struct.fields %}
left.{{field}}() == right.{{field}}() {% if not loop.last %}&&{% endif %}
@@ -158,7 +157,6 @@ bool operator!=(const {{class}} &left, const {{class}} &right) Q_DECL_NOTHROW
QDataStream &operator<<(QDataStream &stream, const {{class}} &obj)
{
- //FIX me for inheritance
{% for field in struct.fields %}
stream << obj.{{field}}();
{% endfor %}
@@ -167,7 +165,6 @@ QDataStream &operator<<(QDataStream &stream, const {{class}} &obj)
QDataStream &operator>>(QDataStream &stream, {{class}} &obj)
{
- //FIX me for inheritance
{% for field in struct.fields %}
stream >> obj.d->m_{{field}};
{% endfor %}
diff --git a/src/tools/ivigenerator/templates_frontend/structmodel.cpp.tpl b/src/tools/ivigenerator/templates_frontend/structmodel.cpp.tpl
deleted file mode 100644
index a372e78..0000000
--- a/src/tools/ivigenerator/templates_frontend/structmodel.cpp.tpl
+++ /dev/null
@@ -1,222 +0,0 @@
-{#
-# Copyright (C) 2018 Pelagicore AG.
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB)
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-{% set class = '{0}Model'.format(struct) %}
-{% include 'generated_comment.cpp.tpl' %}
-
-#include "{{class|lower}}.h"
-#include "{{class|lower}}_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*! \internal */
-{{class}}Private::{{class}}Private()
- : QAbstractItemModelPrivate()
-{
-}
-
-/*! \internal */
-{{class}}Private::~{{class}}Private()
-{
-}
-
-
-{{class}}::{{class}}(QObject* parent)
- : QAbstractListModel(parent)
-{
-}
-
-/*! \internal */
-{{class}}::~{{class}}()
-{
-}
-
-QHash<int, QByteArray> {{class}}::roleNames() const
-{
- auto res = QAbstractItemModel::roleNames();
-{% for field in struct.fields %}
- res.insert({{field|upperfirst}}, "{{field}}");
-{% endfor %}
- return res;
-}
-
-int {{class}}::count() const
-{
- Q_D(const {{class}});
-
- return d->m_data.count();
-}
-
-int {{class}}::rowCount(const QModelIndex &parent) const
-{
- Q_D(const {{class}});
-
- return parent.isValid() ? 0 : d->m_data.count();
-}
-
-QVariant {{class}}::data(const QModelIndex &index, int role) const
-{
- Q_D(const {{class}});
- if (index.row() < 0 || index.row() >= d->m_data.count())
- return {};
-
- const {{struct}} &data = d->m_data.at(index.row());
- switch(role) {
-{% for field in struct.fields %}
- case {{field|upperfirst}}: return qVariantFromValue<{{field|return_type}}>(data.{{field}}());
-{% endfor %}
- default: break;
- }
-
- return {};
-}
-
-bool {{class}}::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- Q_D({{class}});
- if (index.row() < 0 || index.row() >= d->m_data.count())
- return false;
- {{struct}} &data = d->m_data[index.row()];
- switch(role) {
-{% for field in struct.fields %}
- case {{field|upperfirst}}:
-{% if field.readonly or field.const %}
- return false;
-{% else %}
- data.set{{field|upperfirst}}(value.value<{{field|return_type}}>());
- break;
-{% endif %}
-{% endfor %}
- default: return false;
- }
- Q_EMIT dataChanged(index, index, QVector<int>() << role);
- return true;
-}
-
-bool {{class}}::insertRows(int row, int count, const QModelIndex &parent)
-{
- Q_D({{class}});
- if (row < 0 || row >= d->m_data.size() || count < 0 || parent.isValid())
- return false;
- beginInsertRows(parent, row, row + count - 1);
- d->m_data.insert(row, count, {});
- endInsertRows();
- Q_EMIT countChanged(d->m_data.count());
- return true;
-}
-
-bool {{class}}::removeRows(int row, int count, const QModelIndex &parent)
-{
- Q_D({{class}});
- if (row < 0 || row >= d->m_data.size() || count < 0 || parent.isValid())
- return false;
- beginInsertRows(parent, row, row + count - 1);
- while (count) {
- d->m_data.remove(row);
- --count;
- }
- endInsertRows();
- Q_EMIT countChanged(d->m_data.count());
- return true;
-}
-
-bool {{class}}::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
-{
- Q_D({{class}});
- if (sourceRow < 0 || sourceRow >= d->m_data.size() || count < 0 || sourceParent.isValid())
- return false;
- if (destinationChild < 0 || destinationChild > d->m_data.size() || destinationParent.isValid())
- return false;
- if (!beginMoveRows(sourceParent, sourceRow, sourceRow + count - 1, destinationParent, destinationChild))
- return false;
- QVector<{{struct}}> data;
- for (int i = 0; i < count; i++) {
- data << d->m_data.at(sourceRow);
- d->m_data.remove(sourceRow);
- }
- if (destinationChild >= d->m_data.size())
- d->m_data << data;
- else {
- d->m_data.insert(destinationChild, count, {});
- for (int i = 0; i < count; i++)
- d->m_data[destinationChild + 1] = data[i];
- }
- endMoveRows();
- return true;
-}
-
-{{struct}} {{class}}::at(int index) const
-{
- Q_D(const {{class}});
- if (index < 0 || index >= d->m_data.count())
- return {};
- return d->m_data.at(index);
-}
-
-void {{class}}::append(const {{struct}}& data)
-{
- Q_D({{class}});
- beginInsertRows({}, d->m_data.count(), d->m_data.count());
- d->m_data << data;
- endInsertRows();
- Q_EMIT countChanged(d->m_data.count());
-}
-
-{{struct}} {{class}}::append({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %})
-{
- auto data = {{struct}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field}}{% endfor %});
- append(data);
- return data;
-}
-
-void {{class}}::remove(int index)
-{
- Q_D({{class}});
- if (index < 0 || index >= d->m_data.count()) {
- beginRemoveRows({}, index, index);
- d->m_data.remove(index);
- endRemoveRows();
- Q_EMIT countChanged(d->m_data.count());
- }
-}
-
-
-QT_END_NAMESPACE
-
-#include "moc_{{class|lower}}.cpp"
diff --git a/src/tools/ivigenerator/templates_frontend/structmodel.h.tpl b/src/tools/ivigenerator/templates_frontend/structmodel.h.tpl
deleted file mode 100644
index 24ca9a3..0000000
--- a/src/tools/ivigenerator/templates_frontend/structmodel.h.tpl
+++ /dev/null
@@ -1,95 +0,0 @@
-{#
-# Copyright (C) 2018 Pelagicore AG.
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB)
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-{% set class = '{0}Model'.format(struct) %}
-{% set oncedefine = '{0}_{1}_H_'.format(module.module_name|upper, class|upper) %}
-{% set exportsymbol = 'Q_{0}_EXPORT'.format(module.module_name|upper) %}
-{% include 'generated_comment.cpp.tpl' %}
-
-#ifndef {{oncedefine}}
-#define {{oncedefine}}
-
-#include "{{struct|lower}}.h"
-#include <QAbstractListModel>
-
-QT_BEGIN_NAMESPACE
-
-class {{class}}Private;
-
-class {{exportsymbol}} {{class}} : public QAbstractListModel
-{
- Q_OBJECT
- Q_PROPERTY(int count READ count NOTIFY countChanged)
-public:
- enum Roles {
- {% for field in struct.fields %}
- {{field|upperfirst}}{% if loop.first %} = Qt::UserRole{% endif %},
- {% endfor %}
- };
- Q_ENUM(Roles);
-
- explicit {{class}}(QObject *parent = nullptr);
- ~{{class}}();
-
- int count() const;
-
- QHash<int, QByteArray> roleNames() const override;
- int rowCount(const QModelIndex& parent) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole) override;
- bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
- bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
-
- Q_INVOKABLE {{struct}} at(int index) const;
- Q_INVOKABLE void append(const {{struct}}& data);
- Q_INVOKABLE {{struct}} append({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %});
- Q_INVOKABLE void remove(int index);
-
-Q_SIGNALS:
- void countChanged(int count);
-
-private:
- Q_DECLARE_PRIVATE({{class}})
-};
-
-QT_END_NAMESPACE
-
-
-#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_frontend/structmodel_p.h.tpl b/src/tools/ivigenerator/templates_frontend/structmodel_p.h.tpl
deleted file mode 100644
index 1852e25..0000000
--- a/src/tools/ivigenerator/templates_frontend/structmodel_p.h.tpl
+++ /dev/null
@@ -1,79 +0,0 @@
-{#
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-{% set class = '{0}Model'.format(struct) %}
-{% set oncedefine = '{0}_{1}PRIVATE_H_'.format(module.module_name|upper, class|upper) %}
-{% include 'generated_comment.cpp.tpl' %}
-
-#ifndef {{oncedefine}}
-#define {{oncedefine}}
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "{{struct|lower}}.h"
-
-#include <QtCore/private/qabstractitemmodel_p.h>
-#include <QVector>
-
-QT_BEGIN_NAMESPACE
-
-class {{class}};
-
-class {{class}}Private : public QAbstractItemModelPrivate
-{
-public:
- {{class}}Private();
- ~{{class}}Private();
-
- QVector<{{struct}}> m_data;
-
- Q_DECLARE_PUBLIC({{class}})
-};
-
-QT_END_NAMESPACE
-
-#endif // {{oncedefine}}