aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-06-09 11:59:29 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-06-09 13:04:03 +0200
commit2104dcd828d7c3da23300014fdddbc63f9c23cb3 (patch)
tree19a197b5c6e40a795a052bb86896da837467509e /src/imports/controls
parent135327c494b00bbc9d0c4deffba92d55c08ea93f (diff)
Use QList instead of QVector
Task-number: QTBUG-84469 Change-Id: Ic36741d2bcaec8d5e5dc96638b7122f8ce51bdb2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls')
-rw-r--r--src/imports/controls/imagine/qquickninepatchimage.cpp36
-rw-r--r--src/imports/controls/universal/qquickuniversalfocusrectangle.cpp2
2 files changed, 19 insertions, 19 deletions
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<qreal> coordsForSize(qreal count) const;
+ QList<qreal> 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<qreal> &coords, qreal count);
+ void fill(const QList<qreal> &coords, qreal count);
void clear();
private:
bool inverted = false;
- QVector<qreal> data;
+ QList<qreal> data;
};
-QVector<qreal> QQuickNinePatchData::coordsForSize(qreal size) const
+QList<qreal> QQuickNinePatchData::coordsForSize(qreal size) const
{
// n = number of stretchable sections
// We have to compensate when adding 0 and/or
@@ -70,7 +70,7 @@ QVector<qreal> QQuickNinePatchData::coordsForSize(qreal size) const
const int n = (inverted ? l - 1 : l) / 2;
const qreal stretch = (size - data.last()) / n;
- QVector<qreal> coords;
+ QList<qreal> coords;
coords.reserve(l);
coords.append(0);
@@ -87,7 +87,7 @@ QVector<qreal> QQuickNinePatchData::coordsForSize(qreal size) const
return coords;
}
-void QQuickNinePatchData::fill(const QVector<qreal> &coords, qreal size)
+void QQuickNinePatchData::fill(const QList<qreal> &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<qreal> xCoords = xDivs.coordsForSize(targetSize.width());
- QVector<qreal> yCoords = yDivs.coordsForSize(targetSize.height());
+ QList<qreal> xCoords = xDivs.coordsForSize(targetSize.width());
+ QList<qreal> 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<qreal> &horizontal, const QVector<qreal> &vertical);
- void updateInsets(const QVector<qreal> &horizontal, const QVector<qreal> &vertical);
+ void updatePaddings(const QSizeF &size, const QList<qreal> &horizontal, const QList<qreal> &vertical);
+ void updateInsets(const QList<qreal> &horizontal, const QList<qreal> &vertical);
bool resetNode = false;
qreal topPadding = 0;
@@ -207,10 +207,10 @@ public:
QQuickNinePatchData yDivs;
};
-static QVector<qreal> readCoords(const QRgb *data, int from, int count, int offset, QRgb color)
+static QList<qreal> readCoords(const QRgb *data, int from, int count, int offset, QRgb color)
{
int p1 = -1;
- QVector<qreal> coords;
+ QList<qreal> 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<qreal> hInsets = readCoords(data, (h - 1) * w + 1, w - 1, 1, red); // bottom left -> bottom right
- QVector<qreal> vInsets = readCoords(data, 2 * w - 1, h - 1, w, red); // top right -> bottom right
+ QList<qreal> hInsets = readCoords(data, (h - 1) * w + 1, w - 1, 1, red); // bottom left -> bottom right
+ QList<qreal> 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<qreal> hPaddings = readCoords(data, (h - 1) * w + leftInset + 1, sz.width() - 2, 1, black); // bottom left -> bottom right
- QVector<qreal> vPaddings = readCoords(data, (2 + topInset) * w - 1, sz.height() - 2, w, black); // top right -> bottom right
+ QList<qreal> hPaddings = readCoords(data, (h - 1) * w + leftInset + 1, sz.width() - 2, 1, black); // bottom left -> bottom right
+ QList<qreal> 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<qreal> &horizontal, const QVector<qreal> &vertical)
+void QQuickNinePatchImagePrivate::updatePaddings(const QSizeF &size, const QList<qreal> &horizontal, const QList<qreal> &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<qreal> &horizontal, const QVector<qreal> &vertical)
+void QQuickNinePatchImagePrivate::updateInsets(const QList<qreal> &horizontal, const QList<qreal> &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<qreal>(2, 1));
+ pen.setDashPattern(QList<qreal>(2, 1));
p.setPen(pen);
p.drawRect(bounds);