summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2020-01-14 13:54:51 +0100
committerDominik Holland <dominik.holland@qt.io>2020-01-14 16:08:15 +0100
commit2159e80e333ae350fc9b84a454b0076c2d4085c9 (patch)
treeca609179c907cd2333649e4a2008f29645bcbc69 /src
parentf64edefbde38aac07270a3fc3244a48cbb9c4340 (diff)
downloadqtivi-2159e80e333ae350fc9b84a454b0076c2d4085c9.tar.gz
ivigenerator: Register the equals comparator of all structs to the meta type system
Change-Id: I9210fbb1ec14dd41bdc2fcc605e4288fa085b130 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/tools/ivigenerator/templates/frontend/module.cpp.tpl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tools/ivigenerator/templates/frontend/module.cpp.tpl b/src/tools/ivigenerator/templates/frontend/module.cpp.tpl
index 9d42137..ec0f87b 100644
--- a/src/tools/ivigenerator/templates/frontend/module.cpp.tpl
+++ b/src/tools/ivigenerator/templates/frontend/module.cpp.tpl
@@ -113,6 +113,11 @@ QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
/*! \internal */
void {{class}}::registerTypes()
{
+ static bool once = false;
+ if (once)
+ return;
+ once = true;
+
{% for import in module.imports %}
{# All imports are provided including their imported version e.g. "Common 1.0". Because we need
to access the Module type, we first need to split the version and then search for the name.
@@ -139,6 +144,7 @@ void {{class}}::registerTypes()
{% for struct in module.structs %}
qRegisterMetaType<{{struct}}>();
qRegisterMetaTypeStreamOperators<{{struct}}>();
+ QMetaType::registerEqualsComparator<{{struct}}>();
qIviRegisterPendingReplyType<{{struct}}>();
{% endfor %}
}