diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-09 10:46:07 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-09 18:09:30 +0100 |
commit | d7008c79d4ec023527ebfc118ad47f40075f244d (patch) | |
tree | ce4e1b3e4148820fd5682ee1877a7626274cdb59 /examples | |
parent | 5824283a7804e7975140c17731329786045ef432 (diff) |
QQmlListProperty: Use qsizetype rather than int for sizes
[ChangeLog][QtQml] The QQmlListProperty callback functions use qsizetype
now as type for the size of a list. This is in line with the containers
that you might use to back the list.
Fixes: QTBUG-88269
Change-Id: Ia38403cb32f241e6c70e1a580dbeff1d6d694331
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qml/referenceexamples/properties/birthdayparty.cpp | 12 | ||||
-rw-r--r-- | examples/qml/referenceexamples/properties/birthdayparty.h | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/examples/qml/referenceexamples/properties/birthdayparty.cpp b/examples/qml/referenceexamples/properties/birthdayparty.cpp index fe6abab3f5..2dc9bd803d 100644 --- a/examples/qml/referenceexamples/properties/birthdayparty.cpp +++ b/examples/qml/referenceexamples/properties/birthdayparty.cpp @@ -81,12 +81,12 @@ void BirthdayParty::appendGuest(Person* p) { } -int BirthdayParty::guestCount() const +qsizetype BirthdayParty::guestCount() const { return m_guests.count(); } -Person *BirthdayParty::guest(int index) const +Person *BirthdayParty::guest(qsizetype index) const { return m_guests.at(index); } @@ -95,7 +95,7 @@ void BirthdayParty::clearGuests() { m_guests.clear(); } -void BirthdayParty::replaceGuest(int index, Person *p) +void BirthdayParty::replaceGuest(qsizetype index, Person *p) { m_guests[index] = p; } @@ -115,7 +115,7 @@ void BirthdayParty::clearGuests(QQmlListProperty<Person>* list) { reinterpret_cast< BirthdayParty* >(list->data)->clearGuests(); } -void BirthdayParty::replaceGuest(QQmlListProperty<Person> *list, int i, Person *p) +void BirthdayParty::replaceGuest(QQmlListProperty<Person> *list, qsizetype i, Person *p) { reinterpret_cast< BirthdayParty* >(list->data)->replaceGuest(i, p); } @@ -125,10 +125,10 @@ void BirthdayParty::removeLastGuest(QQmlListProperty<Person> *list) reinterpret_cast< BirthdayParty* >(list->data)->removeLastGuest(); } -Person* BirthdayParty::guest(QQmlListProperty<Person>* list, int i) { +Person* BirthdayParty::guest(QQmlListProperty<Person>* list, qsizetype i) { return reinterpret_cast< BirthdayParty* >(list->data)->guest(i); } -int BirthdayParty::guestCount(QQmlListProperty<Person>* list) { +qsizetype BirthdayParty::guestCount(QQmlListProperty<Person>* list) { return reinterpret_cast< BirthdayParty* >(list->data)->guestCount(); } diff --git a/examples/qml/referenceexamples/properties/birthdayparty.h b/examples/qml/referenceexamples/properties/birthdayparty.h index 9da5158de2..7e1668add3 100644 --- a/examples/qml/referenceexamples/properties/birthdayparty.h +++ b/examples/qml/referenceexamples/properties/birthdayparty.h @@ -76,18 +76,18 @@ public: QQmlListProperty<Person> guests(); void appendGuest(Person*); - int guestCount() const; - Person *guest(int) const; + qsizetype guestCount() const; + Person *guest(qsizetype) const; void clearGuests(); - void replaceGuest(int, Person*); + void replaceGuest(qsizetype, Person*); void removeLastGuest(); private: static void appendGuest(QQmlListProperty<Person>*, Person*); - static int guestCount(QQmlListProperty<Person>*); - static Person* guest(QQmlListProperty<Person>*, int); + static qsizetype guestCount(QQmlListProperty<Person>*); + static Person* guest(QQmlListProperty<Person>*, qsizetype); static void clearGuests(QQmlListProperty<Person>*); - static void replaceGuest(QQmlListProperty<Person>*, int, Person*); + static void replaceGuest(QQmlListProperty<Person>*, qsizetype, Person*); static void removeLastGuest(QQmlListProperty<Person>*); Person *m_host; |