diff options
| author | Sami Shalayel <sami.shalayel@qt.io> | 2023-08-10 09:45:37 +0200 |
|---|---|---|
| committer | Sami Shalayel <sami.shalayel@qt.io> | 2023-08-15 12:13:31 +0000 |
| commit | a1ce0596e517e84913b14ab23422137c95b8c785 (patch) | |
| tree | a7a012aa8a0d260c6f464c6b5dc722806697fa4c /src/qmlcompiler/qqmljscompiler.cpp | |
| parent | 8d6f9e716d1c3fdd05ac14612583359313b9dc6e (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 'src/qmlcompiler/qqmljscompiler.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljscompiler.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp index 9dfe7010b0..2f1bc7a391 100644 --- a/src/qmlcompiler/qqmljscompiler.cpp +++ b/src/qmlcompiler/qqmljscompiler.cpp @@ -19,6 +19,8 @@ #include <QtCore/qfileinfo.h> #include <QtCore/qloggingcategory.h> +#include <QtQml/private/qqmlsignalnames_p.h> + #include <limits> QT_BEGIN_NAMESPACE @@ -123,9 +125,7 @@ static bool checkArgumentsObjectUseInSignalHandlers(const QmlIR::Document &doc, if (binding->type() != QV4::CompiledData::Binding::Type_Script) continue; const QString propName = doc.stringAt(binding->propertyNameIndex); - if (!propName.startsWith(QLatin1String("on")) - || propName.size() < 3 - || !propName.at(2).isUpper()) + if (!QQmlSignalNames::isHandlerName(propName)) continue; auto compiledFunction = doc.jsModule.functions.value(object->runtimeFunctionIndices.at(binding->value.compiledScriptIndex)); if (!compiledFunction) |
