diff options
Diffstat (limited to 'src')
112 files changed, 371 insertions, 371 deletions
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index cd9a01a138..cf84200f2a 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -156,7 +156,7 @@ void QVariantAnimationPrivate::convertValues(int t) { auto type = QMetaType(t); //this ensures that all the keyValues are of type t - for (int i = 0; i < keyValues.count(); ++i) { + for (int i = 0; i < keyValues.size(); ++i) { QVariantAnimation::KeyValue &pair = keyValues[i]; pair.second.convert(type); } @@ -190,7 +190,7 @@ void QVariantAnimationPrivate::updateInterpolator() void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/) { // can't interpolate if we don't have at least 2 values - if ((keyValues.count() + (defaultStartEndValue.isValid() ? 1 : 0)) < 2) + if ((keyValues.size() + (defaultStartEndValue.isValid() ? 1 : 0)) < 2) return; const qreal endProgress = (direction == QAbstractAnimation::Forward) ? qreal(1) : qreal(0); @@ -207,7 +207,7 @@ void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/) animationValueLessThan); if (it == keyValues.constBegin()) { //the item pointed to by it is the start element in the range - if (it->first == 0 && keyValues.count() > 1) { + if (it->first == 0 && keyValues.size() > 1) { currentInterval.start = *it; currentInterval.end = *(it+1); } else { @@ -216,7 +216,7 @@ void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/) } } else if (it == keyValues.constEnd()) { --it; //position the iterator on the last item - if (it->first == 1 && keyValues.count() > 1) { + if (it->first == 1 && keyValues.size() > 1) { //we have an end value (item with progress = 1) currentInterval.start = *(it-1); currentInterval.end = *it; @@ -405,7 +405,7 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun // to continue causes the app to crash on exit with a SEGV if (interpolators) { const auto locker = qt_scoped_lock(registeredInterpolatorsMutex); - if (interpolationType >= interpolators->count()) + if (interpolationType >= interpolators->size()) interpolators->resize(interpolationType + 1); interpolators->replace(interpolationType, func); } @@ -423,7 +423,7 @@ QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int in QInterpolatorVector *interpolators = registeredInterpolators(); const auto locker = qt_scoped_lock(registeredInterpolatorsMutex); QVariantAnimation::Interpolator ret = nullptr; - if (interpolationType < interpolators->count()) { + if (interpolationType < interpolators->size()) { ret = interpolators->at(interpolationType); if (ret) return ret; } diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index e58a310901..b54ae214b0 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1271,7 +1271,7 @@ qsizetype QDir::count(QT6_IMPL_NEW_OVERLOAD) const { Q_D(const QDir); d->initFileLists(*this); - return d->files.count(); + return d->files.size(); } /*! diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index e622f3af0d..7f5480c274 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -295,7 +295,7 @@ void QFileSelectorPrivate::updateSelectors() QLatin1Char pathSep(','); QStringList envSelectors = QString::fromLatin1(qgetenv("QT_FILE_SELECTORS")) .split(pathSep, Qt::SkipEmptyParts); - if (envSelectors.count()) + if (envSelectors.size()) sharedData->staticSelectors << envSelectors; if (!qEnvironmentVariableIsEmpty(env_override)) diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp index b7cb5354b6..bedace4c79 100644 --- a/src/corelib/io/qfilesystemengine.cpp +++ b/src/corelib/io/qfilesystemengine.cpp @@ -119,7 +119,7 @@ static bool _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry &ent break; const QStringList &paths = QDir::searchPaths(filePath.left(prefixSeparator)); - for (qsizetype i = 0; i < paths.count(); i++) { + for (int i = 0; i < paths.size(); i++) { entry = QFileSystemEntry(QDir::cleanPath( paths.at(i) % u'/' % QStringView{filePath}.mid(prefixSeparator + 1))); // Recurse! diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index a44ae1a260..a9919fdfa8 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -343,7 +343,7 @@ void QSettingsPrivate::requestUpdate() QStringList QSettingsPrivate::variantListToStringList(const QVariantList &l) { QStringList result; - result.reserve(l.count()); + result.reserve(l.size()); for (auto v : l) result.append(variantToString(v)); return result; @@ -358,7 +358,7 @@ QVariant QSettingsPrivate::stringListToVariantList(const QStringList &l) if (str.startsWith(u'@')) { if (str.size() < 2 || str.at(1) != u'@') { QVariantList variantList; - variantList.reserve(l.count()); + variantList.reserve(l.size()); for (const auto &s : l) variantList.append(stringToVariant(s)); return variantList; @@ -1511,7 +1511,7 @@ bool QConfFileSettingsPrivate::readIniLine(QByteArrayView data, qsizetype &dataP qsizetype &lineStart, qsizetype &lineLen, qsizetype &equalsPos) { - qsizetype dataLen = data.length(); + qsizetype dataLen = data.size(); bool inQuotes = false; equalsPos = -1; @@ -1638,7 +1638,7 @@ bool QConfFileSettingsPrivate::readIniFile(QByteArrayView data, ++position; } - Q_ASSERT(lineStart == data.length()); + Q_ASSERT(lineStart == data.size()); FLUSH_CURRENT_SECTION(); return ok; diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index b94dd6a18d..339f3c565e 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -260,10 +260,10 @@ QString QStandardPaths::writableLocation(StandardLocation type) QRegularExpressionMatch match = exp.match(line); if (match.hasMatch() && match.capturedView(1) == key) { QStringView value = match.capturedView(2); - if (value.length() > 2 + if (value.size() > 2 && value.startsWith(u'\"') && value.endsWith(u'\"')) - value = value.mid(1, value.length() - 2); + value = value.mid(1, value.size() - 2); // value can start with $HOME if (value.startsWith("$HOME"_L1)) result = QDir::homePath() + value.mid(5); @@ -371,7 +371,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) break; case AppConfigLocation: dirs = xdgConfigDirs(); - for (int i = 0; i < dirs.count(); ++i) + for (int i = 0; i < dirs.size(); ++i) appendOrganizationAndApp(dirs[i]); break; case GenericDataLocation: @@ -379,19 +379,19 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) break; case ApplicationsLocation: dirs = xdgDataDirs(); - for (int i = 0; i < dirs.count(); ++i) + for (int i = 0; i < dirs.size(); ++i) dirs[i].append("/applications"_L1); break; case AppDataLocation: case AppLocalDataLocation: dirs = xdgDataDirs(); - for (int i = 0; i < dirs.count(); ++i) + for (int i = 0; i < dirs.size(); ++i) appendOrganizationAndApp(dirs[i]); break; case FontsLocation: dirs += QDir::homePath() + "/.fonts"_L1; dirs += xdgDataDirs(); - for (int i = 1; i < dirs.count(); ++i) + for (int i = 1; i < dirs.size(); ++i) dirs[i].append("/fonts"_L1); break; default: diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 8890f3dfad..86ad1439e3 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -75,7 +75,7 @@ QTemporaryFileName::QTemporaryFileName(const QString &templateName) .nativeFilePath(); // Find mask in native path - phPos = filename.length(); + phPos = filename.size(); phLength = 0; while (phPos != 0) { --phPos; @@ -109,8 +109,8 @@ QTemporaryFileName::QTemporaryFileName(const QString &templateName) QFileSystemEntry::NativePath QTemporaryFileName::generateNext() { Q_ASSERT(length != 0); - Q_ASSERT(pos < path.length()); - Q_ASSERT(length <= path.length() - pos); + Q_ASSERT(pos < path.size()); + Q_ASSERT(length <= path.size() - pos); Char *const placeholderStart = (Char *)path.data() + pos; Char *const placeholderEnd = placeholderStart + length; diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 4be07bcb0f..a3ff86b353 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -918,7 +918,7 @@ inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions o } // check if we need to remove trailing slashes if (options & QUrl::StripTrailingSlash) { - while (thePathView.length() > 1 && thePathView.endsWith(u'/')) + while (thePathView.size() > 1 && thePathView.endsWith(u'/')) thePathView.chop(1); } diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index c63a25125b..5fc6006ef4 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -73,11 +73,11 @@ Q_AUTOTEST_EXPORT void qt_punycodeEncoder(QStringView in, QString *output) // Do not try to encode strings that certainly will result in output // that is longer than allowable domain name label length. Note that // non-BMP codepoints are encoded as two QChars. - if (in.length() > MaxDomainLabelLength * 2) + if (in.size() > MaxDomainLabelLength * 2) return; - int outLen = output->length(); - output->resize(outLen + in.length()); + int outLen = output->size(); + output->resize(outLen + in.size()); QChar *d = output->data() + outLen; bool skipped = false; @@ -468,7 +468,7 @@ static QString mapDomainName(const QString &in, QUrl::AceProcessingOptions optio */ static bool validateAsciiLabel(QStringView label) { - if (label.length() > MaxDomainLabelLength) + if (label.size() > MaxDomainLabelLength) return false; if (label.first() == u'-' || label.last() == u'-') diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index 002ff5a38e..9b3015ecf0 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -630,7 +630,7 @@ QList<QPair<QString, QString> > QUrlQuery::queryItems(QUrl::ComponentFormattingO QList<QPair<QString, QString> > result; Map::const_iterator it = d->itemList.constBegin(); Map::const_iterator end = d->itemList.constEnd(); - result.reserve(d->itemList.count()); + result.reserve(d->itemList.size()); for ( ; it != end; ++it) result << qMakePair(d->recodeToUser(it->first, encoding), d->recodeToUser(it->second, encoding)); diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index bda8b47d4a..ecac010edb 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -2120,7 +2120,7 @@ QStringList QAbstractItemModel::mimeTypes() const */ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const { - if (indexes.count() <= 0) + if (indexes.size() <= 0) return nullptr; QStringList types = mimeTypes(); if (types.isEmpty()) @@ -2159,7 +2159,7 @@ bool QAbstractItemModel::canDropMimeData(const QMimeData *data, Qt::DropAction a return false; const QStringList modelTypes = mimeTypes(); - for (int i = 0; i < modelTypes.count(); ++i) { + for (int i = 0; i < modelTypes.size(); ++i) { if (data->hasFormat(modelTypes.at(i))) return true; } @@ -2516,7 +2516,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role, // iterates twice if wrapping for (int i = 0; (wrap && i < 2) || (!wrap && i < 1); ++i) { - for (int r = from; (r < to) && (allHits || result.count() < hits); ++r) { + for (int r = from; (r < to) && (allHits || result.size() < hits); ++r) { QModelIndex idx = index(r, column, p); if (!idx.isValid()) continue; @@ -2582,7 +2582,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role, if (hasChildren(parent)) { // search the hierarchy result += match(index(0, column, parent), role, (text.isEmpty() ? value : text), - (allHits ? -1 : hits - result.count()), flags); + (allHits ? -1 : hits - result.size()), flags); } } } @@ -3446,8 +3446,8 @@ void QAbstractItemModel::changePersistentIndexList(const QModelIndexList &from, if (d->persistent.indexes.isEmpty()) return; QList<QPersistentModelIndexData *> toBeReinserted; - toBeReinserted.reserve(to.count()); - for (int i = 0; i < from.count(); ++i) { + toBeReinserted.reserve(to.size()); + for (int i = 0; i < from.size(); ++i) { if (from.at(i) == to.at(i)) continue; const auto it = d->persistent.indexes.constFind(from.at(i)); diff --git a/src/corelib/itemmodels/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp index 99324a0cd5..023587e39a 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.cpp +++ b/src/corelib/itemmodels/qabstractproxymodel.cpp @@ -443,7 +443,7 @@ QMimeData* QAbstractProxyModel::mimeData(const QModelIndexList &indexes) const { Q_D(const QAbstractProxyModel); QModelIndexList list; - list.reserve(indexes.count()); + list.reserve(indexes.size()); for (const QModelIndex &index : indexes) list << mapToSource(index); return d->model->mimeData(list); diff --git a/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp index f2e74edf19..44cf28b47a 100644 --- a/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp +++ b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp @@ -315,7 +315,7 @@ QMimeData *QConcatenateTablesProxyModel::mimeData(const QModelIndexList &indexes Q_ASSERT(checkIndex(firstIndex, CheckIndexOption::IndexIsValid)); const auto result = d->sourceModelForRow(firstIndex.row()); QModelIndexList sourceIndexes; - sourceIndexes.reserve(indexes.count()); + sourceIndexes.reserve(indexes.size()); for (const QModelIndex &index : indexes) { const QModelIndex sourceIndex = mapToSource(index); Q_ASSERT(sourceIndex.model() == result.sourceModel); // see documentation above diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp index b610298cbb..cc0730d769 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.cpp +++ b/src/corelib/itemmodels/qidentityproxymodel.cpp @@ -144,7 +144,7 @@ QItemSelection QIdentityProxyModel::mapSelectionFromSource(const QItemSelection& QItemSelection::const_iterator it = selection.constBegin(); const QItemSelection::const_iterator end = selection.constEnd(); - proxySelection.reserve(selection.count()); + proxySelection.reserve(selection.size()); for ( ; it != end; ++it) { Q_ASSERT(it->model() == d->model); const QItemSelectionRange range(mapFromSource(it->topLeft()), mapFromSource(it->bottomRight())); @@ -167,7 +167,7 @@ QItemSelection QIdentityProxyModel::mapSelectionToSource(const QItemSelection& s QItemSelection::const_iterator it = selection.constBegin(); const QItemSelection::const_iterator end = selection.constEnd(); - sourceSelection.reserve(selection.count()); + sourceSelection.reserve(selection.size()); for ( ; it != end; ++it) { Q_ASSERT(it->model() == this); const QItemSelectionRange range(mapToSource(it->topLeft()), mapToSource(it->bottomRight())); @@ -203,7 +203,7 @@ QModelIndexList QIdentityProxyModel::match(const QModelIndex& start, int role, c QModelIndexList::const_iterator it = sourceList.constBegin(); const QModelIndexList::const_iterator end = sourceList.constEnd(); QModelIndexList proxyList; - proxyList.reserve(sourceList.count()); + proxyList.reserve(sourceList.size()); for ( ; it != end; ++it) proxyList.append(mapFromSource(*it)); return proxyList; diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index ec98e3a1f7..0f3cbadca5 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -466,15 +466,15 @@ void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::Sel if (!range.isValid()) continue; newSelection.push_back(range); - for (int t = 0; t < count(); ++t) { + for (int t = 0; t < size(); ++t) { if (range.intersects(at(t))) intersections.append(at(t).intersected(range)); } } // Split the old (and new) ranges using the intersections - for (int i = 0; i < intersections.count(); ++i) { // for each intersection - for (int t = 0; t < count();) { // splitt each old range + for (int i = 0; i < intersections.size(); ++i) { // for each intersection + for (int t = 0; t < size();) { // splitt each old range if (at(t).intersects(intersections.at(i))) { split(at(t), intersections.at(i), this); removeAt(t); @@ -483,7 +483,7 @@ void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::Sel } } // only split newSelection if Toggle is specified - for (int n = 0; (command & QItemSelectionModel::Toggle) && n < newSelection.count();) { + for (int n = 0; (command & QItemSelectionModel::Toggle) && n < newSelection.size();) { if (newSelection.at(n).intersects(intersections.at(i))) { split(newSelection.at(n), intersections.at(i), &newSelection); newSelection.removeAt(n); @@ -613,7 +613,7 @@ QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection QItemSelection expanded; if (command & QItemSelectionModel::Rows) { - for (int i = 0; i < selection.count(); ++i) { + for (int i = 0; i < selection.size(); ++i) { QModelIndex parent = selection.at(i).parent(); int colCount = model->columnCount(parent); QModelIndex tl = model->index(selection.at(i).top(), 0, parent); @@ -623,7 +623,7 @@ QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection } } if (command & QItemSelectionModel::Columns) { - for (int i = 0; i < selection.count(); ++i) { + for (int i = 0; i < selection.size(); ++i) { QModelIndex parent = selection.at(i).parent(); int rowCount = model->rowCount(parent); QModelIndex tl = model->index(0, selection.at(i).left(), parent); @@ -838,7 +838,7 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged(const QList<QPersiste // optimization for when all indexes are selected // (only if there is lots of items (1000) because this is not entirely correct) - if (ranges.isEmpty() && currentSelection.count() == 1) { + if (ranges.isEmpty() && currentSelection.size() == 1) { QItemSelectionRange range = currentSelection.constFirst(); QModelIndex parent = range.parent(); tableRowCount = model->rowCount(parent); @@ -949,11 +949,11 @@ static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes) // merge rows QItemSelection rowSpans; i = 0; - while (i < colSpans.count()) { + while (i < colSpans.size()) { QModelIndex tl = colSpans.at(i).topLeft(); QModelIndex br = colSpans.at(i).bottomRight(); QModelIndex prevTl = tl; - while (++i < colSpans.count()) { + while (++i < colSpans.size()) { QModelIndex nextTl = colSpans.at(i).topLeft(); QModelIndex nextBr = colSpans.at(i).bottomRight(); @@ -1362,7 +1362,7 @@ void QItemSelectionModel::reset() void QItemSelectionModel::clearSelection() { Q_D(QItemSelectionModel); - if (d->ranges.count() == 0 && d->currentSelection.count() == 0) + if (d->ranges.size() == 0 && d->currentSelection.size() == 0) return; select(QItemSelection(), Clear); @@ -1433,7 +1433,7 @@ bool QItemSelectionModel::isSelected(const QModelIndex &index) const } // check currentSelection - if (d->currentSelection.count()) { + if (d->currentSelection.size()) { if ((d->currentCommand & Deselect) && selected) selected = !d->currentSelection.contains(index); else if (d->currentCommand & Toggle) @@ -1468,8 +1468,8 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons return false; // return false if row exist in currentSelection (Deselect) - if (d->currentCommand & Deselect && d->currentSelection.count()) { - for (int i=0; i<d->currentSelection.count(); ++i) { + if (d->currentCommand & Deselect && d->currentSelection.size()) { + for (int i=0; i<d->currentSelection.size(); ++i) { if (d->currentSelection.at(i).parent() == parent && row >= d->currentSelection.at(i).top() && row <= d->currentSelection.at(i).bottom()) @@ -1478,11 +1478,11 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons } // return false if ranges in both currentSelection and ranges // intersect and have the same row contained - if (d->currentCommand & Toggle && d->currentSelection.count()) { - for (int i=0; i<d->currentSelection.count(); ++i) + if (d->currentCommand & Toggle && d->currentSelection.size()) { + for (int i=0; i<d->currentSelection.size(); ++i) if (d->currentSelection.at(i).top() <= row && d->currentSelection.at(i).bottom() >= row) - for (int j=0; j<d->ranges.count(); ++j) + for (int j=0; j<d->ranges.size(); ++j) if (d->ranges.at(j).top() <= row && d->ranges.at(j).bottom() >= row && d->currentSelection.at(i).intersected(d->ranges.at(j)).isValid()) return false; @@ -1497,7 +1497,7 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons // add ranges and currentSelection and check through them all QList<QItemSelectionRange>::const_iterator it; QList<QItemSelectionRange> joined = d->ranges; - if (d->currentSelection.count()) + if (d->currentSelection.size()) joined += d->currentSelection; for (int column = 0; column < colCount; ++column) { if (!isSelectable(row, column)) { @@ -1542,8 +1542,8 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent return false; // return false if column exist in currentSelection (Deselect) - if (d->currentCommand & Deselect && d->currentSelection.count()) { - for (int i = 0; i < d->currentSelection.count(); ++i) { + if (d->currentCommand & Deselect && d->currentSelection.size()) { + for (int i = 0; i < d->currentSelection.size(); ++i) { if (d->currentSelection.at(i).parent() == parent && column >= d->currentSelection.at(i).left() && column <= d->currentSelection.at(i).right()) @@ -1552,11 +1552,11 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent } // return false if ranges in both currentSelection and the selection model // intersect and have the same column contained - if (d->currentCommand & Toggle && d->currentSelection.count()) { - for (int i = 0; i < d->currentSelection.count(); ++i) { + if (d->currentCommand & Toggle && d->currentSelection.size()) { + for (int i = 0; i < d->currentSelection.size(); ++i) { if (d->currentSelection.at(i).left() <= column && d->currentSelection.at(i).right() >= column) { - for (int j = 0; j < d->ranges.count(); ++j) { + for (int j = 0; j < d->ranges.size(); ++j) { if (d->ranges.at(j).left() <= column && d->ranges.at(j).right() >= column && d->currentSelection.at(i).intersected(d->ranges.at(j)).isValid()) { return false; @@ -1575,7 +1575,7 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent // add ranges and currentSelection and check through them all QList<QItemSelectionRange>::const_iterator it; QList<QItemSelectionRange> joined = d->ranges; - if (d->currentSelection.count()) + if (d->currentSelection.size()) joined += d->currentSelection; for (int row = 0; row < rowCount; ++row) { if (!isSelectable(row, column)) { @@ -1759,7 +1759,7 @@ QModelIndexList QItemSelectionModel::selectedRows(int column) const QDuplicateTracker<RowOrColumnDefinition> rowsSeen; const QItemSelection ranges = selection(); - for (int i = 0; i < ranges.count(); ++i) { + for (int i = 0; i < ranges.size(); ++i) { const QItemSelectionRange &range = ranges.at(i); QModelIndex parent = range.parent(); for (int row = range.top(); row <= range.bottom(); row++) { @@ -1788,7 +1788,7 @@ QModelIndexList QItemSelectionModel::selectedColumns(int row) const QDuplicateTracker<RowOrColumnDefinition> columnsSeen; const QItemSelection ranges = selection(); - for (int i = 0; i < ranges.count(); ++i) { + for (int i = 0; i < ranges.size(); ++i) { const QItemSelectionRange &range = ranges.at(i); QModelIndex parent = range.parent(); for (int column = range.left(); column <= range.right(); column++) { @@ -1911,9 +1911,9 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio // remove equal ranges bool advance; - for (int o = 0; o < deselected.count(); ++o) { + for (int o = 0; o < deselected.size(); ++o) { advance = true; - for (int s = 0; s < selected.count() && o < deselected.count();) { + for (int s = 0; s < selected.size() && o < deselected.size();) { if (deselected.at(o) == selected.at(s)) { deselected.removeAt(o); selected.removeAt(s); @@ -1928,17 +1928,17 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio // find intersections QItemSelection intersections; - for (int o = 0; o < deselected.count(); ++o) { - for (int s = 0; s < selected.count(); ++s) { + for (int o = 0; o < deselected.size(); ++o) { + for (int s = 0; s < selected.size(); ++s) { if (deselected.at(o).intersects(selected.at(s))) intersections.append(deselected.at(o).intersected(selected.at(s))); } } // compare remaining ranges with intersections and split them to find deselected and selected - for (int i = 0; i < intersections.count(); ++i) { + for (int i = 0; i < intersections.size(); ++i) { // split deselected - for (int o = 0; o < deselected.count();) { + for (int o = 0; o < deselected.size();) { if (deselected.at(o).intersects(intersections.at(i))) { QItemSelection::split(deselected.at(o), intersections.at(i), &deselected); deselected.removeAt(o); @@ -1947,7 +1947,7 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio } } // split selected - for (int s = 0; s < selected.count();) { + for (int s = 0; s < selected.size();) { if (selected.at(s).intersects(intersections.at(i))) { QItemSelection::split(selected.at(s), intersections.at(i), &selected); selected.removeAt(s); diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index fa88ff0a96..d067edea05 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -1243,7 +1243,7 @@ void QSortFilterProxyModelPrivate::update_persistent_indexes( { Q_Q(QSortFilterProxyModel); QModelIndexList from, to; - const int numSourceIndexes = source_indexes.count(); + const int numSourceIndexes = source_indexes.size(); from.reserve(numSourceIndexes); to.reserve(numSourceIndexes); for (const auto &indexPair : source_indexes) { @@ -2313,7 +2313,7 @@ QMimeData *QSortFilterProxyModel::mimeData(const QModelIndexList &indexes) const { Q_D(const QSortFilterProxyModel); QModelIndexList source_indexes; - source_indexes.reserve(indexes.count()); + source_indexes.reserve(indexes.size()); for (const QModelIndex &idx : indexes) source_indexes << mapToSource(idx); return d->model->mimeData(source_indexes); diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index 8d409f46a0..002f500263 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -86,7 +86,7 @@ int QStringListModel::rowCount(const QModelIndex &parent) const if (parent.isValid()) return 0; - return lst.count(); + return lst.size(); } /*! @@ -94,7 +94,7 @@ int QStringListModel::rowCount(const QModelIndex &parent) const */ QModelIndex QStringListModel::sibling(int row, int column, const QModelIndex &idx) const { - if (!idx.isValid() || column != 0 || row >= lst.count() || row < 0) + if (!idx.isValid() || column != 0 || row >= lst.size() || row < 0) return QModelIndex(); return createIndex(row, 0); @@ -310,7 +310,7 @@ void QStringListModel::sort(int, Qt::SortOrder order) emit layoutAboutToBeChanged(QList<QPersistentModelIndex>(), VerticalSortHint); QList<QPair<QString, int>> list; - const int lstCount = lst.count(); + const int lstCount = lst.size(); list.reserve(lstCount); for (int i = 0; i < lstCount; ++i) list.append(QPair<QString, int>(lst.at(i), i)); @@ -329,7 +329,7 @@ void QStringListModel::sort(int, Qt::SortOrder order) QModelIndexList oldList = persistentIndexList(); QModelIndexList newList; - const int numOldIndexes = oldList.count(); + const int numOldIndexes = oldList.size(); newList.reserve(numOldIndexes); for (int i = 0; i < numOldIndexes; ++i) newList.append(index(forwarding.at(oldList.at(i).row()), 0)); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index c178380e52..04c7474803 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -787,7 +787,7 @@ void QCoreApplicationPrivate::init() // have been removed. Once the original list is exhausted we know all the remaining // items have been added. QStringList newPaths(q->libraryPaths()); - for (qsizetype i = manualPaths->length(), j = appPaths->length(); i > 0 || j > 0; qt_noop()) { + for (qsizetype i = manualPaths->size(), j = appPaths->size(); i > 0 || j > 0; qt_noop()) { if (--j < 0) { newPaths.prepend((*manualPaths)[--i]); } else if (--i < 0) { @@ -2144,12 +2144,12 @@ static void replacePercentN(QString *result, int n) qsizetype len = 0; while ((percentPos = result->indexOf(u'%', percentPos + len)) != -1) { len = 1; - if (percentPos + len == result->length()) + if (percentPos + len == result->size()) break; QString fmt; if (result->at(percentPos + len) == u'L') { ++len; - if (percentPos + len == result->length()) + if (percentPos + len == result->size()) break; fmt = "%L1"_L1; } else { diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index c55d7d6911..e490aca0e0 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1180,7 +1180,7 @@ static const struct : QMetaTypeModuleHelper #endif QMETATYPE_CONVERTER(QString, QByteArray, result = QString::fromUtf8(source); return true;); QMETATYPE_CONVERTER(QString, QStringList, - return (source.count() == 1) ? (result = source.at(0), true) : false; + return (source.size() == 1) ? (result = source.at(0), true) : false; ); #ifndef QT_BOOTSTRAPPED QMETATYPE_CONVERTER(QString, QUrl, result = source.toString(); return true;); diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 6d7079e47f..895f7b40ae 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2155,7 +2155,7 @@ void QObjectPrivate::deleteChildren() // delete children objects // don't use qDeleteAll as the destructor of the child might // delete siblings - for (int i = 0; i < children.count(); ++i) { + for (int i = 0; i < children.size(); ++i) { currentChildBeingDeleted = children.at(i); children[i] = nullptr; delete currentChildBeingDeleted; @@ -3684,7 +3684,7 @@ void QMetaObject::connectSlotsByName(QObject *o) // ...we check each object in our list, ... bool foundIt = false; - for (int j = 0; j < list.count(); ++j) { + for (int j = 0; j < list.size(); ++j) { const QObject *co = list.at(j); const QByteArray coName = co->objectName().toLatin1(); diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp index 4c9eeb4468..8f701adc62 100644 --- a/src/corelib/kernel/qtimerinfo_unix.cpp +++ b/src/corelib/kernel/qtimerinfo_unix.cpp @@ -474,7 +474,7 @@ void QTimerInfoList::registerTimer(int timerId, qint64 interval, Qt::TimerType t bool QTimerInfoList::unregisterTimer(int timerId) { // set timer inactive - for (int i = 0; i < count(); ++i) { + for (int i = 0; i < size(); ++i) { QTimerInfo *t = at(i); if (t->id == timerId) { // found it @@ -495,7 +495,7 @@ bool QTimerInfoList::unregisterTimers(QObject *object) { if (isEmpty()) return false; - for (int i = 0; i < count(); ++i) { + for (int i = 0; i < size(); ++i) { QTimerInfo *t = at(i); if (t->obj == object) { // object found @@ -515,7 +515,7 @@ bool QTimerInfoList::unregisterTimers(QObject *object) QList<QAbstractEventDispatcher::TimerInfo> QTimerInfoList::registeredTimers(QObject *object) const { QList<QAbstractEventDispatcher::TimerInfo> list; - for (int i = 0; i < count(); ++i) { + for (int i = 0; i < size(); ++i) { const QTimerInfo * const t = at(i); if (t->obj == object) { list << QAbstractEventDispatcher::TimerInfo(t->id, diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp index fbd16102fc..3aad45792e 100644 --- a/src/corelib/mimetypes/qmimedatabase.cpp +++ b/src/corelib/mimetypes/qmimedatabase.cpp @@ -357,7 +357,7 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa // Pass 1) Try to match on the file name QMimeGlobMatchResult candidatesByName = findByFileName(fileName); - if (candidatesByName.m_allMatchingMimeTypes.count() == 1) { + if (candidatesByName.m_allMatchingMimeTypes.size() == 1) { const QMimeType mime = mimeTypeForName(candidatesByName.m_matchingMimeTypes.at(0)); if (mime.isValid()) return mime; @@ -399,7 +399,7 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa } } - if (candidatesByName.m_allMatchingMimeTypes.count() > 1) { + if (candidatesByName.m_allMatchingMimeTypes.size() > 1) { candidatesByName.m_matchingMimeTypes.sort(); // make it deterministic const QMimeType mime = mimeTypeForName(candidatesByName.m_matchingMimeTypes.at(0)); if (mime.isValid()) @@ -652,7 +652,7 @@ QList<QMimeType> QMimeDatabase::mimeTypesForFileName(const QString &fileName) co const QStringList matches = d->mimeTypeForFileName(fileName); QList<QMimeType> mimes; - mimes.reserve(matches.count()); + mimes.reserve(matches.size()); for (const QString &mime : matches) mimes.append(d->mimeTypeForName(mime)); return mimes; diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index c1533dd459..ac27d365ac 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -700,7 +700,7 @@ void QMimeXMLProvider::ensureLoaded() const QString packageDir = m_directory + QStringLiteral("/packages"); QDir dir(packageDir); const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot); - allFiles.reserve(files.count()); + allFiles.reserve(files.size()); for (const QString &xmlFile : files) allFiles.append(packageDir + u'/' + xmlFile); diff --git a/src/corelib/serialization/qtextstream_p.h b/src/corelib/serialization/qtextstream_p.h index c5967845f9..909b75d0de 100644 --- a/src/corelib/serialization/qtextstream_p.h +++ b/src/corelib/serialization/qtextstream_p.h @@ -139,14 +139,14 @@ public: NumberParsingStatus getNumber(qulonglong *l); bool getReal(double *f); - inline void write(QStringView data) { write(data.begin(), data.length()); } + inline void write(QStringView data) { write(data.begin(), data.size()); } inline void write(QChar ch); void write(const QChar *data, qsizetype len); void write(QLatin1StringView data); void writePadding(qsizetype len); inline void putString(QStringView string, bool number = false) { - putString(string.constData(), string.length(), number); + putString(string.constData(), string.size(), number); } void putString(const QChar *data, qsizetype len, bool number = false); void putString(QLatin1StringView data, bool number = false); diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h index 8e523f9c67..1fd69a2c1f 100644 --- a/src/corelib/serialization/qxmlstream_p.h +++ b/src/corelib/serialization/qxmlstream_p.h @@ -42,7 +42,7 @@ public: { } XmlStringRef(const QString *string) - : XmlStringRef(string, 0, string->length()) + : XmlStringRef(string, 0, string->size()) { } diff --git a/src/corelib/text/qchar.cpp b/src/corelib/text/qchar.cpp index a9cf306dd9..272de292c5 100644 --- a/src/corelib/text/qchar.cpp +++ b/src/corelib/text/qchar.cpp @@ -2061,7 +2061,7 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo enum { NFQC_YES = 0, NFQC_NO = 1, NFQC_MAYBE = 3 }; const ushort *string = reinterpret_cast<const ushort *>(str->constData()); - qsizetype length = str->length(); + qsizetype length = str->size(); // this avoids one out of bounds check in the loop while (length > from && QChar::isHighSurrogate(string[length - 1])) @@ -2104,8 +2104,8 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo *lastStable = pos; } - if (length != str->length()) // low surrogate parts at the end of text - *lastStable = str->length() - 1; + if (length != str->size()) // low surrogate parts at the end of text + *lastStable = str->size() - 1; return true; } diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 031ba74fac..bd41f7ea5b 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -555,7 +555,7 @@ static bool isScript(QStringView tag) static const QString allScripts = QString::fromLatin1(reinterpret_cast<const char *>(script_code_list), sizeof(script_code_list) - 1); - return tag.length() == 4 && allScripts.indexOf(tag) % 4 == 0; + return tag.size() == 4 && allScripts.indexOf(tag) % 4 == 0; } bool qt_splitLocaleName(QStringView name, QStringView *lang, QStringView *script, QStringView *land) @@ -4014,7 +4014,7 @@ bool QLocaleData::validateChars(QStringView str, NumberMode numMode, QByteArray int decDigits, QLocale::NumberOptions number_options) const { buff->clear(); - buff->reserve(str.length()); + buff->reserve(str.size()); enum { Whole, Fractional, Exponent } state = Whole; const bool scientific = numMode == DoubleScientificMode; @@ -4110,7 +4110,7 @@ double QLocaleData::stringToDouble(QStringView str, bool *ok, } int processed = 0; bool nonNullOk = false; - double d = qt_asciiToDouble(buff.constData(), buff.length() - 1, nonNullOk, processed); + double d = qt_asciiToDouble(buff.constData(), buff.size() - 1, nonNullOk, processed); if (ok != nullptr) *ok = nonNullOk; return d; diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 2372a5cb0b..79ab557e81 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -2718,9 +2718,9 @@ void QString::resize(qsizetype size) void QString::resize(qsizetype newSize, QChar fillChar) { - const qsizetype oldSize = length(); + const qsizetype oldSize = size(); resize(newSize); - const qsizetype difference = length() - oldSize; + const qsizetype difference = size() - oldSize; if (difference > 0) std::fill_n(d.data() + oldSize, difference, fillChar.unicode()); } @@ -4188,7 +4188,7 @@ QString &QString::replace(QChar c, QLatin1StringView after, Qt::CaseSensitivity */ qsizetype QString::indexOf(const QString &str, qsizetype from, Qt::CaseSensitivity cs) const { - return QtPrivate::findString(QStringView(unicode(), length()), from, QStringView(str.unicode(), str.size()), cs); + return QtPrivate::findString(QStringView(unicode(), size()), from, QStringView(str.unicode(), str.size()), cs); } /*! @@ -4242,7 +4242,7 @@ qsizetype QString::indexOf(QLatin1StringView str, qsizetype from, Qt::CaseSensit */ qsizetype QString::indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const { - return qFindChar(QStringView(unicode(), length()), ch, from, cs); + return qFindChar(QStringView(unicode(), size()), ch, from, cs); } /*! @@ -4506,7 +4506,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) } // add the last part of the after string - len = afterView.length() - lastEnd; + len = afterView.size() - lastEnd; if (len > 0) { chunks << afterView.mid(lastEnd, len); newLength += len; @@ -4516,9 +4516,9 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) } // 3. trailing string after the last match - if (copyView.length() > lastEnd) { + if (copyView.size() > lastEnd) { chunks << copyView.mid(lastEnd); - newLength += copyView.length() - lastEnd; + newLength += copyView.size() - lastEnd; } // 4. assemble the chunks together @@ -4526,7 +4526,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) qsizetype i = 0; QChar *uc = data(); for (const QStringView &chunk : std::as_const(chunks)) { - qsizetype len = chunk.length(); + qsizetype len = chunk.size(); memcpy(uc + i, chunk.constData(), len * sizeof(QChar)); i += len; } @@ -4889,7 +4889,7 @@ static QString extractSections(const QList<qt_section_chunk> §ions, qsizetyp qsizetype skip = 0; for (qsizetype k = 0; k < sectionsSize; ++k) { const qt_section_chunk §ion = sections.at(k); - if (section.length == section.string.length()) + if (section.length == section.string.size()) skip++; } if (start < 0) @@ -4905,7 +4905,7 @@ static QString extractSections(const QList<qt_section_chunk> §ions, qsizetyp qsizetype first_i = start, last_i = end; for (qsizetype i = 0; x <= end && i < sectionsSize; ++i) { const qt_section_chunk §ion = sections.at(i); - const bool empty = (section.length == section.string.length()); + const bool empty = (section.length == section.string.size()); if (x >= start) { if (x == start) first_i = i; @@ -4964,7 +4964,7 @@ QString QString::section(const QRegularExpression &re, qsizetype start, qsizetyp sep.setPatternOptions(sep.patternOptions() | QRegularExpression::CaseInsensitiveOption); QList<qt_section_chunk> sections; - qsizetype n = length(), m = 0, last_m = 0, last_len = 0; + qsizetype n = size(), m = 0, last_m = 0, last_len = 0; QRegularExpressionMatchIterator iterator = sep.globalMatch(*this); while (iterator.hasNext()) { QRegularExpressionMatch match = iterator.next(); @@ -5321,7 +5321,7 @@ static QByteArray qt_convert_to_latin1(QStringView string) if (Q_UNLIKELY(string.isNull())) return QByteArray(); - QByteArray ba(string.length(), Qt::Uninitialized); + QByteArray ba(string.size(), Qt::Uninitialized); // since we own the only copy, we're going to const_cast the constData; // that avoids an unnecessary call to detach() and expansion code that will never get used @@ -5490,7 +5490,7 @@ QList<uint> QString::toUcs4() const static QList<uint> qt_convert_to_ucs4(QStringView string) { - QList<uint> v(string.length()); + QList<uint> v(string.size()); uint *a = const_cast<uint*>(v.constData()); QStringIterator it(string); while (it.hasNext()) @@ -6445,7 +6445,7 @@ int QLatin1StringView::compare_helper(const QChar *data1, qsizetype length1, QLa */ int QString::localeAwareCompare(const QString &other) const { - return localeAwareCompare_helper(constData(), length(), other.constData(), other.size()); + return localeAwareCompare_helper(constData(), size(), other.constData(), other.size()); } /*! @@ -6561,7 +6561,7 @@ const ushort *QString::utf16() const QString QString::leftJustified(qsizetype width, QChar fill, bool truncate) const { QString result; - qsizetype len = length(); + qsizetype len = size(); qsizetype padlen = width - len; if (padlen > 0) { result.resize(len+padlen); @@ -6600,7 +6600,7 @@ QString QString::leftJustified(qsizetype width, QChar fill, bool truncate) const QString QString::rightJustified(qsizetype width, QChar fill, bool truncate) const { QString result; - qsizetype len = length(); + qsizetype len = size(); qsizetype padlen = width - len; if (padlen > 0) { result.resize(len+padlen); @@ -7933,7 +7933,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar:: // check if it's fully ASCII first, because then we have no work auto start = reinterpret_cast<const char16_t *>(data->constData()); const char16_t *p = start + from; - if (isAscii_helper(p, p + data->length() - from)) + if (isAscii_helper(p, p + data->size() - from)) return; if (p > start + from) from = p - start - 1; // need one before the non-ASCII to perform NFC @@ -8119,9 +8119,9 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, qsizetyp // Negative field-width for right-padding, positive for left-padding: const qsizetype abs_field_width = qAbs(field_width); const qsizetype result_len = - s.length() - d.escape_len - + (d.occurrences - d.locale_occurrences) * qMax(abs_field_width, arg.length()) - + d.locale_occurrences * qMax(abs_field_width, larg.length()); + s.size() - d.escape_len + + (d.occurrences - d.locale_occurrences) * qMax(abs_field_width, arg.size()) + + d.locale_occurrences * qMax(abs_field_width, larg.size()); QString result(result_len, Qt::Uninitialized); QChar *rc = const_cast<QChar *>(result.unicode()); @@ -8164,15 +8164,15 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, qsizetyp rc += escape_start - text_start; const QStringView use = localize ? larg : arg; - const qsizetype pad_chars = abs_field_width - use.length(); + const qsizetype pad_chars = abs_field_width - use.size(); // (If negative, relevant loops are no-ops: no need to check.) if (field_width > 0) { // left padded rc = std::fill_n(rc, pad_chars, fillChar); } - memcpy(rc, use.data(), use.length() * sizeof(QChar)); - rc += use.length(); + memcpy(rc, use.data(), use.size() * sizeof(QChar)); + rc += use.size(); if (field_width < 0) { // right padded rc = std::fill_n(rc, pad_chars, fillChar); @@ -10956,7 +10956,7 @@ qsizetype QtPrivate::count(QStringView haystack, const QRegularExpression &re) } qsizetype count = 0; qsizetype index = -1; - qsizetype len = haystack.length(); + qsizetype len = haystack.size(); while (index <= len - 1) { QRegularExpressionMatch match = re.matchView(haystack, index + 1); if (!match.hasMatch()) @@ -10983,7 +10983,7 @@ qsizetype QtPrivate::count(QStringView haystack, const QRegularExpression &re) QString QString::toHtmlEscaped() const { QString rich; - const qsizetype len = length(); + const qsizetype len = size(); rich.reserve(qsizetype(len * 1.1)); for (QChar ch : *this) { if (ch == u'<') diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 9c67558edd..300b54feb6 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -679,19 +679,19 @@ public: QString &insert(qsizetype i, QChar c); QString &insert(qsizetype i, const QChar *uc, qsizetype len); inline QString &insert(qsizetype i, const QString &s) { return insert(i, s.constData(), s.size()); } - inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.length()); } + inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.size()); } QString &insert(qsizetype i, QLatin1StringView s); QString &append(QChar c); QString &append(const QChar *uc, qsizetype len); QString &append(const QString &s); - inline QString &append(QStringView v) { return append(v.data(), v.length()); } + inline QString &append(QStringView v) { return append(v.data(), v.size()); } QString &append(QLatin1StringView s); inline QString &prepend(QChar c) { return insert(0, c); } inline QString &prepend(const QChar *uc, qsizetype len) { return insert(0, uc, len); } inline QString &prepend(const QString &s) { return insert(0, s); } - inline QString &prepend(QStringView v) { return prepend(v.data(), v.length()); } + inline QString &prepend(QStringView v) { return prepend(v.data(), v.size()); } inline QString &prepend(QLatin1StringView s) { return insert(0, s); } inline QString &operator+=(QChar c) { return append(c); } @@ -1193,7 +1193,7 @@ QString QLatin1StringView::toString() const { return *this; } // QString QStringView::toString() const -{ return Q_ASSERT(size() == length()), QString(data(), length()); } +{ return Q_ASSERT(size() == size()), QString(data(), size()); } qint64 QStringView::toLongLong(bool *ok, int base) const { return QString::toIntegral_helper<qint64>(*this, ok, base); } @@ -1483,7 +1483,7 @@ inline QString QString::fromStdString(const std::string &s) inline std::wstring QString::toStdWString() const { std::wstring str; - str.resize(length()); + str.resize(size()); str.resize(toWCharArray(str.data())); return str; } @@ -1495,16 +1495,16 @@ inline QString QString::fromStdU16String(const std::u16string &s) { return fromUtf16(s.data(), qsizetype(s.size())); } inline std::u16string QString::toStdU16String() const -{ return std::u16string(reinterpret_cast<const char16_t*>(data()), length()); } +{ return std::u16string(reinterpret_cast<const char16_t*>(data()), size()); } inline QString QString::fromStdU32String(const std::u32string &s) { return fromUcs4(s.data(), qsizetype(s.size())); } inline std::u32string QString::toStdU32String() const { - std::u32string u32str(length(), char32_t(0)); + std::u32string u32str(size(), char32_t(0)); qsizetype len = toUcs4_helper(reinterpret_cast<const ushort *>(constData()), - length(), reinterpret_cast<uint*>(&u32str[0])); + size(), reinterpret_cast<uint*>(&u32str[0])); u32str.resize(len); return u32str; } @@ -1521,9 +1521,9 @@ inline int QString::compare(QStringView s, Qt::CaseSensitivity cs) const noexcep { return -s.compare(*this, cs); } inline int QString::localeAwareCompare(QStringView s) const -{ return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } +{ return localeAwareCompare_helper(constData(), size(), s.constData(), s.size()); } inline int QString::localeAwareCompare(QStringView s1, QStringView s2) -{ return localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); } +{ return localeAwareCompare_helper(s1.constData(), s1.size(), s2.constData(), s2.size()); } inline int QStringView::localeAwareCompare(QStringView other) const { return QString::localeAwareCompare(*this, other); } diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp index a0e0173cbb..bdba20de3a 100644 --- a/src/corelib/text/qstringconverter.cpp +++ b/src/corelib/text/qstringconverter.cpp @@ -504,7 +504,7 @@ char *QUtf8::convertFromUnicode(char *out, QStringView in, QStringConverter::Sta { Q_ASSERT(state); const QChar *uc = in.data(); - qsizetype len = in.length(); + qsizetype len = in.size(); if (!len) return out; @@ -915,13 +915,13 @@ char *QUtf16::convertFromUnicode(char *out, QStringView in, QStringConverter::St out += 2; } if (endian == BigEndianness) - qToBigEndian<char16_t>(in.data(), in.length(), out); + qToBigEndian<char16_t>(in.data(), in.size(), out); else - qToLittleEndian<char16_t>(in.data(), in.length(), out); + qToLittleEndian<char16_t>(in.data(), in.size(), out); state->remainingChars = 0; state->internalState |= HeaderDone; - return out + 2*in.length(); + return out + 2*in.size(); } QString QUtf16::convertToUnicode(QByteArrayView in, QStringConverter::State *state, DataEndianness endian) @@ -1051,7 +1051,7 @@ char *QUtf32::convertFromUnicode(char *out, QStringView in, QStringConverter::St } const QChar *uc = in.data(); - const QChar *end = in.data() + in.length(); + const QChar *end = in.data() + in.size(); QChar ch; char32_t ucs4; if (state->remainingChars == 1) { @@ -1489,7 +1489,7 @@ static char *toLatin1(char *out, QStringView in, QStringConverter::State *state) const char replacement = (state && state->flags & QStringConverter::Flag::ConvertInvalidToNull) ? 0 : '?'; qsizetype invalid = 0; - for (qsizetype i = 0; i < in.length(); ++i) { + for (qsizetype i = 0; i < in.size(); ++i) { if (in[i] > QChar(0xff)) { *out = replacement; ++invalid; @@ -1765,7 +1765,7 @@ struct QStringConverterICU : QStringConverter auto source = reinterpret_cast<const UChar *>(in.data()); auto sourceLimit = reinterpret_cast<const UChar *>(in.data() + in.size()); - qsizetype length = UCNV_GET_MAX_BYTES_FOR_STRING(in.length(), ucnv_getMaxCharSize(icu_conv)); + qsizetype length = UCNV_GET_MAX_BYTES_FOR_STRING(in.size(), ucnv_getMaxCharSize(icu_conv)); char *target = out; char *targetLimit = out + length; diff --git a/src/corelib/text/qstringlist.cpp b/src/corelib/text/qstringlist.cpp index 8eb730ee02..2c0dc77a5a 100644 --- a/src/corelib/text/qstringlist.cpp +++ b/src/corelib/text/qstringlist.cpp @@ -387,7 +387,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, QStringView befo QStringView after, Qt::CaseSensitivity cs) { for (qsizetype i = 0; i < that->size(); ++i) - (*that)[i].replace(before.data(), before.length(), after.data(), after.length(), cs); + (*that)[i].replace(before.data(), before.size(), after.data(), after.size(), cs); } #if QT_CONFIG(regularexpression) @@ -492,7 +492,7 @@ QString QtPrivate::QStringList_join(const QStringList &list, QLatin1StringView s */ QString QtPrivate::QStringList_join(const QStringList *that, QStringView sep) { - return QStringList_join(that, sep.data(), sep.length()); + return QStringList_join(that, sep.data(), sep.size()); } /*! diff --git a/src/corelib/text/qtextboundaryfinder.cpp b/src/corelib/text/qtextboundaryfinder.cpp index 937f88b252..8f20967a1d 100644 --- a/src/corelib/text/qtextboundaryfinder.cpp +++ b/src/corelib/text/qtextboundaryfinder.cpp @@ -20,7 +20,7 @@ static void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharA case QTextBoundaryFinder::Line: options |= QUnicodeTools::LineBreaks; break; default: break; } - QUnicodeTools::initCharAttributes(str, scriptItems.data(), scriptItems.count(), attributes, options); + QUnicodeTools::initCharAttributes(str, scriptItems.data(), scriptItems.size(), attributes, options); } /*! diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h index 6d4259e279..af559b7a96 100644 --- a/src/corelib/thread/qresultstore.h +++ b/src/corelib/thread/qresultstore.h @@ -164,23 +164,23 @@ public: if (containsValidResultItem(index)) // reject if already present return -1; - return addResults(index, new QList<T>(*results), results->count(), results->count()); + return addResults(index, new QList<T>(*results), results->size(), results->size()); } template<typename T> int addResults(int index, const QList<T> *results, int totalCount) { // reject if results are empty, and nothing is filtered away - if ((m_filterMode == false || results->count() == totalCount) && results->empty()) + if ((m_filterMode == false || results->size() == totalCount) && results->empty()) return -1; if (containsValidResultItem(index)) // reject if already present return -1; - if (m_filterMode == true && results->count() != totalCount && 0 == results->count()) + if (m_filterMode == true && results->size() != totalCount && 0 == results->size()) return addResults(index, nullptr, 0, totalCount); - return addResults(index, new QList<T>(*results), results->count(), totalCount); + return addResults(index, new QList<T>(*results), results->size(), totalCount); } int addCanceledResult(int index) diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index 0386e47102..c2029fe1b3 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -55,11 +55,11 @@ QThreadStorageData::QThreadStorageData(void (*func)(void *)) DEBUG_MSG("QThreadStorageData: Allocated id %d, destructor %p cannot be stored", id, func); return; } - for (id = 0; id < destr->count(); id++) { + for (id = 0; id < destr->size(); id++) { if (destr->at(id) == nullptr) break; } - if (id == destr->count()) { + if (id == destr->size()) { destr->append(func); } else { (*destr)[id] = func; diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 21f252a70d..35f01c8022 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -123,7 +123,7 @@ static ParsedRfcDateTime rfcDateImpl(QStringView s) QDate date; const auto isShortName = [](QStringView name) { - return (name.length() == 3 && name[0].isUpper() + return (name.size() == 3 && name[0].isUpper() && name[1].isLower() && name[2].isLower()); }; diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp index 298e477719..c7838953ad 100644 --- a/src/corelib/time/qtimezone.cpp +++ b/src/corelib/time/qtimezone.cpp @@ -751,7 +751,7 @@ QTimeZone::OffsetDataList QTimeZone::transitions(const QDateTime &fromDateTime, if (hasTransitions()) { const QTimeZonePrivate::DataList plist = d->transitions(fromDateTime.toMSecsSinceEpoch(), toDateTime.toMSecsSinceEpoch()); - list.reserve(plist.count()); + list.reserve(plist.size()); for (const QTimeZonePrivate::Data &pdata : plist) list.append(QTimeZonePrivate::toOffsetData(pdata)); } diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 03074f4f32..f63b0c5c59 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -500,9 +500,9 @@ QString QCommandLineParser::errorText() const { if (!d->errorText.isEmpty()) return d->errorText; - if (d->unknownOptionNames.count() == 1) + if (d->unknownOptionNames.size() == 1) return tr("Unknown option '%1'.").arg(d->unknownOptionNames.first()); - if (d->unknownOptionNames.count() > 1) + if (d->unknownOptionNames.size() > 1) return tr("Unknown options: %1.").arg(d->unknownOptionNames.join(QStringLiteral(", "))); return QString(); } diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 40041a9ff3..d8b3367de3 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1274,7 +1274,7 @@ void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2, QList<QPointF> static inline tcbToBezier(const TCBPoints &tcbPoints) { - const int count = tcbPoints.count(); + const int count = tcbPoints.size(); QList<QPointF> bezierPoints; bezierPoints.reserve(3 * (count - 1)); diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index a59670ccca..cdd9ceda20 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -151,7 +151,7 @@ public: // more Qt typedef iterator Iterator; typedef const_iterator ConstIterator; - inline qsizetype count() const { return q_hash.count(); } + inline qsizetype count() const { return q_hash.size(); } inline iterator insert(const T &value) { return q_hash.insert(value, QHashDummyValue()); } inline iterator insert(T &&value) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index fbf0c0d4fb..8b190b8e5f 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -327,7 +327,7 @@ static QByteArray buildMatchRule(const QString &service, // add the argument string-matching now if (!argMatch.args.isEmpty()) { const QString keyValue = "arg%1='%2',"_L1; - for (int i = 0; i < argMatch.args.count(); ++i) + for (int i = 0; i < argMatch.args.size(); ++i) if (!argMatch.args.at(i).isNull()) result += keyValue.arg(i).arg(argMatch.args.at(i)); } @@ -945,7 +945,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q outputArgs.reserve(numMetaTypes - i + 1); QVariant arg{QMetaType(metaTypes[0])}; outputArgs.append( arg ); - params[0] = const_cast<void*>(outputArgs.at( outputArgs.count() - 1 ).constData()); + params[0] = const_cast<void*>(outputArgs.at( outputArgs.size() - 1 ).constData()); } else { outputArgs.reserve(numMetaTypes - i); } @@ -953,7 +953,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q for ( ; i < numMetaTypes; ++i) { QVariant arg{QMetaType(metaTypes[i])}; outputArgs.append( arg ); - params.append(const_cast<void*>(outputArgs.at( outputArgs.count() - 1 ).constData())); + params.append(const_cast<void*>(outputArgs.at( outputArgs.size() - 1 ).constData())); } // make call: diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 2cb6e97f22..054bc448e6 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -221,7 +221,7 @@ void QDBusMetaObjectGenerator::parseMethods() bool ok = true; // build the input argument list - for (qsizetype i = 0; i < m.inputArgs.count(); ++i) { + for (qsizetype i = 0; i < m.inputArgs.size(); ++i) { const QDBusIntrospection::Argument &arg = m.inputArgs.at(i); Type type = findType(arg.type.toLatin1(), m.annotations, "In", i); @@ -240,7 +240,7 @@ void QDBusMetaObjectGenerator::parseMethods() if (!ok) continue; // build the output argument list: - for (qsizetype i = 0; i < m.outputArgs.count(); ++i) { + for (qsizetype i = 0; i < m.outputArgs.size(); ++i) { const QDBusIntrospection::Argument &arg = m.outputArgs.at(i); Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i); @@ -297,7 +297,7 @@ void QDBusMetaObjectGenerator::parseSignals() bool ok = true; // build the output argument list - for (qsizetype i = 0; i < s.outputArgs.count(); ++i) { + for (qsizetype i = 0; i < s.outputArgs.size(); ++i) { const QDBusIntrospection::Argument &arg = s.outputArgs.at(i); Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i); diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index 7390e8d7a4..eb5aab4fd6 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -306,7 +306,7 @@ namespace QDBusUtil return false; // can't be valid if it's empty const QChar *c = part.data(); - for (int i = 0; i < part.length(); ++i) + for (int i = 0; i < part.size(); ++i) if (!isValidCharacterNoDash(c[i])) return false; @@ -358,7 +358,7 @@ namespace QDBusUtil */ bool isValidUniqueConnectionName(QStringView connName) { - if (connName.isEmpty() || connName.length() > DBUS_MAXIMUM_NAME_LENGTH || + if (connName.isEmpty() || connName.size() > DBUS_MAXIMUM_NAME_LENGTH || !connName.startsWith(u':')) return false; @@ -371,7 +371,7 @@ namespace QDBusUtil return false; const QChar* c = part.data(); - for (int j = 0; j < part.length(); ++j) + for (int j = 0; j < part.size(); ++j) if (!isValidCharacter(c[j])) return false; } @@ -419,7 +419,7 @@ namespace QDBusUtil const QChar *c = part.data(); if (isValidNumber(c[0])) return false; - for (int j = 0; j < part.length(); ++j) + for (int j = 0; j < part.size(); ++j) if (!isValidCharacter(c[j])) return false; } @@ -435,13 +435,13 @@ namespace QDBusUtil */ bool isValidMemberName(QStringView memberName) { - if (memberName.isEmpty() || memberName.length() > DBUS_MAXIMUM_NAME_LENGTH) + if (memberName.isEmpty() || memberName.size() > DBUS_MAXIMUM_NAME_LENGTH) return false; const QChar* c = memberName.data(); if (isValidNumber(c[0])) return false; - for (int j = 0; j < memberName.length(); ++j) + for (int j = 0; j < memberName.size(); ++j) if (!isValidCharacterNoDash(c[j])) return false; return true; diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp index c6e339b4bb..e650a59151 100644 --- a/src/gui/accessible/linux/atspiadaptor.cpp +++ b/src/gui/accessible/linux/atspiadaptor.cpp @@ -1811,12 +1811,12 @@ QRect AtSpiAdaptor::getExtents(QAccessibleInterface *interface, uint coordType) bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) { if (function == "GetNActions"_L1) { - int count = QAccessibleBridgeUtils::effectiveActionNames(interface).count(); + int count = QAccessibleBridgeUtils::effectiveActionNames(interface).size(); sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(count)))); } else if (function == "DoAction"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); - if (index < 0 || index >= actionNames.count()) + if (index < 0 || index >= actionNames.size()) return false; const QString actionName = actionNames.at(index); bool success = QAccessibleBridgeUtils::performEffectiveAction(interface, actionName); @@ -1826,13 +1826,13 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin } else if (function == "GetName"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); - if (index < 0 || index >= actionNames.count()) + if (index < 0 || index >= actionNames.size()) return false; sendReply(connection, message, actionNames.at(index)); } else if (function == "GetDescription"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); - if (index < 0 || index >= actionNames.count()) + if (index < 0 || index >= actionNames.size()) return false; QString description; if (QAccessibleActionInterface *actionIface = interface->actionInterface()) @@ -1843,7 +1843,7 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin } else if (function == "GetKeyBinding"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); - if (index < 0 || index >= actionNames.count()) + if (index < 0 || index >= actionNames.size()) return false; QStringList keyBindings; if (QAccessibleActionInterface *actionIface = interface->actionInterface()) @@ -1853,7 +1853,7 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin if (!acc.isEmpty()) keyBindings.append(acc); } - if (keyBindings.length() > 0) + if (keyBindings.size() > 0) sendReply(connection, message, keyBindings.join(u';')); else sendReply(connection, message, QString()); diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 233231c797..e54738e075 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -670,7 +670,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) const QString cn = QLatin1StringView(mo->className()); // Check if the class has a InterfaceFactory installed. - for (int i = qAccessibleFactories()->count(); i > 0; --i) { + for (int i = qAccessibleFactories()->size(); i > 0; --i) { InterfaceFactory factory = qAccessibleFactories()->at(i - 1); if (QAccessibleInterface *iface = factory(cn, object)) { QAccessibleCache::instance()->insert(object, iface); @@ -787,7 +787,7 @@ bool QAccessible::isActive() */ void QAccessible::setActive(bool active) { - for (int i = 0; i < qAccessibleActivationObservers()->count() ;++i) + for (int i = 0; i < qAccessibleActivationObservers()->size() ;++i) qAccessibleActivationObservers()->at(i)->accessibilityActiveChanged(active); } diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index af9d3aa0fc..61d3a90632 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -124,7 +124,7 @@ static QObjectList topLevelObjects() { QObjectList list; const QWindowList tlw(QGuiApplication::topLevelWindows()); - for (int i = 0; i < tlw.count(); ++i) { + for (int i = 0; i < tlw.size(); ++i) { QWindow *w = tlw.at(i); if (w->type() != Qt::Popup && w->type() != Qt::Desktop) { if (QAccessibleInterface *root = w->accessibleRoot()) { @@ -140,7 +140,7 @@ static QObjectList topLevelObjects() /*! \reimp */ int QAccessibleApplication::childCount() const { - return topLevelObjects().count(); + return topLevelObjects().size(); } /*! \reimp */ @@ -160,7 +160,7 @@ QAccessibleInterface *QAccessibleApplication::parent() const QAccessibleInterface *QAccessibleApplication::child(int index) const { const QObjectList tlo(topLevelObjects()); - if (index >= 0 && index < tlo.count()) + if (index >= 0 && index < tlo.size()) return QAccessible::queryAccessibleInterface(tlo.at(index)); return nullptr; } diff --git a/src/gui/accessible/qplatformaccessibility.cpp b/src/gui/accessible/qplatformaccessibility.cpp index 92936c74e6..ae7635ff7c 100644 --- a/src/gui/accessible/qplatformaccessibility.cpp +++ b/src/gui/accessible/qplatformaccessibility.cpp @@ -50,7 +50,7 @@ void QPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) if (!bridges() || bridges()->isEmpty()) return; - for (int i = 0; i < bridges()->count(); ++i) + for (int i = 0; i < bridges()->size(); ++i) bridges()->at(i)->notifyAccessibilityUpdate(event); } @@ -63,7 +63,7 @@ void QPlatformAccessibility::setRootObject(QObject *o) if (!o) return; - for (int i = 0; i < bridges()->count(); ++i) { + for (int i = 0; i < bridges()->size(); ++i) { QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o); bridges()->at(i)->setRootObject(iface); } diff --git a/src/gui/itemmodels/qfileinfogatherer.cpp b/src/gui/itemmodels/qfileinfogatherer.cpp index f7c36b4ca8..1b88b3e018 100644 --- a/src/gui/itemmodels/qfileinfogatherer.cpp +++ b/src/gui/itemmodels/qfileinfogatherer.cpp @@ -344,13 +344,13 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil if (files.isEmpty()) { infoList = QDir::drives(); } else { - infoList.reserve(files.count()); + infoList.reserve(files.size()); for (const auto &file : files) infoList << QFileInfo(file); } QList<QPair<QString, QFileInfo>> updatedFiles; - updatedFiles.reserve(infoList.count()); - for (int i = infoList.count() - 1; i >= 0; --i) { + updatedFiles.reserve(infoList.size()); + for (int i = infoList.size() - 1; i >= 0; --i) { QFileInfo driveInfo = infoList.at(i); driveInfo.stat(); QString driveName = translateDriveName(driveInfo); diff --git a/src/gui/itemmodels/qfilesystemmodel.cpp b/src/gui/itemmodels/qfilesystemmodel.cpp index 44278f86be..d44e89fde0 100644 --- a/src/gui/itemmodels/qfilesystemmodel.cpp +++ b/src/gui/itemmodels/qfilesystemmodel.cpp @@ -394,12 +394,12 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS QFileSystemModelPrivate::QFileSystemNode *parent = node(index); - for (int i = 0; i < pathElements.count(); ++i) { + for (int i = 0; i < pathElements.size(); ++i) { QString element = pathElements.at(i); if (i != 0) elementPath.append(separator); elementPath.append(element); - if (i == pathElements.count() - 1) + if (i == pathElements.size() - 1) elementPath.append(trailingSeparator); #ifdef Q_OS_WIN // On Windows, "filename " and "filename" are equivalent and @@ -1106,7 +1106,7 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order) emit layoutAboutToBeChanged(); QModelIndexList oldList = persistentIndexList(); QList<QPair<QFileSystemModelPrivate::QFileSystemNode *, int>> oldNodes; - const int nodeCount = oldList.count(); + const int nodeCount = oldList.size(); oldNodes.reserve(nodeCount); for (int i = 0; i < nodeCount; ++i) { const QModelIndex &oldNode = oldList.at(i); @@ -1752,7 +1752,7 @@ void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, cons if ((iterator == newFiles.end()) || (i.value()->fileName < *iterator)) toRemove.append(i.value()->fileName); } - for (int i = 0 ; i < toRemove.count() ; ++i ) + for (int i = 0 ; i < toRemove.size() ; ++i ) removeNode(parentNode, toRemove[i]); } @@ -1844,7 +1844,7 @@ void QFileSystemModelPrivate::addVisibleFiles(QFileSystemNode *parentNode, const QModelIndex parent = index(parentNode); bool indexHidden = isHiddenByFilter(parentNode, parent); if (!indexHidden) { - q->beginInsertRows(parent, parentNode->visibleChildren.size() , parentNode->visibleChildren.size() + newFiles.count() - 1); + q->beginInsertRows(parent, parentNode->visibleChildren.size() , parentNode->visibleChildren.size() + newFiles.size() - 1); } if (parentNode->dirtyChildrenIndex == -1) @@ -1974,11 +1974,11 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, max = QString();*/ } - if (newFiles.count() > 0) { + if (newFiles.size() > 0) { addVisibleFiles(parentNode, newFiles); } - if (newFiles.count() > 0 || (sortColumn != 0 && rowsToUpdate.size() > 0)) { + if (newFiles.size() > 0 || (sortColumn != 0 && rowsToUpdate.size() > 0)) { forceSort = true; delayedSort(); } diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 8a21190e49..0920398610 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -2529,9 +2529,9 @@ QStandardItem *QStandardItemModel::verticalHeaderItem(int row) const void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels) { Q_D(QStandardItemModel); - if (columnCount() < labels.count()) - setColumnCount(labels.count()); - for (int i = 0; i < labels.count(); ++i) { + if (columnCount() < labels.size()) + setColumnCount(labels.size()); + for (int i = 0; i < labels.size(); ++i) { QStandardItem *item = horizontalHeaderItem(i); if (!item) { item = d->createItem(); @@ -2552,9 +2552,9 @@ void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels) void QStandardItemModel::setVerticalHeaderLabels(const QStringList &labels) { Q_D(QStandardItemModel); - if (rowCount() < labels.count()) - setRowCount(labels.count()); - for (int i = 0; i < labels.count(); ++i) { + if (rowCount() < labels.size()) + setRowCount(labels.size()); + for (int i = 0; i < labels.size(); ++i) { QStandardItem *item = verticalHeaderItem(i); if (!item) { item = d->createItem(); @@ -3112,9 +3112,9 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const QSet<QStandardItem*> itemsSet; QStack<QStandardItem*> stack; - itemsSet.reserve(indexes.count()); - stack.reserve(indexes.count()); - for (int i = 0; i < indexes.count(); ++i) { + itemsSet.reserve(indexes.size()); + stack.reserve(indexes.size()); + for (int i = 0; i < indexes.size(); ++i) { if (QStandardItem *item = itemFromIndex(indexes.at(i))) { itemsSet << item; stack.push(item); diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 646c705148..36030cac42 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -883,7 +883,7 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking if (modalWindowList.isEmpty() || windowNeverBlocked(window)) return false; - for (int i = 0; i < modalWindowList.count(); ++i) { + for (int i = 0; i < modalWindowList.size(); ++i) { QWindow *modalWindow = modalWindowList.at(i); // A window is not blocked by another modal window if the two are diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 338ec08357..7085e65ae4 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1129,7 +1129,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma // except for a single '+' at the end of the string. // Only '+' can have length 1. - if (sub.length() == 1) { + if (sub.size() == 1) { // Make sure we only encounter a single '+' at the end of the accel if (accel.lastIndexOf(u'+') != accel.size()-1) return Qt::Key_unknown; @@ -1157,7 +1157,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma accelRef = accelRef.mid(p + 1); int fnum = 0; - if (accelRef.length() == 1) { + if (accelRef.size() == 1) { #if defined(Q_OS_MACOS) int qtKey = qtkeyForMacSymbol(accelRef.at(0)); if (qtKey != -1) { @@ -1554,7 +1554,7 @@ QList<QKeySequence> QKeySequence::listFromString(const QString &str, SequenceFor QList<QKeySequence> result; const QStringList strings = str.split("; "_L1); - result.reserve(strings.count()); + result.reserve(strings.size()); for (const QString &string : strings) { result << fromString(string, format); } diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index ceec540784..77cbfd2b96 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -35,7 +35,7 @@ Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd") static QWindow* topLevelAt(const QPoint &pos) { QWindowList list = QGuiApplication::topLevelWindows(); - for (int i = list.count()-1; i >= 0; --i) { + for (int i = list.size()-1; i >= 0; --i) { QWindow *w = list.at(i); if (w->isVisible() && w->handle() && w->geometry().contains(pos) && !qobject_cast<QShapedPixmapWindow*>(w)) return w; diff --git a/src/gui/painting/qpageranges.cpp b/src/gui/painting/qpageranges.cpp index 2c4d5cca6c..500673b22f 100644 --- a/src/gui/painting/qpageranges.cpp +++ b/src/gui/painting/qpageranges.cpp @@ -162,7 +162,7 @@ QPageRanges QPageRanges::fromString(const QString &ranges) if (item.contains(u'-')) { const QStringList rangeItems = item.split(u'-'); - if (rangeItems.count() != 2) + if (rangeItems.size() != 2) return QPageRanges(); bool ok; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index f3dc7588f9..66123eee7d 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -4278,7 +4278,7 @@ protected: void QGradientCache::generateGradientColorTable(const QGradient& gradient, QRgba64 *colorTable, int size, int opacity) const { const QGradientStops stops = gradient.stops(); - int stopCount = stops.count(); + int stopCount = stops.size(); Q_ASSERT(stopCount > 0); bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation); diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 99d67599ed..a3a89d7504 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -421,7 +421,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a) { QDebugStateSaver saver(dbg); dbg.nospace() << "QPolygon("; - for (int i = 0; i < a.count(); ++i) + for (int i = 0; i < a.size(); ++i) dbg.nospace() << a.at(i); dbg.nospace() << ')'; return dbg; @@ -742,7 +742,7 @@ QDebug operator<<(QDebug dbg, const QPolygonF &a) { QDebugStateSaver saver(dbg); dbg.nospace() << "QPolygonF("; - for (int i = 0; i < a.count(); ++i) + for (int i = 0; i < a.size(); ++i) dbg.nospace() << a.at(i); dbg.nospace() << ')'; return dbg; diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index fc403f60b1..457c2cc259 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3818,7 +3818,7 @@ QRegion::QRegion(const QRect &r, RegionType t) QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule) { - if (a.count() > 2) { + if (a.size() > 2) { QRegionPrivate *qt_rgn = PolygonRegion(a.constData(), a.size(), fillRule == Qt::WindingFill ? WindingRule : EvenOddRule); if (qt_rgn) { diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 8aecf16729..6c49cd35ea 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1760,7 +1760,7 @@ QPolygon QTransform::mapToPolygon(const QRect &rect) const */ bool QTransform::squareToQuad(const QPolygonF &quad, QTransform &trans) { - if (quad.count() != 4) + if (quad.size() != 4) return false; qreal dx0 = quad[0].x(); diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 01c0b40294..9ed7f89b2a 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -478,7 +478,7 @@ bool QRhiVulkan::create(QRhi::Flags flags) for (const VkExtensionProperties &p : std::as_const(extProps)) devExts.append({ p.extensionName, p.specVersion }); } - qCDebug(QRHI_LOG_INFO, "%d device extensions available", int(devExts.count())); + qCDebug(QRHI_LOG_INFO, "%d device extensions available", int(devExts.size())); QList<const char *> requestedDevExts; requestedDevExts.append("VK_KHR_swapchain"); @@ -1759,7 +1759,7 @@ QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::Begin // when profiling is enabled, pick a free query (pair) from the pool int timestampQueryIdx = -1; if (hasGpuFrameTimeCallback() && swapChainD->bufferCount > 1) { // no timestamps if not having at least 2 frames in flight - for (int i = 0; i < timestampQueryPoolMap.count(); ++i) { + for (int i = 0; i < timestampQueryPoolMap.size(); ++i) { if (!timestampQueryPoolMap.testBit(i)) { timestampQueryPoolMap.setBit(i); timestampQueryIdx = i * 2; @@ -3245,9 +3245,9 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat cmd.args.copyBufferToImage.src = utexD->stagingBuffers[currentFrameSlot]; cmd.args.copyBufferToImage.dst = utexD->image; cmd.args.copyBufferToImage.dstLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - cmd.args.copyBufferToImage.count = copyInfos.count(); + cmd.args.copyBufferToImage.count = copyInfos.size(); cmd.args.copyBufferToImage.bufferImageCopyIndex = cbD->pools.bufferImageCopy.size(); - cbD->pools.bufferImageCopy.append(copyInfos.constData(), copyInfos.count()); + cbD->pools.bufferImageCopy.append(copyInfos.constData(), copyInfos.size()); // no reuse of staging, this is intentional QRhiVulkan::DeferredReleaseEntry e; diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp index 47fc598a81..85a0271272 100644 --- a/src/gui/rhi/qshader.cpp +++ b/src/gui/rhi/qshader.cpp @@ -388,7 +388,7 @@ QByteArray QShader::serialized() const const QShaderKey &k(it.key()); writeShaderKey(&ds, k); const NativeResourceBindingMap &map(it.value()); - ds << int(map.count()); + ds << int(map.size()); for (auto mapIt = map.cbegin(), mapItEnd = map.cend(); mapIt != mapItEnd; ++mapIt) { ds << mapIt.key(); ds << mapIt.value().first; @@ -400,7 +400,7 @@ QByteArray QShader::serialized() const const QShaderKey &k(it.key()); writeShaderKey(&ds, k); const SeparateToCombinedImageSamplerMappingList &list(it.value()); - ds << int(list.count()); + ds << int(list.size()); for (auto listIt = list.cbegin(), listItEnd = list.cend(); listIt != listItEnd; ++listIt) { ds << listIt->combinedSamplerName; ds << listIt->textureBinding; diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 98293d436c..2f3c04dc54 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -697,7 +697,7 @@ static ColorData parseColorValue(QCss::Value v) return ColorData(); QStringList lst = v.variant.toStringList(); - if (lst.count() != 2) + if (lst.size() != 2) return ColorData(); const QString &identifier = lst.at(0); @@ -794,7 +794,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal) return BrushData(); QStringList lst = v.variant.toStringList(); - if (lst.count() != 2) + if (lst.size() != 2) return BrushData(); QStringList gradFuncs; @@ -1617,7 +1617,7 @@ QRect Declaration::rectValue() const if (v.type != Value::Function) return QRect(); const QStringList func = v.variant.toStringList(); - if (func.count() != 2 || func.at(0).compare("rect"_L1) != 0) + if (func.size() != 2 || func.at(0).compare("rect"_L1) != 0) return QRect(); const auto args = QStringView{func[1]}.split(u' ', Qt::SkipEmptyParts); if (args.size() != 4) @@ -1863,7 +1863,7 @@ int Selector::specificity() const val += 1; val += (sel.pseudos.size() + sel.attributeSelectors.size()) * 0x10; - val += sel.ids.count() * 0x100; + val += sel.ids.size() * 0x100; } return val; } @@ -2128,7 +2128,7 @@ QList<StyleRule> StyleSelector::styleRulesForNode(NodePtr node) if (!styleSheet.idIndex.isEmpty()) { QStringList ids = nodeIds(node); - for (int i = 0; i < ids.count(); i++) { + for (int i = 0; i < ids.size(); i++) { const QString &key = ids.at(i); QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.idIndex.constFind(key); while (it != styleSheet.idIndex.constEnd() && it.key() == key) { @@ -2139,7 +2139,7 @@ QList<StyleRule> StyleSelector::styleRulesForNode(NodePtr node) } if (!styleSheet.nameIndex.isEmpty()) { QStringList names = nodeNames(node); - for (int i = 0; i < names.count(); i++) { + for (int i = 0; i < names.size(); i++) { QString name = names.at(i); if (nameCaseSensitivity == Qt::CaseInsensitive) name = std::move(name).toLower(); diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 3ff73baf92..2b649a7dd8 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -179,7 +179,7 @@ static QStringList splitIntoFamilies(const QString &family) auto str = list.at(i).trimmed(); if ((str.startsWith(u'"') && str.endsWith(u'"')) || (str.startsWith(u'\'') && str.endsWith(u'\''))) { - str = str.mid(1, str.length() - 2); + str = str.mid(1, str.size() - 2); } familyList << str.toString(); } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 27284d8d5a..35d6048594 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1904,9 +1904,9 @@ void QTextEngine::itemize() const { QUnicodeTools::ScriptItemArray scriptItems; QUnicodeTools::initScripts(layoutData->string, &scriptItems); - for (int i = 0; i < scriptItems.length(); ++i) { + for (int i = 0; i < scriptItems.size(); ++i) { const auto &item = scriptItems.at(i); - int end = i < scriptItems.length() - 1 ? scriptItems.at(i + 1).position : length; + int end = i < scriptItems.size() - 1 ? scriptItems.at(i + 1).position : length; for (int j = item.position; j < end; ++j) analysis[j].script = item.script; } @@ -3171,7 +3171,7 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const if (tabSpec.type == QTextOption::RightTab || tabSpec.type == QTextOption::CenterTab) { // find next tab to calculate the width required. tab = QFixed::fromReal(tabSpec.position); - for (int i=item + 1; i < layoutData->items.count(); i++) { + for (int i=item + 1; i < layoutData->items.size(); i++) { const QScriptItem &item = layoutData->items[i]; if (item.analysis.flags == QScriptAnalysis::TabOrObject) { // found it. tabSectionEnd = item.position; @@ -3186,7 +3186,7 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const if (tabSectionEnd > si.position) { QFixed length; // Calculate the length of text between this tab and the tabSectionEnd - for (int i=item; i < layoutData->items.count(); i++) { + for (int i=item; i < layoutData->items.size(); i++) { const QScriptItem &item = layoutData->items.at(i); if (item.position > tabSectionEnd || item.position <= si.position) continue; @@ -3258,7 +3258,7 @@ void QTextEngine::resolveFormats() const QTextFormatCollection *collection = formatCollection(); - QList<QTextCharFormat> resolvedFormats(layoutData->items.count()); + QList<QTextCharFormat> resolvedFormats(layoutData->items.size()); QVarLengthArray<int, 64> formatsSortedByStart; formatsSortedByStart.reserve(specialData->formats.size()); @@ -3276,7 +3276,7 @@ void QTextEngine::resolveFormats() const const int *startIt = formatsSortedByStart.constBegin(); const int *endIt = formatsSortedByEnd.constBegin(); - for (int i = 0; i < layoutData->items.count(); ++i) { + for (int i = 0; i < layoutData->items.size(); ++i) { const QScriptItem *si = &layoutData->items.at(i); int end = si->position + length(si); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 56b9e82be0..508d472062 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3988,7 +3988,7 @@ int QTextFormatCollection::createObjectIndex(const QTextFormat &f) QTextFormat QTextFormatCollection::format(int idx) const { - if (idx < 0 || idx >= formats.count()) + if (idx < 0 || idx >= formats.size()) return QTextFormat(); return formats.at(idx); @@ -3997,7 +3997,7 @@ QTextFormat QTextFormatCollection::format(int idx) const void QTextFormatCollection::setDefaultFont(const QFont &f) { defaultFnt = f; - for (int i = 0; i < formats.count(); ++i) + for (int i = 0; i < formats.size(); ++i) if (formats.at(i).d) formats[i].d->resolveFont(defaultFnt); } diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h index fac7082c1d..1bd9120513 100644 --- a/src/gui/text/qtextformat_p.h +++ b/src/gui/text/qtextformat_p.h @@ -55,7 +55,7 @@ public: inline QTextImageFormat imageFormat(int index) const { return format(index).toImageFormat(); } - inline int numFormats() const { return formats.count(); } + inline int numFormats() const { return formats.size(); } typedef QList<QTextFormat> FormatVector; diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 995f5d3502..55c64bb256 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -771,7 +771,7 @@ QString QTextHtmlParser::parseEntity(QStringView entity) if (!resolved.isNull()) return QString(resolved); - if (entity.length() > 1 && entity.at(0) == u'#') { + if (entity.size() > 1 && entity.at(0) == u'#') { entity = entity.mid(1); // removing leading # int base = 10; @@ -1029,7 +1029,7 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent // set element specific attributes switch (id) { case Html_a: - for (int i = 0; i < attributes.count(); i += 2) { + for (int i = 0; i < attributes.size(); i += 2) { const QString key = attributes.at(i); if (key.compare("href"_L1, Qt::CaseInsensitive) == 0 && !attributes.at(i + 1).isEmpty()) { @@ -1575,12 +1575,12 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) QString linkHref; QString linkType; - if (attributes.count() % 2 == 1) + if (attributes.size() % 2 == 1) return; QTextHtmlParserNode *node = nodes.last(); - for (int i = 0; i < attributes.count(); i += 2) { + for (int i = 0; i < attributes.size(); i += 2) { QString key = attributes.at(i); QString value = attributes.at(i + 1); @@ -1942,7 +1942,7 @@ QList<QCss::Declaration> standardDeclarationForNode(const QTextHtmlParserNode &n case Html_u: { bool needsUnderline = (node.id == Html_u) ? true : false; if (node.id == Html_a) { - for (int i = 0; i < node.attributes.count(); i += 2) { + for (int i = 0; i < node.attributes.size(); i += 2) { const QString key = node.attributes.at(i); if (key.compare("href"_L1, Qt::CaseInsensitive) == 0 && !node.attributes.at(i + 1).isEmpty()) { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 286722fc4c..14cd773834 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1323,7 +1323,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition int neighborItem = itm; if (neighborItem > 0 && si->position == realCursorPosition) --neighborItem; - else if (neighborItem < d->layoutData->items.count() - 1 && si->position + si->num_glyphs == realCursorPosition) + else if (neighborItem < d->layoutData->items.size() - 1 && si->position + si->num_glyphs == realCursorPosition) ++neighborItem; const bool onBoundary = neighborItem != itm && si->analysis.bidiLevel != d->layoutData->items[neighborItem].analysis.bidiLevel; @@ -2215,7 +2215,7 @@ int QTextLine::textStart() const int QTextLine::textLength() const { if (eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators - && eng->block.isValid() && index == eng->lines.count()-1) { + && eng->block.isValid() && index == eng->lines.size()-1) { return eng->lines.at(index).length - 1; } return eng->lines.at(index).length + eng->lines.at(index).trailingSpaces; @@ -2900,7 +2900,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const int neighborItem = itm; if (neighborItem > 0 && scriptItem->position == pos) --neighborItem; - else if (neighborItem < eng->layoutData->items.count() - 1 && scriptItem->position + scriptItem->num_glyphs == pos) + else if (neighborItem < eng->layoutData->items.size() - 1 && scriptItem->position + scriptItem->num_glyphs == pos) ++neighborItem; const bool onBoundary = neighborItem != itm && scriptItem->analysis.bidiLevel != eng->layoutData->items[neighborItem].analysis.bidiLevel; // If we are, prioritise the neighbor item that has the same direction as the engine @@ -3217,7 +3217,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const // character between lines is a space and we want // to position the cursor to the left of that // character. - if (index < eng->lines.count() - 1) + if (index < eng->lines.size() - 1) pos = qMin(eng->previousLogicalPosition(pos), pos); return pos; diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index 2b178b70c9..8b4b308d0c 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -86,7 +86,7 @@ QTextList::~QTextList() int QTextList::count() const { Q_D(const QTextList); - return d->blocks.count(); + return d->blocks.size(); } /*! diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 1a201969f0..8d3195dce6 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -165,7 +165,7 @@ QTextDocument *QTextObject::document() const void QTextBlockGroupPrivate::markBlocksDirty() { - for (int i = 0; i < blocks.count(); ++i) { + for (int i = 0; i < blocks.size(); ++i) { const QTextBlock &block = blocks.at(i); pieceTable->documentChange(block.position(), block.length()); } diff --git a/src/gui/vulkan/qbasicvulkanplatforminstance.cpp b/src/gui/vulkan/qbasicvulkanplatforminstance.cpp index a674d71592..31e27cdac5 100644 --- a/src/gui/vulkan/qbasicvulkanplatforminstance.cpp +++ b/src/gui/vulkan/qbasicvulkanplatforminstance.cpp @@ -243,13 +243,13 @@ void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const // No clever stuff with QSet and friends: the order for layers matters // and the user-provided order must be kept. - for (int i = 0; i < m_enabledLayers.count(); ++i) { + for (int i = 0; i < m_enabledLayers.size(); ++i) { const QByteArray &layerName(m_enabledLayers[i]); if (!m_supportedLayers.contains(layerName)) m_enabledLayers.removeAt(i--); } qDebug(lcPlatVk) << "Enabling Vulkan instance layers:" << m_enabledLayers; - for (int i = 0; i < m_enabledExtensions.count(); ++i) { + for (int i = 0; i < m_enabledExtensions.size(); ++i) { const QByteArray &extName(m_enabledExtensions[i]); if (!m_supportedExtensions.contains(extName)) m_enabledExtensions.removeAt(i--); diff --git a/src/network/access/qhttpheaderparser.cpp b/src/network/access/qhttpheaderparser.cpp index 558f8dbd5c..489defa8d8 100644 --- a/src/network/access/qhttpheaderparser.cpp +++ b/src/network/access/qhttpheaderparser.cpp @@ -102,7 +102,7 @@ bool QHttpHeaderParser::parseStatus(QByteArrayView status) static const int spacePos = 8; static const char httpMagic[] = "HTTP/"; - if (status.length() < minLength + if (status.size() < minLength || !status.startsWith(httpMagic) || status.at(dotPos) != '.' || status.at(spacePos) != ' ') { diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 9e5f48c456..91660cf2f7 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -657,7 +657,7 @@ QAuthenticatorPrivate::parseDigestAuthenticationChallenge(QByteArrayView challen QHash<QByteArray, QByteArray> options; // parse the challenge const char *d = challenge.data(); - const char *end = d + challenge.length(); + const char *end = d + challenge.size(); while (d < end) { while (d < end && (*d == ' ' || *d == '\n' || *d == '\r')) ++d; @@ -1759,7 +1759,7 @@ static QByteArray qGssapiContinue(QAuthenticatorPrivate *ctx, QByteArrayView cha if (!challenge.isEmpty()) { inBuf.value = const_cast<char*>(challenge.data()); - inBuf.length = challenge.length(); + inBuf.length = challenge.size(); } majStat = gss_init_sec_context(&minStat, diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index b2ad52ba8d..09375393a8 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -181,7 +181,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const int rotationAngle = 0; bool invertx = false; bool inverty = false; - for (int i = 0; i < args.count(); ++i) { + for (int i = 0; i < args.size(); ++i) { if (args.at(i).startsWith("rotate"_L1)) { QString rotateArg = args.at(i).section(u'=', 1, 1); bool ok; diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp index 7643122926..89b6df605b 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp +++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp @@ -200,7 +200,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) { const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray(); const QByteArrayList vposComp = vpos.split(','); - if (vposComp.count() == 2) + if (vposComp.size() == 2) vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt()); } if (userConnectorConfig.value(QStringLiteral("primary")).toBool()) @@ -478,7 +478,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, const QStringList crtcPlanePairs = val.split(u':'); for (const QString &crtcPlanePair : crtcPlanePairs) { const QStringList values = crtcPlanePair.split(u','); - if (values.count() == 2 && uint(values[0].toInt()) == output.crtc_id) { + if (values.size() == 2 && uint(values[0].toInt()) == output.crtc_id) { uint planeId = values[1].toInt(); for (QKmsPlane &kmsplane : m_planes) { if (kmsplane.id == planeId) { diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp index 145352973d..a304963669 100644 --- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp +++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp @@ -39,7 +39,7 @@ QTuioHandler::QTuioHandler(const QString &specification) bool invertx = false; bool inverty = false; - for (int i = 0; i < args.count(); ++i) { + for (int i = 0; i < args.size(); ++i) { if (args.at(i).startsWith("udp=")) { QString portString = args.at(i).section('=', 1, 1); portNumber = portString.toInt(); @@ -326,7 +326,7 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message) Q_UNUSED(message); // TODO: do we need to do anything with the frame id? QWindow *win = QGuiApplication::focusWindow(); - if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery) + if (!win && QGuiApplication::topLevelWindows().size() > 0 && forceDelivery) win = QGuiApplication::topLevelWindows().at(0); if (!win) @@ -499,7 +499,7 @@ void QTuioHandler::process2DObjFseq(const QOscMessage &message) Q_UNUSED(message); // TODO: do we need to do anything with the frame id? QWindow *win = QGuiApplication::focusWindow(); - if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery) + if (!win && QGuiApplication::topLevelWindows().size() > 0 && forceDelivery) win = QGuiApplication::topLevelWindows().at(0); if (!win) diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index 6c15d7c142..7c3a9d0741 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -56,7 +56,7 @@ protected: if (isEmpty()) return QStringList(); - if (!formatList.count()) { + if (!formatList.size()) { QXcbClipboardMime *that = const_cast<QXcbClipboardMime *>(this); // get the list of targets from the current clipboard owner - we do this // once so that multiple calls to this function don't require multiple diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index 3d1229044c..b4e28ab831 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -108,7 +108,7 @@ static void sm_setProperty(const QString &name, const QString &value) static void sm_setProperty(const QString &name, const QStringList &value) { - SmPropValue *prop = new SmPropValue[value.count()]; + SmPropValue *prop = new SmPropValue[value.size()]; int count = 0; QList<QByteArray> vl; vl.reserve(value.size()); diff --git a/src/plugins/printsupport/cups/qcupsprintersupport.cpp b/src/plugins/printsupport/cups/qcupsprintersupport.cpp index 539cd55c54..40381097d2 100644 --- a/src/plugins/printsupport/cups/qcupsprintersupport.cpp +++ b/src/plugins/printsupport/cups/qcupsprintersupport.cpp @@ -57,7 +57,7 @@ static const char *getPasswordCB(const char */*prompt*/, http_t *http, const cha QString resourceString = QString::fromLocal8Bit(resource); if (resourceString.startsWith(QStringLiteral("/printers/"))) - resourceString = resourceString.mid(QStringLiteral("/printers/").length()); + resourceString = resourceString.mid(QStringLiteral("/printers/").size()); QLabel *label = new QLabel(); if (hostname == QStringLiteral("localhost")) { diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp index 487b02784e..95813c90fa 100644 --- a/src/plugins/printsupport/cups/qppdprintdevice.cpp +++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp @@ -428,7 +428,7 @@ bool QPpdPrintDevice::setProperty(QPrintDevice::PrintDevicePropertyKey key, cons { if (key == PDPK_PpdOption) { const QStringList values = value.toStringList(); - if (values.count() == 2) { + if (values.size() == 2) { ppdMarkOption(m_ppd, values[0].toLatin1(), values[1].toLatin1()); return true; } @@ -441,7 +441,7 @@ bool QPpdPrintDevice::isFeatureAvailable(QPrintDevice::PrintDevicePropertyKey ke { if (key == PDPK_PpdChoiceIsInstallableConflict) { const QStringList values = params.toStringList(); - if (values.count() == 2) + if (values.size() == 2) return ppdInstallableConflict(m_ppd, values[0].toLatin1(), values[1].toLatin1()); } diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index 301e45d2c9..6812addae1 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -779,7 +779,7 @@ void QSQLiteDriver::close() for (QSQLiteResult *result : std::as_const(d->results)) result->d_func()->finalize(); - if (d->access && (d->notificationid.count() > 0)) { + if (d->access && (d->notificationid.size() > 0)) { d->notificationid.clear(); sqlite3_update_hook(d->access, nullptr, nullptr); } @@ -990,7 +990,7 @@ bool QSQLiteDriver::subscribeToNotification(const QString &name) //sqlite supports only one notification callback, so only the first is registered d->notificationid << name; - if (d->notificationid.count() == 1) + if (d->notificationid.size() == 1) sqlite3_update_hook(d->access, &handle_sqlite_callback, reinterpret_cast<void *> (this)); return true; diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp index f4d3263f48..051b1a8552 100644 --- a/src/printsupport/kernel/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -196,7 +196,7 @@ QCUPSSupport::JobSheets QCUPSSupport::parseJobSheets(const QString &jobSheets) JobSheets result; const QStringList parts = jobSheets.split(u','); - if (parts.count() == 2) { + if (parts.size() == 2) { result.startBannerPage = stringToBannerPage(parts[0]); result.endBannerPage = stringToBannerPage(parts[1]); } diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 56d5edb39f..642aea5461 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -630,7 +630,7 @@ bool QSqlResult::exec() int i; QVariant val; QString holder; - for (i = d->holders.count() - 1; i >= 0; --i) { + for (i = d->holders.size() - 1; i >= 0; --i) { holder = d->holders.at(i).holderName; val = d->values.value(d->indexes.value(holder).value(0,-1)); QSqlField f(""_L1, val.metaType()); diff --git a/src/testlib/qpropertytesthelper_p.h b/src/testlib/qpropertytesthelper_p.h index b5bd8d2583..f2cb82cdd7 100644 --- a/src/testlib/qpropertytesthelper_p.h +++ b/src/testlib/qpropertytesthelper_p.h @@ -129,7 +129,7 @@ void testReadWritePropertyBasics( testedObj.property(propertyName).template value<PropertyType>(), initial, comparator, represent); if (spy) - QCOMPARE(spy->count(), 1); + QCOMPARE(spy->size(), 1); QUntypedBindable bindable = metaProperty.bindable(&instance); @@ -148,7 +148,7 @@ void testReadWritePropertyBasics( QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent); QPROPERTY_TEST_COMPARISON_HELPER(propObserverLambda.value(), changed, comparator, represent); if (spy) - QCOMPARE(spy->count(), 2); + QCOMPARE(spy->size(), 2); // Bind object's property to other property QProperty<PropertyType> propSetter(initial); @@ -162,7 +162,7 @@ void testReadWritePropertyBasics( QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), initial, comparator, represent); QPROPERTY_TEST_COMPARISON_HELPER(propObserverLambda.value(), initial, comparator, represent); if (spy) - QCOMPARE(spy->count(), 3); + QCOMPARE(spy->size(), 3); // Count notifications triggered; should only happen on actual change. int updateCount = 0; @@ -177,7 +177,7 @@ void testReadWritePropertyBasics( QPROPERTY_TEST_COMPARISON_HELPER(propObserverLambda.value(), changed, comparator, represent); QCOMPARE(updateCount, 1); if (spy) - QCOMPARE(spy->count(), 4); + QCOMPARE(spy->size(), 4); // Test that manually setting the value (even the same one) breaks the // binding. @@ -188,7 +188,7 @@ void testReadWritePropertyBasics( // value didn't change -> the signal should not be emitted if (spy) - QCOMPARE(spy->count(), 4); + QCOMPARE(spy->size(), 4); } /*! @@ -287,7 +287,7 @@ void testWriteOncePropertyBasics( represent); QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent); if (spy) - QCOMPARE(spy->count(), 1); + QCOMPARE(spy->size(), 1); // Attempt to set back the 'prior' value and verify that it has no effect testedObj.setProperty(propertyName, QVariant::fromValue(prior)); @@ -296,7 +296,7 @@ void testWriteOncePropertyBasics( represent); QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent); if (spy) - QCOMPARE(spy->count(), 1); + QCOMPARE(spy->size(), 1); if (bindingPreservedOnWrite) QVERIFY(bindable.hasBinding()); else @@ -386,7 +386,7 @@ void testReadOnlyPropertyBasics( testedObj.property(propertyName).template value<PropertyType>(), initial, comparator, represent); if (spy) - QCOMPARE(spy->count(), 0); + QCOMPARE(spy->size(), 0); QProperty<PropertyType> propObserver; propObserver.setBinding(bindable.makeBinding()); @@ -402,7 +402,7 @@ void testReadOnlyPropertyBasics( QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent); if (spy) - QCOMPARE(spy->count(), 1); + QCOMPARE(spy->size(), 1); } } // namespace QTestPrivate diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h index 7c85311856..61192cd9e8 100644 --- a/src/testlib/qsignalspy.h +++ b/src/testlib/qsignalspy.h @@ -97,11 +97,11 @@ public: bool wait(int timeout = 5000) { Q_ASSERT(!m_waiting); - const qsizetype origCount = count(); + const qsizetype origCount = size(); m_waiting = true; m_loop.enterLoopMSecs(timeout); m_waiting = false; - return count() > origCount; + return size() > origCount; } int qt_metacall(QMetaObject::Call call, int methodId, void **a) override diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 347008fe02..335b72f1fb 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -655,7 +655,7 @@ static void qPrintDataTags(FILE *stream) // Print all tag combinations: if (gTable->dataCount() == 0) { - if (localTags.count() == 0) { + if (localTags.size() == 0) { // No tags at all, so just print the test function: fprintf(stream, "%s %s\n", currTestMetaObj->className(), slot); } else { @@ -667,7 +667,7 @@ static void qPrintDataTags(FILE *stream) } } else { for (int j = 0; j < gTable->dataCount(); ++j) { - if (localTags.count() == 0) { + if (localTags.size() == 0) { // Only global tags, so print the current one: fprintf( stream, "%s %s __global__ %s\n", @@ -2431,7 +2431,7 @@ QTest::TestEntryFunction QTest::qGetTestCaseEntryFunction(const QString& name) */ int QTest::qExec(QObject *testObject, const QStringList &arguments) { - const int argc = arguments.count(); + const int argc = arguments.size(); QVarLengthArray<char *> argv(argc); QList<QByteArray> args; diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h index 80745ed9bf..8f092cf8c9 100644 --- a/src/testlib/qtestevent.h +++ b/src/testlib/qtestevent.h @@ -132,7 +132,7 @@ class QTestEventList: public QList<QTestEvent *> public: inline QTestEventList() {} inline QTestEventList(const QTestEventList &other): QList<QTestEvent *>() - { for (int i = 0; i < other.count(); ++i) append(other.at(i)->clone()); } + { for (int i = 0; i < other.size(); ++i) append(other.at(i)->clone()); } inline ~QTestEventList() { clear(); } inline void clear() @@ -182,7 +182,7 @@ public: #ifdef QT_WIDGETS_LIB inline void simulate(QWidget *w) { - for (int i = 0; i < count(); ++i) + for (int i = 0; i < size(); ++i) at(i)->simulate(w); } #endif diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 71b9757ebc..eb359f4dbb 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -330,7 +330,7 @@ int runMoc(int argc, char **argv) if (parser.isSet(collectOption)) return collectJson(files, output, hasOptionFiles); - if (files.count() > 1) { + if (files.size() > 1) { error(qPrintable("Too many input files specified: '"_L1 + files.join("' '"_L1) + u'\'')); parser.showHelp(1); } else if (!files.isEmpty()) { diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 08e3fcf066..03742d4fed 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -333,7 +333,7 @@ static std::deque<CustomType> s_customTypes; static void parseCmdLine(QStringList &arguments) { flags = 0; - for (qsizetype i = 0; i < arguments.count(); ++i) { + for (qsizetype i = 0; i < arguments.size(); ++i) { const QString arg = arguments.at(i); if (arg == "--help"_L1) @@ -373,7 +373,7 @@ static void parseCmdLine(QStringList &arguments) break; case 't': - if (arguments.count() < i + 2) { + if (arguments.size() < i + 2) { printf("-t expects a type=dbustype argument\n"); exit(1); } else { @@ -394,7 +394,7 @@ static void parseCmdLine(QStringList &arguments) break; case 'o': - if (arguments.count() < i + 2 || arguments.at(i + 1).startsWith(u'-')) { + if (arguments.size() < i + 2 || arguments.at(i + 1).startsWith(u'-')) { printf("-o expects a filename\n"); exit(1); } diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp index 5cea80b378..51e151b4fb 100644 --- a/src/tools/qlalr/cppgenerator.cpp +++ b/src/tools/qlalr/cppgenerator.cpp @@ -214,7 +214,7 @@ void CppGenerator::operator () () } auto rule = grammar.rules.begin(); - for (int i = 0; i < used_rules.count (); ++i, ++rule) + for (int i = 0; i < used_rules.size(); ++i, ++rule) { if (! used_rules.testBit (i)) { diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp index f11b2233c6..910c4e2ee2 100644 --- a/src/tools/uic/cpp/cppwritedeclaration.cpp +++ b/src/tools/uic/cpp/cppwritedeclaration.cpp @@ -55,7 +55,7 @@ void WriteDeclaration::acceptUI(DomUI *node) exportMacro.append(u' '); QStringList namespaceList = qualifiedClassName.split("::"_L1); - if (namespaceList.count()) { + if (namespaceList.size()) { className = namespaceList.last(); namespaceList.removeLast(); } @@ -65,7 +65,7 @@ void WriteDeclaration::acceptUI(DomUI *node) // is a User using Qt-in-namespace having his own classes not in a namespace. // In this case the generated Ui helper classes will also end up in // the Qt namespace (which is harmless, but not "pretty") - const bool needsMacro = namespaceList.count() == 0 + const bool needsMacro = namespaceList.size() == 0 || namespaceList[0] == "qdesigner_internal"_L1; if (needsMacro) @@ -73,7 +73,7 @@ void WriteDeclaration::acceptUI(DomUI *node) openNameSpaces(namespaceList, m_output); - if (namespaceList.count()) + if (namespaceList.size()) m_output << "\n"; m_output << "class " << exportMacro << m_option.prefix << className << "\n" @@ -98,7 +98,7 @@ void WriteDeclaration::acceptUI(DomUI *node) closeNameSpaces(namespaceList, m_output); - if (namespaceList.count()) + if (namespaceList.size()) m_output << "\n"; if (m_option.generateNamespace && !m_option.prefix.isEmpty()) { @@ -110,7 +110,7 @@ void WriteDeclaration::acceptUI(DomUI *node) closeNameSpaces(namespaceList, m_output); - if (namespaceList.count()) + if (namespaceList.size()) m_output << "\n"; } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 24ca25e8ee..d87e56d20f 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -977,7 +977,7 @@ void WriteInitialization::writePropertyList(const QString &varName, if (value.isEmpty()) return; const QStringList list = value.split(u','); - const int count = list.count(); + const int count = list.size(); for (int i = 0; i < count; i++) { if (list.at(i) != defaultValue) { m_output << m_indent << varName << language::derefPointer << setFunction @@ -2329,7 +2329,7 @@ void WriteInitialization::initializeTreeWidget(DomWidget *w) QString tempName = disableSorting(w, varName); const auto items = initializeTreeWidgetItems(w->elementItem()); - for (int i = 0; i < items.count(); i++) { + for (int i = 0; i < items.size(); i++) { Item *itm = items[i]; itm->writeSetupUi(varName); QString parentPath; diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 7d165cadd1..ac8ec224b9 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -420,7 +420,7 @@ QAccessibleInterface *QAccessibleAbstractScrollArea::child(int index) const int QAccessibleAbstractScrollArea::childCount() const { - return accessibleChildren().count(); + return accessibleChildren().size(); } int QAccessibleAbstractScrollArea::indexOfChild(const QAccessibleInterface *child) const diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index 79a7228369..073f373d03 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -154,21 +154,21 @@ int QAccessibleTable::selectedCellCount() const { if (!view()->selectionModel()) return 0; - return view()->selectionModel()->selectedIndexes().count(); + return view()->selectionModel()->selectedIndexes().size(); } int QAccessibleTable::selectedColumnCount() const { if (!view()->selectionModel()) return 0; - return view()->selectionModel()->selectedColumns().count(); + return view()->selectionModel()->selectedColumns().size(); } int QAccessibleTable::selectedRowCount() const { if (!view()->selectionModel()) return 0; - return view()->selectionModel()->selectedRows().count(); + return view()->selectionModel()->selectedRows().size(); } QString QAccessibleTable::rowDescription(int row) const @@ -1024,7 +1024,7 @@ void QAccessibleTableCell::unselectCell() //one cell is selected it cannot be unselected by the user if ((selectionMode != QAbstractItemView::MultiSelection) && (selectionMode != QAbstractItemView::ExtendedSelection) - && (view->selectionModel()->selectedIndexes().count() <= 1)) + && (view->selectionModel()->selectedIndexes().size() <= 1)) return; view->selectionModel()->select(m_index, QItemSelectionModel::Deselect); diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 2dd7e035df..13f7eca898 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -299,14 +299,14 @@ QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRel if (match & QAccessible::Controlled) { QObjectList allReceivers; QObject *connectionObject = object(); - for (int sig = 0; sig < d->primarySignals.count(); ++sig) { + for (int sig = 0; sig < d->primarySignals.size(); ++sig) { const QObjectList receivers = connectionObject->d_func()->receiverList(d->primarySignals.at(sig).toLatin1()); allReceivers += receivers; } allReceivers.removeAll(object()); //### The object might connect to itself internally - for (int i = 0; i < allReceivers.count(); ++i) { + for (int i = 0; i < allReceivers.size(); ++i) { const QAccessible::Relation rel = QAccessible::Controlled; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(allReceivers.at(i)); if (iface) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index d85a2a8b0e..d301eaa7ea 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -673,7 +673,7 @@ void QFileDialogPrivate::emitFilesSelected(const QStringList &files) { Q_Q(QFileDialog); emit q->filesSelected(files); - if (files.count() == 1) + if (files.size() == 1) emit q->fileSelected(files.first()); } @@ -1352,7 +1352,7 @@ QStringList qt_strip_filters(const QStringList &filters) #if QT_CONFIG(regularexpression) QStringList strippedFilters; static const QRegularExpression r(QString::fromLatin1(QPlatformFileDialogHelper::filterRegExp)); - const int numFilters = filters.count(); + const int numFilters = filters.size(); strippedFilters.reserve(numFilters); for (int i = 0; i < numFilters; ++i) { QString filterName; @@ -1391,7 +1391,7 @@ void QFileDialog::setNameFilters(const QStringList &filters) { Q_D(QFileDialog); QStringList cleanedFilters; - const int numFilters = filters.count(); + const int numFilters = filters.size(); cleanedFilters.reserve(numFilters); for (int i = 0; i < numFilters; ++i) { cleanedFilters << filters[i].simplified(); @@ -3544,7 +3544,7 @@ void QFileDialogPrivate::_q_deleteCurrent() return; QModelIndexList list = qFileDialogUi->listView->selectionModel()->selectedRows(); - for (int i = list.count() - 1; i >= 0; --i) { + for (int i = list.size() - 1; i >= 0; --i) { QPersistentModelIndex index = list.at(i); if (index == qFileDialogUi->listView->rootIndex()) continue; @@ -3600,7 +3600,7 @@ void QFileDialogPrivate::_q_autoCompleteFileName(const QString &text) } const QStringList multipleFiles = typedFiles(); - if (multipleFiles.count() > 0) { + if (multipleFiles.size() > 0) { QModelIndexList oldFiles = qFileDialogUi->listView->selectionModel()->selectedRows(); QList<QModelIndex> newFiles; for (const auto &file : multipleFiles) { @@ -3808,7 +3808,7 @@ void QFileDialogPrivate::_q_useNameFilter(int index) QStringList newNameFilters = QPlatformFileDialogHelper::cleanFilterList(nameFilter); if (q_func()->acceptMode() == QFileDialog::AcceptSave) { QString newNameFilterExtension; - if (newNameFilters.count() > 0) + if (newNameFilters.size() > 0) newNameFilterExtension = QFileInfo(newNameFilters.at(0)).suffix(); QString fileName = lineEdit()->text(); @@ -3843,8 +3843,8 @@ void QFileDialogPrivate::_q_selectionChanged() continue; allFiles.append(index.data().toString()); } - if (allFiles.count() > 1) - for (qsizetype i = 0; i < allFiles.count(); ++i) { + if (allFiles.size() > 1) + for (qsizetype i = 0; i < allFiles.size(); ++i) { allFiles.replace(i, QString(u'"' + allFiles.at(i) + u'"')); } @@ -4012,7 +4012,7 @@ void QFileDialogComboBox::showPopup() // append history QList<QUrl> urls; - for (int i = 0; i < m_history.count(); ++i) { + for (int i = 0; i < m_history.size(); ++i) { QUrl path = QUrl::fromLocalFile(m_history.at(i)); if (!urls.contains(path)) urls.prepend(path); @@ -4220,7 +4220,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const #else bool startsFromRoot = pathCopy[0] == sep; #endif - if (parts.count() == 1 || (parts.count() > 1 && !startsFromRoot)) { + if (parts.size() == 1 || (parts.size() > 1 && !startsFromRoot)) { const QFileSystemModel *dirModel; if (proxyModel) dirModel = qobject_cast<const QFileSystemModel *>(proxyModel->sourceModel()); @@ -4233,7 +4233,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const #endif if (currentLocation.contains(sep) && path != currentLocation) { QStringList currentLocationList = splitPath(currentLocation); - while (!currentLocationList.isEmpty() && parts.count() > 0 && parts.at(0) == ".."_L1) { + while (!currentLocationList.isEmpty() && parts.size() > 0 && parts.at(0) == ".."_L1) { parts.removeFirst(); currentLocationList.removeLast(); } diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index d54b65a173..7cb2831411 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -2267,11 +2267,11 @@ void QWizard::removePage(int id) QWizardPage *removedPage = nullptr; // update startItem accordingly - if (d->pageMap.count() > 0) { // only if we have any pages + if (d->pageMap.size() > 0) { // only if we have any pages if (d->start == id) { const int firstId = d->pageMap.constBegin().key(); if (firstId == id) { - if (d->pageMap.count() > 1) + if (d->pageMap.size() > 1) d->start = (++d->pageMap.constBegin()).key(); // secondId else d->start = -1; // removing the last page @@ -2395,7 +2395,7 @@ void QWizard::setStartId(int theid) Q_D(QWizard); int newStart = theid; if (theid == -1) - newStart = d->pageMap.count() ? d->pageMap.constBegin().key() : -1; + newStart = d->pageMap.size() ? d->pageMap.constBegin().key() : -1; if (d->start == newStart) { d->startSetByUser = theid != -1; diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index fb49983bbf..f7dab4724b 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -2413,7 +2413,7 @@ QPolygonF QGraphicsView::mapToScene(const QRect &rect) const QPolygonF QGraphicsView::mapToScene(const QPolygon &polygon) const { QPolygonF poly; - poly.reserve(polygon.count()); + poly.reserve(polygon.size()); for (const QPoint &point : polygon) poly << mapToScene(point); return poly; @@ -2509,7 +2509,7 @@ QPolygon QGraphicsView::mapFromScene(const QRectF &rect) const QPolygon QGraphicsView::mapFromScene(const QPolygonF &polygon) const { QPolygon poly; - poly.reserve(polygon.count()); + poly.reserve(polygon.size()); for (const QPointF &point : polygon) poly << mapFromScene(point); return poly; diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index e0334de6f0..7a7b5c4753 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2829,10 +2829,10 @@ void QAbstractItemView::updateEditorGeometries() //we hide and release the editor outside of the loop because it might change the focus and try //to change the editors hashes. - for (int i = 0; i < editorsToHide.count(); ++i) { + for (int i = 0; i < editorsToHide.size(); ++i) { editorsToHide.at(i)->hide(); } - for (int i = 0; i < editorsToRelease.count(); ++i) { + for (int i = 0; i < editorsToRelease.size(); ++i) { d->releaseEditor(editorsToRelease.at(i)); } } @@ -3793,7 +3793,7 @@ void QAbstractItemView::startDrag(Qt::DropActions supportedActions) { Q_D(QAbstractItemView); QModelIndexList indexes = d->selectedDraggableIndexes(); - if (indexes.count() > 0) { + if (indexes.size() > 0) { QMimeData *data = d->model->mimeData(indexes); if (!data) return; @@ -4636,7 +4636,7 @@ QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QStyleOptionViewItem option; q->initViewItemOption(&option); option.state |= QStyle::State_Selected; - for (int j = 0; j < paintPairs.count(); ++j) { + for (int j = 0; j < paintPairs.size(); ++j) { option.rect = paintPairs.at(j).rect.translated(-r->topLeft()); const QModelIndex ¤t = paintPairs.at(j).index; adjustViewOptionsForIndex(&option, current); diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp index 551645cb3d..040bddb311 100644 --- a/src/widgets/itemviews/qcolumnview.cpp +++ b/src/widgets/itemviews/qcolumnview.cpp @@ -420,7 +420,7 @@ int QColumnView::verticalOffset() const */ QRegion QColumnView::visualRegionForSelection(const QItemSelection &selection) const { - int ranges = selection.count(); + int ranges = selection.size(); if (ranges == 0) return QRect(); @@ -984,9 +984,9 @@ void QColumnView::selectAll() QModelIndexList indexList = selectionModel()->selectedIndexes(); QModelIndex parent = rootIndex(); QItemSelection selection; - if (indexList.count() >= 1) + if (indexList.size() >= 1) parent = indexList.at(0).parent(); - if (indexList.count() == 1) { + if (indexList.size() == 1) { parent = indexList.at(0); if (!model()->hasChildren(parent)) parent = parent.parent(); diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index e231345437..b5b0f17f4a 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3453,7 +3453,7 @@ void QHeaderView::initStyleOption(QStyleOptionFrame *option) const bool QHeaderViewPrivate::isSectionSelected(int section) const { int i = section * 2; - if (i < 0 || i >= sectionSelected.count()) + if (i < 0 || i >= sectionSelected.size()) return false; if (sectionSelected.testBit(i)) // if the value was cached return sectionSelected.testBit(i + 1); diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h index 16b98b3ae3..c599aeff8d 100644 --- a/src/widgets/itemviews/qheaderview_p.h +++ b/src/widgets/itemviews/qheaderview_p.h @@ -120,7 +120,7 @@ public: inline void prepareSectionSelected() { if (!selectionModel || !selectionModel->hasSelection()) sectionSelected.clear(); - else if (sectionSelected.count() != sectionCount() * 2) + else if (sectionSelected.size() != sectionCount() * 2) sectionSelected.fill(false, sectionCount() * 2); else sectionSelected.fill(false); } @@ -332,7 +332,7 @@ public: void setHiddenSectionsFromBitVector(const QBitArray §ionHidden) { SectionItem *sectionData = sectionItems.data(); - for (int i = 0; i < sectionHidden.count(); ++i) + for (int i = 0; i < sectionHidden.size(); ++i) sectionData[i].isHidden = sectionHidden.at(i); } diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 359f6da0bd..3ce159e185 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -2885,7 +2885,7 @@ bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions) // plus adding viewitems to the draggedItems list. // We need these items to draw the drag items QModelIndexList indexes = dd->selectionModel->selectedIndexes(); - if (indexes.count() > 0 ) { + if (indexes.size() > 0 ) { if (viewport()->acceptDrops()) { QModelIndexList::ConstIterator it = indexes.constBegin(); for (; it != indexes.constEnd(); ++it) @@ -3140,7 +3140,7 @@ void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info) segPosition = topLeft.x(); } - if (moved.count() != items.size()) + if (moved.size() != items.size()) moved.resize(items.size()); QRect rect(QPoint(), topLeft); @@ -3335,7 +3335,7 @@ void QIconModeViewBase::moveItem(int index, const QPoint &dest) contentsSize = (QRect(QPoint(0, 0), contentsSize)|QRect(dest, rect.size())).size(); // mark the item as moved - if (moved.count() != items.size()) + if (moved.size() != items.size()) moved.resize(items.size()); moved.setBit(index, true); } diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 68f4a547f9..cc0ccf84da 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -91,7 +91,7 @@ void QListModel::insert(int row, QListWidgetItem *item) void QListModel::insert(int row, const QStringList &labels) { - const int count = labels.count(); + const int count = labels.size(); if (count <= 0) return; QListWidget *view = qobject_cast<QListWidget*>(QObject::parent()); @@ -376,7 +376,7 @@ void QListModel::ensureSorted(int column, Qt::SortOrder order, int start, int en else if (oldRow > otherRow && newRow <= otherRow) ++sorting[j].second; } - for (int k = 0; k < newPersistentIndexes.count(); ++k) { + for (int k = 0; k < newPersistentIndexes.size(); ++k) { QModelIndex pi = newPersistentIndexes.at(k); int oldPersistentRow = pi.row(); int newPersistentRow = oldPersistentRow; @@ -444,7 +444,7 @@ QMimeData *QListModel::internalMimeData() const QMimeData *QListModel::mimeData(const QModelIndexList &indexes) const { QList<QListWidgetItem*> itemlist; - const int indexesCount = indexes.count(); + const int indexesCount = indexes.size(); itemlist.reserve(indexesCount); for (int i = 0; i < indexesCount; ++i) itemlist << at(indexes.at(i).row()); @@ -1760,7 +1760,7 @@ QList<QListWidgetItem*> QListWidget::selectedItems() const Q_D(const QListWidget); QModelIndexList indexes = selectionModel()->selectedIndexes(); QList<QListWidgetItem*> items; - const int numIndexes = indexes.count(); + const int numIndexes = indexes.size(); items.reserve(numIndexes); for (int i = 0; i < numIndexes; ++i) items.append(d->listModel()->at(indexes.at(i).row())); diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 3cd93f9337..cfde93a477 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -2197,7 +2197,7 @@ QModelIndexList QTableView::selectedIndexes() const QModelIndexList modelSelected; if (d->selectionModel) modelSelected = d->selectionModel->selectedIndexes(); - for (int i = 0; i < modelSelected.count(); ++i) { + for (int i = 0; i < modelSelected.size(); ++i) { QModelIndex index = modelSelected.at(i); if (!isIndexHidden(index) && index.parent() == d->root) viewSelected.append(index); diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index d646cae406..67886be94f 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -809,7 +809,7 @@ QMimeData *QTableModel::internalMimeData() const QMimeData *QTableModel::mimeData(const QModelIndexList &indexes) const { QList<QTableWidgetItem*> items; - const int indexesCount = indexes.count(); + const int indexesCount = indexes.size(); items.reserve(indexesCount); for (int i = 0; i < indexesCount; ++i) items << item(indexes.at(i)); @@ -2087,7 +2087,7 @@ void QTableWidget::setVerticalHeaderLabels(const QStringList &labels) Q_D(QTableWidget); QTableModel *model = d->tableModel(); QTableWidgetItem *item = nullptr; - for (int i = 0; i < model->rowCount() && i < labels.count(); ++i) { + for (int i = 0; i < model->rowCount() && i < labels.size(); ++i) { item = model->verticalHeaderItem(i); if (!item) { item = model->createItem(); @@ -2105,7 +2105,7 @@ void QTableWidget::setHorizontalHeaderLabels(const QStringList &labels) Q_D(QTableWidget); QTableModel *model = d->tableModel(); QTableWidgetItem *item = nullptr; - for (int i = 0; i < model->columnCount() && i < labels.count(); ++i) { + for (int i = 0; i < model->columnCount() && i < labels.size(); ++i) { item = model->horizontalHeaderItem(i); if (!item) { item = model->createItem(); @@ -2697,7 +2697,7 @@ void QTableWidget::dropEvent(QDropEvent *event) { } QList<QTableWidgetItem *> taken; - const int indexesCount = indexes.count(); + const int indexesCount = indexes.size(); taken.reserve(indexesCount); for (const auto &index : indexes) taken.append(takeItem(index.row(), index.column())); diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 6cf05c411f..065c42d6b7 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1037,7 +1037,7 @@ void QTreeView::keyboardSearch(const QString &search) if (searchFrom.parent() == start.parent()) searchFrom = start; QModelIndexList match = d->model->match(searchFrom, Qt::DisplayRole, searchString); - if (match.count()) { + if (match.size()) { int hitIndex = d->viewIndex(match.at(0)); if (hitIndex >= 0 && hitIndex < startIndex) bestAbove = bestAbove == -1 ? hitIndex : qMin(hitIndex, bestAbove); @@ -1556,11 +1556,11 @@ void QTreeViewPrivate::calcLogicalIndices( } } - itemPositions->resize(logicalIndices->count()); - for (int currentLogicalSection = 0; currentLogicalSection < logicalIndices->count(); ++currentLogicalSection) { + itemPositions->resize(logicalIndices->size()); + for (int currentLogicalSection = 0; currentLogicalSection < logicalIndices->size(); ++currentLogicalSection) { const int headerSection = logicalIndices->at(currentLogicalSection); // determine the viewItemPosition depending on the position of column 0 - int nextLogicalSection = currentLogicalSection + 1 >= logicalIndices->count() + int nextLogicalSection = currentLogicalSection + 1 >= logicalIndices->size() ? logicalIndexAfterRight : logicalIndices->at(currentLogicalSection + 1); int prevLogicalSection = currentLogicalSection - 1 < 0 @@ -2409,7 +2409,7 @@ QModelIndexList QTreeView::selectedIndexes() const QModelIndexList modelSelected; if (selectionModel()) modelSelected = selectionModel()->selectedIndexes(); - for (int i = 0; i < modelSelected.count(); ++i) { + for (int i = 0; i < modelSelected.size(); ++i) { // check that neither the parents nor the index is hidden before we add QModelIndex index = modelSelected.at(i); while (index.isValid() && !isIndexHidden(index)) diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 3fe843895c..3fa8a7e1b9 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -627,7 +627,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order, else if (oldRow > otherRow && newRow <= otherRow) ++sorting[j].second; } - for (int k = 0; k < newPersistentIndexes.count(); ++k) { + for (int k = 0; k < newPersistentIndexes.size(); ++k) { QModelIndex pi = newPersistentIndexes.at(k); if (pi.parent() != parent) continue; @@ -827,7 +827,7 @@ void QTreeModel::sortItems(QList<QTreeWidgetItem*> *items, int column, Qt::SortO return; // store the original order of indexes - QList<QPair<QTreeWidgetItem *, int>> sorting(items->count()); + QList<QPair<QTreeWidgetItem *, int>> sorting(items->size()); for (int i = 0; i < sorting.size(); ++i) { sorting[i].first = items->at(i); sorting[i].second = i; @@ -1396,7 +1396,7 @@ QTreeWidgetItem::QTreeWidgetItem(int type) : rtti(type), d(new QTreeWidgetItemPr QTreeWidgetItem::QTreeWidgetItem(const QStringList &strings, int type) : rtti(type), d(new QTreeWidgetItemPrivate(this)) { - for (int i = 0; i < strings.count(); ++i) + for (int i = 0; i < strings.size(); ++i) setText(i, strings.at(i)); } @@ -1432,7 +1432,7 @@ QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *treeview, int type) QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *treeview, const QStringList &strings, int type) : rtti(type), d(new QTreeWidgetItemPrivate(this)) { - for (int i = 0; i < strings.count(); ++i) + for (int i = 0; i < strings.size(); ++i) setText(i, strings.at(i)); // do not set this->view here otherwise insertChild() will fail if (QTreeModel *model = treeModel(treeview)) { @@ -1481,7 +1481,7 @@ QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, int type) QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, const QStringList &strings, int type) : rtti(type), d(new QTreeWidgetItemPrivate(this)) { - for (int i = 0; i < strings.count(); ++i) + for (int i = 0; i < strings.size(); ++i) setText(i, strings.at(i)); if (parent) parent->addChild(this); @@ -1755,8 +1755,8 @@ void QTreeWidgetItem::setData(int column, int role, const QVariant &value) else values.resize(column + 1); } - if (d->display.count() <= column) { - for (int i = d->display.count() - 1; i < column - 1; ++i) + if (d->display.size() <= column) { + for (int i = d->display.size() - 1; i < column - 1; ++i) d->display.append(QVariant()); d->display.append(value); } else if (d->display[column] != value) { @@ -1823,7 +1823,7 @@ QVariant QTreeWidgetItem::data(int column, int role) const switch (role) { case Qt::EditRole: case Qt::DisplayRole: - if (column >= 0 && column < d->display.count()) + if (column >= 0 && column < d->display.size()) return d->display.at(column); break; case Qt::CheckStateRole: @@ -2375,13 +2375,13 @@ void QTreeWidgetPrivate::_q_selectionChanged(const QItemSelection &selected, con QModelIndexList indices = selected.indexes(); int i; QTreeModel *m = treeModel(); - for (i = 0; i < indices.count(); ++i) { + for (i = 0; i < indices.size(); ++i) { QTreeWidgetItem *item = m->item(indices.at(i)); item->d->selected = true; } indices = deselected.indexes(); - for (i = 0; i < indices.count(); ++i) { + for (i = 0; i < indices.size(); ++i) { QTreeWidgetItem *item = m->item(indices.at(i)); item->d->selected = false; } @@ -2806,10 +2806,10 @@ void QTreeWidget::setHeaderItem(QTreeWidgetItem *item) void QTreeWidget::setHeaderLabels(const QStringList &labels) { Q_D(QTreeWidget); - if (columnCount() < labels.count()) - setColumnCount(labels.count()); + if (columnCount() < labels.size()) + setColumnCount(labels.size()); QTreeWidgetItem *item = d->treeModel()->headerItem; - for (int i = 0; i < labels.count(); ++i) + for (int i = 0; i < labels.size(); ++i) item->setText(i, labels.at(i)); } @@ -3052,8 +3052,8 @@ QList<QTreeWidgetItem*> QTreeWidget::selectedItems() const Q_D(const QTreeWidget); const QModelIndexList indexes = selectionModel()->selectedIndexes(); QList<QTreeWidgetItem*> items; - items.reserve(indexes.count()); - QDuplicateTracker<QTreeWidgetItem *> seen(indexes.count()); + items.reserve(indexes.size()); + QDuplicateTracker<QTreeWidgetItem *> seen(indexes.size()); for (const auto &index : indexes) { QTreeWidgetItem *item = d->item(index); if (item->isHidden() || seen.hasSeen(item)) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 854d638abb..13897e1218 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3330,7 +3330,7 @@ void QApplicationPrivate::closePopup(QWidget *popup) qt_popup_down = nullptr; } - if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup + if (QApplicationPrivate::popupWidgets->size() == 0) { // this was the last popup delete QApplicationPrivate::popupWidgets; QApplicationPrivate::popupWidgets = nullptr; qt_popup_down_closed = false; @@ -3375,7 +3375,7 @@ void QApplicationPrivate::closePopup(QWidget *popup) // can become nullptr due to setFocus() above if (QApplicationPrivate::popupWidgets && - QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard + QApplicationPrivate::popupWidgets->size() == 1) // grab mouse/keyboard grabForPopup(aw); } @@ -3390,7 +3390,7 @@ void QApplicationPrivate::openPopup(QWidget *popup) popupWidgets = new QWidgetList; popupWidgets->append(popup); // add to end of list - if (QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard + if (QApplicationPrivate::popupWidgets->size() == 1) // grab mouse/keyboard grabForPopup(popup); // popups are not focus-handled by the window system (the first @@ -3398,7 +3398,7 @@ void QApplicationPrivate::openPopup(QWidget *popup) // new popup gets the focus if (popup->focusWidget()) { popup->focusWidget()->setFocus(Qt::PopupFocusReason); - } else if (popupWidgets->count() == 1) { // this was the first popup + } else if (popupWidgets->size() == 1) { // this was the first popup if (QWidget *fw = QApplication::focusWidget()) { QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason); QCoreApplication::sendEvent(fw, &e); diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index e83f9d4bb2..cf16d2a005 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -302,7 +302,7 @@ void QWidgetRepaintManager::removeDirtyWidget(QWidget *w) needsFlushWidgets.removeAll(w); QWidgetPrivate *wd = w->d_func(); - const int n = wd->children.count(); + const int n = wd->children.size(); for (int i = 0; i < n; ++i) { if (QWidget *child = qobject_cast<QWidget*>(wd->children.at(i))) removeDirtyWidget(child); diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index abf3566e1c..1b519bf4c5 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -326,7 +326,7 @@ int QCompletionModel::rowCount(const QModelIndex &parent) const if (showAll) { // Show all items below current parent, even if we have no valid matches - if (engine->curParts.count() != 1 && !engine->matchCount() + if (engine->curParts.size() != 1 && !engine->matchCount() && !engine->curParent.isValid()) return 0; return d->model->rowCount(engine->curParent); @@ -411,7 +411,7 @@ void QCompletionEngine::filter(const QStringList& parts) return; QModelIndex parent; - for (int i = 0; i < curParts.count() - 1; i++) { + for (int i = 0; i < curParts.size() - 1; i++) { QString part = curParts.at(i); int emi = filter(part, parent, -1).exactMatchIndex; if (emi == -1) @@ -432,7 +432,7 @@ void QCompletionEngine::filter(const QStringList& parts) QMatchData QCompletionEngine::filterHistory() { QAbstractItemModel *source = c->proxy->sourceModel(); - if (curParts.count() <= 1 || c->proxy->showAll || !source) + if (curParts.size() <= 1 || c->proxy->showAll || !source) return QMatchData(); #if QT_CONFIG(filesystemmodel) @@ -516,7 +516,7 @@ void QCompletionEngine::saveInCache(QString part, const QModelIndex& parent, con QMap<QModelIndex, CacheItem>::iterator it1 = cache.begin(); while (it1 != cache.end()) { CacheItem& ci = it1.value(); - int sz = ci.count()/2; + int sz = ci.size()/2; QMap<QString, QMatchData>::iterator it2 = ci.begin(); int i = 0; while (it2 != ci.end() && i < sz) { @@ -524,7 +524,7 @@ void QCompletionEngine::saveInCache(QString part, const QModelIndex& parent, con it2 = ci.erase(it2); i++; } - if (ci.count() == 0) { + if (ci.size() == 0) { it1 = cache.erase(it1); } else { ++it1; @@ -1811,7 +1811,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const } while (idx.isValid()); #if !defined(Q_OS_WIN) - if (list.count() == 1) // only the separator or some other text + if (list.size() == 1) // only the separator or some other text return list[0]; list[0].clear() ; // the join below will provide the separator #endif diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index b3a2531c18..331764efa8 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2289,7 +2289,7 @@ void QComboBox::insertItems(int index, const QStringList &list) if (list.isEmpty()) return; index = qBound(0, index, count()); - int insertCount = qMin(d->maxCount - index, list.count()); + int insertCount = qMin(d->maxCount - index, list.size()); if (insertCount <= 0) return; // For the common case where we are using the built in QStandardItemModel diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 0fbda907a1..0c2777698a 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1577,7 +1577,7 @@ bool QDockWidget::event(QEvent *event) bool onTop = false; if (win != nullptr) { const QObjectList &siblings = win->children(); - onTop = siblings.count() > 0 && siblings.last() == (QObject*)this; + onTop = siblings.size() > 0 && siblings.last() == (QObject*)this; } #if QT_CONFIG(tabbar) if (!isFloating() && layout != nullptr && onTop) diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index 036d470f9f..a7f31995e1 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -317,7 +317,7 @@ void QFontComboBoxPrivate::_q_updateModel() } result += list.at(i); if (list.at(i) == fi.family() || list.at(i).startsWith(fi.family() + " ["_L1)) - offset = result.count() - 1; + offset = result.size() - 1; } list = result; |