diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-07-09 14:44:47 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-08-31 11:17:04 +0200 |
commit | 71c0d0e34a08e812932bf6db2419d6aa307ba6b0 (patch) | |
tree | 8f7ebe554b34abb9a47e98b901ad3c09861a27f4 /src | |
parent | 7aeaa7aa1ef38ed337b41ea785852c72e48d6f22 (diff) |
Use QList instead of QVector
Task-number: QTBUG-84469
Change-Id: I9109f92d059fd4152aee1f37597c5564d477fbf9
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/controls/Private/qquickcalendarmodel_p.h | 2 | ||||
-rw-r--r-- | src/controls/Private/qquicktreemodeladaptor.cpp | 28 | ||||
-rw-r--r-- | src/controls/Private/qquicktreemodeladaptor_p.h | 8 | ||||
-rw-r--r-- | src/controls/Styles/Android/qquickandroid9patch.cpp | 8 | ||||
-rw-r--r-- | src/controls/Styles/Android/qquickandroid9patch_p.h | 4 |
5 files changed, 25 insertions, 25 deletions
diff --git a/src/controls/Private/qquickcalendarmodel_p.h b/src/controls/Private/qquickcalendarmodel_p.h index 68fdea2ec..8c6375514 100644 --- a/src/controls/Private/qquickcalendarmodel_p.h +++ b/src/controls/Private/qquickcalendarmodel_p.h @@ -90,7 +90,7 @@ protected: QDate mVisibleDate; QDate mFirstVisibleDate; QDate mLastVisibleDate; - QVector<QDate> mVisibleDates; + QList<QDate> mVisibleDates; QLocale mLocale; }; diff --git a/src/controls/Private/qquicktreemodeladaptor.cpp b/src/controls/Private/qquicktreemodeladaptor.cpp index f1c8e4130..cb16f559d 100644 --- a/src/controls/Private/qquicktreemodeladaptor.cpp +++ b/src/controls/Private/qquicktreemodeladaptor.cpp @@ -73,8 +73,8 @@ void QQuickTreeModelAdaptor1::setModel(QAbstractItemModel *arg) SLOT(modelHasBeenDestroyed()) }, { SIGNAL(modelReset()), SLOT(modelHasBeenReset()) }, - { SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)), - SLOT(modelDataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)) }, + { SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QList<int>&)), + SLOT(modelDataChanged(const QModelIndex&, const QModelIndex&, const QList<int>&)) }, { SIGNAL(layoutAboutToBeChanged(const QList<QPersistentModelIndex>&, QAbstractItemModel::LayoutChangeHint)), SLOT(modelLayoutAboutToBeChanged(const QList<QPersistentModelIndex>&, QAbstractItemModel::LayoutChangeHint)) }, @@ -459,7 +459,7 @@ void QQuickTreeModelAdaptor1::expandRow(int n) return; item.expanded = true; m_expandedItems.insert(item.index); - QVector<int> changedRole(1, ExpandedRole); + const QList<int> changedRole = { ExpandedRole }; emit dataChanged(index(n), index(n), changedRole); m_itemsToExpand.append(&item); @@ -496,7 +496,7 @@ void QQuickTreeModelAdaptor1::collapseRow(int n) TreeItem &item = m_items[n]; item.expanded = false; m_expandedItems.remove(item.index); - QVector<int> changedRole(1, ExpandedRole); + const QList<int> changedRole = { ExpandedRole }; queueDataChanged(index(n), index(n), changedRole); int childrenCount = m_model->rowCount(item.index); if ((item.index.flags() & Qt::ItemNeverHasChildren) || !m_model->hasChildren(item.index) || childrenCount == 0) @@ -541,7 +541,7 @@ void QQuickTreeModelAdaptor1::removeVisibleRows(int startIndex, int endIndex, bo if (startIndex <= lastIndex) { const QModelIndex &topLeft = index(startIndex, 0, QModelIndex()); const QModelIndex &bottomRight = index(lastIndex, 0, QModelIndex()); - const QVector<int> changedRole(1, ModelIndexRole); + const QList<int> changedRole = { ModelIndexRole }; queueDataChanged(topLeft, bottomRight, changedRole); } } @@ -562,7 +562,7 @@ void QQuickTreeModelAdaptor1::modelHasBeenReset() ASSERT_CONSISTENCY(); } -void QQuickTreeModelAdaptor1::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRigth, const QVector<int> &roles) +void QQuickTreeModelAdaptor1::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRigth, const QList<int> &roles) { Q_ASSERT(topLeft.parent() == bottomRigth.parent()); const QModelIndex &parent = topLeft.parent(); @@ -648,7 +648,7 @@ void QQuickTreeModelAdaptor1::modelRowsInserted(const QModelIndex & parent, int int parentRow = itemIndex(parent); if (parentRow >= 0) { const QModelIndex& parentIndex = index(parentRow); - QVector<int> changedRole(1, HasChildrenRole); + const QList<int> changedRole = { HasChildrenRole }; queueDataChanged(parentIndex, parentIndex, changedRole); item = m_items.at(parentRow); if (!item.expanded) { @@ -700,7 +700,7 @@ void QQuickTreeModelAdaptor1::modelRowsRemoved(const QModelIndex & parent, int s int parentRow = itemIndex(parent); if (parentRow >= 0) { const QModelIndex& parentIndex = index(parentRow); - QVector<int> changedRole(1, HasChildrenRole); + const QList<int> changedRole = { HasChildrenRole }; queueDataChanged(parentIndex, parentIndex, changedRole); } disableSignalAggregation(); @@ -722,7 +722,7 @@ void QQuickTreeModelAdaptor1::modelRowsAboutToBeMoved(const QModelIndex & source if (isVisible(destinationParent) && m_model->rowCount(destinationParent) == 0) { const QModelIndex &topLeft = index(itemIndex(destinationParent), 0, QModelIndex()); const QModelIndex &bottomRight = topLeft; - const QVector<int> changedRole(1, HasChildrenRole); + const QList<int> changedRole = { HasChildrenRole }; queueDataChanged(topLeft, bottomRight, changedRole); } } else { @@ -806,13 +806,13 @@ void QQuickTreeModelAdaptor1::modelRowsAboutToBeMoved(const QModelIndex & source } const QModelIndex &topLeft = index(top, 0, QModelIndex()); const QModelIndex &bottomRight = index(bottom, 0, QModelIndex()); - const QVector<int> changedRole(1, ModelIndexRole); + const QList<int> changedRole = { ModelIndexRole }; queueDataChanged(topLeft, bottomRight, changedRole); if (depthDifference != 0) { const QModelIndex &topLeft = index(bufferCopyOffset, 0, QModelIndex()); const QModelIndex &bottomRight = index(bufferCopyOffset + totalMovedCount - 1, 0, QModelIndex()); - const QVector<int> changedRole(1, DepthRole); + const QList<int> changedRole = { DepthRole }; queueDataChanged(topLeft, bottomRight, changedRole); } } @@ -834,7 +834,7 @@ void QQuickTreeModelAdaptor1::modelRowsMoved(const QModelIndex & sourceParent, i collapseRow(parentRow); const QModelIndex &topLeft = index(parentRow, 0, QModelIndex()); const QModelIndex &bottomRight = topLeft; - const QVector<int> changedRole { ExpandedRole, HasChildrenRole }; + const QList<int> changedRole { ExpandedRole, HasChildrenRole }; queueDataChanged(topLeft, bottomRight, changedRole); } @@ -942,7 +942,7 @@ void QQuickTreeModelAdaptor1::disableSignalAggregation() { void QQuickTreeModelAdaptor1::queueDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, - const QVector<int> &roles) + const QList<int> &roles) { if (isAggregatingSignals()) { m_queuedDataChanged.append(DataChangedParams { topLeft, bottomRight, roles }); @@ -953,7 +953,7 @@ void QQuickTreeModelAdaptor1::queueDataChanged(const QModelIndex &topLeft, void QQuickTreeModelAdaptor1::emitQueuedSignals() { - QVector<DataChangedParams> combinedUpdates; + QList<DataChangedParams> combinedUpdates; /* First, iterate through the queued updates and merge the overlapping ones * to reduce the number of updates. * We don't merge adjacent updates, because they are typically filed with a diff --git a/src/controls/Private/qquicktreemodeladaptor_p.h b/src/controls/Private/qquicktreemodeladaptor_p.h index 9a272936e..c078cc9f2 100644 --- a/src/controls/Private/qquicktreemodeladaptor_p.h +++ b/src/controls/Private/qquicktreemodeladaptor_p.h @@ -131,7 +131,7 @@ public slots: private slots: void modelHasBeenDestroyed(); void modelHasBeenReset(); - void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRigth, const QVector<int> &roles); + void modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRigth, const QList<int> &roles); void modelLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint); void modelLayoutChanged(const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint); void modelRowsAboutToBeInserted(const QModelIndex & parent, int start, int end); @@ -160,7 +160,7 @@ private: struct DataChangedParams { QModelIndex topLeft; QModelIndex bottomRight; - QVector<int> roles; + QList<int> roles; }; struct SignalFreezer { @@ -178,7 +178,7 @@ private: bool isAggregatingSignals() const { return m_signalAggregatorStack > 0; } void queueDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, - const QVector<int> &roles); + const QList<int> &roles); void emitQueuedSignals(); QPointer<QAbstractItemModel> m_model; @@ -189,7 +189,7 @@ private: mutable int m_lastItemIndex; bool m_visibleRowsMoved; int m_signalAggregatorStack; - QVector<DataChangedParams> m_queuedDataChanged; + QList<DataChangedParams> m_queuedDataChanged; }; QT_END_NAMESPACE diff --git a/src/controls/Styles/Android/qquickandroid9patch.cpp b/src/controls/Styles/Android/qquickandroid9patch.cpp index 48e86baa7..51c2a9d96 100644 --- a/src/controls/Styles/Android/qquickandroid9patch.cpp +++ b/src/controls/Styles/Android/qquickandroid9patch.cpp @@ -85,8 +85,8 @@ void QQuickAndroid9PatchNode1::initialize(QSGTexture *texture, const QRectF &bou m_geometry.allocate(xlen * ylen, verticesPerQuad * quads); QSGGeometry::TexturedPoint2D *vertices = m_geometry.vertexDataAsTexturedPoint2D(); - QVector<qreal> xCoords = xDivs.coordsForSize(bounds.width()); - QVector<qreal> yCoords = yDivs.coordsForSize(bounds.height()); + QList<qreal> xCoords = xDivs.coordsForSize(bounds.width()); + QList<qreal> yCoords = yDivs.coordsForSize(bounds.height()); for (int y = 0; y < ylen; ++y) { for (int x = 0; x < xlen; ++x, ++vertices) vertices->set(xCoords[x], yCoords[y], xDivs.data[x] / sourceSize.width(), @@ -115,7 +115,7 @@ void QQuickAndroid9PatchNode1::initialize(QSGTexture *texture, const QRectF &bou markDirty(QSGNode::DirtyGeometry | QSGNode::DirtyMaterial); } -QVector<qreal> QQuickAndroid9PatchDivs1::coordsForSize(qreal size) const +QList<qreal> QQuickAndroid9PatchDivs1::coordsForSize(qreal size) const { // n = number of stretchable sections // We have to compensate when adding 0 and/or @@ -124,7 +124,7 @@ QVector<qreal> QQuickAndroid9PatchDivs1::coordsForSize(qreal size) const const int n = (inverted ? l - 1 : l) >> 1; const qreal stretchAmount = (size - data.last()) / n; - QVector<qreal> coords; + QList<qreal> coords; coords.reserve(l); coords.append(0); diff --git a/src/controls/Styles/Android/qquickandroid9patch_p.h b/src/controls/Styles/Android/qquickandroid9patch_p.h index 8d0c2a7b2..a9f286068 100644 --- a/src/controls/Styles/Android/qquickandroid9patch_p.h +++ b/src/controls/Styles/Android/qquickandroid9patch_p.h @@ -48,13 +48,13 @@ QT_BEGIN_NAMESPACE struct QQuickAndroid9PatchDivs1 { - QVector<qreal> coordsForSize(qreal size) const; + QList<qreal> coordsForSize(qreal size) const; void fill(const QVariantList &divs, qreal size); void clear(); bool inverted; - QVector<qreal> data; + QList<qreal> data; }; class QQuickAndroid9Patch1 : public QQuickItem |