aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmltyperegistrar/foo.h
diff options
context:
space:
mode:
authorSami Shalayel <sami.shalayel@qt.io>2022-10-12 15:56:00 +0200
committerSami Shalayel <sami.shalayel@qt.io>2022-11-11 17:33:12 +0100
commitfa1a28852369786a580cc7e0e37bc36dc905b81d (patch)
tree09e89800f308fd11c0d5e29a226375387c962d33 /tests/auto/qml/qmltyperegistrar/foo.h
parentedc01fbfa430d6f0ce66f1871ab28e0f691ee252 (diff)
qmltyperegistrar: add IsConstant for method parameters
Mark method parameters with IsConstant instead of including "const " in the typename, which makes type resolution in the qml compilers impossible. This also avoids a crash in qmltc happening when qmltc sees a signal defined in C++ that has a const parameter. When qmltyperegistrar writes out the types in the qmltypes, check if it starts with a const, remove it and add instead IsConstant: true. The name returned by MOC is normalized so no need to check for "volatile const" or "const volatile" (its always the latter) and no need to filter out for extra whitespace. Once the const is read by the qmltypes reader, propagate the const-information around using a newly introduced enum called QQmlJSMetaMethod::PConstness that can currently be Const or NonConst. Also add the isConstant property to the Parameter.qml in the tooling module. Add a test to see if the IsConstant information is written into the qmltypes. This is also required for QTBUG-107625. Fixes: QTBUG-108147 Task-number: QTBUG-107625 Change-Id: I13bda0a27fe83867f259b751468788128fec82ed Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmltyperegistrar/foo.h')
-rw-r--r--tests/auto/qml/qmltyperegistrar/foo.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qml/qmltyperegistrar/foo.h b/tests/auto/qml/qmltyperegistrar/foo.h
index 57b771e4eb..7872c35c17 100644
--- a/tests/auto/qml/qmltyperegistrar/foo.h
+++ b/tests/auto/qml/qmltyperegistrar/foo.h
@@ -12,6 +12,12 @@ class Bbb : public QObject
Q_OBJECT
public:
Bbb(QObject *parent = nullptr) : QObject(parent) {}
+
+Q_SIGNALS:
+ void mySignal(QObject *myObject, const QObject *myConstObject, QObject const *myConstObject2,
+ QObject *const myObject2, const QObject *const myConstObject3);
+ void myVolatileSignal(volatile const QObject *a, const volatile QObject *b,
+ volatile QObject *nonConst);
};
class Ccc : public QObject