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>
This commit is contained in:
parent
5824283a78
commit
d7008c79d4
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -263,13 +263,13 @@ void QQmlDelegateChooser::choices_append(QQmlListProperty<QQmlDelegateChoice> *p
|
|||
q->delegateChanged();
|
||||
}
|
||||
|
||||
int QQmlDelegateChooser::choices_count(QQmlListProperty<QQmlDelegateChoice> *prop)
|
||||
qsizetype QQmlDelegateChooser::choices_count(QQmlListProperty<QQmlDelegateChoice> *prop)
|
||||
{
|
||||
QQmlDelegateChooser *q = static_cast<QQmlDelegateChooser*>(prop->object);
|
||||
return q->m_choices.count();
|
||||
}
|
||||
|
||||
QQmlDelegateChoice *QQmlDelegateChooser::choices_at(QQmlListProperty<QQmlDelegateChoice> *prop, int index)
|
||||
QQmlDelegateChoice *QQmlDelegateChooser::choices_at(QQmlListProperty<QQmlDelegateChoice> *prop, qsizetype index)
|
||||
{
|
||||
QQmlDelegateChooser *q = static_cast<QQmlDelegateChooser*>(prop->object);
|
||||
return q->m_choices.at(index);
|
||||
|
@ -284,8 +284,8 @@ void QQmlDelegateChooser::choices_clear(QQmlListProperty<QQmlDelegateChoice> *pr
|
|||
q->delegateChanged();
|
||||
}
|
||||
|
||||
void QQmlDelegateChooser::choices_replace(QQmlListProperty<QQmlDelegateChoice> *prop, int index,
|
||||
QQmlDelegateChoice *choice)
|
||||
void QQmlDelegateChooser::choices_replace(QQmlListProperty<QQmlDelegateChoice> *prop,
|
||||
qsizetype index, QQmlDelegateChoice *choice)
|
||||
{
|
||||
QQmlDelegateChooser *q = static_cast<QQmlDelegateChooser *>(prop->object);
|
||||
disconnect(q->m_choices[index], &QQmlDelegateChoice::changed,
|
||||
|
|
|
@ -116,10 +116,11 @@ public:
|
|||
|
||||
virtual QQmlListProperty<QQmlDelegateChoice> choices();
|
||||
static void choices_append(QQmlListProperty<QQmlDelegateChoice> *, QQmlDelegateChoice *);
|
||||
static int choices_count(QQmlListProperty<QQmlDelegateChoice> *);
|
||||
static QQmlDelegateChoice *choices_at(QQmlListProperty<QQmlDelegateChoice> *, int);
|
||||
static qsizetype choices_count(QQmlListProperty<QQmlDelegateChoice> *);
|
||||
static QQmlDelegateChoice *choices_at(QQmlListProperty<QQmlDelegateChoice> *, qsizetype);
|
||||
static void choices_clear(QQmlListProperty<QQmlDelegateChoice> *);
|
||||
static void choices_replace(QQmlListProperty<QQmlDelegateChoice> *, int, QQmlDelegateChoice *);
|
||||
static void choices_replace(QQmlListProperty<QQmlDelegateChoice> *, qsizetype,
|
||||
QQmlDelegateChoice *);
|
||||
static void choices_removeLast(QQmlListProperty<QQmlDelegateChoice> *);
|
||||
|
||||
QQmlComponent *delegate(QQmlAdaptorModel *adaptorModel, int row, int column = -1) const override;
|
||||
|
|
|
@ -658,13 +658,13 @@ void QQmlTableModel::columns_append(QQmlListProperty<QQmlTableModelColumn> *prop
|
|||
model->mColumns.append(column);
|
||||
}
|
||||
|
||||
int QQmlTableModel::columns_count(QQmlListProperty<QQmlTableModelColumn> *property)
|
||||
qsizetype QQmlTableModel::columns_count(QQmlListProperty<QQmlTableModelColumn> *property)
|
||||
{
|
||||
const QQmlTableModel *model = static_cast<QQmlTableModel*>(property->object);
|
||||
return model->mColumns.count();
|
||||
}
|
||||
|
||||
QQmlTableModelColumn *QQmlTableModel::columns_at(QQmlListProperty<QQmlTableModelColumn> *property, int index)
|
||||
QQmlTableModelColumn *QQmlTableModel::columns_at(QQmlListProperty<QQmlTableModelColumn> *property, qsizetype index)
|
||||
{
|
||||
const QQmlTableModel *model = static_cast<QQmlTableModel*>(property->object);
|
||||
return model->mColumns.at(index);
|
||||
|
@ -676,7 +676,7 @@ void QQmlTableModel::columns_clear(QQmlListProperty<QQmlTableModelColumn> *prope
|
|||
return model->mColumns.clear();
|
||||
}
|
||||
|
||||
void QQmlTableModel::columns_replace(QQmlListProperty<QQmlTableModelColumn> *property, int index, QQmlTableModelColumn *value)
|
||||
void QQmlTableModel::columns_replace(QQmlListProperty<QQmlTableModelColumn> *property, qsizetype index, QQmlTableModelColumn *value)
|
||||
{
|
||||
QQmlTableModel *model = static_cast<QQmlTableModel*>(property->object);
|
||||
if (QQmlTableModelColumn *column = qobject_cast<QQmlTableModelColumn*>(value))
|
||||
|
|
|
@ -94,10 +94,10 @@ public:
|
|||
QQmlListProperty<QQmlTableModelColumn> columns();
|
||||
|
||||
static void columns_append(QQmlListProperty<QQmlTableModelColumn> *property, QQmlTableModelColumn *value);
|
||||
static int columns_count(QQmlListProperty<QQmlTableModelColumn> *property);
|
||||
static QQmlTableModelColumn *columns_at(QQmlListProperty<QQmlTableModelColumn> *property, int index);
|
||||
static qsizetype columns_count(QQmlListProperty<QQmlTableModelColumn> *property);
|
||||
static QQmlTableModelColumn *columns_at(QQmlListProperty<QQmlTableModelColumn> *property, qsizetype index);
|
||||
static void columns_clear(QQmlListProperty<QQmlTableModelColumn> *property);
|
||||
static void columns_replace(QQmlListProperty<QQmlTableModelColumn> *property, int index, QQmlTableModelColumn *value);
|
||||
static void columns_replace(QQmlListProperty<QQmlTableModelColumn> *property, qsizetype index, QQmlTableModelColumn *value);
|
||||
static void columns_removeLast(QQmlListProperty<QQmlTableModelColumn> *property);
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
|
|
@ -441,7 +441,7 @@ QUrl QQmlContext::baseUrl() const
|
|||
return d->m_data->baseUrl();
|
||||
}
|
||||
|
||||
int QQmlContextPrivate::context_count(QQmlListProperty<QObject> *prop)
|
||||
qsizetype QQmlContextPrivate::context_count(QQmlListProperty<QObject> *prop)
|
||||
{
|
||||
QQmlContext *context = static_cast<QQmlContext*>(prop->object);
|
||||
QQmlContextPrivate *d = QQmlContextPrivate::get(context);
|
||||
|
@ -453,7 +453,7 @@ int QQmlContextPrivate::context_count(QQmlListProperty<QObject> *prop)
|
|||
return ((const QList<QObject> *)d->propertyValue(contextProperty).constData())->count();
|
||||
}
|
||||
|
||||
QObject *QQmlContextPrivate::context_at(QQmlListProperty<QObject> *prop, int index)
|
||||
QObject *QQmlContextPrivate::context_at(QQmlListProperty<QObject> *prop, qsizetype index)
|
||||
{
|
||||
QQmlContext *context = static_cast<QQmlContext*>(prop->object);
|
||||
QQmlContextPrivate *d = QQmlContextPrivate::get(context);
|
||||
|
|
|
@ -78,8 +78,8 @@ public:
|
|||
return static_cast<QQmlContext *>(context->q_func());
|
||||
}
|
||||
|
||||
static int context_count(QQmlListProperty<QObject> *);
|
||||
static QObject *context_at(QQmlListProperty<QObject> *, int);
|
||||
static qsizetype context_count(QQmlListProperty<QObject> *);
|
||||
static QObject *context_at(QQmlListProperty<QObject> *, qsizetype);
|
||||
|
||||
void dropDestroyedQObject(const QString &name, QObject *destroyed);
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ Returns the list element at \a index, or 0 if the operation failed.
|
|||
|
||||
\sa canAt()
|
||||
*/
|
||||
QObject *QQmlListReference::at(int index) const
|
||||
QObject *QQmlListReference::at(qsizetype index) const
|
||||
{
|
||||
if (!canAt()) return nullptr;
|
||||
|
||||
|
@ -348,7 +348,7 @@ bool QQmlListReference::clear() const
|
|||
/*!
|
||||
Returns the number of objects in the list, or 0 if the operation failed.
|
||||
*/
|
||||
int QQmlListReference::count() const
|
||||
qsizetype QQmlListReference::count() const
|
||||
{
|
||||
if (!canCount()) return 0;
|
||||
|
||||
|
@ -361,7 +361,7 @@ Returns true if the operation succeeded, otherwise false.
|
|||
|
||||
\sa canReplace()
|
||||
*/
|
||||
bool QQmlListReference::replace(int index, QObject *object) const
|
||||
bool QQmlListReference::replace(qsizetype index, QObject *object) const
|
||||
{
|
||||
if (!canReplace())
|
||||
return false;
|
||||
|
@ -602,7 +602,7 @@ Append the \a value to the list \a property.
|
|||
/*!
|
||||
\typedef QQmlListProperty::CountFunction
|
||||
|
||||
Synonym for \c {int (*)(QQmlListProperty<T> *property)}.
|
||||
Synonym for \c {qsizetype (*)(QQmlListProperty<T> *property)}.
|
||||
|
||||
Return the number of elements in the list \a property.
|
||||
*/
|
||||
|
@ -616,7 +616,7 @@ Returns true if this QQmlListProperty is equal to \a other, otherwise false.
|
|||
/*!
|
||||
\typedef QQmlListProperty::AtFunction
|
||||
|
||||
Synonym for \c {T *(*)(QQmlListProperty<T> *property, int index)}.
|
||||
Synonym for \c {T *(*)(QQmlListProperty<T> *property, qsizetype index)}.
|
||||
|
||||
Return the element at position \a index in the list \a property.
|
||||
*/
|
||||
|
@ -632,7 +632,7 @@ Clear the list \a property.
|
|||
/*!
|
||||
\typedef QQmlListProperty::ReplaceFunction
|
||||
|
||||
Synonym for \c {void (*)(QQmlListProperty<T> *property, int index, T *value)}.
|
||||
Synonym for \c {void (*)(QQmlListProperty<T> *property, qsizetype index, T *value)}.
|
||||
|
||||
Replace the element at position \a index in the list \a property with \a value.
|
||||
*/
|
||||
|
|
|
@ -60,10 +60,10 @@ template<typename T>
|
|||
class QQmlListProperty {
|
||||
public:
|
||||
using AppendFunction = void (*)(QQmlListProperty<T> *, T *);
|
||||
using CountFunction = int (*)(QQmlListProperty<T> *);
|
||||
using AtFunction = T *(*)(QQmlListProperty<T> *, int);
|
||||
using CountFunction = qsizetype (*)(QQmlListProperty<T> *);
|
||||
using AtFunction = T *(*)(QQmlListProperty<T> *, qsizetype);
|
||||
using ClearFunction = void (*)(QQmlListProperty<T> *);
|
||||
using ReplaceFunction = void (*)(QQmlListProperty<T> *, int, T *);
|
||||
using ReplaceFunction = void (*)(QQmlListProperty<T> *, qsizetype, T *);
|
||||
using RemoveLastFunction = void (*)(QQmlListProperty<T> *);
|
||||
|
||||
QQmlListProperty() = default;
|
||||
|
@ -126,39 +126,39 @@ private:
|
|||
static void qlist_append(QQmlListProperty *p, T *v) {
|
||||
reinterpret_cast<QList<T *> *>(p->data)->append(v);
|
||||
}
|
||||
static int qlist_count(QQmlListProperty *p) {
|
||||
static qsizetype qlist_count(QQmlListProperty *p) {
|
||||
return reinterpret_cast<QList<T *> *>(p->data)->count();
|
||||
}
|
||||
static T *qlist_at(QQmlListProperty *p, int idx) {
|
||||
static T *qlist_at(QQmlListProperty *p, qsizetype idx) {
|
||||
return reinterpret_cast<QList<T *> *>(p->data)->at(idx);
|
||||
}
|
||||
static void qlist_clear(QQmlListProperty *p) {
|
||||
return reinterpret_cast<QList<T *> *>(p->data)->clear();
|
||||
}
|
||||
static void qlist_replace(QQmlListProperty *p, int idx, T *v) {
|
||||
static void qlist_replace(QQmlListProperty *p, qsizetype idx, T *v) {
|
||||
return reinterpret_cast<QList<T *> *>(p->data)->replace(idx, v);
|
||||
}
|
||||
static void qlist_removeLast(QQmlListProperty *p) {
|
||||
return reinterpret_cast<QList<T *> *>(p->data)->removeLast();
|
||||
}
|
||||
|
||||
static void qslow_replace(QQmlListProperty<T> *list, int idx, T *v)
|
||||
static void qslow_replace(QQmlListProperty<T> *list, qsizetype idx, T *v)
|
||||
{
|
||||
const int length = list->count(list);
|
||||
const qsizetype length = list->count(list);
|
||||
if (idx < 0 || idx >= length)
|
||||
return;
|
||||
|
||||
QVector<T *> stash;
|
||||
if (list->clear != qslow_clear) {
|
||||
stash.reserve(length);
|
||||
for (int i = 0; i < length; ++i)
|
||||
for (qsizetype i = 0; i < length; ++i)
|
||||
stash.append(i == idx ? v : list->at(list, i));
|
||||
list->clear(list);
|
||||
for (T *item : qAsConst(stash))
|
||||
list->append(list, item);
|
||||
} else {
|
||||
stash.reserve(length - idx - 1);
|
||||
for (int i = length - 1; i > idx; --i) {
|
||||
for (qsizetype i = length - 1; i > idx; --i) {
|
||||
stash.append(list->at(list, i));
|
||||
list->removeLast(list);
|
||||
}
|
||||
|
@ -171,18 +171,18 @@ private:
|
|||
|
||||
static void qslow_clear(QQmlListProperty<T> *list)
|
||||
{
|
||||
for (int i = 0, end = list->count(list); i < end; ++i)
|
||||
for (qsizetype i = 0, end = list->count(list); i < end; ++i)
|
||||
list->removeLast(list);
|
||||
}
|
||||
|
||||
static void qslow_removeLast(QQmlListProperty<T> *list)
|
||||
{
|
||||
const int length = list->count(list) - 1;
|
||||
const qsizetype length = list->count(list) - 1;
|
||||
if (length < 0)
|
||||
return;
|
||||
QVector<T *> stash;
|
||||
stash.reserve(length);
|
||||
for (int i = 0; i < length; ++i)
|
||||
for (qsizetype i = 0; i < length; ++i)
|
||||
stash.append(list->at(list, i));
|
||||
list->clear(list);
|
||||
for (T *item : qAsConst(stash))
|
||||
|
@ -218,10 +218,10 @@ public:
|
|||
bool isReadable() const;
|
||||
|
||||
bool append(QObject *) const;
|
||||
QObject *at(int) const;
|
||||
QObject *at(qsizetype) const;
|
||||
bool clear() const;
|
||||
int count() const;
|
||||
bool replace(int, QObject *) const;
|
||||
qsizetype count() const;
|
||||
bool replace(qsizetype, QObject *) const;
|
||||
bool removeLast() const;
|
||||
bool operator==(const QQmlListReference &other) const {return d == other.d;}
|
||||
|
||||
|
|
|
@ -1339,7 +1339,7 @@ bool QQmlPropertyPrivate::write(
|
|||
if (variantType == qMetaTypeId<QQmlListReference>()) {
|
||||
QQmlListReference qdlr = value.value<QQmlListReference>();
|
||||
|
||||
for (int ii = 0; ii < qdlr.count(); ++ii) {
|
||||
for (qsizetype ii = 0; ii < qdlr.count(); ++ii) {
|
||||
QObject *o = qdlr.at(ii);
|
||||
if (o && !QQmlMetaObject::canConvert(o, listType))
|
||||
o = nullptr;
|
||||
|
@ -1348,7 +1348,7 @@ bool QQmlPropertyPrivate::write(
|
|||
} else if (variantType == qMetaTypeId<QList<QObject *> >()) {
|
||||
const QList<QObject *> &list = qvariant_cast<QList<QObject *> >(value);
|
||||
|
||||
for (int ii = 0; ii < list.count(); ++ii) {
|
||||
for (qsizetype ii = 0; ii < list.count(); ++ii) {
|
||||
QObject *o = list.at(ii);
|
||||
if (o && !QQmlMetaObject::canConvert(o, listType))
|
||||
o = nullptr;
|
||||
|
|
|
@ -131,12 +131,12 @@ static void list_append(QQmlListProperty<QObject> *prop, QObject *o)
|
|||
resolved.activateSignal();
|
||||
}
|
||||
|
||||
static int list_count(QQmlListProperty<QObject> *prop)
|
||||
static qsizetype list_count(QQmlListProperty<QObject> *prop)
|
||||
{
|
||||
return ResolvedList(prop).list()->count();
|
||||
}
|
||||
|
||||
static QObject *list_at(QQmlListProperty<QObject> *prop, int index)
|
||||
static QObject *list_at(QQmlListProperty<QObject> *prop, qsizetype index)
|
||||
{
|
||||
return ResolvedList(prop).list()->at(index);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ static void list_clear(QQmlListProperty<QObject> *prop)
|
|||
resolved.activateSignal();
|
||||
}
|
||||
|
||||
static void list_replace(QQmlListProperty<QObject> *prop, int index, QObject *o)
|
||||
static void list_replace(QQmlListProperty<QObject> *prop, qsizetype index, QObject *o)
|
||||
{
|
||||
const ResolvedList resolved(prop);
|
||||
resolved.list()->replace(index, o);
|
||||
|
|
|
@ -697,7 +697,7 @@ void QQmlDelegateModelPrivate::group_append(
|
|||
d->m_groupCount += 1;
|
||||
}
|
||||
|
||||
int QQmlDelegateModelPrivate::group_count(
|
||||
qsizetype QQmlDelegateModelPrivate::group_count(
|
||||
QQmlListProperty<QQmlDelegateModelGroup> *property)
|
||||
{
|
||||
QQmlDelegateModelPrivate *d = static_cast<QQmlDelegateModelPrivate *>(property->data);
|
||||
|
@ -705,7 +705,7 @@ int QQmlDelegateModelPrivate::group_count(
|
|||
}
|
||||
|
||||
QQmlDelegateModelGroup *QQmlDelegateModelPrivate::group_at(
|
||||
QQmlListProperty<QQmlDelegateModelGroup> *property, int index)
|
||||
QQmlListProperty<QQmlDelegateModelGroup> *property, qsizetype index)
|
||||
{
|
||||
QQmlDelegateModelPrivate *d = static_cast<QQmlDelegateModelPrivate *>(property->data);
|
||||
return index >= 0 && index < d->m_groupCount - 1
|
||||
|
|
|
@ -338,8 +338,8 @@ public:
|
|||
int adaptorModelCount() const;
|
||||
|
||||
static void group_append(QQmlListProperty<QQmlDelegateModelGroup> *property, QQmlDelegateModelGroup *group);
|
||||
static int group_count(QQmlListProperty<QQmlDelegateModelGroup> *property);
|
||||
static QQmlDelegateModelGroup *group_at(QQmlListProperty<QQmlDelegateModelGroup> *property, int index);
|
||||
static qsizetype group_count(QQmlListProperty<QQmlDelegateModelGroup> *property);
|
||||
static QQmlDelegateModelGroup *group_at(QQmlListProperty<QQmlDelegateModelGroup> *property, qsizetype index);
|
||||
|
||||
void releaseIncubator(QQDMIncubationTask *incubationTask);
|
||||
void incubatorStatusChanged(QQDMIncubationTask *incubationTask, QQmlIncubator::Status status);
|
||||
|
|
|
@ -115,7 +115,7 @@ void QQmlListAccessor::setList(const QVariant &v, QQmlEngine *engine)
|
|||
}
|
||||
}
|
||||
|
||||
int QQmlListAccessor::count() const
|
||||
qsizetype QQmlListAccessor::count() const
|
||||
{
|
||||
switch(m_type) {
|
||||
case StringList:
|
||||
|
@ -136,7 +136,7 @@ int QQmlListAccessor::count() const
|
|||
}
|
||||
}
|
||||
|
||||
QVariant QQmlListAccessor::at(int idx) const
|
||||
QVariant QQmlListAccessor::at(qsizetype idx) const
|
||||
{
|
||||
Q_ASSERT(idx >= 0 && idx < count());
|
||||
switch(m_type) {
|
||||
|
|
|
@ -67,8 +67,8 @@ public:
|
|||
|
||||
bool isValid() const;
|
||||
|
||||
int count() const;
|
||||
QVariant at(int) const;
|
||||
qsizetype count() const;
|
||||
QVariant at(qsizetype) const;
|
||||
|
||||
enum Type { Invalid, StringList, VariantList, ObjectList, ListProperty, Instance, Integer };
|
||||
Type type() const { return m_type; }
|
||||
|
|
|
@ -75,15 +75,15 @@ public:
|
|||
QQmlObjectModelPrivate() : QObjectPrivate(), moveId(0) {}
|
||||
|
||||
static void children_append(QQmlListProperty<QObject> *prop, QObject *item) {
|
||||
int index = static_cast<QQmlObjectModelPrivate *>(prop->data)->children.count();
|
||||
qsizetype index = static_cast<QQmlObjectModelPrivate *>(prop->data)->children.count();
|
||||
static_cast<QQmlObjectModelPrivate *>(prop->data)->insert(index, item);
|
||||
}
|
||||
|
||||
static int children_count(QQmlListProperty<QObject> *prop) {
|
||||
static qsizetype children_count(QQmlListProperty<QObject> *prop) {
|
||||
return static_cast<QQmlObjectModelPrivate *>(prop->data)->children.count();
|
||||
}
|
||||
|
||||
static QObject *children_at(QQmlListProperty<QObject> *prop, int index) {
|
||||
static QObject *children_at(QQmlListProperty<QObject> *prop, qsizetype index) {
|
||||
return static_cast<QQmlObjectModelPrivate *>(prop->data)->children.at(index).item;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
static_cast<QQmlObjectModelPrivate *>(prop->data)->clear();
|
||||
}
|
||||
|
||||
static void children_replace(QQmlListProperty<QObject> *prop, int index, QObject *item) {
|
||||
static void children_replace(QQmlListProperty<QObject> *prop, qsizetype index, QObject *item) {
|
||||
static_cast<QQmlObjectModelPrivate *>(prop->data)->replace(index, item);
|
||||
}
|
||||
|
||||
|
|
|
@ -107,15 +107,15 @@ public:
|
|||
QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
|
||||
list->clear();
|
||||
}
|
||||
static QObject *data_at(QQmlListProperty<QObject> *prop, int index) {
|
||||
static QObject *data_at(QQmlListProperty<QObject> *prop, qsizetype index) {
|
||||
QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
|
||||
return list->at(index);
|
||||
}
|
||||
static int data_count(QQmlListProperty<QObject> *prop) {
|
||||
static qsizetype data_count(QQmlListProperty<QObject> *prop) {
|
||||
QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
|
||||
return list->count();
|
||||
}
|
||||
static void data_replace(QQmlListProperty<QObject> *prop, int index, QObject *o) {
|
||||
static void data_replace(QQmlListProperty<QObject> *prop, qsizetype index, QObject *o) {
|
||||
QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data);
|
||||
list->replace(index, DataGuard(o, list));
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ static void allSubObjects(QObject *object, QObjectList &objectList)
|
|||
&& QQmlMetaType::isList(metaProperty.userType())) {
|
||||
QQmlListReference list(object, metaProperty.name());
|
||||
if (list.canCount() && list.canAt()) {
|
||||
for (int i = 0; i < list.count(); i++) {
|
||||
for (qsizetype i = 0; i < list.count(); i++) {
|
||||
QObject *propertyObject = list.at(i);
|
||||
allSubObjects(propertyObject, objectList);
|
||||
|
||||
|
|
|
@ -1908,13 +1908,13 @@ void QQuickFlickablePrivate::data_append(QQmlListProperty<QObject> *prop, QObjec
|
|||
}
|
||||
}
|
||||
|
||||
int QQuickFlickablePrivate::data_count(QQmlListProperty<QObject> *)
|
||||
qsizetype QQuickFlickablePrivate::data_count(QQmlListProperty<QObject> *)
|
||||
{
|
||||
// XXX todo
|
||||
return 0;
|
||||
}
|
||||
|
||||
QObject *QQuickFlickablePrivate::data_at(QQmlListProperty<QObject> *, int)
|
||||
QObject *QQuickFlickablePrivate::data_at(QQmlListProperty<QObject> *, qsizetype)
|
||||
{
|
||||
// XXX todo
|
||||
return nullptr;
|
||||
|
|
|
@ -273,8 +273,8 @@ public:
|
|||
|
||||
// flickableData property
|
||||
static void data_append(QQmlListProperty<QObject> *, QObject *);
|
||||
static int data_count(QQmlListProperty<QObject> *);
|
||||
static QObject *data_at(QQmlListProperty<QObject> *, int);
|
||||
static qsizetype data_count(QQmlListProperty<QObject> *);
|
||||
static QObject *data_at(QQmlListProperty<QObject> *, qsizetype);
|
||||
static void data_clear(QQmlListProperty<QObject> *);
|
||||
};
|
||||
|
||||
|
|
|
@ -3295,7 +3295,7 @@ void QQuickItemPrivate::data_append(QQmlListProperty<QObject> *prop, QObject *o)
|
|||
automatically assigned to this property.
|
||||
*/
|
||||
|
||||
int QQuickItemPrivate::data_count(QQmlListProperty<QObject> *property)
|
||||
qsizetype QQuickItemPrivate::data_count(QQmlListProperty<QObject> *property)
|
||||
{
|
||||
QQuickItem *item = static_cast<QQuickItem*>(property->object);
|
||||
QQuickItemPrivate *privateItem = QQuickItemPrivate::get(item);
|
||||
|
@ -3305,17 +3305,17 @@ int QQuickItemPrivate::data_count(QQmlListProperty<QObject> *property)
|
|||
return resources_count(&resourcesProperty) + children_count(&childrenProperty);
|
||||
}
|
||||
|
||||
QObject *QQuickItemPrivate::data_at(QQmlListProperty<QObject> *property, int i)
|
||||
QObject *QQuickItemPrivate::data_at(QQmlListProperty<QObject> *property, qsizetype i)
|
||||
{
|
||||
QQuickItem *item = static_cast<QQuickItem*>(property->object);
|
||||
QQuickItemPrivate *privateItem = QQuickItemPrivate::get(item);
|
||||
QQmlListProperty<QObject> resourcesProperty = privateItem->resources();
|
||||
QQmlListProperty<QQuickItem> childrenProperty = privateItem->children();
|
||||
|
||||
int resourcesCount = resources_count(&resourcesProperty);
|
||||
qsizetype resourcesCount = resources_count(&resourcesProperty);
|
||||
if (i < resourcesCount)
|
||||
return resources_at(&resourcesProperty, i);
|
||||
const int j = i - resourcesCount;
|
||||
const qsizetype j = i - resourcesCount;
|
||||
if (j < children_count(&childrenProperty))
|
||||
return children_at(&childrenProperty, j);
|
||||
return nullptr;
|
||||
|
@ -3332,7 +3332,7 @@ void QQuickItemPrivate::data_clear(QQmlListProperty<QObject> *property)
|
|||
children_clear(&childrenProperty);
|
||||
}
|
||||
|
||||
QObject *QQuickItemPrivate::resources_at(QQmlListProperty<QObject> *prop, int index)
|
||||
QObject *QQuickItemPrivate::resources_at(QQmlListProperty<QObject> *prop, qsizetype index)
|
||||
{
|
||||
QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
|
||||
return quickItemPrivate->extra.isAllocated() ? quickItemPrivate->extra->resourcesList.value(index) : 0;
|
||||
|
@ -3349,7 +3349,7 @@ void QQuickItemPrivate::resources_append(QQmlListProperty<QObject> *prop, QObjec
|
|||
}
|
||||
}
|
||||
|
||||
int QQuickItemPrivate::resources_count(QQmlListProperty<QObject> *prop)
|
||||
qsizetype QQuickItemPrivate::resources_count(QQmlListProperty<QObject> *prop)
|
||||
{
|
||||
QQuickItemPrivate *quickItemPrivate = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
|
||||
return quickItemPrivate->extra.isAllocated() ? quickItemPrivate->extra->resourcesList.count() : 0;
|
||||
|
@ -3368,7 +3368,7 @@ void QQuickItemPrivate::resources_clear(QQmlListProperty<QObject> *prop)
|
|||
}
|
||||
}
|
||||
|
||||
QQuickItem *QQuickItemPrivate::children_at(QQmlListProperty<QQuickItem> *prop, int index)
|
||||
QQuickItem *QQuickItemPrivate::children_at(QQmlListProperty<QQuickItem> *prop, qsizetype index)
|
||||
{
|
||||
QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
|
||||
if (index >= p->childItems.count() || index < 0)
|
||||
|
@ -3389,7 +3389,7 @@ void QQuickItemPrivate::children_append(QQmlListProperty<QQuickItem> *prop, QQui
|
|||
o->setParentItem(that);
|
||||
}
|
||||
|
||||
int QQuickItemPrivate::children_count(QQmlListProperty<QQuickItem> *prop)
|
||||
qsizetype QQuickItemPrivate::children_count(QQmlListProperty<QQuickItem> *prop)
|
||||
{
|
||||
QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
|
||||
return p->childItems.count();
|
||||
|
@ -3403,11 +3403,11 @@ void QQuickItemPrivate::children_clear(QQmlListProperty<QQuickItem> *prop)
|
|||
p->childItems.at(0)->setParentItem(nullptr);
|
||||
}
|
||||
|
||||
int QQuickItemPrivate::visibleChildren_count(QQmlListProperty<QQuickItem> *prop)
|
||||
qsizetype QQuickItemPrivate::visibleChildren_count(QQmlListProperty<QQuickItem> *prop)
|
||||
{
|
||||
QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
|
||||
int visibleCount = 0;
|
||||
int c = p->childItems.count();
|
||||
qsizetype visibleCount = 0;
|
||||
qsizetype c = p->childItems.count();
|
||||
while (c--) {
|
||||
if (p->childItems.at(c)->isVisible()) visibleCount++;
|
||||
}
|
||||
|
@ -3415,22 +3415,22 @@ int QQuickItemPrivate::visibleChildren_count(QQmlListProperty<QQuickItem> *prop)
|
|||
return visibleCount;
|
||||
}
|
||||
|
||||
QQuickItem *QQuickItemPrivate::visibleChildren_at(QQmlListProperty<QQuickItem> *prop, int index)
|
||||
QQuickItem *QQuickItemPrivate::visibleChildren_at(QQmlListProperty<QQuickItem> *prop, qsizetype index)
|
||||
{
|
||||
QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
|
||||
const int childCount = p->childItems.count();
|
||||
const qsizetype childCount = p->childItems.count();
|
||||
if (index >= childCount || index < 0)
|
||||
return nullptr;
|
||||
|
||||
int visibleCount = -1;
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
qsizetype visibleCount = -1;
|
||||
for (qsizetype i = 0; i < childCount; i++) {
|
||||
if (p->childItems.at(i)->isVisible()) visibleCount++;
|
||||
if (visibleCount == index) return p->childItems.at(i);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int QQuickItemPrivate::transform_count(QQmlListProperty<QQuickTransform> *prop)
|
||||
qsizetype QQuickItemPrivate::transform_count(QQmlListProperty<QQuickTransform> *prop)
|
||||
{
|
||||
QQuickItem *that = static_cast<QQuickItem *>(prop->object);
|
||||
QQuickItemPrivate *p = QQuickItemPrivate::get(that);
|
||||
|
@ -3485,7 +3485,7 @@ void QQuickItemPrivate::transform_append(QQmlListProperty<QQuickTransform> *prop
|
|||
transform->appendToItem(that);
|
||||
}
|
||||
|
||||
QQuickTransform *QQuickItemPrivate::transform_at(QQmlListProperty<QQuickTransform> *prop, int idx)
|
||||
QQuickTransform *QQuickItemPrivate::transform_at(QQmlListProperty<QQuickTransform> *prop, qsizetype idx)
|
||||
{
|
||||
QQuickItem *that = static_cast<QQuickItem *>(prop->object);
|
||||
QQuickItemPrivate *p = QQuickItemPrivate::get(that);
|
||||
|
@ -3501,7 +3501,7 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
|
|||
QQuickItem *that = static_cast<QQuickItem *>(prop->object);
|
||||
QQuickItemPrivate *p = QQuickItemPrivate::get(that);
|
||||
|
||||
for (int ii = 0; ii < p->transforms.count(); ++ii) {
|
||||
for (qsizetype ii = 0; ii < p->transforms.count(); ++ii) {
|
||||
QQuickTransform *t = p->transforms.at(ii);
|
||||
QQuickTransformPrivate *tp = QQuickTransformPrivate::get(t);
|
||||
tp->items.removeOne(that);
|
||||
|
|
|
@ -288,31 +288,31 @@ public:
|
|||
|
||||
// data property
|
||||
static void data_append(QQmlListProperty<QObject> *, QObject *);
|
||||
static int data_count(QQmlListProperty<QObject> *);
|
||||
static QObject *data_at(QQmlListProperty<QObject> *, int);
|
||||
static qsizetype data_count(QQmlListProperty<QObject> *);
|
||||
static QObject *data_at(QQmlListProperty<QObject> *, qsizetype);
|
||||
static void data_clear(QQmlListProperty<QObject> *);
|
||||
|
||||
// resources property
|
||||
static QObject *resources_at(QQmlListProperty<QObject> *, int);
|
||||
static QObject *resources_at(QQmlListProperty<QObject> *, qsizetype);
|
||||
static void resources_append(QQmlListProperty<QObject> *, QObject *);
|
||||
static int resources_count(QQmlListProperty<QObject> *);
|
||||
static qsizetype resources_count(QQmlListProperty<QObject> *);
|
||||
static void resources_clear(QQmlListProperty<QObject> *);
|
||||
|
||||
// children property
|
||||
static void children_append(QQmlListProperty<QQuickItem> *, QQuickItem *);
|
||||
static int children_count(QQmlListProperty<QQuickItem> *);
|
||||
static QQuickItem *children_at(QQmlListProperty<QQuickItem> *, int);
|
||||
static qsizetype children_count(QQmlListProperty<QQuickItem> *);
|
||||
static QQuickItem *children_at(QQmlListProperty<QQuickItem> *, qsizetype);
|
||||
static void children_clear(QQmlListProperty<QQuickItem> *);
|
||||
|
||||
// visibleChildren property
|
||||
static void visibleChildren_append(QQmlListProperty<QQuickItem> *prop, QQuickItem *o);
|
||||
static int visibleChildren_count(QQmlListProperty<QQuickItem> *prop);
|
||||
static QQuickItem *visibleChildren_at(QQmlListProperty<QQuickItem> *prop, int index);
|
||||
static qsizetype visibleChildren_count(QQmlListProperty<QQuickItem> *prop);
|
||||
static QQuickItem *visibleChildren_at(QQmlListProperty<QQuickItem> *prop, qsizetype index);
|
||||
|
||||
// transform property
|
||||
static int transform_count(QQmlListProperty<QQuickTransform> *list);
|
||||
static qsizetype transform_count(QQmlListProperty<QQuickTransform> *list);
|
||||
static void transform_append(QQmlListProperty<QQuickTransform> *list, QQuickTransform *);
|
||||
static QQuickTransform *transform_at(QQmlListProperty<QQuickTransform> *list, int);
|
||||
static QQuickTransform *transform_at(QQmlListProperty<QQuickTransform> *list, qsizetype);
|
||||
static void transform_clear(QQmlListProperty<QQuickTransform> *list);
|
||||
|
||||
void _q_resourceObjectDeleted(QObject *);
|
||||
|
|
|
@ -240,12 +240,12 @@ public:
|
|||
q->addTouchPrototype(touch);
|
||||
}
|
||||
|
||||
static int touchPoint_count(QQmlListProperty<QQuickTouchPoint> *list) {
|
||||
static qsizetype touchPoint_count(QQmlListProperty<QQuickTouchPoint> *list) {
|
||||
QQuickMultiPointTouchArea *q = static_cast<QQuickMultiPointTouchArea*>(list->object);
|
||||
return q->_touchPrototypes.count();
|
||||
}
|
||||
|
||||
static QQuickTouchPoint* touchPoint_at(QQmlListProperty<QQuickTouchPoint> *list, int index) {
|
||||
static QQuickTouchPoint* touchPoint_at(QQmlListProperty<QQuickTouchPoint> *list, qsizetype index) {
|
||||
QQuickMultiPointTouchArea *q = static_cast<QQuickMultiPointTouchArea*>(list->object);
|
||||
return q->_touchPrototypes.value(index);
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ inline void spriteAppend(QQmlListProperty<QQuickSprite> *p, QQuickSprite* s)
|
|||
p->object->metaObject()->invokeMethod(p->object, "createEngine");
|
||||
}
|
||||
|
||||
inline QQuickSprite* spriteAt(QQmlListProperty<QQuickSprite> *p, int idx)
|
||||
inline QQuickSprite* spriteAt(QQmlListProperty<QQuickSprite> *p, qsizetype idx)
|
||||
{
|
||||
return reinterpret_cast<QList<QQuickSprite *> *>(p->data)->at(idx);
|
||||
}
|
||||
|
@ -325,12 +325,12 @@ inline void spriteClear(QQmlListProperty<QQuickSprite> *p)
|
|||
p->object->metaObject()->invokeMethod(p->object, "createEngine");
|
||||
}
|
||||
|
||||
inline int spriteCount(QQmlListProperty<QQuickSprite> *p)
|
||||
inline qsizetype spriteCount(QQmlListProperty<QQuickSprite> *p)
|
||||
{
|
||||
return reinterpret_cast<QList<QQuickSprite *> *>(p->data)->count();
|
||||
}
|
||||
|
||||
inline void spriteReplace(QQmlListProperty<QQuickSprite> *p, int idx, QQuickSprite *s)
|
||||
inline void spriteReplace(QQmlListProperty<QQuickSprite> *p, qsizetype idx, QQuickSprite *s)
|
||||
{
|
||||
reinterpret_cast<QList<QQuickSprite *> *>(p->data)->replace(idx, s);
|
||||
p->object->metaObject()->invokeMethod(p->object, "createEngine");
|
||||
|
|
|
@ -3378,7 +3378,7 @@ void QQuickWindowPrivate::data_append(QQmlListProperty<QObject> *property, QObje
|
|||
itemProperty.append(&itemProperty, o);
|
||||
}
|
||||
|
||||
int QQuickWindowPrivate::data_count(QQmlListProperty<QObject> *property)
|
||||
qsizetype QQuickWindowPrivate::data_count(QQmlListProperty<QObject> *property)
|
||||
{
|
||||
QQuickWindow *win = static_cast<QQuickWindow*>(property->object);
|
||||
if (!win || !win->contentItem() || !QQuickItemPrivate::get(win->contentItem())->data().count)
|
||||
|
@ -3387,7 +3387,7 @@ int QQuickWindowPrivate::data_count(QQmlListProperty<QObject> *property)
|
|||
return itemProperty.count(&itemProperty);
|
||||
}
|
||||
|
||||
QObject *QQuickWindowPrivate::data_at(QQmlListProperty<QObject> *property, int i)
|
||||
QObject *QQuickWindowPrivate::data_at(QQmlListProperty<QObject> *property, qsizetype i)
|
||||
{
|
||||
QQuickWindow *win = static_cast<QQuickWindow*>(property->object);
|
||||
QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data();
|
||||
|
@ -3401,7 +3401,7 @@ void QQuickWindowPrivate::data_clear(QQmlListProperty<QObject> *property)
|
|||
itemProperty.clear(&itemProperty);
|
||||
}
|
||||
|
||||
void QQuickWindowPrivate::data_replace(QQmlListProperty<QObject> *property, int i, QObject *o)
|
||||
void QQuickWindowPrivate::data_replace(QQmlListProperty<QObject> *property, qsizetype i, QObject *o)
|
||||
{
|
||||
QQuickWindow *win = static_cast<QQuickWindow*>(property->object);
|
||||
QQmlListProperty<QObject> itemProperty = QQuickItemPrivate::get(win->contentItem())->data();
|
||||
|
|
|
@ -330,10 +330,10 @@ public:
|
|||
|
||||
// data property
|
||||
static void data_append(QQmlListProperty<QObject> *, QObject *);
|
||||
static int data_count(QQmlListProperty<QObject> *);
|
||||
static QObject *data_at(QQmlListProperty<QObject> *, int);
|
||||
static qsizetype data_count(QQmlListProperty<QObject> *);
|
||||
static QObject *data_at(QQmlListProperty<QObject> *, qsizetype);
|
||||
static void data_clear(QQmlListProperty<QObject> *);
|
||||
static void data_replace(QQmlListProperty<QObject> *, int, QObject *);
|
||||
static void data_replace(QQmlListProperty<QObject> *, qsizetype, QObject *);
|
||||
static void data_removeLast(QQmlListProperty<QObject> *);
|
||||
|
||||
static void rhiCreationFailureMessage(const QString &backendName,
|
||||
|
|
|
@ -1724,14 +1724,14 @@ void QQuickAnimationGroupPrivate::append_animation(QQmlListProperty<QQuickAbstra
|
|||
a->setGroup(q);
|
||||
}
|
||||
|
||||
QQuickAbstractAnimation *QQuickAnimationGroupPrivate::at_animation(QQmlListProperty<QQuickAbstractAnimation> *list, int index)
|
||||
QQuickAbstractAnimation *QQuickAnimationGroupPrivate::at_animation(QQmlListProperty<QQuickAbstractAnimation> *list, qsizetype index)
|
||||
{
|
||||
if (auto q = qmlobject_cast<QQuickAnimationGroup *>(list->object))
|
||||
return q->d_func()->animations.at(index);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int QQuickAnimationGroupPrivate::count_animation(QQmlListProperty<QQuickAbstractAnimation> *list)
|
||||
qsizetype QQuickAnimationGroupPrivate::count_animation(QQmlListProperty<QQuickAbstractAnimation> *list)
|
||||
{
|
||||
if (auto q = qmlobject_cast<QQuickAnimationGroup *>(list->object))
|
||||
return q->d_func()->animations.count();
|
||||
|
@ -1750,7 +1750,7 @@ void QQuickAnimationGroupPrivate::clear_animation(QQmlListProperty<QQuickAbstrac
|
|||
}
|
||||
|
||||
void QQuickAnimationGroupPrivate::replace_animation(QQmlListProperty<QQuickAbstractAnimation> *list,
|
||||
int i, QQuickAbstractAnimation *a)
|
||||
qsizetype i, QQuickAbstractAnimation *a)
|
||||
{
|
||||
if (auto *q = qmlobject_cast<QQuickAnimationGroup *>(list->object)) {
|
||||
if (QQuickAbstractAnimation *anim = q->d_func()->animations.at(i))
|
||||
|
|
|
@ -256,10 +256,10 @@ public:
|
|||
: QQuickAbstractAnimationPrivate() {}
|
||||
|
||||
static void append_animation(QQmlListProperty<QQuickAbstractAnimation> *list, QQuickAbstractAnimation *role);
|
||||
static QQuickAbstractAnimation *at_animation(QQmlListProperty<QQuickAbstractAnimation> *list, int index);
|
||||
static int count_animation(QQmlListProperty<QQuickAbstractAnimation> *list);
|
||||
static QQuickAbstractAnimation *at_animation(QQmlListProperty<QQuickAbstractAnimation> *list, qsizetype index);
|
||||
static qsizetype count_animation(QQmlListProperty<QQuickAbstractAnimation> *list);
|
||||
static void clear_animation(QQmlListProperty<QQuickAbstractAnimation> *list);
|
||||
static void replace_animation(QQmlListProperty<QQuickAbstractAnimation> *list, int index,
|
||||
static void replace_animation(QQmlListProperty<QQuickAbstractAnimation> *list, qsizetype index,
|
||||
QQuickAbstractAnimation *role);
|
||||
static void removeLast_animation(QQmlListProperty<QQuickAbstractAnimation> *list);
|
||||
QList<QQuickAbstractAnimation *> animations;
|
||||
|
|
|
@ -113,12 +113,12 @@ void QQuickApplication::setDisplayName(const QString &displayName)
|
|||
return QGuiApplication::setApplicationDisplayName(displayName);
|
||||
}
|
||||
|
||||
int screens_count(QQmlListProperty<QQuickScreenInfo> *prop)
|
||||
qsizetype screens_count(QQmlListProperty<QQuickScreenInfo> *prop)
|
||||
{
|
||||
return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->count();
|
||||
}
|
||||
|
||||
QQuickScreenInfo *screens_at(QQmlListProperty<QQuickScreenInfo> *prop, int idx)
|
||||
QQuickScreenInfo *screens_at(QQmlListProperty<QQuickScreenInfo> *prop, qsizetype idx)
|
||||
{
|
||||
return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->at(idx);
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@ static QQuickPathPrivate *privatePath(QObject *object)
|
|||
return QQuickPathPrivate::get(path);
|
||||
}
|
||||
|
||||
QQuickPathElement *QQuickPath::pathElements_at(QQmlListProperty<QQuickPathElement> *property, int index)
|
||||
QQuickPathElement *QQuickPath::pathElements_at(QQmlListProperty<QQuickPathElement> *property, qsizetype index)
|
||||
{
|
||||
QQuickPathPrivate *d = privatePath(property->object);
|
||||
|
||||
|
@ -315,7 +315,7 @@ void QQuickPath::pathElements_append(QQmlListProperty<QQuickPathElement> *proper
|
|||
}
|
||||
}
|
||||
|
||||
int QQuickPath::pathElements_count(QQmlListProperty<QQuickPathElement> *property)
|
||||
qsizetype QQuickPath::pathElements_count(QQmlListProperty<QQuickPathElement> *property)
|
||||
{
|
||||
QQuickPathPrivate *d = privatePath(property->object);
|
||||
|
||||
|
|
|
@ -568,9 +568,9 @@ protected:
|
|||
void gatherAttributes();
|
||||
|
||||
// pathElements property
|
||||
static QQuickPathElement *pathElements_at(QQmlListProperty<QQuickPathElement> *, int);
|
||||
static QQuickPathElement *pathElements_at(QQmlListProperty<QQuickPathElement> *, qsizetype);
|
||||
static void pathElements_append(QQmlListProperty<QQuickPathElement> *, QQuickPathElement *);
|
||||
static int pathElements_count(QQmlListProperty<QQuickPathElement> *);
|
||||
static qsizetype pathElements_count(QQmlListProperty<QQuickPathElement> *);
|
||||
static void pathElements_clear(QQmlListProperty<QQuickPathElement> *);
|
||||
|
||||
private Q_SLOTS:
|
||||
|
|
|
@ -236,15 +236,15 @@ public:
|
|||
e->setState(nullptr);
|
||||
list->clear();
|
||||
}
|
||||
static int operations_count(QQmlListProperty<QQuickStateOperation> *prop) {
|
||||
static qsizetype operations_count(QQmlListProperty<QQuickStateOperation> *prop) {
|
||||
QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
|
||||
return list->count();
|
||||
}
|
||||
static QQuickStateOperation *operations_at(QQmlListProperty<QQuickStateOperation> *prop, int index) {
|
||||
static QQuickStateOperation *operations_at(QQmlListProperty<QQuickStateOperation> *prop, qsizetype index) {
|
||||
QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
|
||||
return list->at(index);
|
||||
}
|
||||
static void operations_replace(QQmlListProperty<QQuickStateOperation> *prop, int index,
|
||||
static void operations_replace(QQmlListProperty<QQuickStateOperation> *prop, qsizetype index,
|
||||
QQuickStateOperation *op) {
|
||||
QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data);
|
||||
auto &guard = list->at(index);
|
||||
|
|
|
@ -67,15 +67,15 @@ public:
|
|||
QQuickState *nullState;
|
||||
|
||||
static void append_state(QQmlListProperty<QQuickState> *list, QQuickState *state);
|
||||
static int count_state(QQmlListProperty<QQuickState> *list);
|
||||
static QQuickState *at_state(QQmlListProperty<QQuickState> *list, int index);
|
||||
static qsizetype count_state(QQmlListProperty<QQuickState> *list);
|
||||
static QQuickState *at_state(QQmlListProperty<QQuickState> *list, qsizetype index);
|
||||
static void clear_states(QQmlListProperty<QQuickState> *list);
|
||||
static void replace_states(QQmlListProperty<QQuickState> *list, int index, QQuickState *state);
|
||||
static void replace_states(QQmlListProperty<QQuickState> *list, qsizetype index, QQuickState *state);
|
||||
static void removeLast_states(QQmlListProperty<QQuickState> *list);
|
||||
|
||||
static void append_transition(QQmlListProperty<QQuickTransition> *list, QQuickTransition *state);
|
||||
static int count_transitions(QQmlListProperty<QQuickTransition> *list);
|
||||
static QQuickTransition *at_transition(QQmlListProperty<QQuickTransition> *list, int index);
|
||||
static qsizetype count_transitions(QQmlListProperty<QQuickTransition> *list);
|
||||
static QQuickTransition *at_transition(QQmlListProperty<QQuickTransition> *list, qsizetype index);
|
||||
static void clear_transitions(QQmlListProperty<QQuickTransition> *list);
|
||||
|
||||
QList<QQuickState *> states;
|
||||
|
@ -184,13 +184,13 @@ void QQuickStateGroupPrivate::append_state(QQmlListProperty<QQuickState> *list,
|
|||
|
||||
}
|
||||
|
||||
int QQuickStateGroupPrivate::count_state(QQmlListProperty<QQuickState> *list)
|
||||
qsizetype QQuickStateGroupPrivate::count_state(QQmlListProperty<QQuickState> *list)
|
||||
{
|
||||
QQuickStateGroup *_this = static_cast<QQuickStateGroup *>(list->object);
|
||||
return _this->d_func()->states.count();
|
||||
}
|
||||
|
||||
QQuickState *QQuickStateGroupPrivate::at_state(QQmlListProperty<QQuickState> *list, int index)
|
||||
QQuickState *QQuickStateGroupPrivate::at_state(QQmlListProperty<QQuickState> *list, qsizetype index)
|
||||
{
|
||||
QQuickStateGroup *_this = static_cast<QQuickStateGroup *>(list->object);
|
||||
return _this->d_func()->states.at(index);
|
||||
|
@ -200,13 +200,13 @@ void QQuickStateGroupPrivate::clear_states(QQmlListProperty<QQuickState> *list)
|
|||
{
|
||||
QQuickStateGroup *_this = static_cast<QQuickStateGroup *>(list->object);
|
||||
_this->d_func()->setCurrentStateInternal(QString(), true);
|
||||
for (int i = 0; i < _this->d_func()->states.count(); ++i) {
|
||||
for (qsizetype i = 0; i < _this->d_func()->states.count(); ++i) {
|
||||
_this->d_func()->states.at(i)->setStateGroup(nullptr);
|
||||
}
|
||||
_this->d_func()->states.clear();
|
||||
}
|
||||
|
||||
void QQuickStateGroupPrivate::replace_states(QQmlListProperty<QQuickState> *list, int index, QQuickState *state)
|
||||
void QQuickStateGroupPrivate::replace_states(QQmlListProperty<QQuickState> *list, qsizetype index, QQuickState *state)
|
||||
{
|
||||
auto *self = qobject_cast<QQuickStateGroup *>(list->object);
|
||||
auto *d = self->d_func();
|
||||
|
@ -265,13 +265,13 @@ void QQuickStateGroupPrivate::append_transition(QQmlListProperty<QQuickTransitio
|
|||
_this->d_func()->transitions.append(trans);
|
||||
}
|
||||
|
||||
int QQuickStateGroupPrivate::count_transitions(QQmlListProperty<QQuickTransition> *list)
|
||||
qsizetype QQuickStateGroupPrivate::count_transitions(QQmlListProperty<QQuickTransition> *list)
|
||||
{
|
||||
QQuickStateGroup *_this = static_cast<QQuickStateGroup *>(list->object);
|
||||
return _this->d_func()->transitions.count();
|
||||
}
|
||||
|
||||
QQuickTransition *QQuickStateGroupPrivate::at_transition(QQmlListProperty<QQuickTransition> *list, int index)
|
||||
QQuickTransition *QQuickStateGroupPrivate::at_transition(QQmlListProperty<QQuickTransition> *list, qsizetype index)
|
||||
{
|
||||
QQuickStateGroup *_this = static_cast<QQuickStateGroup *>(list->object);
|
||||
return _this->d_func()->transitions.at(index);
|
||||
|
|
|
@ -135,8 +135,8 @@ public:
|
|||
protected:
|
||||
|
||||
static void append_animation(QQmlListProperty<QQuickAbstractAnimation> *list, QQuickAbstractAnimation *a);
|
||||
static int animation_count(QQmlListProperty<QQuickAbstractAnimation> *list);
|
||||
static QQuickAbstractAnimation* animation_at(QQmlListProperty<QQuickAbstractAnimation> *list, int pos);
|
||||
static qsizetype animation_count(QQmlListProperty<QQuickAbstractAnimation> *list);
|
||||
static QQuickAbstractAnimation* animation_at(QQmlListProperty<QQuickAbstractAnimation> *list, qsizetype pos);
|
||||
static void clear_animations(QQmlListProperty<QQuickAbstractAnimation> *list);
|
||||
QList<QQuickAbstractAnimation *> animations;
|
||||
};
|
||||
|
@ -148,13 +148,13 @@ void QQuickTransitionPrivate::append_animation(QQmlListProperty<QQuickAbstractAn
|
|||
a->setDisableUserControl();
|
||||
}
|
||||
|
||||
int QQuickTransitionPrivate::animation_count(QQmlListProperty<QQuickAbstractAnimation> *list)
|
||||
qsizetype QQuickTransitionPrivate::animation_count(QQmlListProperty<QQuickAbstractAnimation> *list)
|
||||
{
|
||||
QQuickTransition *q = static_cast<QQuickTransition *>(list->object);
|
||||
return q->d_func()->animations.count();
|
||||
}
|
||||
|
||||
QQuickAbstractAnimation* QQuickTransitionPrivate::animation_at(QQmlListProperty<QQuickAbstractAnimation> *list, int pos)
|
||||
QQuickAbstractAnimation* QQuickTransitionPrivate::animation_at(QQmlListProperty<QQuickAbstractAnimation> *list, qsizetype pos)
|
||||
{
|
||||
QQuickTransition *q = static_cast<QQuickTransition *>(list->object);
|
||||
return q->d_func()->animations.at(pos);
|
||||
|
|
|
@ -424,12 +424,12 @@ void QObjectContainer::children_append(QQmlListProperty<QObject> *prop, QObject
|
|||
}
|
||||
}
|
||||
|
||||
int QObjectContainer::children_count(QQmlListProperty<QObject> *prop)
|
||||
qsizetype QObjectContainer::children_count(QQmlListProperty<QObject> *prop)
|
||||
{
|
||||
return static_cast<QObjectContainer*>(prop->object)->dataChildren.count();
|
||||
}
|
||||
|
||||
QObject *QObjectContainer::children_at(QQmlListProperty<QObject> *prop, int index)
|
||||
QObject *QObjectContainer::children_at(QQmlListProperty<QObject> *prop, qsizetype index)
|
||||
{
|
||||
return static_cast<QObjectContainer*>(prop->object)->dataChildren.at(index);
|
||||
}
|
||||
|
|
|
@ -1687,8 +1687,8 @@ public:
|
|||
QQmlListProperty<QObject> data();
|
||||
|
||||
static void children_append(QQmlListProperty<QObject> *prop, QObject *o);
|
||||
static int children_count(QQmlListProperty<QObject> *prop);
|
||||
static QObject *children_at(QQmlListProperty<QObject> *prop, int index);
|
||||
static qsizetype children_count(QQmlListProperty<QObject> *prop);
|
||||
static QObject *children_at(QQmlListProperty<QObject> *prop, qsizetype index);
|
||||
static void children_clear(QQmlListProperty<QObject> *prop);
|
||||
|
||||
QList<QObject*> dataChildren;
|
||||
|
|
|
@ -98,16 +98,16 @@ public:
|
|||
static void append(QQmlListProperty<TestType> *p, TestType *v) {
|
||||
reinterpret_cast<QList<TestType *> *>(p->data)->append(v);
|
||||
}
|
||||
static int count(QQmlListProperty<TestType> *p) {
|
||||
static qsizetype count(QQmlListProperty<TestType> *p) {
|
||||
return reinterpret_cast<QList<TestType *> *>(p->data)->count();
|
||||
}
|
||||
static TestType *at(QQmlListProperty<TestType> *p, int idx) {
|
||||
static TestType *at(QQmlListProperty<TestType> *p, qsizetype idx) {
|
||||
return reinterpret_cast<QList<TestType *> *>(p->data)->at(idx);
|
||||
}
|
||||
static void clear(QQmlListProperty<TestType> *p) {
|
||||
return reinterpret_cast<QList<TestType *> *>(p->data)->clear();
|
||||
}
|
||||
static void replace(QQmlListProperty<TestType> *p, int idx, TestType *v) {
|
||||
static void replace(QQmlListProperty<TestType> *p, qsizetype idx, TestType *v) {
|
||||
return reinterpret_cast<QList<TestType *> *>(p->data)->replace(idx, v);
|
||||
}
|
||||
static void removeLast(QQmlListProperty<TestType> *p) {
|
||||
|
|
|
@ -4274,13 +4274,13 @@ public:
|
|||
&ObjectsProvider::listAt);
|
||||
}
|
||||
|
||||
static int listLength(QQmlListProperty<QObject> *property)
|
||||
static qsizetype listLength(QQmlListProperty<QObject> *property)
|
||||
{
|
||||
auto objectsProvider = qobject_cast<ObjectsProvider*>(property->object);
|
||||
return objectsProvider ? objectsProvider->m_objects.length() : 0;
|
||||
}
|
||||
|
||||
static QObject* listAt(QQmlListProperty<QObject> *property, int index)
|
||||
static QObject* listAt(QQmlListProperty<QObject> *property, qsizetype index)
|
||||
{
|
||||
auto objectsProvider = qobject_cast<ObjectsProvider*>(property->object);
|
||||
return objectsProvider ? objectsProvider->m_objects.at(index) : nullptr;
|
||||
|
|
Loading…
Reference in New Issue