aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/data
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-05-15 09:58:15 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-05-15 10:46:27 +0200
commite6dd62ff191de0276d2dee5d6b1a073b4d63c4cb (patch)
tree8c49e0ee9f548ecf11ceb7d30098faa092189839 /tests/auto/qml/qmlcppcodegen/data
parentce85cb16160394d616bc3dc4bf2a8915ec63b036 (diff)
QmlCompiler: Do check specificType on SetLookup
We may have implicitly invalidated it when shadow-checking. Amends commit b3281f123ea5a8c0e5f8c63fa1568cf7414f9c14. Change-Id: Ia5c54a3a0fa97c61e947ecb0a5b21d410e1bf19a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/data')
-rw-r--r--tests/auto/qml/qmlcppcodegen/data/failures.qml5
-rw-r--r--tests/auto/qml/qmlcppcodegen/data/person.cpp13
-rw-r--r--tests/auto/qml/qmlcppcodegen/data/person.h8
3 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/failures.qml b/tests/auto/qml/qmlcppcodegen/data/failures.qml
index e6f3af5e87..f0dff85301 100644
--- a/tests/auto/qml/qmlcppcodegen/data/failures.qml
+++ b/tests/auto/qml/qmlcppcodegen/data/failures.qml
@@ -83,6 +83,11 @@ QtObject {
return a;
}
+ property Person shadowable
+ function setLookupOnShadowable() {
+ shadowable.area.width = 16
+ }
+
// TODO: Drop these once we can manipulate QVariant-wrapped lists.
property list<withLength> withLengths
property int l: withLengths.length
diff --git a/tests/auto/qml/qmlcppcodegen/data/person.cpp b/tests/auto/qml/qmlcppcodegen/data/person.cpp
index 4dcd6fd56f..f6353d9b67 100644
--- a/tests/auto/qml/qmlcppcodegen/data/person.cpp
+++ b/tests/auto/qml/qmlcppcodegen/data/person.cpp
@@ -98,3 +98,16 @@ void Person::setCousins(const QList<Person *> &newCousins)
m_cousins = newCousins;
emit cousinsChanged();
}
+
+QRectF Person::area() const
+{
+ return m_area;
+}
+
+void Person::setArea(const QRectF &newArea)
+{
+ if (m_area == newArea)
+ return;
+ m_area = newArea;
+ emit areaChanged();
+}
diff --git a/tests/auto/qml/qmlcppcodegen/data/person.h b/tests/auto/qml/qmlcppcodegen/data/person.h
index b30b7e024b..2f3b28eb66 100644
--- a/tests/auto/qml/qmlcppcodegen/data/person.h
+++ b/tests/auto/qml/qmlcppcodegen/data/person.h
@@ -8,6 +8,7 @@
#include <QtQml/qqml.h>
#include <QtQml/qqmlengine.h>
#include <QtCore/qproperty.h>
+#include <QtCore/qrect.h>
// Intentionally opaque type
class Barzle : public QObject {};
@@ -22,6 +23,7 @@ class Person : public QObject
Q_PROPERTY(QList<Barzle *> barzles READ barzles WRITE setBarzles NOTIFY barzlesChanged FINAL)
Q_PROPERTY(QList<Person *> cousins READ cousins WRITE setCousins NOTIFY cousinsChanged FINAL)
Q_PROPERTY(QByteArray data READ data WRITE setData NOTIFY dataChanged FINAL)
+ Q_PROPERTY(QRectF area READ area WRITE setArea NOTIFY areaChanged) // not FINAL
QML_ELEMENT
public:
Person(QObject *parent = nullptr);
@@ -52,6 +54,9 @@ public:
QList<Person *> cousins() const;
void setCousins(const QList<Person *> &newCousins);
+ QRectF area() const;
+ void setArea(const QRectF &newArea);
+
signals:
void nameChanged();
void shoeSizeChanged();
@@ -65,6 +70,8 @@ signals:
void objectListHappened(const QList<QObject *> &);
void variantListHappened(const QList<QVariant> &);
+ void areaChanged();
+
private:
QString m_name;
int m_shoeSize;
@@ -72,6 +79,7 @@ private:
QList<Barzle *> m_barzles;
QList<Person *> m_cousins;
QProperty<QByteArray> m_data;
+ QRectF m_area;
};
class BarzleListRegistration