aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-11-09 10:46:07 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-11-09 18:09:30 +0100
commitd7008c79d4ec023527ebfc118ad47f40075f244d (patch)
treece4e1b3e4148820fd5682ee1877a7626274cdb59 /src/imports
parent5824283a7804e7975140c17731329786045ef432 (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 'src/imports')
-rw-r--r--src/imports/labsmodels/qqmldelegatecomponent.cpp8
-rw-r--r--src/imports/labsmodels/qqmldelegatecomponent_p.h7
-rw-r--r--src/imports/labsmodels/qqmltablemodel.cpp6
-rw-r--r--src/imports/labsmodels/qqmltablemodel_p.h6
4 files changed, 14 insertions, 13 deletions
diff --git a/src/imports/labsmodels/qqmldelegatecomponent.cpp b/src/imports/labsmodels/qqmldelegatecomponent.cpp
index 68c1d3d741..2de6b55045 100644
--- a/src/imports/labsmodels/qqmldelegatecomponent.cpp
+++ b/src/imports/labsmodels/qqmldelegatecomponent.cpp
@@ -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,
diff --git a/src/imports/labsmodels/qqmldelegatecomponent_p.h b/src/imports/labsmodels/qqmldelegatecomponent_p.h
index 9655d1baf9..ed29f37809 100644
--- a/src/imports/labsmodels/qqmldelegatecomponent_p.h
+++ b/src/imports/labsmodels/qqmldelegatecomponent_p.h
@@ -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;
diff --git a/src/imports/labsmodels/qqmltablemodel.cpp b/src/imports/labsmodels/qqmltablemodel.cpp
index c4209baab3..e60c525b0d 100644
--- a/src/imports/labsmodels/qqmltablemodel.cpp
+++ b/src/imports/labsmodels/qqmltablemodel.cpp
@@ -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))
diff --git a/src/imports/labsmodels/qqmltablemodel_p.h b/src/imports/labsmodels/qqmltablemodel_p.h
index ae46cbe35c..b1a8c90837 100644
--- a/src/imports/labsmodels/qqmltablemodel_p.h
+++ b/src/imports/labsmodels/qqmltablemodel_p.h
@@ -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;