aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlplugindump/main.cpp
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2023-08-10 09:45:37 +0200
committerSami Shalayel <sami.shalayel@qt.io>2023-08-15 12:13:31 +0000
commita1ce0596e517e84913b14ab23422137c95b8c785 (patch)
treea7a012aa8a0d260c6f464c6b5dc722806697fa4c /tools/qmlplugindump/main.cpp
parent8d6f9e716d1c3fdd05ac14612583359313b9dc6e (diff)
Replace signal name manipulations with QQmlSignalNames
Remove custom implementations found in qqmljs* and use the static helper methods from qqmlsignalnames_p.h instead. This sometimes requires to move some code around to avoid bugs with property that do not have letters in their name. Add a warning in the JS implementation of the SignalSpy.qml that the used heuristic might fail on certain signal names. Add tests in in tst_qqmllanguage to see if the property change handlers work correctly for weird names. Change-Id: I4dc73c34df7f77f529511fa04ab5fcc5385b59fc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qmlplugindump/main.cpp')
-rw-r--r--tools/qmlplugindump/main.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 42b9544b04..4031bf91d9 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -30,6 +30,7 @@
#include <QtCore/private/qobject_p.h>
#include <QtCore/private/qmetaobject_p.h>
#include <QtQmlTypeRegistrar/private/qqmljsstreamwriter_p.h>
+#include <QtQml/private/qqmlsignalnames_p.h>
#include <QRegularExpression>
#include <iostream>
@@ -690,10 +691,13 @@ private:
for (int index = meta->propertyOffset(); index < meta->propertyCount(); ++index) {
const QMetaProperty &property = meta->property(index);
dump(property, metaRevision, knownAttributes);
+ const QByteArray changedSignalName =
+ QQmlSignalNames::propertyNameToChangedSignalName(property.name());
if (knownAttributes)
- knownAttributes->knownMethod(QByteArray(property.name()).append("Changed"),
- 0, QTypeRevision::fromEncodedVersion(property.revision()));
- implicitSignals.insert(QString("%1Changed").arg(QString::fromUtf8(property.name())));
+ knownAttributes->knownMethod(
+ changedSignalName, 0,
+ QTypeRevision::fromEncodedVersion(property.revision()));
+ implicitSignals.insert(changedSignalName);
}
return implicitSignals;
}