diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-11-27 16:03:41 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-07 16:23:31 +0000 |
commit | 391dc40bd25133c9b7fdd9822a013fae2683d8a6 (patch) | |
tree | bb25010f7316d6ac8e8238ba1e488e1c80b407b4 /tests/auto/corelib | |
parent | 0566e66e887f230cec2632a8129246511d12b267 (diff) |
Make the signal argument in Q_OBJECT_BINDABLE_PROPERTY optional
The intention was always that you can define properties that do
not require a changed signal. But having to explicitly pass
a nullptr as signal parameter into the macro is ugly, so
use the cool QT_OVERLOADED_MACRO to make it optional.
Change-Id: I0ce366d043850f983c968d73c544d89933c48df9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit cb39ea05810bc207100018589da658a0cce98edb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp index 3cc7bd6f9c..5ae92e8981 100644 --- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp +++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp @@ -999,20 +999,18 @@ class MyQObject : public QObject Q_OBJECT Q_PROPERTY(int foo READ foo WRITE setFoo BINDABLE bindableFoo NOTIFY fooChanged) Q_PROPERTY(int bar READ bar WRITE setBar BINDABLE bindableBar NOTIFY barChanged) - Q_PROPERTY(int read READ read NOTIFY readChanged) + Q_PROPERTY(int read READ read) Q_PROPERTY(int computed READ computed STORED false) Q_PROPERTY(int compat READ compat WRITE setCompat NOTIFY compatChanged) signals: void fooChanged(); void barChanged(); - void readChanged(); void compatChanged(); public slots: void fooHasChanged() { fooChangedCount++; } void barHasChanged() { barChangedCount++; } - void readHasChanged() { readChangedCount++; } void compatHasChanged() { compatChangedCount++; } public: @@ -1044,13 +1042,12 @@ public: public: int fooChangedCount = 0; int barChangedCount = 0; - int readChangedCount = 0; int compatChangedCount = 0; int setCompatCalled = 0; Q_OBJECT_BINDABLE_PROPERTY(MyQObject, int, fooData, &MyQObject::fooChanged); Q_OBJECT_BINDABLE_PROPERTY(MyQObject, int, barData, &MyQObject::barChanged); - Q_OBJECT_BINDABLE_PROPERTY(MyQObject, int, readData, &MyQObject::readChanged); + Q_OBJECT_BINDABLE_PROPERTY(MyQObject, int, readData); Q_OBJECT_COMPUTED_PROPERTY(MyQObject, int, computedData, &MyQObject::computed); Q_OBJECT_COMPAT_PROPERTY(MyQObject, int, compatData, &MyQObject::setCompat) }; @@ -1060,7 +1057,6 @@ void tst_QProperty::testNewStuff() MyQObject object; QObject::connect(&object, &MyQObject::fooChanged, &object, &MyQObject::fooHasChanged); QObject::connect(&object, &MyQObject::barChanged, &object, &MyQObject::barHasChanged); - QObject::connect(&object, &MyQObject::readChanged, &object, &MyQObject::readHasChanged); QCOMPARE(object.fooChangedCount, 0); object.setFoo(10); |