summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qboxlayout.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-09-30 14:09:04 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-04 07:40:08 +0200
commitdf9d882d41b741fef7c5beeddb0abe9d904443d8 (patch)
tree6f3e90dacad4581b7f1cabe235cca298833a3da4 /src/widgets/kernel/qboxlayout.cpp
parent109e088c7c5d0c9325966e88d55fd9f7a58f67ea (diff)
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/kernel/qboxlayout.cpp')
-rw-r--r--src/widgets/kernel/qboxlayout.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index d16d903f53..501883e85a 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -233,7 +233,7 @@ void QBoxLayoutPrivate::setupGeom()
hasHfw = false;
- int n = list.count();
+ int n = list.size();
geomArray.clear();
QList<QLayoutStruct> a(n);
@@ -365,7 +365,7 @@ void QBoxLayoutPrivate::setupGeom()
void QBoxLayoutPrivate::calcHfw(int w)
{
QList<QLayoutStruct> &a = geomArray;
- int n = a.count();
+ int n = a.size();
int h = 0;
int mh = 0;
@@ -411,9 +411,9 @@ QLayoutItem* QBoxLayoutPrivate::replaceAt(int index, QLayoutItem *item)
int QBoxLayoutPrivate::validateIndex(int index) const
{
if (index < 0)
- return list.count(); // append
+ return list.size(); // append
- Q_ASSERT_X(index >= 0 && index <= list.count(), "QBoxLayout::insert", "index out of range");
+ Q_ASSERT_X(index >= 0 && index <= list.size(), "QBoxLayout::insert", "index out of range");
return index;
}
@@ -680,7 +680,7 @@ void QBoxLayout::invalidate()
int QBoxLayout::count() const
{
Q_D(const QBoxLayout);
- return d->list.count();
+ return d->list.size();
}
/*!
@@ -689,7 +689,7 @@ int QBoxLayout::count() const
QLayoutItem *QBoxLayout::itemAt(int index) const
{
Q_D(const QBoxLayout);
- return index >= 0 && index < d->list.count() ? d->list.at(index)->item : nullptr;
+ return index >= 0 && index < d->list.size() ? d->list.at(index)->item : nullptr;
}
/*!
@@ -698,7 +698,7 @@ QLayoutItem *QBoxLayout::itemAt(int index) const
QLayoutItem *QBoxLayout::takeAt(int index)
{
Q_D(QBoxLayout);
- if (index < 0 || index >= d->list.count())
+ if (index < 0 || index >= d->list.size())
return nullptr;
QBoxLayoutItem *b = d->list.takeAt(index);
QLayoutItem *item = b->item;
@@ -749,7 +749,7 @@ void QBoxLayout::setGeometry(const QRect &r)
QList<QLayoutStruct> a = d->geomArray;
int pos = horz(d->dir) ? s.x() : s.y();
int space = horz(d->dir) ? s.width() : s.height();
- int n = a.count();
+ int n = a.size();
if (d->hasHfw && !horz(d->dir)) {
for (int i = 0; i < n; i++) {
QBoxLayoutItem *box = d->list.at(i);