summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/moc
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-08-11 10:45:51 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2024-01-26 14:51:35 +0100
commitac001bef798b79f4932d7ca8f4fb812159ba75ca (patch)
tree1cf783aa9235c4cf72e64d3775957ee6d621870c /tests/auto/tools/moc
parent941afac108aded21ea50caeec0b72291fcad7d59 (diff)
moc/QMetaProperty: Remove limitation on non-own-class notify signals
The moc generated code does a sanity check that NOTIFY signals actually exist in the parent class when they cannot be found in the class moc currently runs on. The logic there was however too simplistic, and couldn't deal with signals taking a parameter. Fix this, and take the opportunity to use a proper static_assert instead of generating a "normal" compile error. We do not do any checks for the presence of QPrivateSignal, as the whole point of QPrivateSignal is that it should be private (and not e.g. protected). Moreover, we adjust QMetaProperty::notifySignalIndex to take single-argument notify methods into consideration as well when encontering an unresolved notify index. Fixes: QTBUG-115989 Pick-to: 6.7 Change-Id: I8a056a15777f3132691e207b4b9ab6c2c9b2126d Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/tools/moc')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 3a72e9bf4b..1726d09678 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -257,6 +257,24 @@ public:
CreatableGadget creatableGadget; // Force the compiler to use the constructor
+struct ParentWithSignalWithArgument : QObject {
+ Q_OBJECT
+ Q_PROPERTY(int i READ i WRITE setI NOTIFY iChanged)
+
+public:
+ int i() const {return 0;}
+ void setI(int) {}
+
+signals:
+ void iChanged(int);
+};
+
+struct SignalWithArgumentInParent : ParentWithSignalWithArgument
+{
+ Q_OBJECT
+ Q_PROPERTY(int otherI READ i WRITE setI NOTIFY iChanged)
+};
+
struct MyStruct {};
struct MyStruct2 {};