From d7008c79d4ec023527ebfc118ad47f40075f244d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 9 Nov 2020 10:46:07 +0100 Subject: 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 --- examples/qml/referenceexamples/properties/birthdayparty.cpp | 12 ++++++------ examples/qml/referenceexamples/properties/birthdayparty.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'examples') 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* list) { reinterpret_cast< BirthdayParty* >(list->data)->clearGuests(); } -void BirthdayParty::replaceGuest(QQmlListProperty *list, int i, Person *p) +void BirthdayParty::replaceGuest(QQmlListProperty *list, qsizetype i, Person *p) { reinterpret_cast< BirthdayParty* >(list->data)->replaceGuest(i, p); } @@ -125,10 +125,10 @@ void BirthdayParty::removeLastGuest(QQmlListProperty *list) reinterpret_cast< BirthdayParty* >(list->data)->removeLastGuest(); } -Person* BirthdayParty::guest(QQmlListProperty* list, int i) { +Person* BirthdayParty::guest(QQmlListProperty* list, qsizetype i) { return reinterpret_cast< BirthdayParty* >(list->data)->guest(i); } -int BirthdayParty::guestCount(QQmlListProperty* list) { +qsizetype BirthdayParty::guestCount(QQmlListProperty* 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 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*); - static int guestCount(QQmlListProperty*); - static Person* guest(QQmlListProperty*, int); + static qsizetype guestCount(QQmlListProperty*); + static Person* guest(QQmlListProperty*, qsizetype); static void clearGuests(QQmlListProperty*); - static void replaceGuest(QQmlListProperty*, int, Person*); + static void replaceGuest(QQmlListProperty*, qsizetype, Person*); static void removeLastGuest(QQmlListProperty*); Person *m_host; -- cgit v1.2.3