From 2104dcd828d7c3da23300014fdddbc63f9c23cb3 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 9 Jun 2020 11:59:29 +0200 Subject: Use QList instead of QVector Task-number: QTBUG-84469 Change-Id: Ic36741d2bcaec8d5e5dc96638b7122f8ce51bdb2 Reviewed-by: Mitch Curtis --- .../controls/imagine/qquickninepatchimage.cpp | 36 +++++++++++----------- .../universal/qquickuniversalfocusrectangle.cpp | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/imagine/qquickninepatchimage.cpp b/src/imports/controls/imagine/qquickninepatchimage.cpp index 7d5e4f71..1d6d60dd 100644 --- a/src/imports/controls/imagine/qquickninepatchimage.cpp +++ b/src/imports/controls/imagine/qquickninepatchimage.cpp @@ -46,22 +46,22 @@ QT_BEGIN_NAMESPACE struct QQuickNinePatchData { - QVector coordsForSize(qreal count) const; + QList coordsForSize(qreal count) const; inline bool isNull() const { return data.isEmpty(); } inline int count() const { return data.size(); } inline qreal at(int index) const { return data.at(index); } inline qreal size() const { return data.last(); } - void fill(const QVector &coords, qreal count); + void fill(const QList &coords, qreal count); void clear(); private: bool inverted = false; - QVector data; + QList data; }; -QVector QQuickNinePatchData::coordsForSize(qreal size) const +QList QQuickNinePatchData::coordsForSize(qreal size) const { // n = number of stretchable sections // We have to compensate when adding 0 and/or @@ -70,7 +70,7 @@ QVector QQuickNinePatchData::coordsForSize(qreal size) const const int n = (inverted ? l - 1 : l) / 2; const qreal stretch = (size - data.last()) / n; - QVector coords; + QList coords; coords.reserve(l); coords.append(0); @@ -87,7 +87,7 @@ QVector QQuickNinePatchData::coordsForSize(qreal size) const return coords; } -void QQuickNinePatchData::fill(const QVector &coords, qreal size) +void QQuickNinePatchData::fill(const QList &coords, qreal size) { data.clear(); inverted = coords.isEmpty() || coords.first() != 0; @@ -151,8 +151,8 @@ void QQuickNinePatchNode::initialize(QSGTexture *texture, const QSizeF &targetSi m_geometry.allocate(xlen * ylen, verticesPerQuad * quads); QSGGeometry::TexturedPoint2D *vertices = m_geometry.vertexDataAsTexturedPoint2D(); - QVector xCoords = xDivs.coordsForSize(targetSize.width()); - QVector yCoords = yDivs.coordsForSize(targetSize.height()); + QList xCoords = xDivs.coordsForSize(targetSize.width()); + QList yCoords = yDivs.coordsForSize(targetSize.height()); for (int y = 0; y < ylen; ++y) { for (int x = 0; x < xlen; ++x, ++vertices) @@ -189,8 +189,8 @@ class QQuickNinePatchImagePrivate : public QQuickImagePrivate public: void updatePatches(); - void updatePaddings(const QSizeF &size, const QVector &horizontal, const QVector &vertical); - void updateInsets(const QVector &horizontal, const QVector &vertical); + void updatePaddings(const QSizeF &size, const QList &horizontal, const QList &vertical); + void updateInsets(const QList &horizontal, const QList &vertical); bool resetNode = false; qreal topPadding = 0; @@ -207,10 +207,10 @@ public: QQuickNinePatchData yDivs; }; -static QVector readCoords(const QRgb *data, int from, int count, int offset, QRgb color) +static QList readCoords(const QRgb *data, int from, int count, int offset, QRgb color) { int p1 = -1; - QVector coords; + QList coords; for (int i = 0; i < count; ++i) { int p2 = from + i * offset; if (data[p2] == color) { @@ -243,17 +243,17 @@ void QQuickNinePatchImagePrivate::updatePatches() xDivs.fill(readCoords(data, 1, w - 1, 1, black), w - 2); // top left -> top right yDivs.fill(readCoords(data, w, h - 1, w, black), h - 2); // top left -> bottom left - QVector hInsets = readCoords(data, (h - 1) * w + 1, w - 1, 1, red); // bottom left -> bottom right - QVector vInsets = readCoords(data, 2 * w - 1, h - 1, w, red); // top right -> bottom right + QList hInsets = readCoords(data, (h - 1) * w + 1, w - 1, 1, red); // bottom left -> bottom right + QList vInsets = readCoords(data, 2 * w - 1, h - 1, w, red); // top right -> bottom right updateInsets(hInsets, vInsets); const QSizeF sz(w - leftInset - rightInset, h - topInset - bottomInset); - QVector hPaddings = readCoords(data, (h - 1) * w + leftInset + 1, sz.width() - 2, 1, black); // bottom left -> bottom right - QVector vPaddings = readCoords(data, (2 + topInset) * w - 1, sz.height() - 2, w, black); // top right -> bottom right + QList hPaddings = readCoords(data, (h - 1) * w + leftInset + 1, sz.width() - 2, 1, black); // bottom left -> bottom right + QList vPaddings = readCoords(data, (2 + topInset) * w - 1, sz.height() - 2, w, black); // top right -> bottom right updatePaddings(sz, hPaddings, vPaddings); } -void QQuickNinePatchImagePrivate::updatePaddings(const QSizeF &size, const QVector &horizontal, const QVector &vertical) +void QQuickNinePatchImagePrivate::updatePaddings(const QSizeF &size, const QList &horizontal, const QList &vertical) { Q_Q(QQuickNinePatchImage); qreal oldTopPadding = topPadding; @@ -287,7 +287,7 @@ void QQuickNinePatchImagePrivate::updatePaddings(const QSizeF &size, const QVect emit q->rightPaddingChanged(); } -void QQuickNinePatchImagePrivate::updateInsets(const QVector &horizontal, const QVector &vertical) +void QQuickNinePatchImagePrivate::updateInsets(const QList &horizontal, const QList &vertical) { Q_Q(QQuickNinePatchImage); qreal oldTopInset = topInset; diff --git a/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp index 88b78e10..51508c6f 100644 --- a/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp +++ b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp @@ -72,7 +72,7 @@ void QQuickUniversalFocusRectangle::paint(QPainter *painter) p.drawRect(bounds); pen.setColor(Qt::black); - pen.setDashPattern(QVector(2, 1)); + pen.setDashPattern(QList(2, 1)); p.setPen(pen); p.drawRect(bounds); -- cgit v1.2.3