aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2019-09-17 12:04:15 +0200
committerAndy Shaw <andy.shaw@qt.io>2019-09-17 13:08:01 +0200
commit903841cb5a58659b9f98ccea4c1d07e3d6b8f3dd (patch)
treec39bc2917bbd505774e414b20d209828c83f5937
parentc3cb549b69d5529a33aaba9de6c34e784cec4df2 (diff)
Replace usage of the QObject keywords with their respective macros
By using Q_EMIT, Q_SIGNALS and so on, then this ensures that the generated code will work with no_keywords set for a project in a pro file. Change-Id: Id53e2219ac215e5b6bef99f835b2ffd42a59ab4e Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r--src/helper/remoteobjects/qiviremoteobjectsourcehelper.h2
-rw-r--r--src/tools/ivigenerator/common/backend_simulation.cpp.tpl16
-rw-r--r--src/tools/ivigenerator/common/backend_simulation.h.tpl2
-rw-r--r--src/tools/ivigenerator/common/pagingmodel_simulation.cpp.tpl16
-rw-r--r--src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl16
-rw-r--r--src/tools/ivigenerator/templates_backend_qtro/backend.h.tpl2
-rw-r--r--src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl2
-rw-r--r--src/tools/ivigenerator/templates_frontend/interface.cpp.tpl22
-rw-r--r--src/tools/ivigenerator/templates_test/pagingmodel.h.tpl6
-rw-r--r--src/tools/ivigenerator/templates_test/tst_test.cpp.tpl18
-rw-r--r--src/tools/ivigenerator/templates_test/tst_test.h.tpl2
11 files changed, 52 insertions, 52 deletions
diff --git a/src/helper/remoteobjects/qiviremoteobjectsourcehelper.h b/src/helper/remoteobjects/qiviremoteobjectsourcehelper.h
index f474f76..b290426 100644
--- a/src/helper/remoteobjects/qiviremoteobjectsourcehelper.h
+++ b/src/helper/remoteobjects/qiviremoteobjectsourcehelper.h
@@ -85,7 +85,7 @@ public:
qCDebug(m_category) << "Returning a pending result: id:" << id;
QObject::connect(pendingReply.watcher(), &QIviPendingReplyWatcher::valueChanged, [this, pendingReply, id] (const QVariant &value) {
qCDebug(m_category) << "Value for pending result available: id:" << id << "value:" << value;
- emit m_adapter->pendingResultAvailable(id, pendingReply.isSuccessful(), value);
+ Q_EMIT m_adapter->pendingResultAvailable(id, pendingReply.isSuccessful(), value);
});
return QVariant::fromValue(result);
}
diff --git a/src/tools/ivigenerator/common/backend_simulation.cpp.tpl b/src/tools/ivigenerator/common/backend_simulation.cpp.tpl
index bfaf76a..da7c3c6 100644
--- a/src/tools/ivigenerator/common/backend_simulation.cpp.tpl
+++ b/src/tools/ivigenerator/common/backend_simulation.cpp.tpl
@@ -82,8 +82,8 @@ QT_BEGIN_NAMESPACE
if (m_{{property}} == {{property}})
return;
m_{{property}} = {{property}};
- emit {{property}}Changed({{property}});
- emit m_parent->{{property}}Changed({{property}}, m_zone);
+ Q_EMIT {{property}}Changed({{property}});
+ Q_EMIT m_parent->{{property}}Changed({{property}}, m_zone);
}
{% endfor %}
{% endif %}
@@ -142,9 +142,9 @@ void {{class}}::initialize()
QIVI_SIMULATION_TRY_CALL({{class}}, "initialize", void);
{% for property in interface.properties %}
{% if not interface_zoned %}
- emit {{property}}Changed(m_{{property}});
+ Q_EMIT {{property}}Changed(m_{{property}});
{% elif not property.tags.config_simulator or not property.tags.config_simulator.zoned%}
- emit {{property}}Changed(m_{{property}}, QString());
+ Q_EMIT {{property}}Changed(m_{{property}}, QString());
{% endif %}
{% endfor %}
@@ -152,12 +152,12 @@ void {{class}}::initialize()
for (const QString &zone : m_zones->keys()) {
{{interface}}Zone *zo = zoneAt(zone);
{% for property in interface.properties %}
- emit {{property}}Changed(zo->{{property|getter_name}}(), zone);
+ Q_EMIT {{property}}Changed(zo->{{property|getter_name}}(), zone);
{% endfor %}
}
{% endif %}
- emit initializationDone();
+ Q_EMIT initializationDone();
}
{% if interface_zoned %}
@@ -212,7 +212,7 @@ void {{class}}::addZone(const QString &zone)
if (m_{{property}} == {{property}})
return;
m_{{property}} = {{property}};
- emit {{property}}Changed({{property}}, QString());
+ Q_EMIT {{property}}Changed({{property}}, QString());
} else {
{{interface}}Zone *zo = zoneAt(zone);
if (zo)
@@ -224,7 +224,7 @@ void {{class}}::addZone(const QString &zone)
if (m_{{property}} == {{property}})
return;
m_{{property}} = {{property}};
- emit {{property}}Changed(m_{{property}});
+ Q_EMIT {{property}}Changed(m_{{property}});
{% endif %}
}
diff --git a/src/tools/ivigenerator/common/backend_simulation.h.tpl b/src/tools/ivigenerator/common/backend_simulation.h.tpl
index 5bcffd2..7eece5a 100644
--- a/src/tools/ivigenerator/common/backend_simulation.h.tpl
+++ b/src/tools/ivigenerator/common/backend_simulation.h.tpl
@@ -89,7 +89,7 @@ public Q_SLOTS:
{{ivi.prop_setter(property, model_interface = true)}};
{% endfor %}
-signals:
+Q_SIGNALS:
{% for property in interface.properties %}
{{ivi.prop_notify(property, model_interface = true)}};
{% endfor %}
diff --git a/src/tools/ivigenerator/common/pagingmodel_simulation.cpp.tpl b/src/tools/ivigenerator/common/pagingmodel_simulation.cpp.tpl
index a28fd2d..3b5ad78 100644
--- a/src/tools/ivigenerator/common/pagingmodel_simulation.cpp.tpl
+++ b/src/tools/ivigenerator/common/pagingmodel_simulation.cpp.tpl
@@ -55,14 +55,14 @@ void {{class}}::initialize()
{
QIVI_SIMULATION_TRY_CALL({{class}}, "initialize", void);
- emit initializationDone();
+ Q_EMIT initializationDone();
}
void {{class}}::registerInstance(const QUuid &identifier)
{
QIVI_SIMULATION_TRY_CALL({{class}}, "registerInstance", void, identifier);
- emit countChanged(identifier, m_list.count());
+ Q_EMIT countChanged(identifier, m_list.count());
}
void {{class}}::unregisterInstance(const QUuid &identifier)
@@ -79,21 +79,21 @@ void {{class}}::fetchData(const QUuid &identifier, int start, int count)
for(int i=start; i < max; i++)
list.append(QVariant::fromValue(m_list.at(i)));
- emit dataFetched(identifier, list, start, max < m_list.count());
+ Q_EMIT dataFetched(identifier, list, start, max < m_list.count());
}
void {{class}}::insert(int index, const {{property.type.nested}} &item)
{
m_list.insert(index, item);
- emit dataChanged(QUuid(), { QVariant::fromValue(item) }, index, 0);
+ Q_EMIT dataChanged(QUuid(), { QVariant::fromValue(item) }, index, 0);
}
void {{class}}::remove(int index)
{
m_list.removeAt(index);
- emit dataChanged(QUuid(), QVariantList(), index, 1);
+ Q_EMIT dataChanged(QUuid(), QVariantList(), index, 1);
}
void {{class}}::move(int currentIndex, int newIndex)
@@ -106,19 +106,19 @@ void {{class}}::move(int currentIndex, int newIndex)
for (int i = min; i <= max; i++)
variantList.append(QVariant::fromValue(m_list.at(i)));
- emit dataChanged(QUuid(), variantList, min, max - min + 1);
+ Q_EMIT dataChanged(QUuid(), variantList, min, max - min + 1);
}
void {{class}}::reset()
{
- emit dataChanged(QUuid(), QVariantList(), 0, m_list.count());
+ Q_EMIT dataChanged(QUuid(), QVariantList(), 0, m_list.count());
m_list.clear();
}
void {{class}}::update(int index, const {{property.type.nested}} &item)
{
m_list[index] = item;
- emit dataChanged(QUuid(), { QVariant::fromValue(item) }, index, 1);
+ Q_EMIT dataChanged(QUuid(), { QVariant::fromValue(item) }, index, 1);
}
const {{property.type.nested}} &{{class}}::at(int index) const
diff --git a/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl b/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl
index afca8dc..39c2bea 100644
--- a/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl
+++ b/src/tools/ivigenerator/templates_backend_qtro/backend.cpp.tpl
@@ -103,7 +103,7 @@ void {{zone_class}}::sync()
void {{zone_class}}::checkSync()
{
if (m_propertiesToSync.isEmpty())
- emit syncDone();
+ Q_EMIT syncDone();
}
void {{zone_class}}::emitCurrentState()
@@ -117,7 +117,7 @@ void {{zone_class}}::emitCurrentState()
{{ivi.prop_setter(property, zone_class, model_interface = true)}}
{
m_{{property}} = {{property}};
- emit m_parent->{{property}}Changed({{property}}, m_zone);
+ Q_EMIT m_parent->{{property}}Changed({{property}}, m_zone);
}
{% endfor %}
{% endif %}
@@ -153,7 +153,7 @@ void {{class}}::initialize()
{
{% for property in interface.properties %}
{% if property.type.is_model %}
- emit {{property}}Changed(m_{{property}});
+ Q_EMIT {{property}}Changed(m_{{property}});
{% endif %}
{% endfor %}
@@ -167,10 +167,10 @@ void {{class}}::initialize()
if (m_replica->isInitialized()) {
{% for property in interface.properties %}
{% if not property.is_model %}
- emit {{property}}Changed(m_replica->{{property}}());
+ Q_EMIT {{property}}Changed(m_replica->{{property}}());
{% endif %}
{% endfor %}
- emit initializationDone();
+ Q_EMIT initializationDone();
}
{% endif %}
@@ -198,7 +198,7 @@ void {{class}}::syncZones()
m_zoneMap.insert(zone, zoneObject);
connect(zoneObject, &{{zone_class}}::syncDone, this, &{{class}}::onZoneSyncDone);
}
- emit availableZonesChanged(m_zones);
+ Q_EMIT availableZonesChanged(m_zones);
for (const QString& zone : m_zoneMap.keys())
m_zoneMap.value(zone)->sync();
@@ -259,7 +259,7 @@ QStringList {{class}}::availableZones() const
//Pass an empty std::function to only handle errors.
iviReply.then(std::function<void({{operation|return_type}})>(), [this]() {
- emit errorChanged(QIviAbstractFeature::InvalidOperation, QStringLiteral("{{class}}, remote call of method {{operation}} failed"));
+ Q_EMIT errorChanged(QIviAbstractFeature::InvalidOperation, QStringLiteral("{{class}}, remote call of method {{operation}} failed"));
});
return iviReply;
}
@@ -352,7 +352,7 @@ void {{class}}::onZoneSyncDone()
for (const QString& zone : zones)
m_zoneMap.value(zone)->emitCurrentState();
- emit initializationDone();
+ Q_EMIT initializationDone();
}
{% endif %}
diff --git a/src/tools/ivigenerator/templates_backend_qtro/backend.h.tpl b/src/tools/ivigenerator/templates_backend_qtro/backend.h.tpl
index 69e808a..7020177 100644
--- a/src/tools/ivigenerator/templates_backend_qtro/backend.h.tpl
+++ b/src/tools/ivigenerator/templates_backend_qtro/backend.h.tpl
@@ -82,7 +82,7 @@ public Q_SLOTS:
{% endfor %}
void emitCurrentState();
-signals:
+Q_SIGNALS:
void syncDone();
private:
diff --git a/src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl b/src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl
index 2816d38..6a20585 100644
--- a/src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl
+++ b/src/tools/ivigenerator/templates_backend_qtro/pagingmodel.cpp.tpl
@@ -60,7 +60,7 @@ void {{class}}::initialize()
return;
if (m_replica->isInitialized())
- emit initializationDone();
+ Q_EMIT initializationDone();
}
void {{class}}::registerInstance(const QUuid &identifier)
diff --git a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
index 545566e..40a9b3c 100644
--- a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
+++ b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
@@ -162,10 +162,10 @@ void {{class}}Private::clearToDefaults()
auto model = new QIviPagingModel();
model->setServiceObject(new QIviProxyServiceObject({ {QIviPagingModel_iid, {{property}} } }));;
{{class}}Private::get(f)->m_{{property}} = model;
- emit f->{{property}}Changed(model);
+ Q_EMIT f->{{property}}Changed(model);
} else {
{{class}}Private::get(f)->m_{{property}} = nullptr;
- emit f->{{property}}Changed(nullptr);
+ Q_EMIT f->{{property}}Changed(nullptr);
}
if (old) {
delete old->serviceObject();
@@ -174,7 +174,7 @@ void {{class}}Private::clearToDefaults()
{% else %}
if ({{class}}Private::get(f)->m_{{property}} != {{property}}) {
{{class}}Private::get(f)->m_{{property}} = {{property}};
- emit f->{{property}}Changed({{property}});
+ Q_EMIT f->{{property}}Changed({{property}});
}
{% endif %}
}
@@ -188,11 +188,11 @@ void {{class}}Private::clearToDefaults()
model->setServiceObject(new QIviProxyServiceObject({ {QIviPagingModel_iid, {{property}} } }));
m_{{property}} = model;
auto q = getParent();
- emit q->{{property}}Changed(model);
+ Q_EMIT q->{{property}}Changed(model);
} else {
m_{{property}} = nullptr;
auto q = getParent();
- emit q->{{property}}Changed(nullptr);
+ Q_EMIT q->{{property}}Changed(nullptr);
}
if (old) {
delete old->serviceObject();
@@ -202,7 +202,7 @@ void {{class}}Private::clearToDefaults()
if (m_{{property}} != {{property}}) {
auto q = getParent();
m_{{property}} = {{property}};
- emit q->{{property}}Changed({{property}});
+ Q_EMIT q->{{property}}Changed({{property}});
}
{% endif %}
}
@@ -220,13 +220,13 @@ void {{class}}Private::on{{signal|upperfirst}}({{ivi.join_params(signal, true)}}
f = q;
if (f->zone() != zone)
return;
- emit f->{{signal}}({{signal.parameters|join(', ')}});
+ Q_EMIT f->{{signal}}({{signal.parameters|join(', ')}});
}
{% else %}
void {{class}}Private::on{{signal|upperfirst}}({{ivi.join_params(signal)}})
{
auto q = getParent();
- emit q->{{signal}}({{signal.parameters|join(', ')}});
+ Q_EMIT q->{{signal}}({{signal.parameters|join(', ')}});
}
{% endif %}
@@ -239,7 +239,7 @@ bool {{class}}Private::notify(const QByteArray &propertyName, const QVariant &va
auto q = getParent();
{% for property in interface.properties %}
if (propertyName == QByteArray("{{property}}")) {
- emit q->{{property}}Changed(value.value<{{property|return_type}}>());
+ Q_EMIT q->{{property}}Changed(value.value<{{property|return_type}}>());
return true;
}
{% endfor %}
@@ -352,7 +352,7 @@ void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minor
if (Q_UNLIKELY(d->m_propertyOverride)) {
const int pi = metaObject()->indexOfProperty("{{property}}");
if (d->m_propertyOverride->isOverridden(pi)) {
- emit {{property}}Changed(d->m_propertyOverride->property(pi).value<{{property|return_type}}>());
+ Q_EMIT {{property}}Changed(d->m_propertyOverride->property(pi).value<{{property|return_type}}>());
return;
}
forceUpdate = property("{{property}}DirtyOverride").isValid();
@@ -367,7 +367,7 @@ void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minor
if ({{class}}BackendInterface *backend = {{interface|lower}}Backend())
backend->{{property|setter_name}}({{property}}{% if interface.tags.config.zoned %}, zone(){% endif %});
else
- emit {{property}}Changed(d->m_{{property}});
+ Q_EMIT {{property}}Changed(d->m_{{property}});
}
{% endif %}
diff --git a/src/tools/ivigenerator/templates_test/pagingmodel.h.tpl b/src/tools/ivigenerator/templates_test/pagingmodel.h.tpl
index 74bfbfb..e3d29ef 100644
--- a/src/tools/ivigenerator/templates_test/pagingmodel.h.tpl
+++ b/src/tools/ivigenerator/templates_test/pagingmodel.h.tpl
@@ -62,12 +62,12 @@ public:
void initialize() override
{
- emit initializationDone();
+ Q_EMIT initializationDone();
}
void registerInstance(const QUuid &identifier) override
{
- emit countChanged(identifier, 100);
+ Q_EMIT countChanged(identifier, 100);
}
void unregisterInstance(const QUuid &identifier) override
@@ -82,7 +82,7 @@ public:
for(int i=start; i < max; i++)
list.append(m_list.at(i));
- emit dataFetched(identifier, list, start, max < m_list.count());
+ Q_EMIT dataFetched(identifier, list, start, max < m_list.count());
}
private:
diff --git a/src/tools/ivigenerator/templates_test/tst_test.cpp.tpl b/src/tools/ivigenerator/templates_test/tst_test.cpp.tpl
index fcccdc8..f6834ea 100644
--- a/src/tools/ivigenerator/templates_test/tst_test.cpp.tpl
+++ b/src/tools/ivigenerator/templates_test/tst_test.cpp.tpl
@@ -89,18 +89,18 @@ public:
void initialize() override
{
{% for property in interface.properties %}
- emit {{property}}Changed(m_{{property}}{% if interface.tags.config.zoned %}, QString(){% endif %});
+ Q_EMIT {{property}}Changed(m_{{property}}{% if interface.tags.config.zoned %}, QString(){% endif %});
{% endfor%}
{% if interface.tags.config.zoned %}
QStringList zones = availableZones();
for (const QString &zone : qAsConst(zones)) {
{% for property in interface.properties %}
- emit {{property}}Changed(m_zone{{property|upperfirst}}[zone], zone);
+ Q_EMIT {{property}}Changed(m_zone{{property|upperfirst}}[zone], zone);
{% endfor %}
}
{% endif %}
- emit initializationDone();
+ Q_EMIT initializationDone();
}
{% if interface.tags.config.zoned %}
@@ -112,14 +112,14 @@ public:
if (!m_zone{{property|upperfirst}}.contains(z)) {
if (m_{{property}} != {{property}}) {
m_{{property}} = {{property}};
- emit {{property}}Changed(m_{{property}}, z);
+ Q_EMIT {{property}}Changed(m_{{property}}, z);
}
return;
}
if (m_zone{{property|upperfirst}}[z] != {{property}}){
m_zone{{property|upperfirst}}[z] = {{property}};
- emit {{property}}Changed(m_zone{{property|upperfirst}}[z], z);
+ Q_EMIT {{property}}Changed(m_zone{{property|upperfirst}}[z], z);
}
}
{% endif %}
@@ -132,7 +132,7 @@ public:
{
if (m_{{property}} != {{property}}) {
m_{{property}} = {{property}};
- emit {{property}}Changed(m_{{property}});
+ Q_EMIT {{property}}Changed(m_{{property}});
}
}
{% endif %}
@@ -142,7 +142,7 @@ public:
{% for signal in interface.signals %}
virtual void trigger{{signal|upperfirst}}({{ivi.join_params(signal, interface_zoned)}})
{
- emit {{signal}}({% if signal.parameters|length %}{{signal.parameters|join(', ')}}{% endif %}{%
+ Q_EMIT {{signal}}({% if signal.parameters|length %}{{signal.parameters|join(', ')}}{% endif %}{%
if interface_zoned %}{%if signal.parameters|length %}, {%endif%} zone{% endif %});
}
{% endfor %}
@@ -150,7 +150,7 @@ public:
{% for operation in interface.operations %}
virtual {{ivi.operation(operation, zoned = interface_zoned)}} override
{
- emit {{operation}}Called({% if operation.parameters|length %}{{operation.parameters|join(', ')}}{% endif %}{%
+ Q_EMIT {{operation}}Called({% if operation.parameters|length %}{{operation.parameters|join(', ')}}{% endif %}{%
if interface_zoned %}{%if operation.parameters|length %}, {%endif%} zone{% endif %});
return QIviPendingReply<{{operation|return_type}}>::createFailedReply();
@@ -223,7 +223,7 @@ public:
void initialize() override
{
- emit initializationDone();
+ Q_EMIT initializationDone();
}
};
diff --git a/src/tools/ivigenerator/templates_test/tst_test.h.tpl b/src/tools/ivigenerator/templates_test/tst_test.h.tpl
index 3ab2430..69d0443 100644
--- a/src/tools/ivigenerator/templates_test/tst_test.h.tpl
+++ b/src/tools/ivigenerator/templates_test/tst_test.h.tpl
@@ -50,7 +50,7 @@ class {{interface}}Test : public QObject
public:
{{interface}}Test();
-private slots:
+private Q_SLOTS:
void init();
void testInitBackend();