aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/referenceexamples/properties/birthdayparty.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/referenceexamples/properties/birthdayparty.cpp')
-rw-r--r--examples/qml/referenceexamples/properties/birthdayparty.cpp24
1 files changed, 23 insertions, 1 deletions
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);
}