aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/referenceexamples
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-03-10 15:09:37 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-03-12 15:03:03 +0100
commit26c5243491f495194f04b449128dae36118e28da (patch)
tree7fb14678a6fc9e44a10c9224d005e2cbdc6bcb63 /examples/qml/referenceexamples
parent1c7d264e3b2e9a2f0021786ea6967185f8282af0 (diff)
parentc24c5baeda4101b0058689adf9200b77a722c3a2 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts: dependencies.yaml src/qml/qml/qqmlengine.cpp Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
Diffstat (limited to 'examples/qml/referenceexamples')
-rw-r--r--examples/qml/referenceexamples/attached/birthdayparty.cpp2
-rw-r--r--examples/qml/referenceexamples/binding/birthdayparty.cpp2
-rw-r--r--examples/qml/referenceexamples/binding/example.qml2
-rw-r--r--examples/qml/referenceexamples/coercion/birthdayparty.cpp2
-rw-r--r--examples/qml/referenceexamples/default/birthdayparty.cpp2
-rw-r--r--examples/qml/referenceexamples/grouped/birthdayparty.cpp2
-rw-r--r--examples/qml/referenceexamples/methods/birthdayparty.cpp2
-rw-r--r--examples/qml/referenceexamples/properties/birthdayparty.cpp24
-rw-r--r--examples/qml/referenceexamples/properties/birthdayparty.h4
-rw-r--r--examples/qml/referenceexamples/signal/birthdayparty.cpp2
-rw-r--r--examples/qml/referenceexamples/signal/example.qml2
-rw-r--r--examples/qml/referenceexamples/valuesource/birthdayparty.cpp2
-rw-r--r--examples/qml/referenceexamples/valuesource/example.qml2
13 files changed, 38 insertions, 12 deletions
diff --git a/examples/qml/referenceexamples/attached/birthdayparty.cpp b/examples/qml/referenceexamples/attached/birthdayparty.cpp
index da0cb800fc..888aafbc18 100644
--- a/examples/qml/referenceexamples/attached/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/attached/birthdayparty.cpp
@@ -81,7 +81,7 @@ void BirthdayParty::setHost(Person *c)
QQmlListProperty<Person> BirthdayParty::guests()
{
- return {this, m_guests};
+ return {this, &m_guests};
}
int BirthdayParty::guestCount() const
diff --git a/examples/qml/referenceexamples/binding/birthdayparty.cpp b/examples/qml/referenceexamples/binding/birthdayparty.cpp
index 866c1f6968..cfedf84be0 100644
--- a/examples/qml/referenceexamples/binding/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/binding/birthdayparty.cpp
@@ -87,7 +87,7 @@ void BirthdayParty::setHost(Person *c)
QQmlListProperty<Person> BirthdayParty::guests()
{
- return QQmlListProperty<Person>(this, m_guests);
+ return QQmlListProperty<Person>(this, &m_guests);
}
int BirthdayParty::guestCount() const
diff --git a/examples/qml/referenceexamples/binding/example.qml b/examples/qml/referenceexamples/binding/example.qml
index a89b4bc02e..b45ef6881b 100644
--- a/examples/qml/referenceexamples/binding/example.qml
+++ b/examples/qml/referenceexamples/binding/example.qml
@@ -62,7 +62,7 @@ BirthdayParty {
shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 }
}
// ![0]
- onPartyStarted: console.log("This party started rockin' at " + time);
+ onPartyStarted: (time) => { console.log("This party started rockin' at " + time); }
Boy {
diff --git a/examples/qml/referenceexamples/coercion/birthdayparty.cpp b/examples/qml/referenceexamples/coercion/birthdayparty.cpp
index 1bae55076c..81db8ab1b8 100644
--- a/examples/qml/referenceexamples/coercion/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/coercion/birthdayparty.cpp
@@ -66,7 +66,7 @@ void BirthdayParty::setHost(Person *c)
QQmlListProperty<Person> BirthdayParty::guests()
{
- return {this, m_guests};
+ return {this, &m_guests};
}
int BirthdayParty::guestCount() const
diff --git a/examples/qml/referenceexamples/default/birthdayparty.cpp b/examples/qml/referenceexamples/default/birthdayparty.cpp
index 1bae55076c..81db8ab1b8 100644
--- a/examples/qml/referenceexamples/default/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/default/birthdayparty.cpp
@@ -66,7 +66,7 @@ void BirthdayParty::setHost(Person *c)
QQmlListProperty<Person> BirthdayParty::guests()
{
- return {this, m_guests};
+ return {this, &m_guests};
}
int BirthdayParty::guestCount() const
diff --git a/examples/qml/referenceexamples/grouped/birthdayparty.cpp b/examples/qml/referenceexamples/grouped/birthdayparty.cpp
index 1bae55076c..81db8ab1b8 100644
--- a/examples/qml/referenceexamples/grouped/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/grouped/birthdayparty.cpp
@@ -66,7 +66,7 @@ void BirthdayParty::setHost(Person *c)
QQmlListProperty<Person> BirthdayParty::guests()
{
- return {this, m_guests};
+ return {this, &m_guests};
}
int BirthdayParty::guestCount() const
diff --git a/examples/qml/referenceexamples/methods/birthdayparty.cpp b/examples/qml/referenceexamples/methods/birthdayparty.cpp
index 7e750e4f4b..4b30d31aeb 100644
--- a/examples/qml/referenceexamples/methods/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/methods/birthdayparty.cpp
@@ -67,7 +67,7 @@ void BirthdayParty::setHost(Person *c)
QQmlListProperty<Person> BirthdayParty::guests()
{
- return {this, m_guests};
+ return {this, &m_guests};
}
int BirthdayParty::guestCount() const
diff --git a/examples/qml/referenceexamples/properties/birthdayparty.cpp b/examples/qml/referenceexamples/properties/birthdayparty.cpp
index 9abb08dbd9..fe6abab3f5 100644
--- a/examples/qml/referenceexamples/properties/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/properties/birthdayparty.cpp
@@ -71,7 +71,9 @@ QQmlListProperty<Person> BirthdayParty::guests()
&BirthdayParty::appendGuest,
&BirthdayParty::guestCount,
&BirthdayParty::guest,
- &BirthdayParty::clearGuests};
+ &BirthdayParty::clearGuests,
+ &BirthdayParty::replaceGuest,
+ &BirthdayParty::removeLastGuest};
}
void BirthdayParty::appendGuest(Person* p) {
@@ -93,6 +95,16 @@ void BirthdayParty::clearGuests() {
m_guests.clear();
}
+void BirthdayParty::replaceGuest(int index, Person *p)
+{
+ m_guests[index] = p;
+}
+
+void BirthdayParty::removeLastGuest()
+{
+ m_guests.removeLast();
+}
+
// ![0]
void BirthdayParty::appendGuest(QQmlListProperty<Person>* list, Person* p) {
@@ -103,6 +115,16 @@ void BirthdayParty::clearGuests(QQmlListProperty<Person>* list) {
reinterpret_cast< BirthdayParty* >(list->data)->clearGuests();
}
+void BirthdayParty::replaceGuest(QQmlListProperty<Person> *list, int i, Person *p)
+{
+ reinterpret_cast< BirthdayParty* >(list->data)->replaceGuest(i, p);
+}
+
+void BirthdayParty::removeLastGuest(QQmlListProperty<Person> *list)
+{
+ reinterpret_cast< BirthdayParty* >(list->data)->removeLastGuest();
+}
+
Person* BirthdayParty::guest(QQmlListProperty<Person>* list, int i) {
return reinterpret_cast< BirthdayParty* >(list->data)->guest(i);
}
diff --git a/examples/qml/referenceexamples/properties/birthdayparty.h b/examples/qml/referenceexamples/properties/birthdayparty.h
index fb8b63a79d..a5704972cc 100644
--- a/examples/qml/referenceexamples/properties/birthdayparty.h
+++ b/examples/qml/referenceexamples/properties/birthdayparty.h
@@ -79,12 +79,16 @@ public:
int guestCount() const;
Person *guest(int) const;
void clearGuests();
+ void replaceGuest(int, Person*);
+ void removeLastGuest();
private:
static void appendGuest(QQmlListProperty<Person>*, Person*);
static int guestCount(QQmlListProperty<Person>*);
static Person* guest(QQmlListProperty<Person>*, int);
static void clearGuests(QQmlListProperty<Person>*);
+ static void replaceGuest(QQmlListProperty<Person>*, int, Person*);
+ static void removeLastGuest(QQmlListProperty<Person>*);
Person *m_host;
QVector<Person *> m_guests;
diff --git a/examples/qml/referenceexamples/signal/birthdayparty.cpp b/examples/qml/referenceexamples/signal/birthdayparty.cpp
index 9d34cdf146..405c8af940 100644
--- a/examples/qml/referenceexamples/signal/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/signal/birthdayparty.cpp
@@ -82,7 +82,7 @@ void BirthdayParty::setHost(Person *c)
QQmlListProperty<Person> BirthdayParty::guests()
{
- return {this, m_guests};
+ return {this, &m_guests};
}
int BirthdayParty::guestCount() const
diff --git a/examples/qml/referenceexamples/signal/example.qml b/examples/qml/referenceexamples/signal/example.qml
index 42d6c44939..5d80d58867 100644
--- a/examples/qml/referenceexamples/signal/example.qml
+++ b/examples/qml/referenceexamples/signal/example.qml
@@ -53,7 +53,7 @@ import QtQuick 2.0 // For QColor
BirthdayParty {
// ![0]
- onPartyStarted: console.log("This party started rockin' at " + time);
+ onPartyStarted: (time) => { console.log("This party started rockin' at " + time); }
// ![0]
host: Boy {
diff --git a/examples/qml/referenceexamples/valuesource/birthdayparty.cpp b/examples/qml/referenceexamples/valuesource/birthdayparty.cpp
index 68d5767e8d..6a5e67aa0d 100644
--- a/examples/qml/referenceexamples/valuesource/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/valuesource/birthdayparty.cpp
@@ -82,7 +82,7 @@ void BirthdayParty::setHost(Person *c)
QQmlListProperty<Person> BirthdayParty::guests()
{
- return {this, m_guests};
+ return {this, &m_guests};
}
int BirthdayParty::guestCount() const
diff --git a/examples/qml/referenceexamples/valuesource/example.qml b/examples/qml/referenceexamples/valuesource/example.qml
index 0abb76261c..65d511058a 100644
--- a/examples/qml/referenceexamples/valuesource/example.qml
+++ b/examples/qml/referenceexamples/valuesource/example.qml
@@ -56,7 +56,7 @@ BirthdayParty {
HappyBirthdaySong on announcement { name: "Bob Jones" }
// ![0]
- onPartyStarted: console.log("This party started rockin' at " + time);
+ onPartyStarted: (time) => { console.log("This party started rockin' at " + time); }
host: Boy {