diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2022-11-11 15:53:00 +0100 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2022-11-18 23:52:04 +0100 |
| commit | 7a501ec6c82c8f8d5997b5d30e667d7820faed1c (patch) | |
| tree | 62c6f0114e329f976718b3eac4370ac839261cd1 | |
| parent | 0ca06764dc1a75ab7702a9d798d23717599284f3 (diff) | |
Port from container::count() and length() to size() - V5
This is a the same semantic patch (qt-port-to-std-compatible-api V5
with config Scope: 'Container') as in dev. I've re-ran it in 6.4 to
avoid cherry-pick conflicts.
Change-Id: I9621dee5ed328b47e78919a34c307105e4311903
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
400 files changed, 4146 insertions, 4146 deletions
diff --git a/src/3rdparty/masm/yarr/YarrInterpreter.cpp b/src/3rdparty/masm/yarr/YarrInterpreter.cpp index cdcd16af64..f57fe363b4 100644 --- a/src/3rdparty/masm/yarr/YarrInterpreter.cpp +++ b/src/3rdparty/masm/yarr/YarrInterpreter.cpp @@ -2406,8 +2406,8 @@ unsigned interpret(BytecodePattern* bytecode, const String& input, unsigned star { SuperSamplerScope superSamplerScope(false); if (input.is8Bit()) - return Interpreter<LChar>(bytecode, output, input.characters8(), input.length(), start).interpret(); - return Interpreter<UChar>(bytecode, output, input.characters16(), input.length(), start).interpret(); + return Interpreter<LChar>(bytecode, output, input.characters8(), input.size(), start).interpret(); + return Interpreter<UChar>(bytecode, output, input.characters16(), input.size(), start).interpret(); } unsigned interpret(BytecodePattern* bytecode, const LChar* input, unsigned length, unsigned start, unsigned* output) diff --git a/src/3rdparty/masm/yarr/YarrParser.h b/src/3rdparty/masm/yarr/YarrParser.h index d5433286dd..a6044d49ac 100644 --- a/src/3rdparty/masm/yarr/YarrParser.h +++ b/src/3rdparty/masm/yarr/YarrParser.h @@ -215,7 +215,7 @@ private: : m_delegate(delegate) , m_backReferenceLimit(backReferenceLimit) , m_data(pattern.characters<CharType>()) - , m_size(pattern.length()) + , m_size(pattern.size()) , m_isUnicode(isUnicode) { } diff --git a/src/labs/folderlistmodel/fileinfothread.cpp b/src/labs/folderlistmodel/fileinfothread.cpp index fa726d95c3..edde6422e8 100644 --- a/src/labs/folderlistmodel/fileinfothread.cpp +++ b/src/labs/folderlistmodel/fileinfothread.cpp @@ -268,7 +268,7 @@ void FileInfoThread::getFileInfos(const QString &path) const QFileInfoList fileInfoList = currentDir.entryInfoList(nameFilters, filter, sortFlags); if (!fileInfoList.isEmpty()) { - filePropertyList.reserve(fileInfoList.count()); + filePropertyList.reserve(fileInfoList.size()); for (const QFileInfo &info : fileInfoList) { //qDebug() << "Adding file : " << info.fileName() << "to list "; filePropertyList << FileProperty(info); diff --git a/src/labs/folderlistmodel/qquickfolderlistmodel.cpp b/src/labs/folderlistmodel/qquickfolderlistmodel.cpp index c1070e3f4f..3b07efab77 100644 --- a/src/labs/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/labs/folderlistmodel/qquickfolderlistmodel.cpp @@ -175,7 +175,7 @@ QString QQuickFolderListModelPrivate::resolvePath(const QUrl &path) QString localPath = QQmlFile::urlToLocalFileOrQrc(path); QUrl localUrl = QUrl(localPath); QString fullPath = localUrl.path(); - if (localUrl.scheme().length()) + if (localUrl.scheme().size()) fullPath = localUrl.scheme() + QLatin1Char(':') + fullPath; return QDir::cleanPath(fullPath); } diff --git a/src/labs/models/qqmldelegatecomponent.cpp b/src/labs/models/qqmldelegatecomponent.cpp index 45e64995fb..3a9bb647c6 100644 --- a/src/labs/models/qqmldelegatecomponent.cpp +++ b/src/labs/models/qqmldelegatecomponent.cpp @@ -239,7 +239,7 @@ void QQmlDelegateChooser::choices_append(QQmlListProperty<QQmlDelegateChoice> *p qsizetype QQmlDelegateChooser::choices_count(QQmlListProperty<QQmlDelegateChoice> *prop) { QQmlDelegateChooser *q = static_cast<QQmlDelegateChooser*>(prop->object); - return q->m_choices.count(); + return q->m_choices.size(); } QQmlDelegateChoice *QQmlDelegateChooser::choices_at(QQmlListProperty<QQmlDelegateChoice> *prop, qsizetype index) @@ -294,7 +294,7 @@ QQmlComponent *QQmlDelegateChooser::delegate(QQmlAdaptorModel *adaptorModel, int } // loop through choices, finding first one that fits - for (int i = 0; i < m_choices.count(); ++i) { + for (int i = 0; i < m_choices.size(); ++i) { const QQmlDelegateChoice *choice = m_choices.at(i); if (choice->match(row, column, v)) return choice->delegate(); diff --git a/src/labs/models/qqmltablemodel.cpp b/src/labs/models/qqmltablemodel.cpp index e95ea46c84..2822087439 100644 --- a/src/labs/models/qqmltablemodel.cpp +++ b/src/labs/models/qqmltablemodel.cpp @@ -627,7 +627,7 @@ void QQmlTableModel::columns_append(QQmlListProperty<QQmlTableModelColumn> *prop qsizetype QQmlTableModel::columns_count(QQmlListProperty<QQmlTableModelColumn> *property) { const QQmlTableModel *model = static_cast<QQmlTableModel*>(property->object); - return model->mColumns.count(); + return model->mColumns.size(); } QQmlTableModelColumn *QQmlTableModel::columns_at(QQmlListProperty<QQmlTableModelColumn> *property, qsizetype index) diff --git a/src/labs/platform/qquicklabsplatformfiledialog.cpp b/src/labs/platform/qquicklabsplatformfiledialog.cpp index 540da2b3bc..4cd3172820 100644 --- a/src/labs/platform/qquicklabsplatformfiledialog.cpp +++ b/src/labs/platform/qquicklabsplatformfiledialog.cpp @@ -308,7 +308,7 @@ void QQuickLabsPlatformFileDialog::setNameFilters(const QStringList &filters) m_options->setNameFilters(filters); if (m_selectedNameFilter) { int index = m_selectedNameFilter->index(); - if (index < 0 || index >= filters.count()) + if (index < 0 || index >= filters.size()) index = 0; m_selectedNameFilter->update(filters.value(index)); } diff --git a/src/labs/platform/qquicklabsplatformmenu.cpp b/src/labs/platform/qquicklabsplatformmenu.cpp index 04f1abd15d..aad1ac8a68 100644 --- a/src/labs/platform/qquicklabsplatformmenu.cpp +++ b/src/labs/platform/qquicklabsplatformmenu.cpp @@ -564,7 +564,7 @@ void QQuickLabsPlatformMenu::setIcon(const QQuickLabsPlatformIcon &icon) */ void QQuickLabsPlatformMenu::addItem(QQuickLabsPlatformMenuItem *item) { - insertItem(m_items.count(), item); + insertItem(m_items.size(), item); } /*! @@ -613,7 +613,7 @@ void QQuickLabsPlatformMenu::removeItem(QQuickLabsPlatformMenuItem *item) */ void QQuickLabsPlatformMenu::addMenu(QQuickLabsPlatformMenu *menu) { - insertMenu(m_items.count(), menu); + insertMenu(m_items.size(), menu); } /*! @@ -809,7 +809,7 @@ void QQuickLabsPlatformMenu::data_append(QQmlListProperty<QObject> *property, QO qsizetype QQuickLabsPlatformMenu::data_count(QQmlListProperty<QObject> *property) { QQuickLabsPlatformMenu *menu = static_cast<QQuickLabsPlatformMenu *>(property->object); - return menu->m_data.count(); + return menu->m_data.size(); } QObject *QQuickLabsPlatformMenu::data_at(QQmlListProperty<QObject> *property, qsizetype index) @@ -833,7 +833,7 @@ void QQuickLabsPlatformMenu::items_append(QQmlListProperty<QQuickLabsPlatformMen qsizetype QQuickLabsPlatformMenu::items_count(QQmlListProperty<QQuickLabsPlatformMenuItem> *property) { QQuickLabsPlatformMenu *menu = static_cast<QQuickLabsPlatformMenu *>(property->object); - return menu->m_items.count(); + return menu->m_items.size(); } QQuickLabsPlatformMenuItem *QQuickLabsPlatformMenu::items_at(QQmlListProperty<QQuickLabsPlatformMenuItem> *property, qsizetype index) diff --git a/src/labs/platform/qquicklabsplatformmenubar.cpp b/src/labs/platform/qquicklabsplatformmenubar.cpp index bea3eb58d6..d6349d5c11 100644 --- a/src/labs/platform/qquicklabsplatformmenubar.cpp +++ b/src/labs/platform/qquicklabsplatformmenubar.cpp @@ -154,7 +154,7 @@ void QQuickLabsPlatformMenuBar::setWindow(QWindow *window) */ void QQuickLabsPlatformMenuBar::addMenu(QQuickLabsPlatformMenu *menu) { - insertMenu(m_menus.count(), menu); + insertMenu(m_menus.size(), menu); } /*! @@ -257,7 +257,7 @@ void QQuickLabsPlatformMenuBar::data_append(QQmlListProperty<QObject> *property, qsizetype QQuickLabsPlatformMenuBar::data_count(QQmlListProperty<QObject> *property) { QQuickLabsPlatformMenuBar *menuBar = static_cast<QQuickLabsPlatformMenuBar *>(property->object); - return menuBar->m_data.count(); + return menuBar->m_data.size(); } QObject *QQuickLabsPlatformMenuBar::data_at(QQmlListProperty<QObject> *property, qsizetype index) @@ -281,7 +281,7 @@ void QQuickLabsPlatformMenuBar::menus_append(QQmlListProperty<QQuickLabsPlatform qsizetype QQuickLabsPlatformMenuBar::menus_count(QQmlListProperty<QQuickLabsPlatformMenu> *property) { QQuickLabsPlatformMenuBar *menuBar = static_cast<QQuickLabsPlatformMenuBar *>(property->object); - return menuBar->m_menus.count(); + return menuBar->m_menus.size(); } QQuickLabsPlatformMenu *QQuickLabsPlatformMenuBar::menus_at(QQmlListProperty<QQuickLabsPlatformMenu> *property, qsizetype index) diff --git a/src/labs/platform/qquicklabsplatformmenuitemgroup.cpp b/src/labs/platform/qquicklabsplatformmenuitemgroup.cpp index df121e47ff..d3d183ec0f 100644 --- a/src/labs/platform/qquicklabsplatformmenuitemgroup.cpp +++ b/src/labs/platform/qquicklabsplatformmenuitemgroup.cpp @@ -339,7 +339,7 @@ void QQuickLabsPlatformMenuItemGroup::items_append(QQmlListProperty<QQuickLabsPl qsizetype QQuickLabsPlatformMenuItemGroup::items_count(QQmlListProperty<QQuickLabsPlatformMenuItem> *prop) { QQuickLabsPlatformMenuItemGroup *group = static_cast<QQuickLabsPlatformMenuItemGroup *>(prop->object); - return group->m_items.count(); + return group->m_items.size(); } QQuickLabsPlatformMenuItem *QQuickLabsPlatformMenuItemGroup::items_at(QQmlListProperty<QQuickLabsPlatformMenuItem> *prop, qsizetype index) diff --git a/src/labs/platform/widgets/qwidgetplatformfiledialog.cpp b/src/labs/platform/widgets/qwidgetplatformfiledialog.cpp index ae9d7d3cb0..738982b5c6 100644 --- a/src/labs/platform/widgets/qwidgetplatformfiledialog.cpp +++ b/src/labs/platform/widgets/qwidgetplatformfiledialog.cpp @@ -21,7 +21,7 @@ QWidgetPlatformFileDialog::QWidgetPlatformFileDialog(QObject *parent) }); connect(m_dialog.data(), &QFileDialog::filesSelected, [this](const QList<QString> &files) { QList<QUrl> urls; - urls.reserve(files.count()); + urls.reserve(files.size()); for (const QString &file : files) urls += QUrl::fromLocalFile(file); emit filesSelected(urls); diff --git a/src/labs/platform/widgets/qwidgetplatformmenu.cpp b/src/labs/platform/widgets/qwidgetplatformmenu.cpp index f640b6bc06..a154775b94 100644 --- a/src/labs/platform/widgets/qwidgetplatformmenu.cpp +++ b/src/labs/platform/widgets/qwidgetplatformmenu.cpp @@ -39,7 +39,7 @@ void QWidgetPlatformMenu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuI m_menu->insertAction(widgetBefore ? widgetBefore->action() : nullptr, widgetItem->action()); int index = m_items.indexOf(widgetBefore); if (index < 0) - index = m_items.count(); + index = m_items.size(); m_items.insert(index, widgetItem); } diff --git a/src/labs/sharedimage/qsharedimageprovider.cpp b/src/labs/sharedimage/qsharedimageprovider.cpp index 7bac6d4e03..69f0013b06 100644 --- a/src/labs/sharedimage/qsharedimageprovider.cpp +++ b/src/labs/sharedimage/qsharedimageprovider.cpp @@ -45,7 +45,7 @@ QImage QuickSharedImageLoader::loadFile(const QString &path, ImageParameters *pa } } - if (params && params->count() > OriginalSize) + if (params && params->size() > OriginalSize) params->replace(OriginalSize, realSize); return image; diff --git a/src/labs/wavefrontmesh/qwavefrontmesh.cpp b/src/labs/wavefrontmesh/qwavefrontmesh.cpp index 536447c26d..844ebfbd84 100644 --- a/src/labs/wavefrontmesh/qwavefrontmesh.cpp +++ b/src/labs/wavefrontmesh/qwavefrontmesh.cpp @@ -245,7 +245,7 @@ void QWavefrontMesh::readData() d->textureCoordinates.append(QVector2D(u, v)); } else if (command == "v") { // Format: v <x> <y> <z> [w] - if (tokens.length() < 4 || tokens.length() > 5) { + if (tokens.size() < 4 || tokens.size() > 5) { setLastError(InvalidSourceError); return; } @@ -438,7 +438,7 @@ QString QWavefrontMesh::log() const bool QWavefrontMesh::validateAttributes(const QList<QByteArray> &attributes, int *posIndex) { Q_D(QWavefrontMesh); - const int attrCount = attributes.count(); + const int attrCount = attributes.size(); int positionIndex = attributes.indexOf(qtPositionAttributeName()); int texCoordIndex = attributes.indexOf(qtTexCoordAttributeName()); diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index b4461f5a7e..90ece1fc7a 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -1042,7 +1042,7 @@ void QQuickImageParticle::createEngine() { if (m_spriteEngine) delete m_spriteEngine; - if (m_sprites.count()) { + if (m_sprites.size()) { m_spriteEngine = new QQuickSpriteEngine(m_sprites, this); connect(m_spriteEngine, SIGNAL(stateChanged(int)), this, SLOT(spriteAdvance(int)), Qt::DirectConnection); @@ -1244,7 +1244,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node) m_debugMode = m_system->m_debugMode; - if (m_sprites.count() || m_bypassOptimizations) { + if (m_sprites.size() || m_bypassOptimizations) { perfLevel = Sprites; } else if (m_colorTable || m_sizeTable || m_opacityTable) { perfLevel = Tabled; @@ -1624,7 +1624,7 @@ void QQuickImageParticle::spritesUpdate(qreal time) // This is particularly important for cut-up sprites. QQuickParticleData* datum = (mainDatum->animationOwner == this ? mainDatum : getShadowDatum(mainDatum)); int spriteIdx = 0; - for (int i = 0; i<m_startsIdx.count(); i++) { + for (int i = 0; i<m_startsIdx.size(); i++) { if (m_startsIdx[i].second == groupId){ spriteIdx = m_startsIdx[i].first + datum->index; break; @@ -1677,12 +1677,12 @@ void QQuickImageParticle::spritesUpdate(qreal time) void QQuickImageParticle::spriteAdvance(int spriteIdx) { - if (!m_startsIdx.count())//Probably overly defensive + if (!m_startsIdx.size())//Probably overly defensive return; int gIdx = -1; int i; - for (i = 0; i<m_startsIdx.count(); i++) { + for (i = 0; i<m_startsIdx.size(); i++) { if (spriteIdx < m_startsIdx[i].first) { gIdx = m_startsIdx[i-1].second; break; diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp index 36b6413503..b7b245758f 100644 --- a/src/particles/qquickmaskextruder.cpp +++ b/src/particles/qquickmaskextruder.cpp @@ -69,9 +69,9 @@ void QQuickMaskExtruder::finishMaskLoading() QPointF QQuickMaskExtruder::extrude(const QRectF &r) { ensureInitialized(r); - if (!m_mask.count() || m_img.isNull()) + if (!m_mask.size() || m_img.isNull()) return r.topLeft(); - const QPointF p = m_mask[QRandomGenerator::global()->bounded(m_mask.count())]; + const QPointF p = m_mask[QRandomGenerator::global()->bounded(m_mask.size())]; //### Should random sub-pixel positioning be added? return p + r.topLeft(); } diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp index 2bceb2456a..35115183a5 100644 --- a/src/particles/qquickparticlesystem.cpp +++ b/src/particles/qquickparticlesystem.cpp @@ -807,7 +807,7 @@ void QQuickParticleSystem::emittersChanged() } // Populate groups and set sizes. - for (int i = 0; i < m_emitters.count(); ) { + for (int i = 0; i < m_emitters.size(); ) { QQuickParticleEmitter *e = m_emitters.at(i); if (!e) { m_emitters.removeAt(i); @@ -873,7 +873,7 @@ void QQuickParticleSystem::createEngine() } } - if (m_groups.count()) { + if (m_groups.size()) { //Reorder groups List so as to have the same order as groupData // TODO: can't we just merge the two lists? QList<QQuickParticleGroup*> newList; @@ -893,7 +893,7 @@ void QQuickParticleSystem::createEngine() } m_groups = newList; QList<QQuickStochasticState*> states; - states.reserve(m_groups.count()); + states.reserve(m_groups.size()); for (QQuickParticleGroup *g : qAsConst(m_groups)) states << (QQuickStochasticState*)g; @@ -952,7 +952,7 @@ int QQuickParticleSystem::nextSystemIndex() QQuickParticleData* QQuickParticleSystem::newDatum(int groupId, bool respectLimits, int sysIndex) { - Q_ASSERT(groupId < groupData.count());//XXX shouldn't really be an assert + Q_ASSERT(groupId < groupData.size());//XXX shouldn't really be an assert QQuickParticleData* ret = groupData[groupId]->newDatum(respectLimits); if (!ret) { diff --git a/src/particles/qquicktrailemitter.cpp b/src/particles/qquicktrailemitter.cpp index 97d1e11baf..4deb96c1e5 100644 --- a/src/particles/qquicktrailemitter.cpp +++ b/src/particles/qquicktrailemitter.cpp @@ -147,7 +147,7 @@ void QQuickTrailEmitter::emitWindow(int timeStamp) int gId = m_system->groupIds[m_follow]; int gId2 = groupId(); - for (int i=0; i<m_system->groupData[gId]->data.count(); i++) { + for (int i=0; i<m_system->groupData[gId]->data.size(); i++) { QQuickParticleData *d = m_system->groupData[gId]->data[i]; if (!d->stillAlive(m_system)){ m_lastEmission[i] = time; //Should only start emitting when it returns to life diff --git a/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp b/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp index 3a7cda534c..0bc017b3d2 100644 --- a/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp +++ b/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp @@ -129,7 +129,7 @@ void QPacketProtocol::send(const QByteArray &data) qint64 QPacketProtocol::packetsAvailable() const { Q_D(const QPacketProtocol); - return d->packets.count(); + return d->packets.size(); } /*! @@ -223,7 +223,7 @@ void QPacketProtocol::readyToRead() static_cast<qint64>(d->inProgressSize - d->inProgress.size()))); QByteArray toRead(bytesToRead, Qt::Uninitialized); - if (!d->readFromDevice(toRead.data(), toRead.length())) { + if (!d->readFromDevice(toRead.data(), toRead.size())) { emit error(); return; } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index 7708260f8c..1fcc1e7772 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -122,7 +122,7 @@ QDataStream &operator>>(QDataStream &ds, static inline bool isSignalPropertyName(const QString &signalName) { // see QmlCompiler::isSignalPropertyName - return signalName.length() >= 3 && signalName.startsWith(QLatin1String("on")) && + return signalName.size() >= 3 && signalName.startsWith(QLatin1String("on")) && signalName.at(2).isLetter() && signalName.at(2).isUpper(); } @@ -259,8 +259,8 @@ void QQmlEngineDebugServiceImpl::buildObjectDump(QDataStream &message, QObjectList children = object->children(); - int childrenCount = children.count(); - for (int ii = 0; ii < children.count(); ++ii) { + int childrenCount = children.size(); + for (int ii = 0; ii < children.size(); ++ii) { if (qobject_cast<QQmlContext*>(children[ii])) --childrenCount; } @@ -269,7 +269,7 @@ void QQmlEngineDebugServiceImpl::buildObjectDump(QDataStream &message, QList<QQmlObjectProperty> fakeProperties; - for (int ii = 0; ii < children.count(); ++ii) { + for (int ii = 0; ii < children.size(); ++ii) { QObject *child = children.at(ii); if (qobject_cast<QQmlContext*>(child)) continue; @@ -318,12 +318,12 @@ void QQmlEngineDebugServiceImpl::buildObjectDump(QDataStream &message, } } - message << int(propertyIndexes.size() + fakeProperties.count()); + message << int(propertyIndexes.size() + fakeProperties.size()); for (int ii = 0; ii < propertyIndexes.size(); ++ii) message << propertyData(object, propertyIndexes.at(ii)); - for (int ii = 0; ii < fakeProperties.count(); ++ii) + for (int ii = 0; ii < fakeProperties.size(); ++ii) message << fakeProperties[ii]; } @@ -332,7 +332,7 @@ void QQmlEngineDebugServiceImpl::prepareDeferredObjects(QObject *obj) qmlExecuteDeferred(obj); QObjectList children = obj->children(); - for (int ii = 0; ii < children.count(); ++ii) { + for (int ii = 0; ii < children.size(); ++ii) { QObject *child = children.at(ii); prepareDeferredObjects(child); } @@ -343,7 +343,7 @@ void QQmlEngineDebugServiceImpl::storeObjectIds(QObject *co) { QQmlDebugService::idForObject(co); QObjectList children = co->children(); - for (int ii = 0; ii < children.count(); ++ii) + for (int ii = 0; ii < children.size(); ++ii) storeObjectIds(children.at(ii)); } @@ -380,14 +380,14 @@ void QQmlEngineDebugServiceImpl::buildObjectList(QDataStream &message, } count = 0; - for (int ii = 0; ii < instances.count(); ++ii) { + for (int ii = 0; ii < instances.size(); ++ii) { QQmlData *data = QQmlData::get(instances.at(ii)); if (data->context == p.data()) count ++; } message << count; - for (int ii = 0; ii < instances.count(); ++ii) { + for (int ii = 0; ii < instances.size(); ++ii) { QQmlData *data = QQmlData::get(instances.at(ii)); if (data->context == p.data()) message << objectData(instances.at(ii)); @@ -465,9 +465,9 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) if (type == "LIST_ENGINES") { rs << QByteArray("LIST_ENGINES_R"); - rs << queryId << int(m_engines.count()); + rs << queryId << int(m_engines.size()); - for (int ii = 0; ii < m_engines.count(); ++ii) { + for (int ii = 0; ii < m_engines.size(); ++ii) { QJSEngine *engine = m_engines.at(ii); QString engineName = engine->objectName(); @@ -523,7 +523,7 @@ void QQmlEngineDebugServiceImpl::processMessage(const QByteArray &message) const QList<QObject*> objects = objectForLocationInfo(file, lineNumber, columnNumber); rs << QByteArray("FETCH_OBJECTS_FOR_LOCATION_R") << queryId - << int(objects.count()); + << int(objects.size()); for (QObject *object : objects) { if (recurse) @@ -755,7 +755,7 @@ bool QQmlEngineDebugServiceImpl::setMethodBody(int objectId, const QString &meth QList<QByteArray> paramNames = metaMethod.parameterNames(); QString paramStr; - for (int ii = 0; ii < paramNames.count(); ++ii) { + for (int ii = 0; ii < paramNames.size(); ++ii) { if (ii != 0) paramStr.append(QLatin1Char(',')); paramStr.append(QString::fromUtf8(paramNames.at(ii))); } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index b78a09f0fb..904749d7f6 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -242,7 +242,7 @@ QJsonObject QV4DataCollector::buildFrame(const QV4::StackFrame &stackFrame, int // Only type and index are used by Qt Creator, so we keep it easy: QVector<QV4::Heap::ExecutionContext::ContextType> scopeTypes = getScopeTypes(frameNr); - for (int i = 0, ei = scopeTypes.count(); i != ei; ++i) { + for (int i = 0, ei = scopeTypes.size(); i != ei; ++i) { int type = encodeScopeType(scopeTypes[i]); if (type == -1) continue; diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp index 647804d62e..383668833b 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp @@ -124,7 +124,7 @@ FrameJob::FrameJob(QV4DataCollector *collector, int frameNr) : void FrameJob::run() { QVector<QV4::StackFrame> frames = collector->engine()->stackTrace(frameNr + 1); - if (frameNr >= frames.length()) { + if (frameNr >= frames.size()) { success = false; } else { result = collector->buildFrame(frames[frameNr], frameNr); diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp index 2488a10c0d..64f0f89ae0 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp @@ -395,10 +395,10 @@ public: QV4Debugger *debugger = debugService->debuggerAgent.pausedDebugger(); if (!debugger) { const QList<QV4Debugger *> &debuggers = debugService->debuggerAgent.debuggers(); - if (debuggers.count() > 1) { + if (debuggers.size() > 1) { createErrorResponse(QStringLiteral("Cannot lookup values if multiple debuggers are running and none is paused")); return; - } else if (debuggers.count() == 0) { + } else if (debuggers.size() == 0) { createErrorResponse(QStringLiteral("No debuggers available to lookup values")); return; } @@ -611,10 +611,10 @@ public: QV4Debugger *debugger = debugService->debuggerAgent.pausedDebugger(); if (!debugger) { const QList<QV4Debugger *> &debuggers = debugService->debuggerAgent.debuggers(); - if (debuggers.count() > 1) { + if (debuggers.size() > 1) { createErrorResponse(QStringLiteral("Cannot evaluate expressions if multiple debuggers are running and none is paused")); return; - } else if (debuggers.count() == 0) { + } else if (debuggers.size() == 0) { createErrorResponse(QStringLiteral("No debuggers available to evaluate expressions")); return; } diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp index 72b9fa5f4c..f4e90f87ca 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp @@ -60,7 +60,7 @@ void GlobalInspector::setSelectedItems(const QList<QQuickItem *> &items) return; QList<QObject*> objectList; - objectList.reserve(items.count()); + objectList.reserve(items.size()); for (QQuickItem *item : items) objectList << item; @@ -81,7 +81,7 @@ void GlobalInspector::sendCurrentObjects(const QList<QObject*> &objects) ds << QByteArray(EVENT) << m_eventId++ << QByteArray(SELECT); QList<int> debugIds; - debugIds.reserve(objects.count()); + debugIds.reserve(objects.size()); for (QObject *object : objects) debugIds << QQmlDebugService::idForObject(object); ds << debugIds; diff --git a/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp index 2bf043d9b9..cedb17e150 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp @@ -86,7 +86,7 @@ void InspectTool::touchEvent(QTouchEvent *event) switch (event->type()) { case QEvent::TouchBegin: - if (touchPoints.count() == 1 && (event->touchPointStates() & QEventPoint::State::Pressed)) { + if (touchPoints.size() == 1 && (event->touchPointStates() & QEventPoint::State::Pressed)) { m_mousePosition = touchPoints.first().position(); m_tapEvent = true; } else { @@ -94,14 +94,14 @@ void InspectTool::touchEvent(QTouchEvent *event) } break; case QEvent::TouchUpdate: { - if (touchPoints.count() > 1) + if (touchPoints.size() > 1) m_tapEvent = false; - else if ((touchPoints.count() == 1) && (event->touchPointStates() & QEventPoint::State::Updated)) + else if ((touchPoints.size() == 1) && (event->touchPointStates() & QEventPoint::State::Updated)) m_mousePosition = touchPoints.first().position(); break; } case QEvent::TouchEnd: { - if (touchPoints.count() == 1 && m_tapEvent) { + if (touchPoints.size() == 1 && m_tapEvent) { m_tapEvent = false; bool doubleTap = event->timestamp() - m_touchTimestamp < static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval()); @@ -125,9 +125,9 @@ void InspectTool::selectNextItem() if (m_lastClickedItem != inspector()->topVisibleItemAt(m_mousePosition)) return; QList<QQuickItem*> items = inspector()->itemsAt(m_mousePosition); - for (int i = 0; i < items.count(); i++) { + for (int i = 0; i < items.size(); i++) { if (m_lastItem == items[i]) { - if (i + 1 < items.count()) + if (i + 1 < items.size()) m_lastItem = items[i+1]; else m_lastItem = items[0]; diff --git a/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp index 945fe4e985..b9ba13c9e7 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp @@ -29,7 +29,7 @@ static QQuickItem *itemAt(QQuickItem *item, const QPointF &pos, } QList<QQuickItem *> children = QQuickItemPrivate::get(item)->paintOrderChildItems(); - for (int i = children.count() - 1; i >= 0; --i) { + for (int i = children.size() - 1; i >= 0; --i) { QQuickItem *child = children.at(i); if (QQuickItem *betterCandidate = itemAt(child, item->mapToItem(child, pos), overlay)) @@ -60,7 +60,7 @@ static void collectItemsAt(QQuickItem *item, const QPointF &pos, } QList<QQuickItem *> children = QQuickItemPrivate::get(item)->paintOrderChildItems(); - for (int i = children.count() - 1; i >= 0; --i) { + for (int i = children.size() - 1; i >= 0; --i) { QQuickItem *child = children.at(i); collectItemsAt(child, item->mapToItem(child, pos), overlay, resultList); } diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp index 9f83ae8db9..3afdaa53f1 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp @@ -18,7 +18,7 @@ static bool isRelative(const QString &path) return true; if (path.at(0) == '/') return false; - if (path.at(0) == ':' && path.length() >= 2 && path.at(1) == '/') + if (path.at(0) == ':' && path.size() >= 2 && path.at(1) == '/') return false; #ifdef Q_OS_WIN if (path.length() >= 2 && path.at(1) == ':') diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp index 2acef4f781..7601c59cac 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp @@ -104,7 +104,7 @@ void QQmlPreviewHandler::loadUrl(const QUrl &url) m_component.reset(nullptr); QQuickPixmap::purgeCache(); - const int numEngines = m_engines.count(); + const int numEngines = m_engines.size(); if (numEngines > 1) { emit error(QString::fromLatin1("%1 QML engines available. We cannot decide which one " "should load the component.").arg(numEngines)); diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp index 9836672b4c..be753ed10f 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp @@ -92,9 +92,9 @@ static void qQmlProfilerDataToByteArrays(const QQmlProfilerData &d, qint64 QQmlProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &messages) { - while (next != data.length()) { + while (next != data.size()) { const QQmlProfilerData &nextData = data.at(next); - if (nextData.time > until || messages.length() > s_numMessagesPerBatch) + if (nextData.time > until || messages.size() > s_numMessagesPerBatch) return nextData.time; qQmlProfilerDataToByteArrays(nextData, locations, messages); ++next; diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index 6d7edd88bd..bf70008775 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -345,7 +345,7 @@ void QQmlProfilerServiceImpl::sendMessages() if (next != -1) m_startTimes.insert(next, first); - if (messages.length() >= QQmlAbstractProfilerAdapter::s_numMessagesPerBatch) { + if (messages.size() >= QQmlAbstractProfilerAdapter::s_numMessagesPerBatch) { emit messagesToClient(name(), messages); messages.clear(); } diff --git a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp index 945a9bee95..1a3e17fcbc 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp @@ -38,14 +38,14 @@ qint64 QV4ProfilerAdapter::appendMemoryEvents(qint64 until, QList<QByteArray> &m // Make it const, so that we cannot accidentally detach it. const QVector<QV4::Profiling::MemoryAllocationProperties> &memoryData = m_memoryData; - while (memoryData.length() > m_memoryPos && memoryData[m_memoryPos].timestamp <= until) { + while (memoryData.size() > m_memoryPos && memoryData[m_memoryPos].timestamp <= until) { const QV4::Profiling::MemoryAllocationProperties &props = memoryData[m_memoryPos]; d << props.timestamp << int(MemoryAllocation) << int(props.type) << props.size; ++m_memoryPos; messages.append(d.squeezedData()); d.clear(); } - return memoryData.length() == m_memoryPos ? -1 : memoryData[m_memoryPos].timestamp; + return memoryData.size() == m_memoryPos ? -1 : memoryData[m_memoryPos].timestamp; } qint64 QV4ProfilerAdapter::finalizeMessages(qint64 until, QList<QByteArray> &messages, @@ -80,9 +80,9 @@ qint64 QV4ProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &message while (true) { while (!m_stack.isEmpty() && - (m_functionCallPos == functionCallData.length() || + (m_functionCallPos == functionCallData.size() || m_stack.top() <= functionCallData[m_functionCallPos].start)) { - if (m_stack.top() > until || messages.length() > s_numMessagesPerBatch) + if (m_stack.top() > until || messages.size() > s_numMessagesPerBatch) return finalizeMessages(until, messages, m_stack.top(), d); appendMemoryEvents(m_stack.top(), messages, d); @@ -90,11 +90,11 @@ qint64 QV4ProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &message messages.append(d.squeezedData()); d.clear(); } - while (m_functionCallPos != functionCallData.length() && + while (m_functionCallPos != functionCallData.size() && (m_stack.empty() || functionCallData[m_functionCallPos].start < m_stack.top())) { const QV4::Profiling::FunctionCallProperties &props = functionCallData[m_functionCallPos]; - if (props.start > until || messages.length() > s_numMessagesPerBatch) + if (props.start > until || messages.size() > s_numMessagesPerBatch) return finalizeMessages(until, messages, props.start, d); appendMemoryEvents(props.start, messages, d); @@ -117,7 +117,7 @@ qint64 QV4ProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &message m_stack.push(props.end); ++m_functionCallPos; } - if (m_stack.empty() && m_functionCallPos == functionCallData.length()) + if (m_stack.empty() && m_functionCallPos == functionCallData.size()) return finalizeMessages(until, messages, -1, d); } } diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp index a7fe757df6..9eba1e23a6 100644 --- a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp @@ -119,7 +119,7 @@ static void qQuickProfilerDataToByteArrays(const QQuickProfilerData &data, qint64 QQuickProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &messages) { while (next < m_data.size()) { - if (m_data[next].time <= until && messages.length() <= s_numMessagesPerBatch) + if (m_data[next].time <= until && messages.size() <= s_numMessagesPerBatch) qQuickProfilerDataToByteArrays(m_data[next++], messages); else return m_data[next].time; diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp index 2583f005a7..8ecbfdeef8 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp @@ -442,7 +442,7 @@ void QQmlDebugServerImpl::receiveMessage() QStringList pluginNames; QList<float> pluginVersions; if (clientSupportsMultiPackets) { // otherwise, disable all plugins - const int count = m_plugins.count(); + const int count = m_plugins.size(); pluginNames.reserve(count); pluginVersions.reserve(count); for (QHash<QString, QQmlDebugService *>::ConstIterator i = m_plugins.constBegin(); @@ -561,7 +561,7 @@ void QQmlDebugServerImpl::addEngine(QJSEngine *engine) for (QQmlDebugService *service : qAsConst(m_plugins)) service->engineAboutToBeAdded(engine); - m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.count()); + m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.size()); for (QQmlDebugService *service : qAsConst(m_plugins)) service->engineAdded(engine); @@ -578,7 +578,7 @@ void QQmlDebugServerImpl::removeEngine(QJSEngine *engine) for (QQmlDebugService *service : qAsConst(m_plugins)) service->engineAboutToBeRemoved(engine); - m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.count()); + m_engineConditions[engine].waitForServices(&m_helloMutex, m_plugins.size()); for (QQmlDebugService *service : qAsConst(m_plugins)) service->engineRemoved(engine); diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index 196fe7ed4a..6224d033fe 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -93,7 +93,7 @@ void QQmlAnimationTimer::updateAnimationsTime(qint64 delta) //when the CPU load is high if (delta) { insideTick = true; - for (currentAnimationIdx = 0; currentAnimationIdx < animations.count(); ++currentAnimationIdx) { + for (currentAnimationIdx = 0; currentAnimationIdx < animations.size(); ++currentAnimationIdx) { QAbstractAnimationJob *animation = animations.at(currentAnimationIdx); int elapsed = animation->m_totalCurrentTime + (animation->direction() == QAbstractAnimationJob::Forward ? delta : -delta); @@ -101,7 +101,7 @@ void QQmlAnimationTimer::updateAnimationsTime(qint64 delta) } if (animationTickDump()) { qDebug() << "***** Dumping Animation Tree ***** ( tick:" << lastTick << "delta:" << delta << ")"; - for (int i = 0; i < animations.count(); ++i) + for (int i = 0; i < animations.size(); ++i) qDebug() << animations.at(i); } insideTick = false; diff --git a/src/qml/animations/qabstractanimationjob_p.h b/src/qml/animations/qabstractanimationjob_p.h index a933f49be3..6330b01bb1 100644 --- a/src/qml/animations/qabstractanimationjob_p.h +++ b/src/qml/animations/qabstractanimationjob_p.h @@ -193,7 +193,7 @@ public: void updateAnimationsTime(qint64 timeStep) override; //useful for profiling/debugging - int runningAnimationCount() override { return animations.count(); } + int runningAnimationCount() override { return animations.size(); } bool hasStartAnimationPending() const { return startAnimationPending; } diff --git a/src/qml/common/qqmljsfixedpoolarray_p.h b/src/qml/common/qqmljsfixedpoolarray_p.h index 16f60c002e..e946b1ecfd 100644 --- a/src/qml/common/qqmljsfixedpoolarray_p.h +++ b/src/qml/common/qqmljsfixedpoolarray_p.h @@ -44,7 +44,7 @@ public: void allocate(MemoryPool *pool, const QVector<T> &vector) { - count = vector.count(); + count = vector.size(); data = reinterpret_cast<T*>(pool->allocate(count * sizeof(T))); if (QTypeInfo<T>::isComplex) { @@ -58,7 +58,7 @@ public: template <typename Container> void allocate(MemoryPool *pool, const Container &container) { - count = container.count(); + count = container.size(); data = reinterpret_cast<T*>(pool->allocate(count * sizeof(T))); typename Container::ConstIterator it = container.constBegin(); for (int i = 0; i < count; ++i) diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h index ec14ebd48e..23c75d705f 100644 --- a/src/qml/common/qv4compileddata_p.h +++ b/src/qml/common/qv4compileddata_p.h @@ -222,7 +222,7 @@ struct String qint32_le size; static int calculateSize(const QString &str) { - return (sizeof(String) + (str.length() + 1) * sizeof(quint16) + 7) & ~0x7; + return (sizeof(String) + (str.size() + 1) * sizeof(quint16) + 7) & ~0x7; } }; @@ -578,7 +578,7 @@ struct Binding static QString escapedString(const QString &string) { QString tmp = QLatin1String("\""); - for (int i = 0; i < string.length(); ++i) { + for (int i = 0; i < string.size(); ++i) { const QChar &c = string.at(i); switch (c.unicode()) { case 0x08: diff --git a/src/qml/common/qv4stringtoarrayindex_p.h b/src/qml/common/qv4stringtoarrayindex_p.h index ba5642a27d..fc71ca7072 100644 --- a/src/qml/common/qv4stringtoarrayindex_p.h +++ b/src/qml/common/qv4stringtoarrayindex_p.h @@ -52,7 +52,7 @@ uint stringToArrayIndex(const T *ch, const T *end) inline uint stringToArrayIndex(const QString &str) { - return stringToArrayIndex(str.constData(), str.constData() + str.length()); + return stringToArrayIndex(str.constData(), str.constData() + str.size()); } } // namespace QV4 diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp index c0026aba1f..3d8594214b 100644 --- a/src/qml/compiler/qv4compiler.cpp +++ b/src/qml/compiler/qv4compiler.cpp @@ -74,8 +74,8 @@ void QV4::Compiler::StringTableGenerator::serialize(CompiledData::Unit *unit) QV4::CompiledData::String *s = reinterpret_cast<QV4::CompiledData::String *>(stringData); Q_ASSERT(reinterpret_cast<uintptr_t>(s) % alignof(QV4::CompiledData::String) == 0); - Q_ASSERT(qstr.length() >= 0); - s->size = qstr.length(); + Q_ASSERT(qstr.size() >= 0); + s->size = qstr.size(); ushort *uc = reinterpret_cast<ushort *>(reinterpret_cast<char *>(s) + sizeof(*s)); qToLittleEndian<ushort>(qstr.constData(), s->size, uc); @@ -313,12 +313,12 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(GeneratorO // write js classes and js class lookup table quint32_le *jsClassOffsetTable = reinterpret_cast<quint32_le *>(dataPtr + unit->offsetToJSClassTable); - for (int i = 0; i < jsClassOffsets.count(); ++i) + for (int i = 0; i < jsClassOffsets.size(); ++i) jsClassOffsetTable[i] = jsClassDataOffset + jsClassOffsets.at(i); } - if (translations.count()) { - memcpy(dataPtr + unit->offsetToTranslationTable, translations.constData(), translations.count() * sizeof(CompiledData::TranslationData)); + if (translations.size()) { + memcpy(dataPtr + unit->offsetToTranslationTable, translations.constData(), translations.size() * sizeof(CompiledData::TranslationData)); } { @@ -588,7 +588,7 @@ QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Comp unit.offsetToBlockTable = nextOffset; nextOffset += unit.blockTableSize * sizeof(uint); - unit.lookupTableSize = lookups.count(); + unit.lookupTableSize = lookups.size(); unit.offsetToLookupTable = nextOffset; nextOffset += unit.lookupTableSize * sizeof(CompiledData::Lookup); @@ -603,7 +603,7 @@ QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Comp unit.offsetToConstantTable = nextOffset; nextOffset += unit.constantTableSize * sizeof(ReturnedValue); - unit.jsClassTableSize = jsClassOffsets.count(); + unit.jsClassTableSize = jsClassOffsets.size(); unit.offsetToJSClassTable = nextOffset; nextOffset += unit.jsClassTableSize * sizeof(uint); @@ -612,7 +612,7 @@ QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Comp nextOffset = static_cast<quint32>(roundUpToMultipleOf(8, nextOffset)); - unit.translationTableSize = translations.count(); + unit.translationTableSize = translations.size(); unit.offsetToTranslationTable = nextOffset; nextOffset += unit.translationTableSize * sizeof(CompiledData::TranslationData); @@ -625,16 +625,16 @@ QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Comp nextOffset = static_cast<quint32>(roundUpToMultipleOf(8, nextOffset)); }; - reserveExportTable(module->localExportEntries.count(), &unit.localExportEntryTableSize, &unit.offsetToLocalExportEntryTable); - reserveExportTable(module->indirectExportEntries.count(), &unit.indirectExportEntryTableSize, &unit.offsetToIndirectExportEntryTable); - reserveExportTable(module->starExportEntries.count(), &unit.starExportEntryTableSize, &unit.offsetToStarExportEntryTable); + reserveExportTable(module->localExportEntries.size(), &unit.localExportEntryTableSize, &unit.offsetToLocalExportEntryTable); + reserveExportTable(module->indirectExportEntries.size(), &unit.indirectExportEntryTableSize, &unit.offsetToIndirectExportEntryTable); + reserveExportTable(module->starExportEntries.size(), &unit.starExportEntryTableSize, &unit.offsetToStarExportEntryTable); - unit.importEntryTableSize = module->importEntries.count(); + unit.importEntryTableSize = module->importEntries.size(); unit.offsetToImportEntryTable = nextOffset; nextOffset += unit.importEntryTableSize * sizeof(CompiledData::ImportEntry); nextOffset = static_cast<quint32>(roundUpToMultipleOf(8, nextOffset)); - unit.moduleRequestTableSize = module->moduleRequests.count(); + unit.moduleRequestTableSize = module->moduleRequests.size(); unit.offsetToModuleRequestTable = nextOffset; nextOffset += unit.moduleRequestTableSize * sizeof(uint); nextOffset = static_cast<quint32>(roundUpToMultipleOf(8, nextOffset)); @@ -696,7 +696,7 @@ QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Comp if (showStats) { qDebug() << "Generated JS unit that is" << unit.unitSize << "bytes contains:"; qDebug() << " " << functionSize << "bytes for non-code function data for" << unit.functionTableSize << "functions"; - qDebug() << " " << translations.count() * sizeof(CompiledData::TranslationData) << "bytes for" << translations.count() << "translations"; + qDebug() << " " << translations.size() * sizeof(CompiledData::TranslationData) << "bytes for" << translations.size() << "translations"; } return unit; diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp index cb32f9ad43..696bffa23b 100644 --- a/src/qml/compiler/qv4compilercontext.cpp +++ b/src/qml/compiler/qv4compilercontext.cpp @@ -147,7 +147,7 @@ Context::ResolvedName Context::resolveName(const QString &name, const QQmlJS::So return result; if (c->contextType == ContextType::ESModule) { - for (int i = 0; i < c->importEntries.count(); ++i) { + for (int i = 0; i < c->importEntries.size(); ++i) { if (c->importEntries.at(i).localName == name) { result.index = i; result.type = ResolvedName::Import; @@ -180,7 +180,7 @@ void Context::emitBlockHeader(Codegen *codegen) if (requiresExecutionContext) { if (blockIndex < 0) { codegen->module()->blocks.append(this); - blockIndex = codegen->module()->blocks.count() - 1; + blockIndex = codegen->module()->blocks.size() - 1; } if (contextType == ContextType::Global) { @@ -360,7 +360,7 @@ void Context::setupFunctionIndices(Moth::BytecodeGenerator *bytecodeGenerator) break; } - sizeOfLocalTemporalDeadZone = localsInTDZ.count(); + sizeOfLocalTemporalDeadZone = localsInTDZ.size(); for (auto &member: qAsConst(localsInTDZ)) { member->index = locals.size(); locals.append(member.key()); @@ -375,7 +375,7 @@ void Context::setupFunctionIndices(Moth::BytecodeGenerator *bytecodeGenerator) } } - sizeOfRegisterTemporalDeadZone = registersInTDZ.count(); + sizeOfRegisterTemporalDeadZone = registersInTDZ.size(); firstTemporalDeadZoneRegister = bytecodeGenerator->currentRegister(); for (auto &member: qAsConst(registersInTDZ)) member->index = bytecodeGenerator->newRegister(); diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index 29bc3918ea..ee54137c10 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -861,7 +861,7 @@ void ScanFunctions::calcEscapingVariables() mIt->canEscape = true; } const QLatin1String exprForOn("expression for on"); - if (c->contextType == ContextType::Binding && c->name.length() > exprForOn.size() && + if (c->contextType == ContextType::Binding && c->name.size() > exprForOn.size() && c->name.startsWith(exprForOn) && c->name.at(exprForOn.size()).isUpper()) // we don't really need this for bindings, but we do for signal handlers, and in this case, // we don't know if the code is a signal handler or not. diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index c7fdec1a4d..75408fd348 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -503,7 +503,7 @@ void dumpBytecode(const char *bytecode, int len, int nLocals, int nFormals, int const QVector<CompiledData::CodeOffsetToLine> &lineNumberMapping = QVector<CompiledData::CodeOffsetToLine>()); inline void dumpBytecode(const QByteArray &bytecode, int nLocals, int nFormals, int startLine = 1, const QVector<CompiledData::CodeOffsetToLine> &lineNumberMapping = QVector<CompiledData::CodeOffsetToLine>()) { - dumpBytecode(bytecode.constData(), bytecode.length(), nLocals, nFormals, startLine, lineNumberMapping); + dumpBytecode(bytecode.constData(), bytecode.size(), nLocals, nFormals, startLine, lineNumberMapping); } union Instr diff --git a/src/qml/debugger/qqmldebugconnector.cpp b/src/qml/debugger/qqmldebugconnector.cpp index add0396228..0b66a29e18 100644 --- a/src/qml/debugger/qqmldebugconnector.cpp +++ b/src/qml/debugger/qqmldebugconnector.cpp @@ -95,7 +95,7 @@ QQmlDebugConnector *QQmlDebugConnector::instance() int connectorEnd = params->arguments.indexOf(QLatin1Char(','), connectorBegin); if (connectorEnd == -1) - connectorEnd = params->arguments.length(); + connectorEnd = params->arguments.size(); params->instance = loadQQmlDebugConnector(params->arguments.mid( connectorBegin, diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index f82c2cba26..7363703544 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -829,7 +829,7 @@ static bool convertString(const QString &string, QMetaType metaType, void *ptr) { // have a string based value without engine. Do conversion manually if (metaType == QMetaType::fromType<bool>()) { - *reinterpret_cast<bool*>(ptr) = string.length() != 0; + *reinterpret_cast<bool*>(ptr) = string.size() != 0; return true; } if (metaType == QMetaType::fromType<QString>()) { diff --git a/src/qml/jsapi/qjsmanagedvalue.cpp b/src/qml/jsapi/qjsmanagedvalue.cpp index 8b2f367304..0bb01f1835 100644 --- a/src/qml/jsapi/qjsmanagedvalue.cpp +++ b/src/qml/jsapi/qjsmanagedvalue.cpp @@ -958,7 +958,7 @@ QJSValue QJSManagedValue::call(const QJSValueList &arguments) const QV4::ExecutionEngine *engine = f->engine(); QV4::Scope scope(engine); - QV4::JSCallArguments jsCallData(scope, arguments.length()); + QV4::JSCallArguments jsCallData(scope, arguments.size()); *jsCallData.thisObject = engine->globalObject; int i = 0; for (const QJSValue &arg : arguments) { @@ -997,7 +997,7 @@ QJSValue QJSManagedValue::callWithInstance(const QJSValue &instance, } QV4::Scope scope(engine); - QV4::JSCallArguments jsCallData(scope, arguments.length()); + QV4::JSCallArguments jsCallData(scope, arguments.size()); *jsCallData.thisObject = QJSValuePrivate::convertToReturnedValue(engine, instance); int i = 0; for (const QJSValue &arg : arguments) { @@ -1030,7 +1030,7 @@ QJSValue QJSManagedValue::callAsConstructor(const QJSValueList &arguments) const QV4::ExecutionEngine *engine = f->engine(); QV4::Scope scope(engine); - QV4::JSCallArguments jsCallData(scope, arguments.length()); + QV4::JSCallArguments jsCallData(scope, arguments.size()); int i = 0; for (const QJSValue &arg : arguments) { if (Q_UNLIKELY(!QJSValuePrivate::checkEngine(engine, arg))) { diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index 8370a92ea7..ea0381e886 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -500,7 +500,7 @@ double QJSValue::toNumber() const bool QJSValue::toBool() const { if (const QString *string = QJSValuePrivate::asQString(this)) - return string->length() > 0; + return string->size() > 0; return caughtResult<bool>(this, &QV4::Value::toBoolean); } @@ -674,7 +674,7 @@ QJSValue QJSValue::call(const QJSValueList &args) const Q_ASSERT(engine); Scope scope(engine); - JSCallArguments jsCallData(scope, args.length()); + JSCallArguments jsCallData(scope, args.size()); *jsCallData.thisObject = engine->globalObject; for (int i = 0; i < args.size(); ++i) { if (!QJSValuePrivate::checkEngine(engine, args.at(i))) { diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 769b8c161a..1fb6d92183 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -343,7 +343,7 @@ static inline double ParseString(const QString &s, double localTZA) }; const QChar *ch = s.constData(); - const QChar *end = ch + s.length(); + const QChar *end = ch + s.size(); uint format = Year; int current = 0; diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index ba5662cf46..f4b96c53b9 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -955,13 +955,13 @@ Heap::Object *ExecutionEngine::newObject(Heap::InternalClass *internalClass) Heap::String *ExecutionEngine::newString(const QString &s) { - return memoryManager->allocWithStringData<String>(s.length() * sizeof(QChar), s); + return memoryManager->allocWithStringData<String>(s.size() * sizeof(QChar), s); } Heap::String *ExecutionEngine::newIdentifier(const QString &text) { Scope scope(this); - ScopedString s(scope, memoryManager->allocWithStringData<String>(text.length() * sizeof(QChar), text)); + ScopedString s(scope, memoryManager->allocWithStringData<String>(text.size() * sizeof(QChar), text)); s->toPropertyKey(); return s->d(); } @@ -1848,11 +1848,11 @@ QV4::ReturnedValue ExecutionEngine::fromData( // directly against QList<QObject*>? const QList<QObject *> &list = *(const QList<QObject *>*)ptr; QV4::ScopedArrayObject a(scope, newArrayObject()); - a->arrayReserve(list.count()); + a->arrayReserve(list.size()); QV4::ScopedValue v(scope); - for (int ii = 0; ii < list.count(); ++ii) + for (int ii = 0; ii < list.size(); ++ii) a->arrayPut(ii, (v = QV4::QObjectWrapper::wrap(this, list.at(ii)))); - a->setArrayLengthUnchecked(list.count()); + a->setArrayLengthUnchecked(list.size()); return a.asReturnedValue(); } else if (auto flags = metaType.flags(); flags & QMetaType::PointerToQObject) { if (flags.testFlag(QMetaType::IsConst)) @@ -2271,7 +2271,7 @@ int ExecutionEngine::consoleCountHelper(const QString &file, quint16 line, quint void ExecutionEngine::setExtensionData(int index, Deletable *data) { - if (m_extensionData.count() <= index) + if (m_extensionData.size() <= index) m_extensionData.resize(index + 1); if (m_extensionData.at(index)) diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index fc5f75b693..8b78cef349 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -703,7 +703,7 @@ public: void setExtensionData(int, Deletable *); Deletable *extensionData(int index) const { - if (index < m_extensionData.count()) + if (index < m_extensionData.size()) return m_extensionData[index]; else return nullptr; diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index f3adadc887..eb449ba293 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -120,7 +120,7 @@ ReturnedValue ErrorObject::method_get_stack(const FunctionObject *b, const Value return v4->throwTypeError(); if (!This->d()->stack) { QString trace; - for (int i = 0; i < This->d()->stackTrace->count(); ++i) { + for (int i = 0; i < This->d()->stackTrace->size(); ++i) { if (i > 0) trace += QLatin1Char('\n'); const StackFrame &frame = This->d()->stackTrace->at(i); diff --git a/src/qml/jsruntime/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h index d6551599e7..7fd8a10cdb 100644 --- a/src/qml/jsruntime/qv4executableallocator_p.h +++ b/src/qml/jsruntime/qv4executableallocator_p.h @@ -79,8 +79,8 @@ public: }; // for debugging / unit-testing - int freeAllocationCount() const { return freeAllocations.count(); } - int chunkCount() const { return chunks.count(); } + int freeAllocationCount() const { return freeAllocations.size(); } + int chunkCount() const { return chunks.size(); } struct ChunkOfPages { diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp index 3fe031501f..c0e6a71980 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit.cpp +++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp @@ -832,7 +832,7 @@ bool ExecutableCompilationUnit::saveToDisk(const QUrl &unitUrl, QString *errorSt bool ResolvedTypeReferenceMap::addToHash( QCryptographicHash *hash, QHash<quintptr, QByteArray> *checksums) const { - std::vector<int> keys (count()); + std::vector<int> keys (size()); int i = 0; for (auto it = constBegin(), end = constEnd(); it != end; ++it) { keys[i] = it.key(); @@ -864,7 +864,7 @@ QString ExecutableCompilationUnit::bindingValueAsString(const CompiledData::Bind // This code must match that in the qsTr() implementation const QString &path = fileName(); int lastSlash = path.lastIndexOf(QLatin1Char('/')); - QStringView context = (lastSlash > -1) ? QStringView{path}.mid(lastSlash + 1, path.length() - lastSlash - 5) + QStringView context = (lastSlash > -1) ? QStringView{path}.mid(lastSlash + 1, path.size() - lastSlash - 5) : QStringView(); QByteArray contextUtf8 = context.toUtf8(); QByteArray comment = stringAt(translation.commentIndex).toUtf8(); diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index 1be093f0a4..f756575ea8 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -111,7 +111,7 @@ Function::Function(ExecutionEngine *engine, const QQmlPrivate::AOTCompiledFuncti , aotFunction(aotFunction) { internalClass = engine->internalClasses(EngineBase::Class_CallContext); - nFormals = aotFunction->argumentTypes.length(); + nFormals = aotFunction->argumentTypes.size(); } Function::~Function() @@ -127,7 +127,7 @@ void Function::updateInternalClass(ExecutionEngine *engine, const QList<QByteArr QStringList parameterNames; // Resolve duplicate parameter names: - for (int i = 0, ei = parameters.count(); i != ei; ++i) { + for (int i = 0, ei = parameters.size(); i != ei; ++i) { const QByteArray ¶m = parameters.at(i); int duplicate = -1; diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 0112347053..7ea90a2ddd 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -32,7 +32,7 @@ static QString escape(const QString &input) { QString output; output.reserve(input.size() * 3); - const int length = input.length(); + const int length = input.size(); for (int i = 0; i < length; ++i) { ushort uc = input.at(i).unicode(); if (uc < 0x100) { @@ -63,9 +63,9 @@ static QString escape(const QString &input) static QString unescape(const QString &input) { QString result; - result.reserve(input.length()); + result.reserve(input.size()); int i = 0; - const int length = input.length(); + const int length = input.size(); while (i < length) { QChar c = input.at(i++); if ((c == u'%') && (i + 1 < length)) { @@ -113,7 +113,7 @@ static QString encode(const QString &input, const char *unescapedSet, bool *ok) { *ok = true; QString output; - const int length = input.length(); + const int length = input.size(); int i = 0; while (i < length) { const QChar c = input.at(i); @@ -187,8 +187,8 @@ static QString decode(const QString &input, DecodeMode decodeMode, bool *ok) { *ok = true; QString output; - output.reserve(input.length()); - const int length = input.length(); + output.reserve(input.size()); + const int length = input.size(); int i = 0; const QChar percent = QLatin1Char('%'); while (i < length) { @@ -381,7 +381,7 @@ ReturnedValue GlobalFunctions::method_parseInt(const FunctionObject *b, const Va CHECK_EXCEPTION(); const QChar *pos = trimmed.constData(); - const QChar *end = pos + trimmed.length(); + const QChar *end = pos + trimmed.size(); int sign = 1; // 3 if (pos != end) { diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp index 5b0c2f25ee..e3cde9b7c7 100644 --- a/src/qml/jsruntime/qv4identifiertable.cpp +++ b/src/qml/jsruntime/qv4identifiertable.cpp @@ -100,7 +100,7 @@ void IdentifierTable::addEntry(Heap::StringOrSymbol *str) Heap::String *IdentifierTable::insertString(const QString &s) { uint subtype; - uint hash = String::createHashValue(s.constData(), s.length(), &subtype); + uint hash = String::createHashValue(s.constData(), s.size(), &subtype); if (subtype == Heap::String::StringType_ArrayIndex) { Heap::String *str = engine->newString(s); str->stringHash = hash; @@ -133,7 +133,7 @@ Heap::Symbol *IdentifierTable::insertSymbol(const QString &s) Q_ASSERT(s.at(0) == QLatin1Char('@')); uint subtype; - uint hash = String::createHashValue(s.constData(), s.length(), &subtype); + uint hash = String::createHashValue(s.constData(), s.size(), &subtype); uint idx = hash % alloc; while (Heap::StringOrSymbol *e = entriesByHash[idx]) { if (e->stringHash == hash && e->toQString() == s) @@ -252,7 +252,7 @@ void IdentifierTable::sweep() PropertyKey IdentifierTable::asPropertyKey(const QString &s) { uint subtype; - const uint hash = String::createHashValue(s.constData(), s.length(), &subtype); + const uint hash = String::createHashValue(s.constData(), s.size(), &subtype); if (subtype == Heap::String::StringType_ArrayIndex) return PropertyKey::fromArrayIndex(hash); return resolveStringEntry(s, hash, subtype)->identifier; diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 8ff6a8c238..ca9b959cfe 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -635,7 +635,7 @@ private: static QString quote(const QString &str) { QString product; - const int length = str.length(); + const int length = str.size(); product.reserve(length + 2); product += u'"'; for (int i = 0; i < length; ++i) { @@ -885,7 +885,7 @@ ReturnedValue JsonObject::method_parse(const FunctionObject *b, const Value *, c jtext = argv[0].toQString(); DEBUG << "parsing source = " << jtext; - JsonParser parser(v4, jtext.constData(), jtext.length()); + JsonParser parser(v4, jtext.constData(), jtext.size()); QJsonParseError error; ReturnedValue result = parser.parse(&error); if (error.error != QJsonParseError::NoError) { diff --git a/src/qml/jsruntime/qv4module.cpp b/src/qml/jsruntime/qv4module.cpp index 779eb77a36..1e1a059dfa 100644 --- a/src/qml/jsruntime/qv4module.cpp +++ b/src/qml/jsruntime/qv4module.cpp @@ -195,7 +195,7 @@ struct ModuleNamespaceIterator : ObjectOwnPropertyKeyIterator PropertyKey ModuleNamespaceIterator::next(const Object *o, Property *pd, PropertyAttributes *attrs) { const Module *module = static_cast<const Module *>(o); - if (exportIndex < exportedNames.count()) { + if (exportIndex < exportedNames.size()) { if (attrs) *attrs = Attr_Data; Scope scope(module->engine()); diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index aec04b167d..6a39b9e27f 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -1104,7 +1104,7 @@ void Heap::ArrayObject::init(const QStringList &list) // The result is a new Array object with length equal to the length // of the QStringList, and the elements being the QStringList's // elements converted to JS Strings. - int len = list.count(); + int len = list.size(); a->arrayReserve(len); ScopedValue v(scope); for (int ii = 0; ii < len; ++ii) diff --git a/src/qml/jsruntime/qv4propertykey.cpp b/src/qml/jsruntime/qv4propertykey.cpp index 8a3e1adc65..e07df07543 100644 --- a/src/qml/jsruntime/qv4propertykey.cpp +++ b/src/qml/jsruntime/qv4propertykey.cpp @@ -66,7 +66,7 @@ QV4::Heap::String *QV4::PropertyKey::asFunctionName(ExecutionEngine *engine, Fun QString str = s->toQString(); if (s->internalClass->vtable->isString) n += s->toQString(); - else if (str.length() > 1) + else if (str.size() > 1) n += QChar::fromLatin1('[') + QStringView{str}.mid(1) + QChar::fromLatin1(']'); } return engine->newString(n); diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 7186c2647a..5485c257c4 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -1195,7 +1195,7 @@ ReturnedValue QObjectWrapper::method_disconnect(const FunctionObject *b, const V static void markChildQObjectsRecursively(QObject *parent, MarkStack *markStack) { const QObjectList &children = parent->children(); - for (int i = 0; i < children.count(); ++i) { + for (int i = 0; i < children.size(); ++i) { QObject *child = children.at(i); if (!child) continue; @@ -1369,8 +1369,8 @@ static ReturnedValue CallMethod(const QQmlObjectOrGadget &object, int index, QMe } } } - QVarLengthArray<void *, 9> argData(args.count()); - for (int ii = 0; ii < args.count(); ++ii) + QVarLengthArray<void *, 9> argData(args.size()); + for (int ii = 0; ii < args.size(); ++ii) argData[ii] = args[ii].dataPtr(); object.metacall(callType, index, argData.data()); @@ -2116,11 +2116,11 @@ ReturnedValue CallArgument::toValue(ExecutionEngine *engine) QList<QObject *> &list = *qlistPtr; Scope scope(engine); ScopedArrayObject array(scope, engine->newArrayObject()); - array->arrayReserve(list.count()); + array->arrayReserve(list.size()); ScopedValue v(scope); - for (int ii = 0; ii < list.count(); ++ii) + for (int ii = 0; ii < list.size(); ++ii) array->arrayPut(ii, (v = QObjectWrapper::wrap(engine, list.at(ii)))); - array->setArrayLengthUnchecked(list.count()); + array->setArrayLengthUnchecked(list.size()); return array.asReturnedValue(); } diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp index 0c039967ba..be7ff77603 100644 --- a/src/qml/jsruntime/qv4regexp.cpp +++ b/src/qml/jsruntime/qv4regexp.cpp @@ -49,7 +49,7 @@ uint RegExp::match(const QString &string, int start, uint *matchOffsets) uint ret = JSC::Yarr::offsetNoMatch; #if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS) char buffer[8192]; - ret = uint(priv->jitCode->execute(s.characters16(), start, s.length(), + ret = uint(priv->jitCode->execute(s.characters16(), start, s.size(), (int*)matchOffsets, buffer, 8192).start); #else ret = uint(priv->jitCode->execute(s.characters16(), start, s.length(), @@ -74,18 +74,18 @@ uint RegExp::match(const QString &string, int start, uint *matchOffsets) } #endif // ENABLE(YARR_JIT) - return JSC::Yarr::interpret(byteCode(), s.characters16(), string.length(), start, matchOffsets); + return JSC::Yarr::interpret(byteCode(), s.characters16(), string.size(), start, matchOffsets); } QString RegExp::getSubstitution(const QString &matched, const QString &str, int position, const Value *captures, int nCaptures, const QString &replacement) { QString result; - int matchedLength = matched.length(); - Q_ASSERT(position >= 0 && position <= str.length()); + int matchedLength = matched.size(); + Q_ASSERT(position >= 0 && position <= str.size()); int tailPos = position + matchedLength; int seenDollar = -1; - for (int i = 0; i < replacement.length(); ++i) { + for (int i = 0; i < replacement.size(); ++i) { QChar ch = replacement.at(i); if (seenDollar >= 0) { if (ch.unicode() == '$') { @@ -98,7 +98,7 @@ QString RegExp::getSubstitution(const QString &matched, const QString &str, int result += str.mid(tailPos); } else if (ch.unicode() >= '0' && ch.unicode() <= '9') { int n = ch.unicode() - '0'; - if (i + 1 < replacement.length()) { + if (i + 1 < replacement.size()) { ch = replacement.at(i + 1); if (ch.unicode() >= '0' && ch.unicode() <= '9') { n = n*10 + (ch.unicode() - '0'); diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index 365593e207..0fab40a281 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -48,7 +48,7 @@ void Heap::RegExpObject::init(QV4::RegExp *value) static QString minimalPattern(const QString &pattern) { QString ecmaPattern; - int len = pattern.length(); + int len = pattern.size(); ecmaPattern.reserve(len); int i = 0; const QChar *wc = pattern.unicode(); @@ -146,7 +146,7 @@ ReturnedValue RegExpObject::builtinExec(ExecutionEngine *engine, const String *s Scope scope(engine); int offset = (global() || sticky()) ? lastIndex() : 0; - if (offset < 0 || offset > s.length()) { + if (offset < 0 || offset > s.size()) { setLastIndex(0); RETURN_RESULT(Encode::null()); } @@ -170,7 +170,7 @@ ReturnedValue RegExpObject::builtinExec(ExecutionEngine *engine, const String *s int len = value()->captureCount(); array->arrayReserve(len); ScopedValue v(scope); - int strlen = s.length(); + int strlen = s.size(); for (int i = 0; i < len; ++i) { int start = matchOffsets[i * 2]; int end = matchOffsets[i * 2 + 1]; @@ -232,7 +232,7 @@ uint parseFlags(Scope &scope, const QV4::Value *f) if (scope.hasException()) return flags; QString str = s->toQString(); - for (int i = 0; i < str.length(); ++i) { + for (int i = 0; i < str.size(); ++i) { if (str.at(i) == QLatin1Char('g') && !(flags & CompiledData::RegExp::RegExp_Global)) { flags |= CompiledData::RegExp::RegExp_Global; } else if (str.at(i) == QLatin1Char('i') && !(flags & CompiledData::RegExp::RegExp_IgnoreCase)) { @@ -382,7 +382,7 @@ ReturnedValue RegExpPrototype::execFirstMatch(const FunctionObject *b, const Val QString s = str->toQString(); int offset = r->lastIndex(); - if (offset < 0 || offset > s.length()) { + if (offset < 0 || offset > s.size()) { r->setLastIndex(0); RETURN_RESULT(Encode::null()); } @@ -518,7 +518,7 @@ ReturnedValue RegExpPrototype::method_get_ignoreCase(const FunctionObject *f, co static int advanceStringIndex(int index, const QString &str, bool unicode) { if (unicode) { - if (index < str.length() - 1 && + if (index < str.size() - 1 && str.at(index).isHighSurrogate() && str.at(index + 1).isLowSurrogate()) ++index; @@ -607,7 +607,7 @@ ReturnedValue RegExpPrototype::method_replace(const FunctionObject *f, const Val if (scope.hasException()) return Encode::undefined(); - int lengthS = s->toQString().length(); + int lengthS = s->toQString().size(); ScopedString replaceValue(scope); ScopedFunctionObject replaceFunction(scope, (argc > 1 ? argv[1] : Value::undefinedValue())); @@ -659,7 +659,7 @@ ReturnedValue RegExpPrototype::method_replace(const FunctionObject *f, const Val if (scope.hasException()) return Encode::undefined(); QString m = matchString->toQString(); - int matchLength = m.length(); + int matchLength = m.size(); v = resultObject->get(scope.engine->id_index()); int position = v->toInt32(); position = qMax(qMin(position, lengthS), 0); @@ -786,7 +786,7 @@ ReturnedValue RegExpPrototype::method_split(const FunctionObject *f, const Value return A->asReturnedValue(); QString S = s->toQString(); - int size = S.length(); + int size = S.size(); if (size == 0) { ScopedValue z(scope, exec(scope.engine, splitter, s)); if (z->isNull()) diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index bd81c56bbd..768482267c 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -217,7 +217,7 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix) *result = qdtoa(num, &decpt, &sign); if (decpt <= ecma_shortest_low || decpt > ecma_shortest_high) { - if (result->length() > 1) + if (result->size() > 1) result->insert(1, dot); result->append(QLatin1Char('e')); if (decpt > 0) @@ -225,10 +225,10 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix) result->append(QString::number(decpt - 1)); } else if (decpt <= 0) { result->prepend(QLatin1String("0.") + QString(-decpt, zero)); - } else if (decpt < result->length()) { + } else if (decpt < result->size()) { result->insert(decpt, dot); } else { - result->append(QString(decpt - result->length(), zero)); + result->append(QString(decpt - result->size(), zero)); } if (sign && num) @@ -392,7 +392,7 @@ double RuntimeHelpers::stringToNumber(const QString &string) // libdoubleconversion sources. The same maximum value would be represented by roughly 3.5 times // as many binary digits. const int excessiveLength = 16 * 1024; - if (string.length() > excessiveLength) + if (string.size() > excessiveLength) return qQNaN(); const QStringView s = QStringView(string).trimmed(); @@ -642,7 +642,7 @@ static Q_NEVER_INLINE ReturnedValue getElementIntFallback(ExecutionEngine *engin ScopedObject o(scope, object); if (!o) { if (const String *str = object.as<String>()) { - if (idx >= (uint)str->toQString().length()) { + if (idx >= (uint)str->toQString().size()) { return Encode::undefined(); } const QString s = str->toQString().mid(idx, 1); diff --git a/src/qml/jsruntime/qv4stringiterator.cpp b/src/qml/jsruntime/qv4stringiterator.cpp index 99f10c55b4..9cb2711efb 100644 --- a/src/qml/jsruntime/qv4stringiterator.cpp +++ b/src/qml/jsruntime/qv4stringiterator.cpp @@ -35,7 +35,7 @@ ReturnedValue StringIteratorPrototype::method_next(const FunctionObject *b, cons quint32 index = thisObject->d()->nextIndex; QString str = s->toQString(); - quint32 len = str.length(); + quint32 len = str.size(); if (index >= len) { thisObject->d()->iteratedString.set(scope.engine, nullptr); diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 5e1d764aed..bec4132b5f 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -51,7 +51,7 @@ void Heap::StringObject::init(const QV4::String *str) Heap::String *Heap::StringObject::getIndex(uint index) const { QString str = string->toQString(); - if (index >= (uint)str.length()) + if (index >= (uint)str.size()) return nullptr; return internalClass->engine->newString(str.mid(index, 1)); } @@ -67,7 +67,7 @@ bool StringObject::virtualDeleteProperty(Managed *m, PropertyKey id) if (id.isArrayIndex()) { StringObject *o = static_cast<StringObject *>(m); uint index = id.asArrayIndex(); - if (index < static_cast<uint>(o->d()->string->toQString().length())) + if (index < static_cast<uint>(o->d()->string->toQString().size())) return false; } return Object::virtualDeleteProperty(m, id); @@ -83,7 +83,7 @@ struct StringObjectOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator PropertyKey StringObjectOwnPropertyKeyIterator::next(const QV4::Object *o, Property *pd, PropertyAttributes *attrs) { const StringObject *s = static_cast<const StringObject *>(o); - uint slen = s->d()->string->toQString().length(); + uint slen = s->d()->string->toQString().size(); if (arrayIndex < slen) { uint index = arrayIndex; ++arrayIndex; @@ -119,7 +119,7 @@ PropertyAttributes StringObject::virtualGetOwnProperty(const Managed *m, Propert if (id.isArrayIndex()) { const uint index = id.asArrayIndex(); const auto s = static_cast<const StringObject *>(m); - if (index < uint(s->d()->string->toQString().length())) { + if (index < uint(s->d()->string->toQString().size())) { if (p) p->value = s->getIndex(index); return Attr_NotConfigurable|Attr_NotWritable; @@ -338,7 +338,7 @@ ReturnedValue StringPrototype::method_charAt(const FunctionObject *b, const Valu pos = (int) argv[0].toInteger(); QString result; - if (pos >= 0 && pos < str.length()) + if (pos >= 0 && pos < str.size()) result += str.at(pos); return Encode(v4->newString(result)); @@ -356,7 +356,7 @@ ReturnedValue StringPrototype::method_charCodeAt(const FunctionObject *b, const pos = (int) argv[0].toInteger(); - if (pos >= 0 && pos < str.length()) + if (pos >= 0 && pos < str.size()) RETURN_RESULT(Encode(str.at(pos).unicode())); return Encode(qt_qnan()); @@ -419,11 +419,11 @@ ReturnedValue StringPrototype::method_endsWith(const FunctionObject *b, const Va if (v4->hasException) return Encode::undefined(); - int pos = value.length(); + int pos = value.size(); if (argc > 1) pos = (int) argv[1].toInteger(); - if (pos == value.length()) + if (pos == value.size()) RETURN_RESULT(Encode(value.endsWith(searchString))); QStringView stringToSearch = QStringView{value}.left(pos); @@ -447,7 +447,7 @@ ReturnedValue StringPrototype::method_indexOf(const FunctionObject *b, const Val int index = -1; if (! value.isEmpty()) - index = value.indexOf(searchString, qMin(qMax(pos, 0), value.length())); + index = value.indexOf(searchString, qMin(qMax(pos, 0), value.size())); return Encode(index); } @@ -470,7 +470,7 @@ ReturnedValue StringPrototype::method_includes(const FunctionObject *b, const Va const Value &posArg = argv[1]; pos = (int) posArg.toInteger(); if (!posArg.isInteger() && posArg.isNumber() && qIsInf(posArg.toNumber())) - pos = value.length(); + pos = value.size(); } if (pos == 0) @@ -497,8 +497,8 @@ ReturnedValue StringPrototype::method_lastIndexOf(const FunctionObject *b, const else position = std::trunc(position); - int pos = std::trunc(qMin(qMax(position, 0.0), double(value.length()))); - if (!searchString.isEmpty() && pos == value.length()) + int pos = std::trunc(qMin(qMax(position, 0.0), double(value.size()))); + if (!searchString.isEmpty() && pos == value.size()) --pos; if (searchString.isNull() && pos == 0) RETURN_RESULT(Encode(-1)); @@ -607,12 +607,12 @@ ReturnedValue StringPrototype::method_padEnd(const FunctionObject *f, const Valu return s->asReturnedValue(); QString padded = s->toQString(); - int oldLength = padded.length(); + int oldLength = padded.size(); int toFill = maxLen - oldLength; padded.resize(maxLen); QChar *ch = padded.data() + oldLength; while (toFill) { - int copy = qMin(fillString.length(), toFill); + int copy = qMin(fillString.size(), toFill); memcpy(ch, fillString.constData(), copy*sizeof(QChar)); toFill -= copy; ch += copy; @@ -646,13 +646,13 @@ ReturnedValue StringPrototype::method_padStart(const FunctionObject *f, const Va return s->asReturnedValue(); QString original = s->toQString(); - int oldLength = original.length(); + int oldLength = original.size(); int toFill = maxLen - oldLength; QString padded; padded.resize(maxLen); QChar *ch = padded.data(); while (toFill) { - int copy = qMin(fillString.length(), toFill); + int copy = qMin(fillString.size(), toFill); memcpy(ch, fillString.constData(), copy*sizeof(QChar)); toFill -= copy; ch += copy; @@ -682,9 +682,9 @@ ReturnedValue StringPrototype::method_repeat(const FunctionObject *b, const Valu static void appendReplacementString(QString *result, const QString &input, const QString& replaceValue, uint* matchOffsets, int captureCount) { - result->reserve(result->length() + replaceValue.length()); - for (int i = 0; i < replaceValue.length(); ++i) { - if (replaceValue.at(i) == QLatin1Char('$') && i < replaceValue.length() - 1) { + result->reserve(result->size() + replaceValue.size()); + for (int i = 0; i < replaceValue.size(); ++i) { + if (replaceValue.at(i) == QLatin1Char('$') && i < replaceValue.size() - 1) { ushort ch = replaceValue.at(i + 1).unicode(); uint substStart = JSC::Yarr::offsetNoMatch; uint substEnd = JSC::Yarr::offsetNoMatch; @@ -703,12 +703,12 @@ static void appendReplacementString(QString *result, const QString &input, const skip = 1; } else if (ch == '\'') { substStart = matchOffsets[1]; - substEnd = input.length(); + substEnd = input.size(); skip = 1; } else if (ch >= '0' && ch <= '9') { uint capture = ch - '0'; skip = 1; - if (i < replaceValue.length() - 2) { + if (i < replaceValue.size() - 2) { ch = replaceValue.at(i + 2).unicode(); if (ch >= '0' && ch <= '9') { uint c = capture*10 + ch - '0'; @@ -793,7 +793,7 @@ ReturnedValue StringPrototype::method_replace(const FunctionObject *b, const Val if (idx != -1) { numStringMatches = 1; matchOffsets[0] = idx; - matchOffsets[1] = idx + searchString.length(); + matchOffsets[1] = idx + searchString.size(); } } @@ -802,7 +802,7 @@ ReturnedValue StringPrototype::method_replace(const FunctionObject *b, const Val ScopedValue replaceValue(scope, argc > 1 ? argv[1] : Value::undefinedValue()); ScopedFunctionObject searchCallback(scope, replaceValue); if (!!searchCallback) { - result.reserve(string.length() + 10*numStringMatches); + result.reserve(string.size() + 10*numStringMatches); ScopedValue entry(scope); Value *arguments = scope.alloc(numCaptures + 2); int lastEnd = 0; @@ -832,7 +832,7 @@ ReturnedValue StringPrototype::method_replace(const FunctionObject *b, const Val result += QStringView{string}.mid(lastEnd); } else { QString newString = replaceValue->toQString(); - result.reserve(string.length() + numStringMatches*newString.size()); + result.reserve(string.size() + numStringMatches*newString.size()); int lastEnd = 0; for (int i = 0; i < numStringMatches; ++i) { @@ -975,7 +975,7 @@ ReturnedValue StringPrototype::method_split(const FunctionObject *b, const Value } else { QString separator = separatorValue->toQString(); if (separator.isEmpty()) { - for (uint i = 0; i < qMin(limit, uint(text.length())); ++i) + for (uint i = 0; i < qMin(limit, uint(text.size())); ++i) array->push_back((s = scope.engine->newString(text.mid(i, 1)))); return array.asReturnedValue(); } @@ -1033,7 +1033,7 @@ ReturnedValue StringPrototype::method_substr(const FunctionObject *b, const Valu if (argc > 1) length = argv[1].toInteger(); - double count = value.length(); + double count = value.size(); if (start < 0) start = qMax(count + start, 0.0); @@ -1051,7 +1051,7 @@ ReturnedValue StringPrototype::method_substring(const FunctionObject *b, const V if (v4->hasException) return QV4::Encode::undefined(); - int length = value.length(); + int length = value.size(); double start = 0; double end = length; @@ -1124,11 +1124,11 @@ ReturnedValue StringPrototype::method_trim(const FunctionObject *b, const Value const QChar *chars = s.constData(); int start, end; - for (start = 0; start < s.length(); ++start) { + for (start = 0; start < s.size(); ++start) { if (!chars[start].isSpace() && chars[start].unicode() != 0xfeff) break; } - for (end = s.length() - 1; end >= start; --end) { + for (end = s.size() - 1; end >= start; --end) { if (!chars[end].isSpace() && chars[end].unicode() != 0xfeff) break; } diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index 295dc889b2..86be5e61c0 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -943,7 +943,7 @@ void MemoryManager::sweep(bool lastSweep, ClassDestroyStatsCallback classCountPt } // Now it is time to free QV4::QObjectWrapper Value, we must check the Value's tag to make sure its object has been destroyed - const int pendingCount = m_pendingFreedObjectWrapperValue.count(); + const int pendingCount = m_pendingFreedObjectWrapperValue.size(); if (pendingCount) { QVector<Value *> remainingWeakQObjectWrappers; remainingWeakQObjectWrappers.reserve(pendingCount); @@ -1078,7 +1078,7 @@ void MemoryManager::runGC() std::swap(freedObjectStats, *freedObjectStatsGlobal()); typedef std::pair<const char*, int> ObjectStatInfo; std::vector<ObjectStatInfo> freedObjectsSorted; - freedObjectsSorted.reserve(freedObjectStats.count()); + freedObjectsSorted.reserve(freedObjectStats.size()); for (auto it = freedObjectStats.constBegin(); it != freedObjectStats.constEnd(); ++it) { freedObjectsSorted.push_back(std::make_pair(it.key(), it.value())); } diff --git a/src/qml/parser/qqmljslexer.cpp b/src/qml/parser/qqmljslexer.cpp index d44b5a29da..db5f1b92dd 100644 --- a/src/qml/parser/qqmljslexer.cpp +++ b/src/qml/parser/qqmljslexer.cpp @@ -75,7 +75,7 @@ void Lexer::setCode(const QString &code, int lineno, bool qmlMode) _state.rawString = QStringView(); _state.codePtr = code.unicode(); - _endPtr = _state.codePtr + code.length(); + _endPtr = _state.codePtr + code.size(); _state.tokenStartPtr = _state.codePtr; _state.currentChar = u'\n'; diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index 9beaffc2ae..5e002fcbee 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -200,12 +200,12 @@ QHashedStringRef::QHashedStringRef() } QHashedStringRef::QHashedStringRef(const QString &str) -: m_data(str.constData()), m_length(str.length()), m_hash(0) +: m_data(str.constData()), m_length(str.size()), m_hash(0) { } QHashedStringRef::QHashedStringRef(QStringView str) -: m_data(str.constData()), m_length(str.length()), m_hash(0) +: m_data(str.constData()), m_length(str.size()), m_hash(0) { } @@ -220,7 +220,7 @@ QHashedStringRef::QHashedStringRef(const QChar *data, int length, quint32 hash) } QHashedStringRef::QHashedStringRef(const QHashedString &string) -: m_data(string.constData()), m_length(string.length()), m_hash(string.m_hash) +: m_data(string.constData()), m_length(string.size()), m_hash(string.m_hash) { } @@ -248,7 +248,7 @@ bool QHashedStringRef::operator==(const QHashedString &string) const if (m_hash && string.m_hash && m_hash != string.m_hash) return false; QStringView view {m_data, m_length}; - QStringView otherView {string.constData(), string.length()}; + QStringView otherView {string.constData(), string.size()}; return view == otherView; } @@ -424,7 +424,7 @@ quint32 QHashedString::stringHash(const char *data, int length) void QHashedString::computeHash() const { - m_hash = stringHash(constData(), length()); + m_hash = stringHash(constData(), size()); } namespace QtPrivate { diff --git a/src/qml/qml/ftw/qstringhash_p.h b/src/qml/qml/ftw/qstringhash_p.h index 1d0e7d6e97..ee2928ee59 100644 --- a/src/qml/qml/ftw/qstringhash_p.h +++ b/src/qml/qml/ftw/qstringhash_p.h @@ -38,7 +38,7 @@ public: } QStringHashNode(const QHashedString &key) - : length(key.length()), hash(key.hash()), symbolId(0) + : length(key.size()), hash(key.hash()), symbolId(0) , arrayData(mutableStringData(key).d_ptr()) , strData(mutableStringData(key).data()) { @@ -491,7 +491,7 @@ int QStringHash<T>::numBuckets() const template<class T> void QStringHash<T>::initializeNode(Node *node, const QHashedString &key) { - node->length = key.length(); + node->length = key.size(); node->hash = key.hash(); node->arrayData = mutableStringData(key).d_ptr(); node->strData = mutableStringData(key).data(); diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 3e9e124f4d..2cc7cc4d37 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -350,7 +350,7 @@ bool QQmlComponentPrivate::setInitialProperty( QV4::ScopedObject object(scope, QV4::QObjectWrapper::wrap(scope.engine, base)); QV4::ScopedString segment(scope); - for (int i = 0; i < properties.length() - 1; ++i) { + for (int i = 0; i < properties.size() - 1; ++i) { segment = scope.engine->newString(properties.at(i)); object = object->get(segment); if (scope.engine->hasException) @@ -1341,7 +1341,7 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent) QList<APF> functions = QQmlMetaType::parentFunctions(); bool needParent = false; - for (int ii = 0; ii < functions.count(); ++ii) { + for (int ii = 0; ii < functions.size(); ++ii) { QQmlPrivate::AutoParentResult res = functions.at(ii)(me, parent); if (res == QQmlPrivate::Parented) { needParent = false; @@ -1420,7 +1420,7 @@ void QQmlComponentPrivate::setInitialProperties(QV4::ExecutionEngine *engine, QV object = o; const QStringList properties = name->toQString().split(QLatin1Char('.')); bool isTopLevelProperty = properties.size() == 1; - for (int i = 0; i < properties.length() - 1; ++i) { + for (int i = 0; i < properties.size() - 1; ++i) { name = engine->newString(properties.at(i)); object = object->get(name); if (engine->hasException || !object) { diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index baa8d6133e..0c9286693f 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -481,7 +481,7 @@ qsizetype QQmlContextPrivate::context_count(QQmlListProperty<QObject> *prop) if (d->propertyValue(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) return 0; else - return ((const QList<QObject> *)d->propertyValue(contextProperty).constData())->count(); + return ((const QList<QObject> *)d->propertyValue(contextProperty).constData())->size(); } QObject *QQmlContextPrivate::context_at(QQmlListProperty<QObject> *prop, qsizetype index) diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h index aa50485a00..5489afb892 100644 --- a/src/qml/qml/qqmlcontext_p.h +++ b/src/qml/qml/qqmlcontext_p.h @@ -50,7 +50,7 @@ public: int notifyIndex() const { return m_notifyIndex; } void setNotifyIndex(int notifyIndex) { m_notifyIndex = notifyIndex; } - int numPropertyValues() const { return m_propertyValues.count(); } + int numPropertyValues() const { return m_propertyValues.size(); } void appendPropertyValue(const QVariant &value) { m_propertyValues.append(value); } void setPropertyValue(int index, const QVariant &value) { m_propertyValues[index] = value; } QVariant propertyValue(int index) const { return m_propertyValues[index]; } diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp index ca3985bd92..f284a82dbe 100644 --- a/src/qml/qml/qqmlcustomparser.cpp +++ b/src/qml/qml/qqmlcustomparser.cpp @@ -93,7 +93,7 @@ int QQmlCustomParser::evaluateEnum(const QString &script, bool *ok) const auto nextDot = [&](int dot) { const int nextDot = script.indexOf(u'.', dot + 1); - return (nextDot == script.length() - 1) ? -1 : nextDot; + return (nextDot == script.size() - 1) ? -1 : nextDot; }; int dot = nextDot(-1); @@ -161,7 +161,7 @@ int QQmlCustomParser::evaluateEnum(const QString &script, bool *ok) const if (!scopedEnumName.isEmpty() && scopedEnumName != enumData->name) continue; - for (int jj = 0; jj < enumData->values.count(); ++jj) { + for (int jj = 0; jj < enumData->values.size(); ++jj) { const QQmlEnumValue value = enumData->values.at(jj); if (value.namedValue == enumValue) { *ok = true; diff --git a/src/qml/qml/qqmldatablob.cpp b/src/qml/qml/qqmldatablob.cpp index 6114c2846a..0cb685ac7f 100644 --- a/src/qml/qml/qqmldatablob.cpp +++ b/src/qml/qml/qqmldatablob.cpp @@ -254,7 +254,7 @@ void QQmlDataBlob::setError(const QList<QQmlError> &errors) Q_ASSERT(m_errors.isEmpty()); // m_errors must be set before the m_data fence - m_errors.reserve(errors.count()); + m_errors.reserve(errors.size()); for (const QQmlError &error : errors) { if (error.url().isEmpty()) { QQmlError mutableError = error; @@ -269,7 +269,7 @@ void QQmlDataBlob::setError(const QList<QQmlError> &errors) if (dumpErrors()) { qWarning().nospace() << "Errors for " << urlString(); - for (int ii = 0; ii < errors.count(); ++ii) + for (int ii = 0; ii < errors.size(); ++ii) qWarning().nospace() << " " << qPrintable(errors.at(ii).toString()); } cancelAllWaitingFor(); @@ -503,7 +503,7 @@ void QQmlDataBlob::tryDone() void QQmlDataBlob::cancelAllWaitingFor() { - while (m_waitingFor.count()) { + while (m_waitingFor.size()) { QQmlRefPointer<QQmlDataBlob> blob = m_waitingFor.takeLast(); Q_ASSERT(blob->m_waitingOnMe.contains(this)); @@ -514,7 +514,7 @@ void QQmlDataBlob::cancelAllWaitingFor() void QQmlDataBlob::notifyAllWaitingOnMe() { - while (m_waitingOnMe.count()) { + while (m_waitingOnMe.size()) { QQmlDataBlob *blob = m_waitingOnMe.takeLast(); Q_ASSERT(std::any_of(blob->m_waitingFor.constBegin(), blob->m_waitingFor.constEnd(), @@ -533,7 +533,7 @@ void QQmlDataBlob::notifyComplete(QQmlDataBlob *blob) m_inCallback = true; QQmlRefPointer<QQmlDataBlob> blobRef; - for (int i = 0; i < m_waitingFor.count(); ++i) { + for (int i = 0; i < m_waitingFor.size(); ++i) { if (m_waitingFor.at(i).data() == blob) { blobRef = m_waitingFor.takeAt(i); break; @@ -576,7 +576,7 @@ QString QQmlDataBlob::SourceCodeData::readAll(QString *error) const } QByteArray data(fileSize, Qt::Uninitialized); - if (f.read(data.data(), data.length()) != data.length()) { + if (f.read(data.data(), data.size()) != data.size()) { *error = f.errorString(); return QString(); } diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp index 66192ff06c..a0b6440e7d 100644 --- a/src/qml/qml/qqmlerror.cpp +++ b/src/qml/qml/qqmlerror.cpp @@ -295,13 +295,13 @@ QDebug operator<<(QDebug debug, const QQmlError &error) const QString code = stream.readAll(); const auto lines = QStringView{code}.split(QLatin1Char('\n')); - if (lines.count() >= error.line()) { + if (lines.size() >= error.line()) { const QStringView &line = lines.at(error.line() - 1); debug << "\n " << line.toLocal8Bit().constData(); if(error.column() > 0) { int column = qMax(0, error.column() - 1); - column = qMin(column, line.length()); + column = qMin(column, line.size()); QByteArray ind; ind.reserve(column); diff --git a/src/qml/qml/qqmlfile.cpp b/src/qml/qml/qqmlfile.cpp index 4f18389864..d616616ebd 100644 --- a/src/qml/qml/qqmlfile.cpp +++ b/src/qml/qml/qqmlfile.cpp @@ -413,8 +413,8 @@ bool QQmlFile::isSynchronous(const QUrl &url) { QString scheme = url.scheme(); - if ((scheme.length() == 4 && 0 == scheme.compare(QLatin1String(file_string), Qt::CaseInsensitive)) || - (scheme.length() == 3 && 0 == scheme.compare(QLatin1String(qrc_string), Qt::CaseInsensitive))) { + if ((scheme.size() == 4 && 0 == scheme.compare(QLatin1String(file_string), Qt::CaseInsensitive)) || + (scheme.size() == 3 && 0 == scheme.compare(QLatin1String(qrc_string), Qt::CaseInsensitive))) { return true; #if defined(Q_OS_ANDROID) @@ -438,20 +438,20 @@ Synchronous urls have a qrc:/ or file:// scheme. */ bool QQmlFile::isSynchronous(const QString &url) { - if (url.length() < 5 /* qrc:/ */) + if (url.size() < 5 /* qrc:/ */) return false; QChar f = url[0]; if (f == QLatin1Char('f') || f == QLatin1Char('F')) { - return url.length() >= 7 /* file:// */ && + return url.size() >= 7 /* file:// */ && url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) && url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/'); } else if (f == QLatin1Char('q') || f == QLatin1Char('Q')) { - return url.length() >= 5 /* qrc:/ */ && + return url.size() >= 5 /* qrc:/ */ && url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) && url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/'); @@ -497,10 +497,10 @@ bool QQmlFile::isLocalFile(const QUrl &url) // file: URLs with two slashes following the scheme can be interpreted as local files // where the slashes are part of the path. Therefore, disregard the authority. // See QUrl::toLocalFile(). - if (scheme.length() == 4 && scheme.startsWith(QLatin1String(file_string), Qt::CaseInsensitive)) + if (scheme.size() == 4 && scheme.startsWith(QLatin1String(file_string), Qt::CaseInsensitive)) return true; - if (scheme.length() == 3 && scheme.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive)) + if (scheme.size() == 3 && scheme.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive)) return url.authority().isEmpty(); #if defined(Q_OS_ANDROID) @@ -517,7 +517,7 @@ bool QQmlFile::isLocalFile(const QUrl &url) static bool hasScheme(const QString &url, const char *scheme, qsizetype schemeLength) { - const qsizetype urlLength = url.length(); + const qsizetype urlLength = url.size(); if (urlLength < schemeLength + 1) return false; @@ -533,7 +533,7 @@ static bool hasScheme(const QString &url, const char *scheme, qsizetype schemeLe static qsizetype authorityOffset(const QString &url, qsizetype schemeLength) { - const qsizetype urlLength = url.length(); + const qsizetype urlLength = url.size(); if (urlLength < schemeLength + 3) return -1; @@ -572,7 +572,7 @@ Local file urls have either a qrc: or file: scheme. */ bool QQmlFile::isLocalFile(const QString &url) { - if (url.length() < 4 /* qrc: */) + if (url.size() < 4 /* qrc: */) return false; switch (url[0].toLatin1()) { @@ -584,7 +584,7 @@ bool QQmlFile::isLocalFile(const QString &url) const qsizetype fileLength = strlen(file_string); return url.startsWith(QLatin1String(file_string, file_string + fileLength), Qt::CaseInsensitive) - && url.length() > fileLength + && url.size() > fileLength && url[fileLength] == QLatin1Char(':'); } case 'q': @@ -646,7 +646,7 @@ static QString toLocalFile(const QString &url) static bool isDoubleSlashed(const QString &url, qsizetype offset) { - const qsizetype urlLength = url.length(); + const qsizetype urlLength = url.size(); if (urlLength < offset + 2) return false; @@ -669,7 +669,7 @@ QString QQmlFile::urlToLocalFileOrQrc(const QString& url) if (url.startsWith(QLatin1String("qrc://"), Qt::CaseInsensitive)) { // Exactly two slashes are bad because that's a URL authority. // One slash is fine and >= 3 slashes are file. - if (url.length() == 6 || url[6] != QLatin1Char('/')) { + if (url.size() == 6 || url[6] != QLatin1Char('/')) { Q_ASSERT(isDoubleSlashed(url, strlen("qrc:"))); return QString(); } @@ -679,7 +679,7 @@ QString QQmlFile::urlToLocalFileOrQrc(const QString& url) if (url.startsWith(QLatin1String("qrc:"), Qt::CaseInsensitive)) { Q_ASSERT(!isDoubleSlashed(url, strlen("qrc:"))); - if (url.length() > 4) + if (url.size() > 4) return QLatin1Char(':') + QStringView{url}.mid(4); return QStringLiteral(":"); } diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index a7af7cedd6..37cc6bd2c6 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -123,7 +123,7 @@ QString resolveLocalUrl(const QString &url, const QString &relative) QString base = baseRef + relative; // Remove any relative directory elements in the path - int length = base.length(); + int length = base.size(); int index = 0; while ((index = base.indexOf(QLatin1String("/."), index)) != -1) { if ((length > (index + 2)) && (base.at(index + 2) == Dot) && @@ -235,7 +235,7 @@ void QQmlImports::populateCache(QQmlTypeNameCache *cache) const { const QQmlImportNamespace &set = m_unqualifiedset; - for (int ii = set.imports.count() - 1; ii >= 0; --ii) { + for (int ii = set.imports.size() - 1; ii >= 0; --ii) { const QQmlImportInstance *import = set.imports.at(ii); QQmlTypeModule *module = QQmlMetaType::typeModule(import->uri, import->version); if (module) { @@ -251,7 +251,7 @@ void QQmlImports::populateCache(QQmlTypeNameCache *cache) const QQmlImportRef &typeimport = cache->m_namedImports[set.prefix]; typeimport.m_qualifier = set.prefix; - for (int ii = set.imports.count() - 1; ii >= 0; --ii) { + for (int ii = set.imports.size() - 1; ii >= 0; --ii) { const QQmlImportInstance *import = set.imports.at(ii); QQmlTypeModule *module = QQmlMetaType::typeModule(import->uri, import->version); if (module) { @@ -283,7 +283,7 @@ void findCompositeSingletons(const QQmlImportNamespace &set, QList<QQmlImports:: { typedef QQmlDirComponents::const_iterator ConstIterator; - for (int ii = set.imports.count() - 1; ii >= 0; --ii) { + for (int ii = set.imports.size() - 1; ii >= 0; --ii) { const QQmlImportInstance *import = set.imports.at(ii); const QQmlDirComponents &components = import->qmlDirComponents; @@ -373,7 +373,7 @@ QList<QQmlImports::ScriptReference> QQmlImports::resolvedScripts() const const QQmlImportNamespace &set = m_unqualifiedset; - for (int ii = set.imports.count() - 1; ii >= 0; --ii) { + for (int ii = set.imports.size() - 1; ii >= 0; --ii) { const QQmlImportInstance *import = set.imports.at(ii); for (const QQmlDirParser::Script &script : import->qmlDirScripts) { @@ -387,7 +387,7 @@ QList<QQmlImports::ScriptReference> QQmlImports::resolvedScripts() const for (QQmlImportNamespace *ns = m_qualifiedSets.first(); ns; ns = m_qualifiedSets.next(ns)) { const QQmlImportNamespace &set = *ns; - for (int ii = set.imports.count() - 1; ii >= 0; --ii) { + for (int ii = set.imports.size() - 1; ii >= 0; --ii) { const QQmlImportInstance *import = set.imports.at(ii); for (const QQmlDirParser::Script &script : import->qmlDirScripts) { @@ -736,7 +736,7 @@ bool QQmlImports::resolveType( m_typeLoader, unqualifiedtype, version_return, type_return, &m_base, errors, registrationType, typeRecursionDetected)) return true; - if (nameSpace->imports.count() == 1 + if (nameSpace->imports.size() == 1 && !nameSpace->imports.at(0)->isLibrary && type_return && nameSpace != &m_unqualifiedset) { @@ -868,13 +868,13 @@ bool QQmlImportNamespace::resolveType(QQmlTypeLoader *typeLoader, const QHashedS }); setNeedsSorting(false); } - for (int i=0; i<imports.count(); ++i) { + for (int i=0; i<imports.size(); ++i) { const QQmlImportInstance *import = imports.at(i); if (import->resolveType(typeLoader, type, version_return, type_return, base, typeRecursionDetected, registrationType, recursionRestriction, errors)) { if (qmlCheckTypes()) { // check for type clashes - for (int j = i+1; j<imports.count(); ++j) { + for (int j = i+1; j<imports.size(); ++j) { const QQmlImportInstance *import2 = imports.at(j); if (import2->resolveType(typeLoader, type, version_return, nullptr, base, nullptr, registrationType)) { @@ -1012,7 +1012,7 @@ QString QQmlImports::resolvedUri(const QString &dir_arg, QQmlImportDatabase *dat QString stableRelativePath = dir; for (const QString &path : qAsConst(paths)) { if (dir.startsWith(path)) { - stableRelativePath = dir.mid(path.length()+1); + stableRelativePath = dir.mid(path.size()+1); break; } } @@ -1496,7 +1496,7 @@ QUrl QQmlImports::urlFromLocalFileOrQrcOrUrl(const QString &file) QUrl url(QLatin1String(file.at(0) == Colon ? "qrc" : "") + file); // We don't support single character schemes as those conflict with windows drive letters. - if (url.scheme().length() < 2) + if (url.scheme().size() < 2) return QUrl::fromLocalFile(file); return url; } @@ -1547,7 +1547,7 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e) auto addEnvImportPath = [this](const char *var) { if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty(var))) { const QStringList paths = parseEnvPath(qEnvironmentVariable(var)); - for (int ii = paths.count() - 1; ii >= 0; --ii) + for (int ii = paths.size() - 1; ii >= 0; --ii) addImportPath(paths.at(ii)); } }; @@ -1562,7 +1562,7 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e) auto addEnvPluginPath = [this](const char *var) { if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty(var))) { const QStringList paths = parseEnvPath(qEnvironmentVariable(var)); - for (int ii = paths.count() - 1; ii >= 0; --ii) + for (int ii = paths.size() - 1; ii >= 0; --ii) addPluginPath(paths.at(ii)); } }; @@ -1609,7 +1609,7 @@ void QQmlImportDatabase::addPluginPath(const QString& path) QUrl url = QUrl(path); if (url.isRelative() || url.scheme() == QLatin1String("file") - || (url.scheme().length() == 1 && QFile::exists(path)) ) { // windows path + || (url.scheme().size() == 1 && QFile::exists(path)) ) { // windows path QDir dir = QDir(path); filePluginPath.prepend(dir.canonicalPath()); } else { @@ -1643,7 +1643,7 @@ void QQmlImportDatabase::addImportPath(const QString& path) cPath = QLatin1String("qrc") + path; cPath.replace(Backslash, Slash); } else if (url.isRelative() || - (url.scheme().length() == 1 && QFile::exists(path)) ) { // windows path + (url.scheme().size() == 1 && QFile::exists(path)) ) { // windows path QDir dir = QDir(path); cPath = dir.canonicalPath(); } else { diff --git a/src/qml/qml/qqmlirloader.cpp b/src/qml/qml/qqmlirloader.cpp index 4ead4d05cb..5c322ab021 100644 --- a/src/qml/qml/qqmlirloader.cpp +++ b/src/qml/qml/qqmlirloader.cpp @@ -98,7 +98,7 @@ QmlIR::Object *QQmlIRLoader::loadObject(const QV4::CompiledData::Object *seriali object->bindings->append(b); if (b->type() == QV4::CompiledData::Binding::Type_Script) { functionIndices.append(b->value.compiledScriptIndex); - b->value.compiledScriptIndex = functionIndices.count() - 1; + b->value.compiledScriptIndex = functionIndices.size() - 1; QmlIR::CompiledFunctionOrExpression *foe = pool->New<QmlIR::CompiledFunctionOrExpression>(); foe->nameIndex = 0; @@ -106,9 +106,9 @@ QmlIR::Object *QQmlIRLoader::loadObject(const QV4::CompiledData::Object *seriali QQmlJS::AST::ExpressionNode *expr; if (b->stringIndex != quint32(0)) { - const int start = output->code.length(); + const int start = output->code.size(); const QString script = output->stringAt(b->stringIndex); - const int length = script.length(); + const int length = script.size(); output->code.append(script); expr = new (pool) FakeExpression(start, length); } else @@ -118,7 +118,7 @@ QmlIR::Object *QQmlIRLoader::loadObject(const QV4::CompiledData::Object *seriali } } - Q_ASSERT(object->functionsAndExpressions->count == functionIndices.count()); + Q_ASSERT(object->functionsAndExpressions->count == functionIndices.size()); for (uint i = 0; i < serializedObject->nSignals; ++i) { const QV4::CompiledData::Signal *serializedSignal = serializedObject->signalAt(i); @@ -174,7 +174,7 @@ QmlIR::Object *QQmlIRLoader::loadObject(const QV4::CompiledData::Object *seriali const QV4::CompiledData::Function *compiledFunction = unit->functionAt(*functionIdx); functionIndices.append(*functionIdx); - f->index = functionIndices.count() - 1; + f->index = functionIndices.size() - 1; f->location = compiledFunction->location; f->nameIndex = compiledFunction->nameIndex; f->returnType = compiledFunction->returnType; diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 3fb1bd45cd..304c5da29a 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -176,7 +176,7 @@ public: ~QQmlJavaScriptExpressionCapture() { if (capture.errorString) { - for (int ii = 0; ii < capture.errorString->count(); ++ii) + for (int ii = 0; ii < capture.errorString->size(); ++ii) qWarning("%s", qPrintable(capture.errorString->at(ii))); delete capture.errorString; capture.errorString = nullptr; diff --git a/src/qml/qml/qqmllist.h b/src/qml/qml/qqmllist.h index 051f3d67ff..af2326abc4 100644 --- a/src/qml/qml/qqmllist.h +++ b/src/qml/qml/qqmllist.h @@ -91,7 +91,7 @@ private: reinterpret_cast<QList<T *> *>(p->data)->append(v); } static qsizetype qlist_count(QQmlListProperty *p) { - return reinterpret_cast<QList<T *> *>(p->data)->count(); + return reinterpret_cast<QList<T *> *>(p->data)->size(); } static T *qlist_at(QQmlListProperty *p, qsizetype idx) { return reinterpret_cast<QList<T *> *>(p->data)->at(idx); diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index cd356271a9..82138c4f43 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -353,7 +353,7 @@ QV4::ReturnedValue QQmlNumberExtension::method_toLocaleString(const QV4::Functio if (!argv[1].isString()) THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments"); QString fs = argv[1].toQString(); - if (fs.length()) + if (fs.size()) format = fs.at(0).unicode(); } int prec = 2; @@ -415,7 +415,7 @@ ReturnedValue QQmlNumberExtension::method_fromLocaleString(const QV4::FunctionOb } QString ns = argv[numberIdx].toQString(); - if (!ns.length()) + if (!ns.size()) RETURN_RESULT(QV4::Encode(Q_QNAN)); bool ok = false; diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index e87eed27bc..f6adbd30a2 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -322,7 +322,7 @@ int QQmlMetaType::registerAutoParentFunction(const QQmlPrivate::RegisterAutoPare data->parentFunctions.append(function.function); - return data->parentFunctions.count() - 1; + return data->parentFunctions.size() - 1; } void QQmlMetaType::unregisterAutoParentFunction(const QQmlPrivate::AutoParentFunction &function) @@ -390,7 +390,7 @@ static bool checkRegistration( // There can also be types that aren't even gadgets, and there can be types for namespaces. // We cannot check those, but namespaces should be uppercase. - int typeNameLen = typeName.length(); + int typeNameLen = typeName.size(); for (int ii = 0; ii < typeNameLen; ++ii) { if (!(typeName.at(ii).isLetterOrNumber() || typeName.at(ii) == u'_')) { QString failure(QCoreApplication::translate("qmlRegisterType", "Invalid QML %1 name \"%2\"")); @@ -1148,7 +1148,7 @@ QQmlType QQmlMetaType::qmlType(const QString &qualifiedName, QTypeRevision versi return QQmlType(); QHashedStringRef module(qualifiedName.constData(), slash); - QHashedStringRef name(qualifiedName.constData() + slash + 1, qualifiedName.length() - slash - 1); + QHashedStringRef name(qualifiedName.constData() + slash + 1, qualifiedName.size() - slash - 1); return qmlType(name, module, version); } @@ -1471,7 +1471,7 @@ QList<QString> QQmlMetaType::qmlTypeNames() const QQmlMetaTypeDataPtr data; QList<QString> names; - names.reserve(data->nameToType.count()); + names.reserve(data->nameToType.size()); QQmlMetaTypeData::Names::ConstIterator it = data->nameToType.cbegin(); while (it != data->nameToType.cend()) { QQmlType t(*it); diff --git a/src/qml/qml/qqmlmetatypedata.cpp b/src/qml/qml/qqmlmetatypedata.cpp index 2dd86c1c2a..ab6054349a 100644 --- a/src/qml/qml/qqmlmetatypedata.cpp +++ b/src/qml/qml/qqmlmetatypedata.cpp @@ -28,7 +28,7 @@ QQmlMetaTypeData::~QQmlMetaTypeData() // This expects a "fresh" QQmlTypePrivate and adopts its reference. void QQmlMetaTypeData::registerType(QQmlTypePrivate *priv) { - for (int i = 0; i < types.count(); ++i) { + for (int i = 0; i < types.size(); ++i) { if (!types.at(i).isValid()) { types[i] = QQmlType(priv); priv->index = i; @@ -37,7 +37,7 @@ void QQmlMetaTypeData::registerType(QQmlTypePrivate *priv) } } types.append(QQmlType(priv)); - priv->index = types.count() - 1; + priv->index = types.size() - 1; priv->release(); } @@ -86,7 +86,7 @@ bool QQmlMetaTypeData::registerModuleTypes(const QString &uri) QQmlPropertyCache::ConstPtr QQmlMetaTypeData::propertyCacheForVersion( int index, QTypeRevision version) const { - return (index < typePropertyCaches.length()) + return (index < typePropertyCaches.size()) ? typePropertyCaches.at(index).value(version) : QQmlPropertyCache::ConstPtr(); } @@ -94,14 +94,14 @@ QQmlPropertyCache::ConstPtr QQmlMetaTypeData::propertyCacheForVersion( void QQmlMetaTypeData::setPropertyCacheForVersion(int index, QTypeRevision version, const QQmlPropertyCache::ConstPtr &cache) { - if (index >= typePropertyCaches.length()) + if (index >= typePropertyCaches.size()) typePropertyCaches.resize(index + 1); typePropertyCaches[index][version] = cache; } void QQmlMetaTypeData::clearPropertyCachesForVersion(int index) { - if (index < typePropertyCaches.length()) + if (index < typePropertyCaches.size()) typePropertyCaches[index].clear(); } @@ -167,13 +167,13 @@ QQmlPropertyCache::ConstPtr QQmlMetaTypeData::propertyCache( QQmlPropertyCache::ConstPtr raw = propertyCache(type.metaObject(), combinedVersion); QQmlPropertyCache::Ptr copied; - for (int ii = 0; ii < types.count(); ++ii) { + for (int ii = 0; ii < types.size(); ++ii) { const QQmlType ¤tType = types.at(ii); if (!currentType.isValid()) continue; QTypeRevision rev = currentType.metaObjectRevision(); - int moIndex = types.count() - 1 - ii; + int moIndex = types.size() - 1 - ii; if (raw->allowedRevision(moIndex) != rev) { if (copied.isNull()) { diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp index e36be3840e..e7b8799f82 100644 --- a/src/qml/qml/qqmlnotifier.cpp +++ b/src/qml/qml/qqmlnotifier.cpp @@ -89,10 +89,10 @@ void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine QString sourceName; QDebug(&sourceName) << source; - sourceName = sourceName.left(sourceName.length() - 1); + sourceName = sourceName.left(sourceName.size() - 1); QString engineName; QDebug(&engineName).nospace() << engine; - engineName = engineName.left(engineName.length() - 1); + engineName = engineName.left(engineName.size() - 1); qFatal("QQmlEngine: Illegal attempt to connect to %s that is in" " a different thread than the QML engine %s.", qPrintable(sourceName), diff --git a/src/qml/qml/qqmlopenmetaobject.cpp b/src/qml/qml/qqmlopenmetaobject.cpp index b6ea0ee2e6..b9934eb76a 100644 --- a/src/qml/qml/qqmlopenmetaobject.cpp +++ b/src/qml/qml/qqmlopenmetaobject.cpp @@ -59,19 +59,19 @@ int QQmlOpenMetaObjectType::signalOffset() const int QQmlOpenMetaObjectType::propertyCount() const { - return d->names.count(); + return d->names.size(); } QByteArray QQmlOpenMetaObjectType::propertyName(int idx) const { - Q_ASSERT(idx >= 0 && idx < d->names.count()); + Q_ASSERT(idx >= 0 && idx < d->names.size()); return d->mob.property(idx).name(); } void QQmlOpenMetaObjectType::createProperties(const QVector<QByteArray> &names) { - for (int i = 0; i < names.count(); ++i) { + for (int i = 0; i < names.size(); ++i) { const QByteArray &name = names.at(i); const int id = d->mob.propertyCount(); d->mob.addSignal("__" + QByteArray::number(id) + "()"); @@ -114,7 +114,7 @@ int QQmlOpenMetaObjectType::createProperty(const QByteArray &name) void QQmlOpenMetaObjectType::propertyCreated(int id, QMetaPropertyBuilder &builder) { - if (d->referers.count()) + if (d->referers.size()) (*d->referers.begin())->propertyCreated(id, builder); } @@ -163,13 +163,13 @@ public: }; inline void setPropertyValue(int idx, const QVariant &value) { - if (data.count() <= idx) + if (data.size() <= idx) data.resize(idx + 1); data[idx].setValue(value); } inline Property &propertyRef(int idx) { - if (data.count() <= idx) + if (data.size() <= idx) data.resize(idx + 1); Property &prop = data[idx]; if (!prop.valueSet) @@ -188,7 +188,7 @@ public: } inline bool hasProperty(int idx) const { - if (idx >= data.count()) + if (idx >= data.size()) return false; return data[idx].valueSet; } @@ -270,7 +270,7 @@ int QQmlOpenMetaObject::metaCall(QObject *o, QMetaObject::Call c, int id, void * propertyRead(propId); *reinterpret_cast<QVariant *>(a[0]) = d->propertyValue(propId); } else if (c == QMetaObject::WriteProperty) { - if (propId >= d->data.count() || d->data.at(propId).value() != *reinterpret_cast<QVariant *>(a[0])) { + if (propId >= d->data.size() || d->data.at(propId).value() != *reinterpret_cast<QVariant *>(a[0])) { propertyWrite(propId); d->setPropertyValue(propId, propertyWriteValue(propId, *reinterpret_cast<QVariant *>(a[0]))); propertyWritten(propId); @@ -461,12 +461,12 @@ QVariant QQmlOpenMetaObject::initialValue(int) int QQmlOpenMetaObject::count() const { - return d->type->d->names.count(); + return d->type->d->names.size(); } QByteArray QQmlOpenMetaObject::name(int idx) const { - Q_ASSERT(idx >= 0 && idx < d->type->d->names.count()); + Q_ASSERT(idx >= 0 && idx < d->type->d->names.size()); return d->type->d->mob.property(idx).name(); } diff --git a/src/qml/qml/qqmlpluginimporter.cpp b/src/qml/qml/qqmlpluginimporter.cpp index 62b3a4b4a4..a29a3101ec 100644 --- a/src/qml/qml/qqmlpluginimporter.cpp +++ b/src/qml/qml/qqmlpluginimporter.cpp @@ -91,7 +91,7 @@ static QStringList versionUriList(const QString &uri, QTypeRevision version) { QStringList result; for (int mode = QQmlImports::FullyVersioned; mode <= QQmlImports::Unversioned; ++mode) { - int index = uri.length(); + int index = uri.size(); do { QString versionUri = uri; versionUri.insert(index, QQmlImports::versionString( @@ -501,7 +501,7 @@ bool QQmlPluginImporter::populatePluginDataVector(QVector<StaticPluginData> &res QTypeRevision QQmlPluginImporter::importPlugins() { const auto qmldirPlugins = qmldir->plugins(); - const int qmldirPluginCount = qmldirPlugins.count(); + const int qmldirPluginCount = qmldirPlugins.size(); QTypeRevision importVersion = version; // If the path contains a version marker or if we have more than one plugin, diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index f2b4cc85ed..a3258aef10 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -248,7 +248,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name, if (path.isEmpty()) return; // Everything up to the last property must be an "object type" property - for (int ii = 0; ii < path.count() - 1; ++ii) { + for (int ii = 0; ii < path.size() - 1; ++ii) { const QStringView &pathName = path.at(ii); // Types must begin with an uppercase letter (see checkRegistration() @@ -264,7 +264,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name, currentObject = qmlAttachedPropertiesObject(currentObject, func); if (!currentObject) return; // Something is broken with the attachable type } else if (r.importNamespace) { - if (++ii == path.count()) + if (++ii == path.size()) return; // No type following the namespace // TODO: Do we really _not_ want to query the namespaced types here? @@ -320,7 +320,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name, return; // Not an object property } - if (ii == (path.count() - 2) && QQmlMetaType::isValueType(property->propType())) { + if (ii == (path.size() - 2) && QQmlMetaType::isValueType(property->propType())) { // We're now at a value type property const QMetaObject *valueTypeMetaObject = QQmlMetaType::metaObjectForValueType(property->propType()); if (!valueTypeMetaObject) return; // Not a value type @@ -374,7 +374,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name, auto findChangeSignal = [&](QStringView signalName) { const QString changed = QStringLiteral("Changed"); if (signalName.endsWith(changed)) { - const QStringView propName = signalName.first(signalName.length() - changed.length()); + const QStringView propName = signalName.first(signalName.size() - changed.size()); const QQmlPropertyData *d = ddata->propertyCache->property(propName, currentObject, context); while (d && d->isFunction()) d = ddata->propertyCache->overrideData(d); @@ -392,7 +392,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name, if (QmlIR::IRBuilder::isSignalPropertyName(terminalString)) { QString signalName = terminalString.mid(2); int firstNon_; - int length = signalName.length(); + int length = signalName.size(); for (firstNon_ = 0; firstNon_ < length; ++firstNon_) if (signalName.at(firstNon_) != u'_') break; @@ -753,7 +753,7 @@ QString QQmlProperty::name() const } else if (type() & SignalProperty) { // ### Qt7: Return the original signal name here. Do not prepend "on" QString name = QStringLiteral("on") + d->core.name(d->object); - for (int i = 2, end = name.length(); i != end; ++i) { + for (int i = 2, end = name.size(); i != end; ++i) { const QChar c = name.at(i); if (c != u'_') { name[i] = c.toUpper(); @@ -1451,7 +1451,7 @@ bool QQmlPropertyPrivate::write( } else if (variantMetaType == QMetaType::fromType<QList<QObject *>>()) { const QList<QObject *> &list = qvariant_cast<QList<QObject *> >(value); - for (qsizetype ii = 0; ii < list.count(); ++ii) { + for (qsizetype ii = 0; ii < list.size(); ++ii) { QObject *o = list.at(ii); if (o && !QQmlMetaObject::canConvert(o, valueMetaObject)) o = nullptr; @@ -1788,7 +1788,7 @@ QMetaMethod QQmlPropertyPrivate::findSignalByName(const QMetaObject *mo, const Q // If no signal is found, but the signal is of the form "onBlahChanged", // return the notify signal for the property "Blah" if (name.endsWith("Changed")) { - QByteArray propName = name.mid(0, name.length() - 7); + QByteArray propName = name.mid(0, name.size() - 7); int propIdx = mo->indexOfProperty(propName.constData()); if (propIdx >= 0) { QMetaProperty prop = mo->property(propIdx); diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 117f5cfebd..0e16bc46f3 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -166,9 +166,9 @@ QQmlPropertyCache::Ptr QQmlPropertyCache::copy(const QQmlMetaObjectPointer &mo, QQmlPropertyCache::Ptr cache = QQmlPropertyCache::Ptr( new QQmlPropertyCache(mo), QQmlPropertyCache::Ptr::Adopt); cache->_parent.reset(this); - cache->propertyIndexCacheStart = propertyIndexCache.count() + propertyIndexCacheStart; - cache->methodIndexCacheStart = methodIndexCache.count() + methodIndexCacheStart; - cache->signalHandlerIndexCacheStart = signalHandlerIndexCache.count() + signalHandlerIndexCacheStart; + cache->propertyIndexCacheStart = propertyIndexCache.size() + propertyIndexCacheStart; + cache->methodIndexCacheStart = methodIndexCache.size() + methodIndexCacheStart; + cache->signalHandlerIndexCacheStart = signalHandlerIndexCache.size() + signalHandlerIndexCacheStart; cache->stringCache.linkAndReserve(stringCache, reserve); cache->allowedRevisionCache = allowedRevisionCache; cache->_defaultPropertyName = _defaultPropertyName; @@ -214,7 +214,7 @@ void QQmlPropertyCache::appendProperty(const QString &name, QQmlPropertyData::Fl if (overrideResult == InvalidOverride) return; - int index = propertyIndexCache.count(); + int index = propertyIndexCache.size(); propertyIndexCache.append(data); setNamedProperty(name, index + propertyOffset(), propertyIndexCache.data() + index, @@ -235,7 +235,7 @@ void QQmlPropertyCache::appendSignal(const QString &name, QQmlPropertyData::Flag handler.m_flags.setIsSignalHandler(true); if (types) { - const auto argumentCount = names.length(); + const auto argumentCount = names.size(); QQmlPropertyCacheMethodArguments *args = createArgumentsObject(argumentCount, names); new (args->types) QMetaType; // Invalid return type ::memcpy(args->types + 1, types, argumentCount * sizeof(QMetaType)); @@ -246,10 +246,10 @@ void QQmlPropertyCache::appendSignal(const QString &name, QQmlPropertyData::Flag if (overrideResult == InvalidOverride) return; - int methodIndex = methodIndexCache.count(); + int methodIndex = methodIndexCache.size(); methodIndexCache.append(data); - int signalHandlerIndex = signalHandlerIndexCache.count(); + int signalHandlerIndex = signalHandlerIndexCache.size(); signalHandlerIndexCache.append(handler); QString handlerName = QLatin1String("on") + name; @@ -267,7 +267,7 @@ void QQmlPropertyCache::appendMethod(const QString &name, QQmlPropertyData::Flag const QList<QByteArray> &names, const QVector<QMetaType> ¶meterTypes) { - int argumentCount = names.count(); + int argumentCount = names.size(); QQmlPropertyData data; data.setPropType(returnType); @@ -283,7 +283,7 @@ void QQmlPropertyCache::appendMethod(const QString &name, QQmlPropertyData::Flag new (args->types + ii + 1) QMetaType(parameterTypes.at(ii)); data.setArguments(args); - int methodIndex = methodIndexCache.count(); + int methodIndex = methodIndexCache.size(); methodIndexCache.append(data); setNamedProperty(name, methodIndex + methodOffset(), methodIndexCache.data() + methodIndex, @@ -435,8 +435,8 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, data->load(m); - Q_ASSERT((allowedRevisionCache.count() - 1) < Q_INT16_MAX); - data->setMetaObjectOffset(allowedRevisionCache.count() - 1); + Q_ASSERT((allowedRevisionCache.size() - 1) < Q_INT16_MAX); + data->setMetaObjectOffset(allowedRevisionCache.size() - 1); if (data->isSignal()) { sigdata = &signalHandlerIndexCache[signalHandlerIndex - signalHandlerIndexCacheStart]; @@ -516,8 +516,8 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, data->load(p); data->setTypeVersion(typeVersion); - Q_ASSERT((allowedRevisionCache.count() - 1) < Q_INT16_MAX); - data->setMetaObjectOffset(allowedRevisionCache.count() - 1); + Q_ASSERT((allowedRevisionCache.size() - 1) < Q_INT16_MAX); + data->setMetaObjectOffset(allowedRevisionCache.size() - 1); QQmlPropertyData *old = nullptr; @@ -591,9 +591,9 @@ void QQmlPropertyCache::invalidate(const QMetaObject *metaObject) int reserve = pc + mc + sc; if (parent()) { - propertyIndexCacheStart = parent()->propertyIndexCache.count() + parent()->propertyIndexCacheStart; - methodIndexCacheStart = parent()->methodIndexCache.count() + parent()->methodIndexCacheStart; - signalHandlerIndexCacheStart = parent()->signalHandlerIndexCache.count() + parent()->signalHandlerIndexCacheStart; + propertyIndexCacheStart = parent()->propertyIndexCache.size() + parent()->propertyIndexCacheStart; + methodIndexCacheStart = parent()->methodIndexCache.size() + parent()->methodIndexCacheStart; + signalHandlerIndexCacheStart = parent()->signalHandlerIndexCache.size() + parent()->signalHandlerIndexCacheStart; stringCache.linkAndReserve(parent()->stringCache, reserve); append(metaObject, QTypeRevision()); } else { @@ -743,7 +743,7 @@ QString QQmlPropertyCache::signalParameterStringForJS(QV4::ExecutionEngine *engi const QSet<QString> &illegalNames = engine->illegalNames(); QString parameters; - for (int i = 0; i < parameterNameList.count(); ++i) { + for (int i = 0; i < parameterNameList.size(); ++i) { if (i > 0) parameters += QLatin1Char(','); const QByteArray ¶m = parameterNameList.at(i); @@ -976,13 +976,13 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const for (StringCache::ConstIterator iter = stringCache.begin(), cend = stringCache.end(); iter != cend; ++iter) Insert::in(this, properties, methods, iter, iter.value().second); - Q_ASSERT(properties.count() == propertyIndexCache.count()); - Q_ASSERT(methods.count() == methodIndexCache.count()); + Q_ASSERT(properties.size() == propertyIndexCache.size()); + Q_ASSERT(methods.size() == methodIndexCache.size()); std::sort(properties.begin(), properties.end(), Sort::lt); std::sort(methods.begin(), methods.end(), Sort::lt); - for (int ii = 0; ii < properties.count(); ++ii) { + for (int ii = 0; ii < properties.size(); ++ii) { const QQmlPropertyData *data = properties.at(ii).second; int notifierId = -1; @@ -1001,7 +1001,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const property.setAlias(data->isAlias()); } - for (int ii = 0; ii < methods.count(); ++ii) { + for (int ii = 0; ii < methods.size(); ++ii) { const QQmlPropertyData *data = methods.at(ii).second; QByteArray returnType; @@ -1015,7 +1015,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const QQmlPropertyCacheMethodArguments *arguments = nullptr; if (data->hasArguments()) { arguments = data->arguments(); - for (int ii = 0, end = arguments->names ? arguments->names->length() : 0; + for (int ii = 0, end = arguments->names ? arguments->names->size() : 0; ii < end; ++ii) { if (ii != 0) signature.append(','); @@ -1040,11 +1040,11 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const method.setReturnType(returnType); } - for (int ii = 0; ii < enumCache.count(); ++ii) { + for (int ii = 0; ii < enumCache.size(); ++ii) { const QQmlEnumData &enumData = enumCache.at(ii); QMetaEnumBuilder enumeration = builder.addEnumerator(enumData.name.toUtf8()); enumeration.setIsScoped(true); - for (int jj = 0; jj < enumData.values.count(); ++jj) { + for (int jj = 0; jj < enumData.values.size(); ++jj) { const QQmlEnumValue &value = enumData.values.at(jj); enumeration.addKey(value.namedValue.toUtf8(), value.value); } diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index 681945d5f8..1ba23a15e3 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -343,7 +343,7 @@ inline const QQmlPropertyData *QQmlPropertyCache::property(int index) const inline const QQmlPropertyData *QQmlPropertyCache::method(int index) const { - if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.count())) + if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.size())) return nullptr; if (index < methodIndexCacheStart) @@ -358,7 +358,7 @@ inline const QQmlPropertyData *QQmlPropertyCache::method(int index) const */ inline const QQmlPropertyData *QQmlPropertyCache::signal(int index) const { - if (index < 0 || index >= (signalHandlerIndexCacheStart + signalHandlerIndexCache.count())) + if (index < 0 || index >= (signalHandlerIndexCacheStart + signalHandlerIndexCache.size())) return nullptr; if (index < signalHandlerIndexCacheStart) @@ -371,7 +371,7 @@ inline const QQmlPropertyData *QQmlPropertyCache::signal(int index) const inline QQmlEnumData *QQmlPropertyCache::qmlEnum(int index) const { - if (index < 0 || index >= enumCache.count()) + if (index < 0 || index >= enumCache.size()) return nullptr; return const_cast<QQmlEnumData *>(&enumCache.at(index)); @@ -379,7 +379,7 @@ inline QQmlEnumData *QQmlPropertyCache::qmlEnum(int index) const inline int QQmlPropertyCache::methodIndexToSignalIndex(int index) const { - if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.count())) + if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.size())) return index; if (index < methodIndexCacheStart) @@ -419,7 +419,7 @@ bool QQmlPropertyCache::isAllowedInRevision(const QQmlPropertyData *data) const return true; Q_ASSERT(offset >= 0); - Q_ASSERT(offset < allowedRevisionCache.length()); + Q_ASSERT(offset < allowedRevisionCache.size()); const QTypeRevision allowed = allowedRevisionCache[offset]; if (requested.hasMajorVersion()) { @@ -434,7 +434,7 @@ bool QQmlPropertyCache::isAllowedInRevision(const QQmlPropertyData *data) const int QQmlPropertyCache::propertyCount() const { - return propertyIndexCacheStart + propertyIndexCache.count(); + return propertyIndexCacheStart + propertyIndexCache.size(); } int QQmlPropertyCache::propertyOffset() const @@ -444,7 +444,7 @@ int QQmlPropertyCache::propertyOffset() const int QQmlPropertyCache::methodCount() const { - return methodIndexCacheStart + methodIndexCache.count(); + return methodIndexCacheStart + methodIndexCache.size(); } int QQmlPropertyCache::methodOffset() const @@ -454,7 +454,7 @@ int QQmlPropertyCache::methodOffset() const int QQmlPropertyCache::signalCount() const { - return signalHandlerIndexCacheStart + signalHandlerIndexCache.count(); + return signalHandlerIndexCacheStart + signalHandlerIndexCache.size(); } int QQmlPropertyCache::signalOffset() const @@ -464,7 +464,7 @@ int QQmlPropertyCache::signalOffset() const int QQmlPropertyCache::qmlEnumCount() const { - return enumCache.count(); + return enumCache.size(); } bool QQmlPropertyCache::callJSFactoryMethod(QObject *object, void **args) const diff --git a/src/qml/qml/qqmlpropertycachecreator.cpp b/src/qml/qml/qqmlpropertycachecreator.cpp index 50e95dac25..4bc903c22e 100644 --- a/src/qml/qml/qqmlpropertycachecreator.cpp +++ b/src/qml/qml/qqmlpropertycachecreator.cpp @@ -58,7 +58,7 @@ QByteArray QQmlPropertyCacheCreatorBase::createClassNameTypeByUrl(const QUrl &ur if (lastSlash <= -1) return QByteArray(); // ### this might not be correct for .ui.qml files - const QStringView nameBase = QStringView{path}.mid(lastSlash + 1, path.length() - lastSlash - 5); + const QStringView nameBase = QStringView{path}.mid(lastSlash + 1, path.size() - lastSlash - 5); // Not a reusable type if it doesn't start with a upper case letter. if (nameBase.isEmpty() || !nameBase.at(0).isUpper()) return QByteArray(); diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h index 30eef16495..42345448a6 100644 --- a/src/qml/qml/qqmlpropertycachecreator_p.h +++ b/src/qml/qml/qqmlpropertycachecreator_p.h @@ -1013,8 +1013,8 @@ inline QQmlError QQmlPropertyCacheAliasCreator<ObjectContainer>::appendAliasesTo QQmlPropertyCache::Ptr propertyCache = propertyCaches->ownAt(objectIndex); Q_ASSERT(propertyCache); - int effectiveSignalIndex = propertyCache->signalHandlerIndexCacheStart + propertyCache->propertyIndexCache.count(); - int effectivePropertyIndex = propertyCache->propertyIndexCacheStart + propertyCache->propertyIndexCache.count(); + int effectiveSignalIndex = propertyCache->signalHandlerIndexCacheStart + propertyCache->propertyIndexCache.size(); + int effectivePropertyIndex = propertyCache->propertyIndexCacheStart + propertyCache->propertyIndexCache.size(); int aliasIndex = 0; auto alias = object.aliasesBegin(); diff --git a/src/qml/qml/qqmlpropertycachevector_p.h b/src/qml/qml/qqmlpropertycachevector_p.h index 71a4896315..6386795086 100644 --- a/src/qml/qml/qqmlpropertycachevector_p.h +++ b/src/qml/qml/qqmlpropertycachevector_p.h @@ -36,10 +36,10 @@ public: return data.resize(size); } - int count() const { return data.count(); } + int count() const { return data.size(); } void clear() { - for (int i = 0; i < data.count(); ++i) { + for (int i = 0; i < data.size(); ++i) { const auto &cache = data.at(i); if (cache.isT2()) { if (QQmlPropertyCache *data = cache.asT2()) diff --git a/src/qml/qml/qqmlpropertyresolver.cpp b/src/qml/qml/qqmlpropertyresolver.cpp index 6be2c205ed..ff29c38997 100644 --- a/src/qml/qml/qqmlpropertyresolver.cpp +++ b/src/qml/qml/qqmlpropertyresolver.cpp @@ -44,7 +44,7 @@ const QQmlPropertyData *QQmlPropertyResolver::signal(const QString &name, bool * } if (name.endsWith(QLatin1String("Changed"))) { - QString propName = name.mid(0, name.length() - static_cast<int>(strlen("Changed"))); + QString propName = name.mid(0, name.size() - static_cast<int>(strlen("Changed"))); d = property(propName, notInRevision); if (d) diff --git a/src/qml/qml/qqmlproxymetaobject.cpp b/src/qml/qml/qqmlproxymetaobject.cpp index 9a5347bd74..ad67856c02 100644 --- a/src/qml/qml/qqmlproxymetaobject.cpp +++ b/src/qml/qml/qqmlproxymetaobject.cpp @@ -32,8 +32,8 @@ QQmlProxyMetaObject::~QQmlProxyMetaObject() QObject *QQmlProxyMetaObject::getProxy(int index) { if (!proxies) { - proxies = new QObject *[metaObjects->count()]; - ::memset(proxies, 0, sizeof(QObject *) * metaObjects->count()); + proxies = new QObject *[metaObjects->size()]; + ::memset(proxies, 0, sizeof(QObject *) * metaObjects->size()); } if (!proxies[index]) { @@ -71,7 +71,7 @@ int QQmlProxyMetaObject::metaCall(QObject *o, QMetaObject::Call c, int id, void if (id < metaObjects->constLast().propertyOffset) break; - for (int ii = 0; ii < metaObjects->count(); ++ii) { + for (int ii = 0; ii < metaObjects->size(); ++ii) { const int globalPropertyOffset = metaObjects->at(ii).propertyOffset; if (id < globalPropertyOffset) continue; @@ -94,7 +94,7 @@ int QQmlProxyMetaObject::metaCall(QObject *o, QMetaObject::Call c, int id, void return -1; } - for (int ii = 0; ii < metaObjects->count(); ++ii) { + for (int ii = 0; ii < metaObjects->size(); ++ii) { const int globalMethodOffset = metaObjects->at(ii).methodOffset; if (id < globalMethodOffset) continue; diff --git a/src/qml/qml/qqmlscriptblob.cpp b/src/qml/qml/qqmlscriptblob.cpp index 5bfa6d3470..505a57636f 100644 --- a/src/qml/qml/qqmlscriptblob.cpp +++ b/src/qml/qml/qqmlscriptblob.cpp @@ -126,7 +126,7 @@ void QQmlScriptBlob::done() return; // Check all script dependencies for errors - for (int ii = 0; ii < m_scripts.count(); ++ii) { + for (int ii = 0; ii < m_scripts.size(); ++ii) { const ScriptReference &script = m_scripts.at(ii); Q_ASSERT(script.script->isCompleteOrError()); if (script.script->isError()) { @@ -147,7 +147,7 @@ void QQmlScriptBlob::done() QSet<QString> ns; - for (int scriptIndex = 0; scriptIndex < m_scripts.count(); ++scriptIndex) { + for (int scriptIndex = 0; scriptIndex < m_scripts.size(); ++scriptIndex) { const ScriptReference &script = m_scripts.at(scriptIndex); m_scriptData->scripts.append(script.script); diff --git a/src/qml/qml/qqmlscriptdata.cpp b/src/qml/qml/qqmlscriptdata.cpp index 994a76c96e..b5ba04c93e 100644 --- a/src/qml/qml/qqmlscriptdata.cpp +++ b/src/qml/qml/qqmlscriptdata.cpp @@ -55,14 +55,14 @@ QQmlRefPointer<QQmlContextData> QQmlScriptData::qmlContextDataForContext( QV4::Scope scope(v4); QV4::ScopedObject scriptsArray(scope); if (qmlContextData->importedScripts().isNullOrUndefined()) { - scriptsArray = v4->newArrayObject(scripts.count()); + scriptsArray = v4->newArrayObject(scripts.size()); qmlContextData->setImportedScripts( QV4::PersistentValue(v4, scriptsArray.asReturnedValue())); } else { scriptsArray = qmlContextData->importedScripts().valueRef(); } QV4::ScopedValue v(scope); - for (int ii = 0; ii < scripts.count(); ++ii) { + for (int ii = 0; ii < scripts.size(); ++ii) { v = scripts.at(ii)->scriptData()->scriptValueForContext(qmlContextData); scriptsArray->put(ii, v); } diff --git a/src/qml/qml/qqmlscriptstring.cpp b/src/qml/qml/qqmlscriptstring.cpp index d872d4b55c..370573b199 100644 --- a/src/qml/qml/qqmlscriptstring.cpp +++ b/src/qml/qml/qqmlscriptstring.cpp @@ -154,7 +154,7 @@ Otherwise returns a null QString. QString QQmlScriptString::stringLiteral() const { if (d->isStringLiteral) - return d->script.mid(1, d->script.length()-2); + return d->script.mid(1, d->script.size()-2); return QString(); } diff --git a/src/qml/qml/qqmltype.cpp b/src/qml/qml/qqmltype.cpp index 5c3cfa94a5..c6f948e355 100644 --- a/src/qml/qml/qqmltype.cpp +++ b/src/qml/qml/qqmltype.cpp @@ -208,7 +208,7 @@ void QQmlTypePrivate::init() const mo, baseMetaObject, metaObjects.isEmpty() ? nullptr : metaObjects.constLast().metaObject)); - for (int ii = 0; ii < metaObjects.count(); ++ii) { + for (int ii = 0; ii < metaObjects.size(); ++ii) { metaObjects[ii].propertyOffset = metaObjects.at(ii).metaObject->propertyOffset(); metaObjects[ii].methodOffset = @@ -320,7 +320,7 @@ void QQmlTypePrivate::insertEnums(const QMetaObject *metaObject) const if (isScoped) { scopedEnums << scoped; - scopedEnumIndex.insert(QString::fromUtf8(e.name()), scopedEnums.count()-1); + scopedEnumIndex.insert(QString::fromUtf8(e.name()), scopedEnums.size()-1); } } } @@ -392,13 +392,13 @@ void QQmlTypePrivate::insertEnumsFromPropertyCache( QStringHash<int> *scoped = new QStringHash<int>(); QQmlEnumData *enumData = currentCache->qmlEnum(ii); - for (int jj = 0; jj < enumData->values.count(); ++jj) { + for (int jj = 0; jj < enumData->values.size(); ++jj) { const QQmlEnumValue &value = enumData->values.at(jj); enums.insert(value.namedValue, value.value); scoped->insert(value.namedValue, value.value); } scopedEnums << scoped; - scopedEnumIndex.insert(enumData->name, scopedEnums.count()-1); + scopedEnumIndex.insert(enumData->name, scopedEnums.size()-1); } } insertEnums(cppMetaObject); @@ -822,7 +822,7 @@ int QQmlType::scopedEnumValue(QQmlEnginePrivate *engine, int index, const QV4::S *ok = true; if (d) { - Q_ASSERT(index > -1 && index < d->scopedEnums.count()); + Q_ASSERT(index > -1 && index < d->scopedEnums.size()); int *rv = d->scopedEnums.at(index)->value(name); if (rv) return *rv; @@ -839,7 +839,7 @@ int QQmlType::scopedEnumValue(QQmlEnginePrivate *engine, int index, const QStrin *ok = true; if (d) { - Q_ASSERT(index > -1 && index < d->scopedEnums.count()); + Q_ASSERT(index > -1 && index < d->scopedEnums.size()); int *rv = d->scopedEnums.at(index)->value(name); if (rv) return *rv; @@ -857,11 +857,11 @@ int QQmlType::scopedEnumValue(QQmlEnginePrivate *engine, const QByteArray &scope d->initEnums(engine); - int *rv = d->scopedEnumIndex.value(QHashedCStringRef(scopedEnumName.constData(), scopedEnumName.length())); + int *rv = d->scopedEnumIndex.value(QHashedCStringRef(scopedEnumName.constData(), scopedEnumName.size())); if (rv) { int index = *rv; - Q_ASSERT(index > -1 && index < d->scopedEnums.count()); - rv = d->scopedEnums.at(index)->value(QHashedCStringRef(name.constData(), name.length())); + Q_ASSERT(index > -1 && index < d->scopedEnums.size()); + rv = d->scopedEnums.at(index)->value(QHashedCStringRef(name.constData(), name.size())); if (rv) return *rv; } @@ -882,7 +882,7 @@ int QQmlType::scopedEnumValue(QQmlEnginePrivate *engine, QStringView scopedEnumN int *rv = d->scopedEnumIndex.value(QHashedStringRef(scopedEnumName)); if (rv) { int index = *rv; - Q_ASSERT(index > -1 && index < d->scopedEnums.count()); + Q_ASSERT(index > -1 && index < d->scopedEnums.size()); rv = d->scopedEnums.at(index)->value(QHashedStringRef(name)); if (rv) return *rv; diff --git a/src/qml/qml/qqmltypecompiler.cpp b/src/qml/qml/qqmltypecompiler.cpp index 64a9238739..f2fddae3f7 100644 --- a/src/qml/qml/qqmltypecompiler.cpp +++ b/src/qml/qml/qqmltypecompiler.cpp @@ -243,7 +243,7 @@ void QQmlTypeCompiler::addImport(const QString &module, const QString &qualifier const quint32 moduleIdx = registerString(module); const quint32 qualifierIdx = registerString(qualifier); - for (int i = 0, count = document->imports.count(); i < count; ++i) { + for (int i = 0, count = document->imports.size(); i < count; ++i) { const QV4::CompiledData::Import *existingImport = document->imports.at(i); if (existingImport->type == QV4::CompiledData::Import::ImportLibrary && existingImport->uriIndex == moduleIdx @@ -282,7 +282,7 @@ SignalHandlerResolver::SignalHandlerResolver(QQmlTypeCompiler *typeCompiler) bool SignalHandlerResolver::resolveSignalHandlerExpressions() { - for (int objectIndex = 0; objectIndex < qmlObjects.count(); ++objectIndex) { + for (int objectIndex = 0; objectIndex < qmlObjects.size(); ++objectIndex) { const QmlIR::Object * const obj = qmlObjects.at(objectIndex); QQmlPropertyCache::ConstPtr cache = propertyCaches->at(objectIndex); if (!cache) @@ -335,7 +335,7 @@ bool SignalHandlerResolver::resolveSignalHandlerExpressions( QString qPropertyName; if (signalName.endsWith(QLatin1String("Changed"))) - qPropertyName = signalName.mid(0, signalName.length() - static_cast<int>(strlen("Changed"))); + qPropertyName = signalName.mid(0, signalName.size() - static_cast<int>(strlen("Changed"))); bool notInRevision = false; const QQmlPropertyData * const signal = resolver.signal(signalName, ¬InRevision); @@ -353,7 +353,7 @@ bool SignalHandlerResolver::resolveSignalHandlerExpressions( bool unnamedParameter = false; QList<QByteArray> parameterNames = propertyCache->signalParameterNames(sigIndex); - for (int i = 0; i < parameterNames.count(); ++i) { + for (int i = 0; i < parameterNames.size(); ++i) { const QString param = QString::fromUtf8(parameterNames.at(i)); if (param.isEmpty()) unnamedParameter = true; @@ -442,7 +442,7 @@ QQmlEnumTypeResolver::QQmlEnumTypeResolver(QQmlTypeCompiler *typeCompiler) bool QQmlEnumTypeResolver::resolveEnumBindings() { - for (int i = 0; i < qmlObjects.count(); ++i) { + for (int i = 0; i < qmlObjects.size(); ++i) { QQmlPropertyCache::ConstPtr propertyCache = propertyCaches->at(i); if (!propertyCache) continue; @@ -517,11 +517,11 @@ bool QQmlEnumTypeResolver::tryQualifiedEnumAssignment( // * <TypeName>.<ScopedEnumName>.<EnumValue> int dot = string.indexOf(QLatin1Char('.')); - if (dot == -1 || dot == string.length()-1) + if (dot == -1 || dot == string.size()-1) return true; int dot2 = string.indexOf(QLatin1Char('.'), dot+1); - if (dot2 != -1 && dot2 != string.length()-1) { + if (dot2 != -1 && dot2 != string.size()-1) { if (!string.at(dot+1).isUpper()) return true; if (string.indexOf(QLatin1Char('.'), dot2+1) != -1) @@ -612,7 +612,7 @@ int QQmlEnumTypeResolver::evaluateEnum(const QString &scope, QStringView enumNam return -1; if (!enumName.isEmpty()) return type.scopedEnumValue(compiler->enginePrivate(), enumName, enumValue, ok); - return type.enumValue(compiler->enginePrivate(), QHashedStringRef(enumValue.constData(), enumValue.length()), ok); + return type.enumValue(compiler->enginePrivate(), QHashedStringRef(enumValue.constData(), enumValue.size()), ok); } const QMetaObject *mo = &Qt::staticMetaObject; @@ -674,7 +674,7 @@ QQmlAliasAnnotator::QQmlAliasAnnotator(QQmlTypeCompiler *typeCompiler) void QQmlAliasAnnotator::annotateBindingsToAliases() { - for (int i = 0; i < qmlObjects.count(); ++i) { + for (int i = 0; i < qmlObjects.size(); ++i) { QQmlPropertyCache::ConstPtr propertyCache = propertyCaches->at(i); if (!propertyCache) continue; @@ -706,7 +706,7 @@ QQmlScriptStringScanner::QQmlScriptStringScanner(QQmlTypeCompiler *typeCompiler) void QQmlScriptStringScanner::scan() { const QMetaType scriptStringMetaType = QMetaType::fromType<QQmlScriptString>(); - for (int i = 0; i < qmlObjects.count(); ++i) { + for (int i = 0; i < qmlObjects.size(); ++i) { QQmlPropertyCache::ConstPtr propertyCache = propertyCaches->at(i); if (!propertyCache) continue; @@ -833,7 +833,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents( } qmlObjects->append(syntheticComponent); - const int componentIndex = qmlObjects->count() - 1; + const int componentIndex = qmlObjects->size() - 1; // Keep property caches symmetric QQmlPropertyCache::ConstPtr componentCache = QQmlMetaType::propertyCache(&QQmlComponent::staticMetaObject); @@ -863,7 +863,7 @@ bool QQmlComponentAndAliasResolver::resolve(int root) // someItemDelegate: Item {} // In the implicit case Item is surrounded by a synthetic Component {} because the property // on the left hand side is of QQmlComponent type. - const int objCountWithoutSynthesizedComponents = qmlObjects->count(); + const int objCountWithoutSynthesizedComponents = qmlObjects->size(); const int startObjectIndex = root == 0 ? root : root+1; // root+1, as ic root is handled at the end for (int i = startObjectIndex; i < objCountWithoutSynthesizedComponents; ++i) { QmlIR::Object *obj = qmlObjects->at(i); @@ -931,7 +931,7 @@ bool QQmlComponentAndAliasResolver::resolve(int root) } - for (int i = 0; i < componentRoots.count(); ++i) { + for (int i = 0; i < componentRoots.size(); ++i) { QmlIR::Object *component = qmlObjects->at(componentRoots.at(i)); const QmlIR::Binding *rootBinding = component->firstBinding(); @@ -977,7 +977,7 @@ bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex) recordError(obj->locationOfIdProperty, tr("id is not unique")); return false; } - obj->id = _idToObjectIndex.count(); + obj->id = _idToObjectIndex.size(); _idToObjectIndex.insert(obj->idNameIndex, objectIndex); } @@ -1396,7 +1396,7 @@ QQmlDefaultPropertyMerger::QQmlDefaultPropertyMerger(QQmlTypeCompiler *typeCompi void QQmlDefaultPropertyMerger::mergeDefaultProperties() { - for (int i = 0; i < qmlObjects.count(); ++i) + for (int i = 0; i < qmlObjects.size(); ++i) mergeDefaultProperties(i); } diff --git a/src/qml/qml/qqmltypecompiler_p.h b/src/qml/qml/qqmltypecompiler_p.h index 188eda471f..02edbb0c08 100644 --- a/src/qml/qml/qqmltypecompiler_p.h +++ b/src/qml/qml/qqmltypecompiler_p.h @@ -55,7 +55,7 @@ public: using ListPropertyAssignBehavior = QmlIR::Pragma::ListPropertyAssignBehaviorValue; const QmlIR::Object *objectAt(int index) const { return document->objects.at(index); } - int objectCount() const { return document->objects.count(); } + int objectCount() const { return document->objects.size(); } QString stringAt(int idx) const; QmlIR::PoolList<QmlIR::Function>::Iterator objectFunctionsBegin(const QmlIR::Object *object) const { return object->functionsBegin(); } QmlIR::PoolList<QmlIR::Function>::Iterator objectFunctionsEnd(const QmlIR::Object *object) const { return object->functionsEnd(); } diff --git a/src/qml/qml/qqmltypedata.cpp b/src/qml/qml/qqmltypedata.cpp index 972723326a..899192adbd 100644 --- a/src/qml/qml/qqmltypedata.cpp +++ b/src/qml/qml/qqmltypedata.cpp @@ -292,7 +292,7 @@ void QQmlTypeData::done() return; // Check all script dependencies for errors - for (int ii = 0; ii < m_scripts.count(); ++ii) { + for (int ii = 0; ii < m_scripts.size(); ++ii) { const ScriptReference &script = m_scripts.at(ii); Q_ASSERT(script.script->isCompleteOrError()); if (script.script->isError()) { @@ -349,7 +349,7 @@ void QQmlTypeData::done() } // Check all composite singleton type dependencies for errors - for (int ii = 0; ii < m_compositeSingletons.count(); ++ii) { + for (int ii = 0; ii < m_compositeSingletons.size(); ++ii) { const TypeReference &type = m_compositeSingletons.at(ii); Q_ASSERT(!type.typeData || type.typeData->isCompleteOrError()); if (type.typeData && type.typeData->isError()) { @@ -482,8 +482,8 @@ void QQmlTypeData::done() { // Collect imported scripts - m_compiledData->dependentScripts.reserve(m_scripts.count()); - for (int scriptIndex = 0; scriptIndex < m_scripts.count(); ++scriptIndex) { + m_compiledData->dependentScripts.reserve(m_scripts.size()); + for (int scriptIndex = 0; scriptIndex < m_scripts.size(); ++scriptIndex) { const QQmlTypeData::ScriptReference &script = m_scripts.at(scriptIndex); QStringView qualifier(script.qualifier); @@ -599,7 +599,7 @@ bool QQmlTypeData::loadFromSource() if (!compiler.generateFromQml(source, finalUrlString(), m_document.data())) { QList<QQmlError> errors; - errors.reserve(compiler.errors.count()); + errors.reserve(compiler.errors.size()); for (const QQmlJS::DiagnosticMessage &msg : qAsConst(compiler.errors)) { QQmlError e; e.setUrl(url()); @@ -723,7 +723,7 @@ void QQmlTypeData::allDependenciesDone() void QQmlTypeData::downloadProgressChanged(qreal p) { - for (int ii = 0; ii < m_callbacks.count(); ++ii) { + for (int ii = 0; ii < m_callbacks.size(); ++ii) { TypeDataCallback *callback = m_callbacks.at(ii); callback->typeDataProgress(this, p); } diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 046ee0ef51..ab3ea80d35 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -614,7 +614,7 @@ bool QQmlTypeLoader::Blob::addLibraryImport(PendingImportPtr import, QList<QQmlE scriptImported(blob, import->location, script.nameSpace, import->qualifier); } } - if (!qmldir.plugins().count()) { + if (!qmldir.plugins().size()) { // If the qmldir does not register a plugin, we might still have declaratively // registered types (if we are dealing with an application instead of a library) auto module = QQmlMetaType::typeModule(import->uri, import->version); @@ -1035,7 +1035,7 @@ QString QQmlTypeLoader::absoluteFilePath(const QString &path) return QString(); QString absoluteFilePath; - QString fileName(path.mid(lastSlash+1, path.length()-lastSlash-1)); + QString fileName(path.mid(lastSlash+1, path.size()-lastSlash-1)); bool *value = fileSet->object(fileName); if (value) { @@ -1048,7 +1048,7 @@ QString QQmlTypeLoader::absoluteFilePath(const QString &path) absoluteFilePath = path; } - if (absoluteFilePath.length() > 2 && absoluteFilePath.at(0) != QLatin1Char('/') && absoluteFilePath.at(1) != QLatin1Char(':')) + if (absoluteFilePath.size() > 2 && absoluteFilePath.at(0) != QLatin1Char('/') && absoluteFilePath.at(1) != QLatin1Char(':')) absoluteFilePath = QFileInfo(absoluteFilePath).absoluteFilePath(); return absoluteFilePath; @@ -1134,7 +1134,7 @@ bool QQmlTypeLoader::directoryExists(const QString &path) return fileInfo.exists() && fileInfo.isDir(); } - int length = path.length(); + int length = path.size(); if (path.endsWith(QLatin1Char('/'))) --length; QString dirPath(path.left(length)); @@ -1171,7 +1171,7 @@ const QQmlTypeLoaderQmldirContent QQmlTypeLoader::qmldirContent(const QString &f // Yet, this heuristic is the best we can do until we pass more structured information here, // for example a QUrl also for local files. QUrl url(filePathIn); - if (url.scheme().length() < 2) { + if (url.scheme().size() < 2) { filePath = filePathIn; } else { filePath = QQmlFile::urlToLocalFileOrQrc(url); diff --git a/src/qml/qml/qqmltypemodule.cpp b/src/qml/qml/qqmltypemodule.cpp index 4360bf8fb9..b188b7fb90 100644 --- a/src/qml/qml/qqmltypemodule.cpp +++ b/src/qml/qml/qqmltypemodule.cpp @@ -30,7 +30,7 @@ void QQmlTypeModule::add(QQmlTypePrivate *type) addMinorVersion(type->version.minorVersion()); QList<QQmlTypePrivate *> &list = m_typeHash[type->elementName]; - for (int ii = 0; ii < list.count(); ++ii) { + for (int ii = 0; ii < list.size(); ++ii) { QQmlTypePrivate *in_list = list.at(ii); Q_ASSERT(in_list); if (in_list->version.minorVersion() < type->version.minorVersion()) { @@ -54,7 +54,7 @@ void QQmlTypeModule::remove(const QQmlTypePrivate *type) QQmlType QQmlTypeModule::findType(const QList<QQmlTypePrivate *> *types, QTypeRevision version) { if (types) { - for (int ii = 0; ii < types->count(); ++ii) + for (int ii = 0; ii < types->size(); ++ii) if (types->at(ii)->version.minorVersion() <= version.minorVersion()) return QQmlType(types->at(ii)); } diff --git a/src/qml/qml/qqmltypenamecache.cpp b/src/qml/qml/qqmltypenamecache.cpp index bf270cef7d..d3088a6c7c 100644 --- a/src/qml/qml/qqmltypenamecache.cpp +++ b/src/qml/qml/qqmltypenamecache.cpp @@ -9,7 +9,7 @@ QT_BEGIN_NAMESPACE void QQmlTypeNameCache::add(const QHashedString &name, const QUrl &url, const QHashedString &nameSpace) { - if (nameSpace.length() != 0) { + if (nameSpace.size() != 0) { QQmlImportRef *i = m_namedImports.value(nameSpace); Q_ASSERT(i != nullptr); i->compositeSingletons.insert(name, url); @@ -28,7 +28,7 @@ void QQmlTypeNameCache::add(const QHashedString &name, int importedScriptIndex, import.scriptIndex = importedScriptIndex; import.m_qualifier = name; - if (nameSpace.length() != 0) { + if (nameSpace.size() != 0) { QQmlImportRef *i = m_namedImports.value(nameSpace); Q_ASSERT(i != nullptr); m_namespacedImports[i].insert(name, import); diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index a24287b04c..0cc26fe0fb 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -99,7 +99,7 @@ static void list_append(QQmlListProperty<QObject> *prop, QObject *o) static qsizetype list_count(QQmlListProperty<QObject> *prop) { - return ResolvedList(prop).list()->count(); + return ResolvedList(prop).list()->size(); } static QObject *list_at(QQmlListProperty<QObject> *prop, qsizetype index) @@ -1050,7 +1050,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * auto arguments = methodData->hasArguments() ? methodData->arguments() : nullptr; if (arguments && arguments->names) { - const quint32 parameterCount = arguments->names->count(); + const quint32 parameterCount = arguments->names->size(); Q_ASSERT(parameterCount == function->formalParameterCount()); if (void *result = a[0]) arguments->types[0].destruct(result); diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 68f290030d..60403c1bad 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -504,7 +504,7 @@ ReturnedValue NodePrototype::method_get_previousSibling(const FunctionObject *b, if (!r->d()->d->parent) RETURN_RESULT(Encode::null()); - for (int ii = 0; ii < r->d()->d->parent->children.count(); ++ii) { + for (int ii = 0; ii < r->d()->d->parent->children.size(); ++ii) { if (r->d()->d->parent->children.at(ii) == r->d()->d) { if (ii == 0) return Encode::null(); @@ -526,9 +526,9 @@ ReturnedValue NodePrototype::method_get_nextSibling(const FunctionObject *b, con if (!r->d()->d->parent) RETURN_RESULT(Encode::null()); - for (int ii = 0; ii < r->d()->d->parent->children.count(); ++ii) { + for (int ii = 0; ii < r->d()->d->parent->children.size(); ++ii) { if (r->d()->d->parent->children.at(ii) == r->d()->d) { - if ((ii + 1) == r->d()->d->parent->children.count()) + if ((ii + 1) == r->d()->d->parent->children.size()) return Encode::null(); else return Node::create(scope.engine, r->d()->d->parent->children.at(ii + 1)); @@ -666,7 +666,7 @@ ReturnedValue CharacterData::method_length(const FunctionObject *b, const Value if (!r) RETURN_UNDEFINED(); - return Encode(int(r->d()->d->data.length())); + return Encode(int(r->d()->d->data.size())); } ReturnedValue CharacterData::prototype(ExecutionEngine *v4) @@ -859,7 +859,7 @@ ReturnedValue NamedNodeMap::virtualGet(const Managed *m, PropertyKey id, const V if (id.isArrayIndex()) { uint index = id.asArrayIndex(); - if ((int)index < r->d()->list().count()) { + if ((int)index < r->d()->list().size()) { if (hasProperty) *hasProperty = true; return Node::create(v4, r->d()->list().at(index)); @@ -873,10 +873,10 @@ ReturnedValue NamedNodeMap::virtualGet(const Managed *m, PropertyKey id, const V return Object::virtualGet(m, id, receiver, hasProperty); if (id == v4->id_length()->propertyKey()) - return Value::fromInt32(r->d()->list().count()).asReturnedValue(); + return Value::fromInt32(r->d()->list().size()).asReturnedValue(); QString str = id.toQString(); - for (int ii = 0; ii < r->d()->list().count(); ++ii) { + for (int ii = 0; ii < r->d()->list().size(); ++ii) { if (r->d()->list().at(ii)->name == str) { if (hasProperty) *hasProperty = true; @@ -902,7 +902,7 @@ ReturnedValue NodeList::virtualGet(const Managed *m, PropertyKey id, const Value if (id.isArrayIndex()) { uint index = id.asArrayIndex(); - if ((int)index < r->d()->d->children.count()) { + if ((int)index < r->d()->d->children.size()) { if (hasProperty) *hasProperty = true; return Node::create(v4, r->d()->d->children.at(index)); @@ -913,7 +913,7 @@ ReturnedValue NodeList::virtualGet(const Managed *m, PropertyKey id, const Value } if (id == v4->id_length()->propertyKey()) - return Value::fromInt32(r->d()->d->children.count()).asReturnedValue(); + return Value::fromInt32(r->d()->d->children.size()).asReturnedValue(); return Object::virtualGet(m, id, receiver, hasProperty); } @@ -1138,7 +1138,7 @@ QString QQmlXMLHttpRequest::headers() const QString ret; for (const HeaderPair &header : m_headersList) { - if (ret.length()) + if (ret.size()) ret.append(QLatin1String("\r\n")); ret += QString::fromUtf8(header.first) + QLatin1String(": ") + QString::fromUtf8(header.second); @@ -1202,7 +1202,7 @@ void QQmlXMLHttpRequest::requestFromUrl(const QUrl &url) int n = 0; int semiColon = str.indexOf(QLatin1Char(';'), charsetIdx); if (semiColon == -1) { - n = str.length() - charsetIdx; + n = str.size() - charsetIdx; } else { n = semiColon - charsetIdx; } @@ -1447,7 +1447,7 @@ void QQmlXMLHttpRequest::readEncoding() if (charsetIdx != -1) { charsetIdx += 8; separatorIdx = header.second.indexOf(';', charsetIdx); - m_charset = header.second.mid(charsetIdx, separatorIdx >= 0 ? separatorIdx : header.second.length()); + m_charset = header.second.mid(charsetIdx, separatorIdx >= 0 ? separatorIdx : header.second.size()); } } break; @@ -1480,7 +1480,7 @@ QV4::ReturnedValue QQmlXMLHttpRequest::jsonResponseBody(QV4::ExecutionEngine* en QJsonParseError error; const QString& jtext = responseBody(); - JsonParser parser(scope.engine, jtext.constData(), jtext.length()); + JsonParser parser(scope.engine, jtext.constData(), jtext.size()); ScopedValue jsonObject(scope, parser.parse(&error)); if (error.error != QJsonParseError::NoError) return engine->throwSyntaxError(QStringLiteral("JSON.parse: Parse error")); diff --git a/src/qml/qmldirparser/qqmldirparser.cpp b/src/qml/qmldirparser/qqmldirparser.cpp index 6415e6cee2..112c7d12d0 100644 --- a/src/qml/qmldirparser/qqmldirparser.cpp +++ b/src/qml/qmldirparser/qqmldirparser.cpp @@ -11,13 +11,13 @@ static int parseInt(QStringView str, bool *ok) { int pos = 0; int number = 0; - while (pos < str.length() && str.at(pos).isDigit()) { + while (pos < str.size() && str.at(pos).isDigit()) { if (pos != 0) number *= 10; number += str.at(pos).unicode() - '0'; ++pos; } - if (pos != str.length()) + if (pos != str.size()) *ok = false; else *ok = true; @@ -31,7 +31,7 @@ static QTypeRevision parseVersion(const QString &str) bool ok = false; const int major = parseInt(QStringView(str).left(dotIndex), &ok); if (!ok) return QTypeRevision(); - const int minor = parseInt(QStringView(str).mid(dotIndex + 1, str.length() - dotIndex - 1), &ok); + const int minor = parseInt(QStringView(str).mid(dotIndex + 1, str.size() - dotIndex - 1), &ok); return ok ? QTypeRevision::fromVersion(major, minor) : QTypeRevision(); } return QTypeRevision(); diff --git a/src/qml/qmldirparser/qqmlimportresolver.cpp b/src/qml/qmldirparser/qqmlimportresolver.cpp index b4f4dbf7a1..15ec7765b0 100644 --- a/src/qml/qmldirparser/qqmlimportresolver.cpp +++ b/src/qml/qmldirparser/qqmlimportresolver.cpp @@ -28,7 +28,7 @@ QStringList qQmlResolveImportPaths(QStringView uri, const QStringList &basePaths QStringList importPaths; // fully & partially versioned parts + 1 unversioned for each base path - importPaths.reserve(2 * parts.count() + 1); + importPaths.reserve(2 * parts.size() + 1); auto versionString = [](QTypeRevision version, ImportVersion mode) { @@ -71,7 +71,7 @@ QStringList qQmlResolveImportPaths(QStringView uri, const QStringList &basePaths if (mode != Unversioned) { // insert in the middle - for (int index = parts.count() - 2; index >= 0; --index) { + for (int index = parts.size() - 2; index >= 0; --index) { importPaths += dir + joinStringRefs(parts.mid(0, index + 1), Slash) + ver + Slash + joinStringRefs(parts.mid(index + 1), Slash); diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp index fb2664da73..5726d4a560 100644 --- a/src/qml/types/qqmlbind.cpp +++ b/src/qml/types/qqmlbind.cpp @@ -307,7 +307,7 @@ void QQmlBindPrivate::validate(QQmlBind *q) const if (!when) return; - qsizetype iterationEnd = entries.length(); + qsizetype iterationEnd = entries.size(); if (lastIsTarget) { if (obj) { Q_ASSERT(!entries.isEmpty()); @@ -604,7 +604,7 @@ void QQmlBind::setDelayed(bool delayed) oldEntries.pop_back(); } - for (qsizetype i = 0, end = oldEntries.length(); i < end; ++i) { + for (qsizetype i = 0, end = oldEntries.size(); i < end; ++i) { QQmlBindEntry &newEntry = d->entries[i]; QQmlBindEntry &oldEntry = oldEntries[i]; newEntry.previousKind = newEntry.previous.set( @@ -794,7 +794,7 @@ void QQmlBindPrivate::decodeBinding( if (delayed) { if (!delayedValues) createDelayedValues(); - const QString delayedName = QString::number(entries.length()); + const QString delayedName = QString::number(entries.size()); delayedValues->insert(delayedName, QVariant()); QQmlProperty bindingTarget = QQmlProperty(delayedValues.get(), delayedName); Q_ASSERT(bindingTarget.isValid()); @@ -863,7 +863,7 @@ void QQmlBindPrivate::evalDelayed() bool ok; const int delayedIndex = delayedName.toInt(&ok); Q_ASSERT(ok); - Q_ASSERT(delayedIndex >= 0 && delayedIndex < entries.length()); + Q_ASSERT(delayedIndex >= 0 && delayedIndex < entries.size()); entries[delayedIndex].prop.write((*delayedValues)[delayedName]); } (*delayedValues)[pendingName].setValue(QStringList()); @@ -1010,7 +1010,7 @@ void QQmlBind::eval() return; d->writingProperty = true; - for (qsizetype i = 0, end = d->entries.length(); i != end; ++i) { + for (qsizetype i = 0, end = d->entries.size(); i != end; ++i) { QQmlBindEntry &entry = d->entries[i]; if (!entry.prop.isValid()) continue; diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp index e93e40e69f..cb1148a416 100644 --- a/src/qml/types/qqmlconnections.cpp +++ b/src/qml/types/qqmlconnections.cpp @@ -203,11 +203,11 @@ void QQmlConnections::setIgnoreUnknownSignals(bool ignore) void QQmlConnectionsParser::verifyBindings(const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &props) { - for (int ii = 0; ii < props.count(); ++ii) { + for (int ii = 0; ii < props.size(); ++ii) { const QV4::CompiledData::Binding *binding = props.at(ii); const QString &propName = compilationUnit->stringAt(binding->propertyNameIndex); - const bool thirdCharacterIsValid = (propName.length() >= 2) + const bool thirdCharacterIsValid = (propName.size() >= 2) && (propName.at(2).isUpper() || propName.at(2) == u'_'); if (!propName.startsWith(QLatin1String("on")) || !thirdCharacterIsValid) { error(props.at(ii), QQmlConnections::tr("Cannot assign to non-existent property \"%1\"").arg(propName)); @@ -304,7 +304,7 @@ void QQmlConnections::connectSignalsToMethods() signal->takeExpression(expression); d->boundsignals += signal; } else if (!d->ignoreUnknownSignals - && propName.startsWith(QLatin1String("on")) && propName.length() > 2 + && propName.startsWith(QLatin1String("on")) && propName.size() > 2 && propName.at(2).isUpper()) { qmlWarning(this) << tr("Detected function \"%1\" in Connections element. " "This is probably intended to be a signal handler but no " diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp index 663d4974a7..494bf4e744 100644 --- a/src/qml/util/qqmlpropertymap.cpp +++ b/src/qml/util/qqmlpropertymap.cpp @@ -263,7 +263,7 @@ QStringList QQmlPropertyMap::keys() const int QQmlPropertyMap::count() const { Q_D(const QQmlPropertyMap); - return d->keys.count(); + return d->keys.size(); } /*! diff --git a/src/qmlcompiler/qqmljsbasicblocks.cpp b/src/qmlcompiler/qqmljsbasicblocks.cpp index a7bbd5326c..b014e2a482 100644 --- a/src/qmlcompiler/qqmljsbasicblocks.cpp +++ b/src/qmlcompiler/qqmljsbasicblocks.cpp @@ -45,14 +45,14 @@ QQmlJSCompilePass::InstructionAnnotations QQmlJSBasicBlocks::run( m_function = function; m_annotations = annotations; - for (int i = 0, end = function->argumentTypes.length(); i != end; ++i) { + for (int i = 0, end = function->argumentTypes.size(); i != end; ++i) { InstructionAnnotation annotation; annotation.changedRegisterIndex = FirstArgument + i; annotation.changedRegister = function->argumentTypes[i]; m_annotations[-annotation.changedRegisterIndex] = annotation; } - for (int i = 0, end = function->registerTypes.length(); i != end; ++i) { + for (int i = 0, end = function->registerTypes.size(); i != end; ++i) { InstructionAnnotation annotation; annotation.changedRegisterIndex = firstRegisterIndex() + i; annotation.changedRegister = function->registerTypes[i]; @@ -62,7 +62,7 @@ QQmlJSCompilePass::InstructionAnnotations QQmlJSBasicBlocks::run( m_basicBlocks.insert_or_assign(m_annotations.begin().key(), BasicBlock()); const QByteArray byteCode = function->code; - decode(byteCode.constData(), static_cast<uint>(byteCode.length())); + decode(byteCode.constData(), static_cast<uint>(byteCode.size())); if (m_hadBackJumps) { // We may have missed some connections between basic blocks if there were back jumps. // Fill them in via a second pass. @@ -75,7 +75,7 @@ QQmlJSCompilePass::InstructionAnnotations QQmlJSBasicBlocks::run( } reset(); - decode(byteCode.constData(), static_cast<uint>(byteCode.length())); + decode(byteCode.constData(), static_cast<uint>(byteCode.size())); for (auto it = m_basicBlocks.begin(), end = m_basicBlocks.end(); it != end; ++it) deduplicate(it->second.jumpOrigins); } @@ -415,7 +415,7 @@ void QQmlJSBasicBlocks::adjustTypes() const InstructionAnnotation &annotation = m_annotations[instructionOffset]; - Q_ASSERT(it->trackedTypes.length() == 1); + Q_ASSERT(it->trackedTypes.size() == 1); Q_ASSERT(it->trackedTypes[0] == m_typeResolver->containedType(annotation.changedRegister)); Q_ASSERT(!annotation.readRegisters.isEmpty()); @@ -446,7 +446,7 @@ void QQmlJSBasicBlocks::adjustTypes() // There is always one first occurrence of any tracked type. Conversions don't change // the type. - if (it->trackedTypes.length() != 1) + if (it->trackedTypes.size() != 1) continue; m_typeResolver->adjustTrackedType(it->trackedTypes[0], it->typeReaders.values()); diff --git a/src/qmlcompiler/qqmljscodegenerator.cpp b/src/qmlcompiler/qqmljscodegenerator.cpp index f9455e7815..65479ed9e5 100644 --- a/src/qmlcompiler/qqmljscodegenerator.cpp +++ b/src/qmlcompiler/qqmljscodegenerator.cpp @@ -103,7 +103,7 @@ QQmlJSAotFunction QQmlJSCodeGenerator::run( auto ¤tRegisterNames = registerNames[registerIndex]; QString &name = currentRegisterNames[m_typeResolver->comparableType(seenType)]; if (name.isEmpty()) - name = u"r%1_%2"_s.arg(registerIndex).arg(currentRegisterNames.count()); + name = u"r%1_%2"_s.arg(registerIndex).arg(currentRegisterNames.size()); typesForRegisters[seenType] = name; } }; @@ -123,7 +123,7 @@ QT_WARNING_POP // ensure we have m_labels for loops for (const auto loopLabel : m_context->labelInfo) - m_labels.insert(loopLabel, u"label_%1"_s.arg(m_labels.count())); + m_labels.insert(loopLabel, u"label_%1"_s.arg(m_labels.size())); // Initialize the first instruction's state to hold the arguments. // After this, the arguments (or whatever becomes of them) are carried @@ -131,7 +131,7 @@ QT_WARNING_POP m_state.State::operator=(initialState(m_function)); const QByteArray byteCode = function->code; - decode(byteCode.constData(), static_cast<uint>(byteCode.length())); + decode(byteCode.constData(), static_cast<uint>(byteCode.size())); QQmlJSAotFunction result; result.includes.swap(m_includes); @@ -2462,7 +2462,7 @@ void QQmlJSCodeGenerator::generateJumpCodeWithTypeConversions(int relativeOffset if (relativeOffset) { auto labelIt = m_labels.find(absoluteOffset); if (labelIt == m_labels.end()) - labelIt = m_labels.insert(absoluteOffset, u"label_%1"_s.arg(m_labels.count())); + labelIt = m_labels.insert(absoluteOffset, u"label_%1"_s.arg(m_labels.size())); conversionCode += u" goto "_s + *labelIt + u";\n"_s; } diff --git a/src/qmlcompiler/qqmljscompilepass_p.h b/src/qmlcompiler/qqmljscompilepass_p.h index 40e61464f5..5c4f1c4637 100644 --- a/src/qmlcompiler/qqmljscompilepass_p.h +++ b/src/qmlcompiler/qqmljscompilepass_p.h @@ -166,7 +166,7 @@ protected: int firstRegisterIndex() const { - return FirstArgument + m_function->argumentTypes.count(); + return FirstArgument + m_function->argumentTypes.size(); } bool isArgument(int registerIndex) const @@ -184,11 +184,11 @@ protected: State initialState(const Function *function) { State state; - for (int i = 0, end = function->argumentTypes.length(); i < end; ++i) { + for (int i = 0, end = function->argumentTypes.size(); i < end; ++i) { state.registers[FirstArgument + i] = function->argumentTypes.at(i); Q_ASSERT(state.registers[FirstArgument + i].isValid()); } - for (int i = 0, end = function->registerTypes.length(); i != end; ++i) + for (int i = 0, end = function->registerTypes.size(); i != end; ++i) state.registers[firstRegisterIndex() + i] = function->registerTypes[i]; return state; } diff --git a/src/qmlcompiler/qqmljsfunctioninitializer.cpp b/src/qmlcompiler/qqmljsfunctioninitializer.cpp index 56d1d25124..bb80586028 100644 --- a/src/qmlcompiler/qqmljsfunctioninitializer.cpp +++ b/src/qmlcompiler/qqmljsfunctioninitializer.cpp @@ -97,7 +97,7 @@ void QQmlJSFunctionInitializer::populateSignature( } } - for (int i = QQmlJSCompilePass::FirstArgument + function->argumentTypes.length(); + for (int i = QQmlJSCompilePass::FirstArgument + function->argumentTypes.size(); i < context->registerCountInFunction; ++i) { function->registerTypes.append(m_typeResolver->tracked( m_typeResolver->globalType(m_typeResolver->voidType()))); diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp index f0897de99f..48eaa020cd 100644 --- a/src/qmlcompiler/qqmljsimporter.cpp +++ b/src/qmlcompiler/qqmljsimporter.cpp @@ -696,7 +696,7 @@ bool QQmlJSImporter::importHelper(const QString &module, AvailableTypes *types, if (modulePath.startsWith(u':')) { if (m_mapper) { const QString resourcePath = modulePath.mid( - 1, modulePath.endsWith(u'/') ? modulePath.length() - 2 : -1) + 1, modulePath.endsWith(u'/') ? modulePath.size() - 2 : -1) + SlashQmldir; const auto entry = m_mapper->entry( QQmlJSResourceFileMapper::resourceFileFilter(resourcePath)); diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp index f93afc696a..2439bbaf33 100644 --- a/src/qmlcompiler/qqmljsimportvisitor.cpp +++ b/src/qmlcompiler/qqmljsimportvisitor.cpp @@ -283,8 +283,8 @@ void QQmlJSImportVisitor::resolveAliasesAndIds() if (doRequeue) requeue.enqueue(object); - if (objects.isEmpty() && requeue.length() < lastRequeueLength) { - lastRequeueLength = requeue.length(); + if (objects.isEmpty() && requeue.size() < lastRequeueLength) { + lastRequeueLength = requeue.size(); objects.swap(requeue); } } @@ -547,7 +547,7 @@ void QQmlJSImportVisitor::processDefaultProperties() const QQmlJSMetaProperty defaultProp = parentScope->property(defaultPropertyName); - if (it.value().length() > 1 && !defaultProp.isList()) { + if (it.value().size() > 1 && !defaultProp.isList()) { m_logger->log( QStringLiteral("Cannot assign multiple objects to a default non-list property"), Log_Property, it.value().constFirst()->sourceLocation()); @@ -780,7 +780,7 @@ void QQmlJSImportVisitor::checkRequiredProperties() QStringList aliasExpression = property.aliasExpression().split(u'.'); - if (aliasExpression.length() != 2) + if (aliasExpression.size() != 2) continue; if (aliasExpression[0] == scopeId && aliasExpression[1] == propName) { @@ -793,8 +793,8 @@ void QQmlJSImportVisitor::checkRequiredProperties() if (propertyUsedInRootAlias) continue; - const QQmlJSScope::ConstPtr propertyScope = scopesToSearch.length() > 1 - ? scopesToSearch.at(scopesToSearch.length() - 2) + const QQmlJSScope::ConstPtr propertyScope = scopesToSearch.size() > 1 + ? scopesToSearch.at(scopesToSearch.size() - 2) : QQmlJSScope::ConstPtr(); const QString propertyScopeName = !propertyScope.isNull() @@ -971,7 +971,7 @@ void QQmlJSImportVisitor::checkSignals() const QStringList signalParameters = signalMethod->parameterNames(); - if (pair.second.length() > signalParameters.length()) { + if (pair.second.size() > signalParameters.size()) { m_logger->log(QStringLiteral("Signal handler for \"%2\" has more formal" " parameters than the signal it handles.") .arg(pair.first), @@ -979,7 +979,7 @@ void QQmlJSImportVisitor::checkSignals() continue; } - for (qsizetype i = 0; i < pair.second.length(); i++) { + for (qsizetype i = 0; i < pair.second.size(); i++) { const QStringView handlerParameter = pair.second.at(i); const qsizetype j = signalParameters.indexOf(handlerParameter); if (j == i || j < 0) @@ -1273,7 +1273,7 @@ bool QQmlJSImportVisitor::visit(QQmlJS::AST::StringLiteral *sl) bool escaped = false; const QChar stringQuote = s[0]; - for (qsizetype i = 1; i < s.length() - 1; i++) { + for (qsizetype i = 1; i < s.size() - 1; i++) { const QChar c = s[i]; if (c == u'\\') { @@ -1287,7 +1287,7 @@ bool QQmlJSImportVisitor::visit(QQmlJS::AST::StringLiteral *sl) } else { if (c == u'`') templateString += u'\\'; - if (c == u'$' && i + 1 < s.length() - 1 && s[i + 1] == u'{') + if (c == u'$' && i + 1 < s.size() - 1 && s[i + 1] == u'{') templateString += u'\\'; } diff --git a/src/qmlcompiler/qqmljsloadergenerator.cpp b/src/qmlcompiler/qqmljsloadergenerator.cpp index 21be215bba..494ecdadd0 100644 --- a/src/qmlcompiler/qqmljsloadergenerator.cpp +++ b/src/qmlcompiler/qqmljsloadergenerator.cpp @@ -49,7 +49,7 @@ QString mangledIdentifier(const QString &str) } } - for (int ei = str.length(); i != ei; ++i) { + for (int ei = str.size(); i != ei; ++i) { auto c = str.at(i).unicode(); if ((c >= QLatin1Char('0') && c <= QLatin1Char('9')) || (c >= QLatin1Char('a') && c <= QLatin1Char('z')) @@ -68,7 +68,7 @@ QString qQmlJSSymbolNamespaceForPath(const QString &relativePath) { QFileInfo fi(relativePath); QString symbol = fi.path(); - if (symbol.length() == 1 && symbol.startsWith(QLatin1Char('.'))) { + if (symbol.size() == 1 && symbol.startsWith(QLatin1Char('.'))) { symbol.clear(); } else { symbol.replace(QLatin1Char('/'), QLatin1Char('_')); @@ -105,7 +105,7 @@ bool qQmlJSGenerateLoader(const QStringList &compiledFiles, const QString &outpu stream << "\n"; stream << "namespace QmlCacheGeneratedCode {\n"; - for (int i = 0; i < compiledFiles.count(); ++i) { + for (int i = 0; i < compiledFiles.size(); ++i) { const QString compiledFile = compiledFiles.at(i); const QString ns = qQmlJSSymbolNamespaceForPath(compiledFile); stream << "namespace " << ns << " { \n"; @@ -131,7 +131,7 @@ bool qQmlJSGenerateLoader(const QStringList &compiledFiles, const QString &outpu stream << "Registry::Registry() {\n"; - for (int i = 0; i < compiledFiles.count(); ++i) { + for (int i = 0; i < compiledFiles.size(); ++i) { const QString qrcFile = compiledFiles.at(i); const QString ns = qQmlJSSymbolNamespaceForPath(qrcFile); stream << " resourcePathToCachedUnit.insert(QStringLiteral(\"" << qrcFile << "\"), &QmlCacheGeneratedCode::" << ns << "::unit);\n"; diff --git a/src/qmlcompiler/qqmljslogger.cpp b/src/qmlcompiler/qqmljslogger.cpp index d8b1fe096f..9c22f55287 100644 --- a/src/qmlcompiler/qqmljslogger.cpp +++ b/src/qmlcompiler/qqmljslogger.cpp @@ -223,7 +223,7 @@ void QQmlJSLogger::printContext(const QString &overrideFileName, int tabCount = issueLocationWithContext.beforeText().count(QLatin1Char('\t')); int locationLength = location.length == 0 ? 1 : location.length; - m_output.write(QString::fromLatin1(" ").repeated(issueLocationWithContext.beforeText().length() + m_output.write(QString::fromLatin1(" ").repeated(issueLocationWithContext.beforeText().size() - tabCount) + QString::fromLatin1("\t").repeated(tabCount) + QString::fromLatin1("^").repeated(locationLength) + QLatin1Char('\n')); @@ -278,9 +278,9 @@ void QQmlJSLogger::printFix(const FixSuggestion &fix) continue; m_output.write(u" "_s.repeated( - issueLocationWithContext.beforeText().length() - tabCount) + issueLocationWithContext.beforeText().size() - tabCount) + u"\t"_s.repeated(tabCount) - + u"^"_s.repeated(fixItem.replacementString.length()) + u'\n'); + + u"^"_s.repeated(fixItem.replacementString.size()) + u'\n'); } } diff --git a/src/qmlcompiler/qqmljsmetatypes_p.h b/src/qmlcompiler/qqmljsmetatypes_p.h index 49b521a51d..e2987984fb 100644 --- a/src/qmlcompiler/qqmljsmetatypes_p.h +++ b/src/qmlcompiler/qqmljsmetatypes_p.h @@ -158,7 +158,7 @@ public: } void setParameterTypes(const QList<QSharedPointer<const QQmlJSScope>> &types) { - Q_ASSERT(types.length() == m_paramNames.length()); + Q_ASSERT(types.size() == m_paramNames.size()); m_paramTypes.clear(); for (const auto &type : types) m_paramTypes.append(type); diff --git a/src/qmlcompiler/qqmljsresourcefilemapper.cpp b/src/qmlcompiler/qqmljsresourcefilemapper.cpp index b9ae292018..4213902fb3 100644 --- a/src/qmlcompiler/qqmljsresourcefilemapper.cpp +++ b/src/qmlcompiler/qqmljsresourcefilemapper.cpp @@ -101,7 +101,7 @@ void doFilter(const QList<QQmlJSResourceFileMapper::Entry> &qrcPathToFileSystemP if ((filter.flags & QQmlJSResourceFileMapper::Recurse) // Crude. But shall we really allow slashes in QRC file names? - || !candidate.mid(terminatedDirectory.length()).contains(u'/')) { + || !candidate.mid(terminatedDirectory.size()).contains(u'/')) { if (handler(*it)) return; } diff --git a/src/qmlcompiler/qqmljsscope.cpp b/src/qmlcompiler/qqmljsscope.cpp index c0513d1554..b263e92e54 100644 --- a/src/qmlcompiler/qqmljsscope.cpp +++ b/src/qmlcompiler/qqmljsscope.cpp @@ -397,10 +397,10 @@ QTypeRevision QQmlJSScope::resolveType( const auto paramTypeNames = it->parameterTypeNames(); QList<QSharedPointer<const QQmlJSScope>> paramTypes = it->parameterTypes(); - if (paramTypes.length() < paramTypeNames.length()) - paramTypes.resize(paramTypeNames.length()); + if (paramTypes.size() < paramTypeNames.size()) + paramTypes.resize(paramTypeNames.size()); - for (int i = 0, length = paramTypes.length(); i < length; ++i) { + for (int i = 0, length = paramTypes.size(); i < length; ++i) { auto ¶mType = paramTypes[i]; const auto paramTypeName = paramTypeNames[i]; if (!paramType && !paramTypeName.isEmpty()) { diff --git a/src/qmlcompiler/qqmljsshadowcheck.cpp b/src/qmlcompiler/qqmljsshadowcheck.cpp index 719eeaef31..f8252b1faa 100644 --- a/src/qmlcompiler/qqmljsshadowcheck.cpp +++ b/src/qmlcompiler/qqmljsshadowcheck.cpp @@ -36,7 +36,7 @@ void QQmlJSShadowCheck::run( m_function = function; m_error = error; m_state = initialState(function); - decode(m_function->code.constData(), static_cast<uint>(m_function->code.length())); + decode(m_function->code.constData(), static_cast<uint>(m_function->code.size())); } void QQmlJSShadowCheck::generate_LoadProperty(int nameIndex) diff --git a/src/qmlcompiler/qqmljstypepropagator.cpp b/src/qmlcompiler/qqmljstypepropagator.cpp index c6ba251b34..2e4d2d5240 100644 --- a/src/qmlcompiler/qqmljstypepropagator.cpp +++ b/src/qmlcompiler/qqmljstypepropagator.cpp @@ -50,7 +50,7 @@ QQmlJSCompilePass::InstructionAnnotations QQmlJSTypePropagator::run( m_state.State::operator=(initialState(m_function)); reset(); - decode(m_function->code.constData(), static_cast<uint>(m_function->code.length())); + decode(m_function->code.constData(), static_cast<uint>(m_function->code.size())); // If we have found unresolved backwards jumps, we need to start over with a fresh state. // Mind that m_jumpOriginRegisterStateByTargetInstructionOffset is retained in that case. @@ -294,13 +294,13 @@ void QQmlJSTypePropagator::handleUnqualifiedAccess(const QString &name, bool isM std::optional<FixSuggestion> suggestion; auto childScopes = m_function->qmlScope->childScopes(); - for (qsizetype i = 0; i < m_function->qmlScope->childScopes().length(); i++) { + for (qsizetype i = 0; i < m_function->qmlScope->childScopes().size(); i++) { auto &scope = childScopes[i]; if (location.offset > scope->sourceLocation().offset) { - if (i + 1 < childScopes.length() + if (i + 1 < childScopes.size() && childScopes.at(i + 1)->sourceLocation().offset < location.offset) continue; - if (scope->childScopes().length() == 0) + if (scope->childScopes().size() == 0) continue; const auto jsId = scope->childScopes().first()->findJSIdentifier(name); @@ -810,7 +810,7 @@ void QQmlJSTypePropagator::propagatePropertyLookup(const QString &propertyName) return; } - if (m_state.accumulatorOut().isMethod() && m_state.accumulatorOut().method().length() != 1) { + if (m_state.accumulatorOut().isMethod() && m_state.accumulatorOut().method().size() != 1) { setError(u"Cannot determine overloaded method on loadProperty"_s); return; } @@ -1161,8 +1161,8 @@ void QQmlJSTypePropagator::propagateCall(const QList<QQmlJSMetaMethod> &methods, const QQmlJSMetaMethod match = bestMatchForCall(methods, argc, argv, &errors); if (!match.isValid()) { - Q_ASSERT(errors.length() == methods.length()); - if (methods.length() == 1) + Q_ASSERT(errors.size() == methods.size()); + if (methods.size() == 1) setError(errors.first()); else setError(u"No matching override found. Candidates:\n"_s + errors.join(u'\n')); @@ -1182,7 +1182,7 @@ void QQmlJSTypePropagator::propagateCall(const QList<QQmlJSMetaMethod> &methods, m_state.setHasSideEffects(true); const auto types = match.parameterTypes(); for (int i = 0; i < argc; ++i) { - if (i < types.length()) { + if (i < types.size()) { const QQmlJSScope::ConstPtr type = match.isJavaScriptFunction() ? m_typeResolver->jsValueType() : QQmlJSScope::ConstPtr(types.at(i)); @@ -2158,12 +2158,12 @@ QString QQmlJSTypePropagator::registerName(int registerIndex) const if (registerIndex == Accumulator) return u"accumulator"_s; if (registerIndex >= FirstArgument - && registerIndex < FirstArgument + m_function->argumentTypes.count()) { + && registerIndex < FirstArgument + m_function->argumentTypes.size()) { return u"argument %1"_s.arg(registerIndex - FirstArgument); } return u"temporary register %1"_s.arg( - registerIndex - FirstArgument - m_function->argumentTypes.count()); + registerIndex - FirstArgument - m_function->argumentTypes.size()); } QQmlJSRegisterContent QQmlJSTypePropagator::checkedInputRegister(int reg) diff --git a/src/qmlcompiler/qqmljstyperesolver.cpp b/src/qmlcompiler/qqmljstyperesolver.cpp index dddfc75783..3cba571e44 100644 --- a/src/qmlcompiler/qqmljstyperesolver.cpp +++ b/src/qmlcompiler/qqmljstyperesolver.cpp @@ -70,7 +70,7 @@ QQmlJSTypeResolver::QQmlJSTypeResolver(QQmlJSImporter *importer) m_jsGlobalObject = importer->jsGlobalObject(); auto numberMethods = m_jsGlobalObject->methods(u"Number"_s); - Q_ASSERT(numberMethods.length() == 1); + Q_ASSERT(numberMethods.size() == 1); m_numberPrototype = numberMethods[0].returnType()->baseType(); Q_ASSERT(m_numberPrototype); Q_ASSERT(m_numberPrototype->internalName() == u"NumberPrototype"_s); diff --git a/src/qmlcompiler/qqmljsutils.cpp b/src/qmlcompiler/qqmljsutils.cpp index b4c8dfde06..33c30ccca9 100644 --- a/src/qmlcompiler/qqmljsutils.cpp +++ b/src/qmlcompiler/qqmljsutils.cpp @@ -100,7 +100,7 @@ std::optional<FixSuggestion> QQmlJSUtils::didYouMean(const QString &userInput, QQmlJS::SourceLocation location) { QString shortestDistanceWord; - int shortestDistance = userInput.length(); + int shortestDistance = userInput.size(); // Most of the time the candidates are keys() from QHash, which means that // running this function in the seemingly same setup might yield different @@ -118,14 +118,14 @@ std::optional<FixSuggestion> QQmlJSUtils::didYouMean(const QString &userInput, * Roughly based on * https://en.wikipedia.org/wiki/Levenshtein_distance#Iterative_with_two_matrix_rows. */ - QList<int> v0(candidate.length() + 1); - QList<int> v1(candidate.length() + 1); + QList<int> v0(candidate.size() + 1); + QList<int> v1(candidate.size() + 1); std::iota(v0.begin(), v0.end(), 0); - for (qsizetype i = 0; i < userInput.length(); i++) { + for (qsizetype i = 0; i < userInput.size(); i++) { v1[0] = i + 1; - for (qsizetype j = 0; j < candidate.length(); j++) { + for (qsizetype j = 0; j < candidate.size(); j++) { int deletionCost = v0[j + 1] + 1; int insertionCost = v1[j] + 1; int substitutionCost = userInput[i] == candidate[j] ? v0[j] : v0[j] + 1; @@ -134,7 +134,7 @@ std::optional<FixSuggestion> QQmlJSUtils::didYouMean(const QString &userInput, std::swap(v0, v1); } - int distance = v0[candidate.length()]; + int distance = v0[candidate.size()]; if (distance < shortestDistance) { shortestDistanceWord = candidate; shortestDistance = distance; @@ -142,7 +142,7 @@ std::optional<FixSuggestion> QQmlJSUtils::didYouMean(const QString &userInput, } if (shortestDistance - < std::min(std::max(userInput.length() / 2, qsizetype(3)), userInput.length())) { + < std::min(std::max(userInput.size() / 2, qsizetype(3)), userInput.size())) { return FixSuggestion { { FixSuggestion::Fix { u"Did you mean \"%1\"?"_s.arg(shortestDistanceWord), location, shortestDistanceWord } } }; diff --git a/src/qmlcompiler/qqmljsutils_p.h b/src/qmlcompiler/qqmljsutils_p.h index 8a1ee9c287..040e996cd4 100644 --- a/src/qmlcompiler/qqmljsutils_p.h +++ b/src/qmlcompiler/qqmljsutils_p.h @@ -104,7 +104,7 @@ struct Q_QMLCOMPILER_PRIVATE_EXPORT QQmlJSUtils { if (handlerName.startsWith(u"on") && handlerName.size() > 2) { QString signal = handlerName.mid(2).toString(); - for (int i = 0; i < signal.length(); ++i) { + for (int i = 0; i < signal.size(); ++i) { QChar &ch = signal[i]; if (ch.isLower()) return {}; diff --git a/src/qmldebug/qv4debugclient.cpp b/src/qmldebug/qv4debugclient.cpp index bb108fc5ef..83c6660a94 100644 --- a/src/qmldebug/qv4debugclient.cpp +++ b/src/qmldebug/qv4debugclient.cpp @@ -293,7 +293,7 @@ void QV4DebugClient::scripts(int types, const QList<int> &ids, bool includeSourc QJsonObject args; args.insert(QLatin1String(TYPES), types); - if (ids.count()) { + if (ids.size()) { QJsonArray array; for (int id : ids) array.append(id); diff --git a/src/qmldom/qqmldomastcreator.cpp b/src/qmldom/qqmldomastcreator.cpp index 2559a6febf..78c896619e 100644 --- a/src/qmldom/qqmldomastcreator.cpp +++ b/src/qmldom/qqmldomastcreator.cpp @@ -133,9 +133,9 @@ class QmlDomAstCreator final : public AST::Visitor template<typename T> StackEl ¤tEl(int idx = 0) { - Q_ASSERT_X(idx < nodeStack.length() && idx >= 0, "currentQmlObjectOrComponentEl", + Q_ASSERT_X(idx < nodeStack.size() && idx >= 0, "currentQmlObjectOrComponentEl", "Stack does not contain enough elements!"); - int i = nodeStack.length() - idx; + int i = nodeStack.size() - idx; while (i-- > 0) { DomType k = nodeStack.at(i).item.kind; if (k == T::kindValue) @@ -155,9 +155,9 @@ class QmlDomAstCreator final : public AST::Visitor StackEl ¤tQmlObjectOrComponentEl(int idx = 0) { - Q_ASSERT_X(idx < nodeStack.length() && idx >= 0, "currentQmlObjectOrComponentEl", + Q_ASSERT_X(idx < nodeStack.size() && idx >= 0, "currentQmlObjectOrComponentEl", "Stack does not contain enough elements!"); - int i = nodeStack.length() - idx; + int i = nodeStack.size() - idx; while (i-- > 0) { DomType k = nodeStack.at(i).item.kind; if (k == DomType::QmlObject || k == DomType::QmlComponent) @@ -169,16 +169,16 @@ class QmlDomAstCreator final : public AST::Visitor StackEl ¤tNodeEl(int i = 0) { - Q_ASSERT_X(i < nodeStack.length() && i >= 0, "currentNode", + Q_ASSERT_X(i < nodeStack.size() && i >= 0, "currentNode", "Stack does not contain element!"); - return nodeStack[nodeStack.length() - i - 1]; + return nodeStack[nodeStack.size() - i - 1]; } DomValue ¤tNode(int i = 0) { - Q_ASSERT_X(i < nodeStack.length() && i >= 0, "currentNode", + Q_ASSERT_X(i < nodeStack.size() && i >= 0, "currentNode", "Stack does not contain element!"); - return nodeStack[nodeStack.length() - i - 1].item; + return nodeStack[nodeStack.size() - i - 1].item; } void removeCurrentNode(std::optional<DomType> expectedType) @@ -471,7 +471,7 @@ public: currentEl<QmlObject>() .path.field(Fields::bindings) .key(pDef.name) - .index(obj.m_bindings.values(pDef.name).length() - 1), + .index(obj.m_bindings.values(pDef.name).size() - 1), ann); } } @@ -591,11 +591,11 @@ public: scope.addPrototypePath(Paths::lookupTypePath(scope.name())); QmlObject *sPtr = nullptr; Path sPathFromOwner; - if (!arrayBindingLevels.isEmpty() && nodeStack.length() == arrayBindingLevels.last()) { + if (!arrayBindingLevels.isEmpty() && nodeStack.size() == arrayBindingLevels.last()) { if (currentNode().kind == DomType::Binding) { QList<QmlObject> *vals = std::get<Binding>(currentNode().value).arrayValue(); if (vals) { - int idx = vals->length(); + int idx = vals->size(); vals->append(scope); sPathFromOwner = currentNodeEl().path.field(Fields::value).index(idx); sPtr = &((*vals)[idx]); @@ -631,7 +631,7 @@ public: { QmlObject &obj = current<QmlObject>(); int idx = currentIndex(); - if (!arrayBindingLevels.isEmpty() && nodeStack.length() == arrayBindingLevels.last() + 1) { + if (!arrayBindingLevels.isEmpty() && nodeStack.size() == arrayBindingLevels.last() + 1) { if (currentNode(1).kind == DomType::Binding) { Binding &b = std::get<Binding>(currentNode(1).value); QList<QmlObject> *vals = b.arrayValue(); @@ -814,7 +814,7 @@ public: createMap(currentNodeEl().fileLocations, Path::Field(Fields::value), nullptr); FileLocations::addRegion(arrayList, u"leftSquareBrace", el->lbracketToken); FileLocations::addRegion(arrayList, u"rightSquareBrace", el->lbracketToken); - arrayBindingLevels.append(nodeStack.length()); + arrayBindingLevels.append(nodeStack.size()); return true; } diff --git a/src/qmldom/qqmldomcomments.cpp b/src/qmldom/qqmldomcomments.cpp index 19e1328d6e..257916cffa 100644 --- a/src/qmldom/qqmldomcomments.cpp +++ b/src/qmldom/qqmldomcomments.cpp @@ -68,12 +68,12 @@ CommentInfo gets such a raw comment string and makes the various pieces availabl CommentInfo::CommentInfo(QStringView rawComment) : rawComment(rawComment) { commentBegin = 0; - while (commentBegin < quint32(rawComment.length()) && rawComment.at(commentBegin).isSpace()) { + while (commentBegin < quint32(rawComment.size()) && rawComment.at(commentBegin).isSpace()) { if (rawComment.at(commentBegin) == QLatin1Char('\n')) hasStartNewline = true; ++commentBegin; } - if (commentBegin < quint32(rawComment.length())) { + if (commentBegin < quint32(rawComment.size())) { QString expectedEnd; switch (rawComment.at(commentBegin).unicode()) { case '/': @@ -98,7 +98,7 @@ CommentInfo::CommentInfo(QStringView rawComment) : rawComment(rawComment) break; } commentEnd = commentBegin + commentStartStr.size(); - quint32 rawEnd = quint32(rawComment.length()); + quint32 rawEnd = quint32(rawComment.size()); while (commentEnd < rawEnd && rawComment.at(commentEnd).isSpace()) ++commentEnd; commentContentEnd = commentContentBegin = commentEnd; @@ -106,9 +106,9 @@ CommentInfo::CommentInfo(QStringView rawComment) : rawComment(rawComment) while (commentEnd < rawEnd) { QChar c = rawComment.at(commentEnd); if (c == e1) { - if (expectedEnd.length() > 1) { + if (expectedEnd.size() > 1) { if (++commentEnd < rawEnd && rawComment.at(commentEnd) == expectedEnd.at(1)) { - Q_ASSERT(expectedEnd.length() == 2); + Q_ASSERT(expectedEnd.size() == 2); commentEndStr = rawComment.mid(++commentEnd - 2, 2); break; } else { diff --git a/src/qmldom/qqmldomcomments_p.h b/src/qmldom/qqmldomcomments_p.h index fe7638913a..5dd541684e 100644 --- a/src/qmldom/qqmldomcomments_p.h +++ b/src/qmldom/qqmldomcomments_p.h @@ -145,7 +145,7 @@ public: Path addPreComment(const Comment &comment, QString regionName) { auto &preList = regionComments[regionName].preComments; - index_type idx = preList.length(); + index_type idx = preList.size(); preList.append(comment); return Path::Field(Fields::regionComments) .key(regionName) @@ -156,7 +156,7 @@ public: Path addPostComment(const Comment &comment, QString regionName) { auto &postList = regionComments[regionName].postComments; - index_type idx = postList.length(); + index_type idx = postList.size(); postList.append(comment); return Path::Field(Fields::regionComments) .key(regionName) diff --git a/src/qmldom/qqmldomelements_p.h b/src/qmldom/qqmldomelements_p.h index 0f5159e535..341ca1e68f 100644 --- a/src/qmldom/qqmldomelements_p.h +++ b/src/qmldom/qqmldomelements_p.h @@ -541,7 +541,7 @@ public: bool isSignalHandler() const { QString baseName = m_name.split(QLatin1Char('.')).last(); - if (baseName.startsWith(u"on") && baseName.length() > 2 && baseName.at(2).isUpper()) + if (baseName.startsWith(u"on") && baseName.size() > 2 && baseName.at(2).isUpper()) return true; return false; } diff --git a/src/qmldom/qqmldomerrormessage.cpp b/src/qmldom/qqmldomerrormessage.cpp index 6eb9ce98ea..d4b95850e2 100644 --- a/src/qmldom/qqmldomerrormessage.cpp +++ b/src/qmldom/qqmldomerrormessage.cpp @@ -72,20 +72,20 @@ and use it to create new ErrorMessages using its debug, warning, error,... metho void ErrorGroups::dump(Sink sink) const { - for (int i = 0; i < groups.length(); ++i) + for (int i = 0; i < groups.size(); ++i) groups.at(i).dump(sink); } void ErrorGroups::dumpId(Sink sink) const { - for (int i = 0; i < groups.length(); ++i) + for (int i = 0; i < groups.size(); ++i) groups.at(i).dumpId(sink); } QCborArray ErrorGroups::toCbor() const { QCborArray res; - for (int i = 0; i < groups.length(); ++i) + for (int i = 0; i < groups.size(); ++i) res.append(QCborValue(groups.at(i).groupId())); return res; } @@ -163,7 +163,7 @@ void ErrorGroups::fatal(Dumper msg, Path element, QStringView canonicalFilePath, int ibuf = 0; auto sink = [&ibuf, &buf](QStringView s) { int is = 0; - while (ibuf < FatalMsgMaxLen && is < s.length()) { + while (ibuf < FatalMsgMaxLen && is < s.size()) { QChar c = s.at(is); if (c == QChar::fromLatin1('\n') || c == QChar::fromLatin1('\r') || (c >= QChar::fromLatin1(' ') && c <= QChar::fromLatin1('~'))) buf[ibuf++] = c.toLatin1(); @@ -236,11 +236,11 @@ int ErrorGroups::cmp(const ErrorGroups &o1, const ErrorGroups &o2) { auto &g1 = o1.groups; auto &g2 = o2.groups; - if (g1.length() < g2.length()) + if (g1.size() < g2.size()) return -1; - if (g1.length() < g2.length()) + if (g1.size() < g2.size()) return 1; - for (int i = 0; i < g1.length(); ++i) { + for (int i = 0; i < g1.size(); ++i) { int c = std::strcmp(g1.at(i).groupId().data(), g2.at(i).groupId().data()); if (c != 0) return c; diff --git a/src/qmldom/qqmldomexternalitems_p.h b/src/qmldom/qqmldomexternalitems_p.h index 4f6648f9e4..7bd51a30d1 100644 --- a/src/qmldom/qqmldomexternalitems_p.h +++ b/src/qmldom/qqmldomexternalitems_p.h @@ -286,7 +286,7 @@ public: void setImports(const QList<Import> &imports) { m_imports = imports; } Path addImport(const Import &i) { - index_type idx = index_type(m_imports.length()); + index_type idx = index_type(m_imports.size()); m_imports.append(i); if (i.uri.isModule()) { m_importScope.addImport((i.importId.isEmpty() @@ -313,7 +313,7 @@ public: void setPragmas(QList<Pragma> pragmas) { m_pragmas = pragmas; } Path addPragma(const Pragma &pragma) { - int idx = m_pragmas.length(); + int idx = m_pragmas.size(); m_pragmas.append(pragma); return Path::Field(Fields::pragmas).index(idx); } @@ -383,7 +383,7 @@ public: void setExports(QMultiMap<QString, Export> e) { m_exports = e; } Path addExport(const Export &e) { - index_type i = m_exports.values(e.typeName).length(); + index_type i = m_exports.values(e.typeName).size(); m_exports.insert(e.typeName, e); addUri(e.uri, e.version.majorVersion); return canonicalPath().field(Fields::exports).index(i); diff --git a/src/qmldom/qqmldomitem_p.h b/src/qmldom/qqmldomitem_p.h index f5fca3bc41..10945734da 100644 --- a/src/qmldom/qqmldomitem_p.h +++ b/src/qmldom/qqmldomitem_p.h @@ -407,7 +407,7 @@ public: for (void *p : pList) m_pList.append(p); } else if (options == ListOptions::Reverse) { - for (qsizetype i = pList.length(); i-- != 0;) + for (qsizetype i = pList.size(); i-- != 0;) // probably writing in reverse and reading sequentially would be better m_pList.append(pList.at(i)); } else { @@ -1204,21 +1204,21 @@ List List::fromQList( std::function<DomItem(DomItem &, const PathEls::PathComponent &, T &)> elWrapper, ListOptions options) { - index_type len = list.length(); + index_type len = list.size(); if (options == ListOptions::Reverse) { return List( pathFromOwner, [list, elWrapper](DomItem &self, index_type i) mutable { - if (i < 0 || i >= list.length()) + if (i < 0 || i >= list.size()) return DomItem(); - return elWrapper(self, PathEls::Index(i), list[list.length() - i - 1]); + return elWrapper(self, PathEls::Index(i), list[list.size() - i - 1]); }, [len](DomItem &) { return len; }, nullptr, QLatin1String(typeid(T).name())); } else { return List( pathFromOwner, [list, elWrapper](DomItem &self, index_type i) mutable { - if (i < 0 || i >= list.length()) + if (i < 0 || i >= list.size()) return DomItem(); return elWrapper(self, PathEls::Index(i), list[i]); }, @@ -1236,21 +1236,21 @@ List List::fromQListRef( return List( pathFromOwner, [&list, elWrapper](DomItem &self, index_type i) { - if (i < 0 || i >= list.length()) + if (i < 0 || i >= list.size()) return DomItem(); - return elWrapper(self, PathEls::Index(i), list[list.length() - i - 1]); + return elWrapper(self, PathEls::Index(i), list[list.size() - i - 1]); }, - [&list](DomItem &) { return list.length(); }, nullptr, + [&list](DomItem &) { return list.size(); }, nullptr, QLatin1String(typeid(T).name())); } else { return List( pathFromOwner, [&list, elWrapper](DomItem &self, index_type i) { - if (i < 0 || i >= list.length()) + if (i < 0 || i >= list.size()) return DomItem(); return elWrapper(self, PathEls::Index(i), list[i]); }, - [&list](DomItem &) { return list.length(); }, nullptr, + [&list](DomItem &) { return list.size(); }, nullptr, QLatin1String(typeid(T).name())); } } @@ -1635,7 +1635,7 @@ template<typename T> Path appendUpdatableElementInQList(Path listPathFromOwner, QList<T> &list, const T &value, T **vPtr = nullptr) { - int idx = list.length(); + int idx = list.size(); list.append(value); Path newPath = listPathFromOwner.index(idx); T &targetV = list[idx]; @@ -1946,7 +1946,7 @@ bool ListPT<T>::iterateDirectSubpaths(DomItem &self, DirectVisitor v) template<typename T> DomItem ListPT<T>::index(DomItem &self, index_type index) const { - if (index >= 0 && index < m_pList.length()) + if (index >= 0 && index < m_pList.size()) return self.wrap(PathEls::Index(index), *reinterpret_cast<T *>(m_pList.value(index))); return DomItem(); } diff --git a/src/qmldom/qqmldomlinewriter.cpp b/src/qmldom/qqmldomlinewriter.cpp index cb312b4fa7..c0110e8bf9 100644 --- a/src/qmldom/qqmldomlinewriter.cpp +++ b/src/qmldom/qqmldomlinewriter.cpp @@ -94,10 +94,10 @@ LineWriter &LineWriter::ensureSpace(QStringView space, TextAddType t) if (ind.nNewlines > 0) ensureNewline(ind.nNewlines, t); if (cc != counter() || m_currentLine.isEmpty() - || !m_currentLine.at(m_currentLine.length() - 1).isSpace()) + || !m_currentLine.at(m_currentLine.size() - 1).isSpace()) write(ind.trailingString, t); else { - int len = m_currentLine.length(); + int len = m_currentLine.size(); int i = len; while (i != 0 && m_currentLine.at(i - 1).isSpace()) --i; @@ -109,8 +109,8 @@ LineWriter &LineWriter::ensureSpace(QStringView space, TextAddType t) ind = IndentInfo(space, tabSize, trailingSpaceStartColumn); if (i == 0) { if (indExisting.column < ind.column) { - qint32 utf16Change = ind.trailingString.length() - trailingSpace.length(); - m_currentColumnNr += ind.trailingString.length() - trailingSpace.length(); + qint32 utf16Change = ind.trailingString.size() - trailingSpace.size(); + m_currentColumnNr += ind.trailingString.size() - trailingSpace.size(); m_currentLine.replace( i, len - i, ind.trailingString.toString()); // invalidates most QStringViews changeAtOffset(i, utf16Change, utf16Change, 0); @@ -341,8 +341,8 @@ void LineWriter::changeAtOffset(quint32 offset, qint32 change, qint32 colChange, int LineWriter::column(int index) { - if (index > m_currentLine.length()) - index = m_currentLine.length(); + if (index > m_currentLine.size()) + index = m_currentLine.size(); IndentInfo iInfo(QStringView(m_currentLine).mid(0, index), m_options.formatOptions.tabSize, m_columnNr); return iInfo.column; diff --git a/src/qmldom/qqmldomlinewriter_p.h b/src/qmldom/qqmldomlinewriter_p.h index b3efadd958..ff7c075899 100644 --- a/src/qmldom/qqmldomlinewriter_p.h +++ b/src/qmldom/qqmldomlinewriter_p.h @@ -45,7 +45,7 @@ public: column = initialColumn + fixup; const QChar tab = QLatin1Char('\t'); int iStart = 0; - int len = line.length(); + int len = line.size(); for (int i = 0; i < len; i++) { if (line[i] == tab) column = ((column / tabSize) + 1) * tabSize; diff --git a/src/qmldom/qqmldommoduleindex.cpp b/src/qmldom/qqmldommoduleindex.cpp index 5dfb4d7917..37a33c328a 100644 --- a/src/qmldom/qqmldommoduleindex.cpp +++ b/src/qmldom/qqmldommoduleindex.cpp @@ -154,7 +154,7 @@ QSet<QString> ModuleIndex::exportNames(DomItem &self) const { QSet<QString> res; QList<Path> mySources = sources(); - for (int i = 0; i < mySources.length(); ++i) { + for (int i = 0; i < mySources.size(); ++i) { DomItem source = self.path(mySources.at(i)); res += source.field(Fields::exports).keys(); } @@ -230,7 +230,7 @@ QList<DomItem> ModuleIndex::exportsWithNameAndMinorVersion(DomItem &self, QStrin if (minorVersion < 0) minorVersion = std::numeric_limits<int>::max(); int vNow = Version::Undefined; - for (int i = 0; i < mySources.length(); ++i) { + for (int i = 0; i < mySources.size(); ++i) { DomItem source = self.path(mySources.at(i)); DomItem exports = source.field(Fields::exports).key(name); int nExports = exports.indexes(); diff --git a/src/qmldom/qqmldompath.cpp b/src/qmldom/qqmldompath.cpp index 447e0479c4..4554a7cb40 100644 --- a/src/qmldom/qqmldompath.cpp +++ b/src/qmldom/qqmldompath.cpp @@ -90,7 +90,7 @@ QString Filter::name() const { bool Filter::checkName(QStringView s) const { return s.startsWith(u"?(") - && s.mid(2, s.length()-3) == filterDescription + && s.mid(2, s.size()-3) == filterDescription && s.endsWith(u")"); } @@ -181,7 +181,7 @@ const PathEls::PathComponent &Path::component(int i) const i = i - m_length - m_endOffset; auto data = m_data.get(); while (data) { - i += data->components.length(); + i += data->components.size(); if (i >= 0) return qAsConst(data)->components[i]; data = data->parent.get(); @@ -311,7 +311,7 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) const QChar backslash = QChar::fromLatin1('\\'); const QChar underscore = QChar::fromLatin1('_'); const QChar tilda = QChar::fromLatin1('~'); - for (int i=0; i < s.length(); ++i) + for (int i=0; i < s.size(); ++i) if (s.at(i) == lsBrace || s.at(i) == dot) ++len; QVector<Component> components; @@ -320,25 +320,25 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) int i0 = 0; PathEls::ParserState state = PathEls::ParserState::Start; QStringList strVals; - while (i < s.length()) { + while (i < s.size()) { // skip space - while (i < s.length() && s.at(i).isSpace()) + while (i < s.size() && s.at(i).isSpace()) ++i; - if (i >= s.length()) + if (i >= s.size()) break; QChar c = s.at(i++); switch (state) { case PathEls::ParserState::Start: if (c == dollar) { i0 = i; - while (i < s.length() && s.at(i).isLetterOrNumber()){ + while (i < s.size() && s.at(i).isLetterOrNumber()){ ++i; } components.append(Component(PathEls::Root(s.mid(i0,i-i0)))); state = PathEls::ParserState::End; } else if (c == at) { i0 = i; - while (i < s.length() && s.at(i).isLetterOrNumber()){ + while (i < s.size() && s.at(i).isLetterOrNumber()){ ++i; } components.append(Component(PathEls::Current(s.mid(i0,i-i0)))); @@ -355,7 +355,7 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) case PathEls::ParserState::IndexOrKey: if (c.isDigit()) { i0 = i-1; - while (i < s.length() && s.at(i).isDigit()) + while (i < s.size() && s.at(i).isDigit()) ++i; bool ok; components.append(Component(static_cast<index_type>(s.mid(i0,i-i0).toString() @@ -367,14 +367,14 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) } } else if (c.isLetter() || c == tilda || c == underscore) { i0 = i-1; - while (i < s.length() && (s.at(i).isLetterOrNumber() || s.at(i) == underscore || s.at(i) == tilda)) + while (i < s.size() && (s.at(i).isLetterOrNumber() || s.at(i) == underscore || s.at(i) == tilda)) ++i; components.append(Component(PathEls::Key(s.mid(i0, i - i0).toString()))); } else if (c == quote) { i0 = i; QString strVal; bool properEnd = false; - while (i < s.length()) { + while (i < s.size()) { c = s.at(i); if (c == quote) { properEnd = true; @@ -406,16 +406,16 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) } else if (c == QChar::fromLatin1('*')) { components.append(Component(PathEls::Any())); } else if (c == QChar::fromLatin1('?')) { - while (i < s.length() && s.at(i).isSpace()) + while (i < s.size() && s.at(i).isSpace()) ++i; - if (i >= s.length() || s.at(i) != QChar::fromLatin1('(')) { + if (i >= s.size() || s.at(i) != QChar::fromLatin1('(')) { myErrors().error(tr("Expected a brace in filter after the question mark (at char %1).") .arg(QString::number(i))).handle(errorHandler); return Path(); } i0 = ++i; - while (i < s.length() && s.at(i) != QChar::fromLatin1(')')) ++i; // check matching braces when skipping?? - if (i >= s.length() || s.at(i) != QChar::fromLatin1(')')) { + while (i < s.size() && s.at(i) != QChar::fromLatin1(')')) ++i; // check matching braces when skipping?? + if (i >= s.size() || s.at(i) != QChar::fromLatin1(')')) { myErrors().error(tr("Expected a closing brace in filter after the question mark (at char %1).") .arg(QString::number(i))).handle(errorHandler); return Path(); @@ -429,8 +429,8 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) .arg(c).arg(i-1)).handle(errorHandler); return Path(); } - while (i < s.length() && s.at(i).isSpace()) ++i; - if (i >= s.length() || s.at(i) != rsBrace) { + while (i < s.size() && s.at(i).isSpace()) ++i; + if (i >= s.size() || s.at(i) != rsBrace) { myErrors().error(tr("square braces misses closing brace at char %1.") .arg(QString::number(i))).handle(errorHandler); return Path(); @@ -441,20 +441,20 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) break; case PathEls::ParserState::End: if (c == dot) { - while (i < s.length() && s.at(i).isSpace()) ++i; - if (i == s.length()) { + while (i < s.size() && s.at(i).isSpace()) ++i; + if (i == s.size()) { components.append(Component()); state = PathEls::ParserState::End; } else if (s.at(i).isLetter() || s.at(i) == underscore || s.at(i) == tilda) { i0 = i; - while (i < s.length() && (s.at(i).isLetterOrNumber() || s.at(i) == underscore || s.at(i) == tilda)) { + while (i < s.size() && (s.at(i).isLetterOrNumber() || s.at(i) == underscore || s.at(i) == tilda)) { ++i; } components.append(Component(PathEls::Field(s.mid(i0,i-i0)))); state = PathEls::ParserState::End; } else if (s.at(i).isDigit()) { i0 = i; - while (i < s.length() && s.at(i).isDigit()){ + while (i < s.size() && s.at(i).isDigit()){ ++i; } bool ok; @@ -474,14 +474,14 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) state = PathEls::ParserState::End; } else if (s.at(i) == at) { i0 = ++i; - while (i < s.length() && s.at(i).isLetterOrNumber()){ + while (i < s.size() && s.at(i).isLetterOrNumber()){ ++i; } components.append(Component(PathEls::Current(s.mid(i0,i-i0)))); state = PathEls::ParserState::End; } else if (s.at(i) == dollar) { i0 = ++i; - while (i < s.length() && s.at(i).isLetterOrNumber()){ + while (i < s.size() && s.at(i).isLetterOrNumber()){ ++i; } components.append(Component(PathEls::Root(s.mid(i0,i-i0)))); @@ -512,7 +512,7 @@ Path Path::fromString(QStringView s, ErrorHandler errorHandler) return Path(); case PathEls::ParserState::End: - return Path(0, components.length(), std::shared_ptr<PathEls::PathData>( + return Path(0, components.size(), std::shared_ptr<PathEls::PathData>( new PathEls::PathData(strVals, components))); } Q_ASSERT(false && "Unexpected state in Path::fromString"); @@ -728,9 +728,9 @@ Path Path::path(Path toAdd, bool avoidToAddAsBase) const } data = toAdd.m_data.get(); while (data) { - for (int ij = 0; ij < data->strData.length(); ++ij) { + for (int ij = 0; ij < data->strData.size(); ++ij) { bool hasAlready = false; - for (int ii = 0; ii < myStrs.length() && !hasAlready; ++ii) + for (int ii = 0; ii < myStrs.size() && !hasAlready; ++ii) hasAlready = inQString(data->strData[ij], myStrs[ii]); if (!hasAlready) addedStrs.append(data->strData[ij]); @@ -743,7 +743,7 @@ Path Path::path(Path toAdd, bool avoidToAddAsBase) const components.append(toAdd.component(i)); QStringView compStrView = toAdd.component(i).stringView(); if (!compStrView.isEmpty()) { - for (int j = 0; j < addedStrs.length(); ++j) { + for (int j = 0; j < addedStrs.size(); ++j) { if (inQString(compStrView, addedStrs[j])) { toAddStrs.append(addedStrs[j]); addedStrs.removeAt(j); @@ -761,7 +761,7 @@ Path Path::expandFront() const int newLen = 0; auto data = m_data.get(); while (data) { - newLen += data->components.length(); + newLen += data->components.size(); data = data->parent.get(); } newLen -= m_endOffset; @@ -822,14 +822,14 @@ Path Path::noEndOffset() const // peel back qint16 endOffset = m_endOffset; std::shared_ptr<PathEls::PathData> lastData = m_data; - while (lastData && endOffset >= lastData->components.length()) { - endOffset -= lastData->components.length(); + while (lastData && endOffset >= lastData->components.size()) { + endOffset -= lastData->components.size(); lastData = lastData->parent; } if (endOffset > 0) { Q_ASSERT(lastData && "Internal problem, reference to non existing PathData"); return Path(0, m_length, std::shared_ptr<PathEls::PathData>( - new PathEls::PathData(lastData->strData, lastData->components.mid(0, lastData->components.length() - endOffset), lastData->parent))); + new PathEls::PathData(lastData->strData, lastData->components.mid(0, lastData->components.size() - endOffset), lastData->parent))); } return Path(0, m_length, lastData); } diff --git a/src/qmldom/qqmldomstringdumper.cpp b/src/qmldom/qqmldomstringdumper.cpp index a964a542e0..081a6abf81 100644 --- a/src/qmldom/qqmldomstringdumper.cpp +++ b/src/qmldom/qqmldomstringdumper.cpp @@ -63,7 +63,7 @@ void sinkEscaped(Sink sink, QStringView s, EscapeOptions options) { if (options == EscapeOptions::OuterQuotes) sink(u"\""); int it0=0; - for (int it = 0; it < s.length();++it) { + for (int it = 0; it < s.size();++it) { QChar c=s[it]; bool noslash = c != QLatin1Char('\\'); bool noquote = c != QLatin1Char('"'); @@ -84,7 +84,7 @@ void sinkEscaped(Sink sink, QStringView s, EscapeOptions options) { else Q_ASSERT(0); } - sink(s.mid(it0, s.length() - it0)); + sink(s.mid(it0, s.size() - it0)); if (options == EscapeOptions::OuterQuotes) sink(u"\""); } @@ -161,9 +161,9 @@ void sinkIndent(Sink s, int indent) { if (indent > 0) { QStringView spaces = u" "; - while (indent > spaces.length()) { + while (indent > spaces.size()) { s(spaces); - indent -= spaces.length(); + indent -= spaces.size(); } s(spaces.left(indent)); } diff --git a/src/qmldom/qqmldomtop_p.h b/src/qmldom/qqmldomtop_p.h index f1b0a3b76a..1e020600fc 100644 --- a/src/qmldom/qqmldomtop_p.h +++ b/src/qmldom/qqmldomtop_p.h @@ -567,7 +567,7 @@ public: int nNotDone() const { QMutexLocker l(mutex()); - return m_toDo.length() + m_inProgress.length(); + return m_toDo.size() + m_inProgress.size(); } QList<Dependency> inProgress() const @@ -585,7 +585,7 @@ public: int nCallbacks() const { QMutexLocker l(mutex()); - return m_endCallbacks.length(); + return m_endCallbacks.size(); } private: diff --git a/src/qmlmodels/qqmladaptormodel.cpp b/src/qmlmodels/qqmladaptormodel.cpp index 080cd90aa6..3be2474987 100644 --- a/src/qmlmodels/qqmladaptormodel.cpp +++ b/src/qmlmodels/qqmladaptormodel.cpp @@ -109,7 +109,7 @@ public: } QVector<int> signalIndexes; - for (int i = 0; i < roles.count(); ++i) { + for (int i = 0; i < roles.size(); ++i) { const int role = roles.at(i); if (!changed && watchedRoleIds.contains(role)) changed = true; @@ -119,7 +119,7 @@ public: signalIndexes.append(propertyId + signalOffset); } if (roles.isEmpty()) { - const int propertyRolesCount = propertyRoles.count(); + const int propertyRolesCount = propertyRoles.size(); signalIndexes.reserve(propertyRolesCount); for (int propertyId = 0; propertyId < propertyRolesCount; ++propertyId) signalIndexes.append(propertyId + signalOffset); @@ -135,7 +135,7 @@ public: const int idx = item->modelIndex(); if (idx >= index && idx < index + count) { - for (int i = 0; i < signalIndexes.count(); ++i) + for (int i = 0; i < signalIndexes.size(); ++i) QMetaObject::activate(item, signalIndexes.at(i), nullptr); } } @@ -226,7 +226,7 @@ QQmlDMCachedModelData::QQmlDMCachedModelData( , type(dataType) { if (index == -1) - cachedData.resize(type->hasModelData ? 1 : type->propertyRoles.count()); + cachedData.resize(type->hasModelData ? 1 : type->propertyRoles.size()); QObjectPrivate::get(this)->metaObject = type; @@ -250,10 +250,10 @@ int QQmlDMCachedModelData::metaCall(QMetaObject::Call call, int id, void **argum const int propertyIndex = id - type->propertyOffset; if (index == -1) { const QMetaObject *meta = metaObject(); - if (cachedData.count() > 1) { + if (cachedData.size() > 1) { cachedData[propertyIndex] = *static_cast<QVariant *>(arguments[0]); QMetaObject::activate(this, meta, propertyIndex, nullptr); - } else if (cachedData.count() == 1) { + } else if (cachedData.size() == 1) { cachedData[0] = *static_cast<QVariant *>(arguments[0]); QMetaObject::activate(this, meta, 0, nullptr); QMetaObject::activate(this, meta, 1, nullptr); @@ -271,7 +271,7 @@ void QQmlDMCachedModelData::setValue(const QString &role, const QVariant &value) { QHash<QByteArray, int>::iterator it = type->roleNames.find(role.toUtf8()); if (it != type->roleNames.end()) { - for (int i = 0; i < type->propertyRoles.count(); ++i) { + for (int i = 0; i < type->propertyRoles.size(); ++i) { if (type->propertyRoles.at(i) == *it) { cachedData[i] = value; return; @@ -287,7 +287,7 @@ bool QQmlDMCachedModelData::resolveIndex(const QQmlAdaptorModel &adaptorModel, i cachedData.clear(); setModelIndex(idx, adaptorModel.rowAt(idx), adaptorModel.columnAt(idx)); const QMetaObject *meta = metaObject(); - const int propertyCount = type->propertyRoles.count(); + const int propertyCount = type->propertyRoles.size(); for (int i = 0; i < propertyCount; ++i) QMetaObject::activate(this, meta, i, nullptr); return true; @@ -332,10 +332,10 @@ QV4::ReturnedValue QQmlDMCachedModelData::set_property(const QV4::FunctionObject if (o->d()->item->index == -1) { QQmlDMCachedModelData *modelData = static_cast<QQmlDMCachedModelData *>(o->d()->item); if (!modelData->cachedData.isEmpty()) { - if (modelData->cachedData.count() > 1) { + if (modelData->cachedData.size() > 1) { modelData->cachedData[propertyId] = scope.engine->toVariant(argv[0], QMetaType {}); QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, nullptr); - } else if (modelData->cachedData.count() == 1) { + } else if (modelData->cachedData.size() == 1) { modelData->cachedData[0] = scope.engine->toVariant(argv[0], QMetaType {}); QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, nullptr); QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, nullptr); @@ -496,12 +496,12 @@ public: const QAbstractItemModel *aim = model.aim(); const QHash<int, QByteArray> names = aim ? aim->roleNames() : QHash<int, QByteArray>(); for (QHash<int, QByteArray>::const_iterator it = names.begin(), cend = names.end(); it != cend; ++it) { - const int propertyId = propertyRoles.count(); + const int propertyId = propertyRoles.size(); propertyRoles.append(it.key()); roleNames.insert(it.value(), it.key()); addProperty(&builder, propertyId, it.value(), propertyType); } - if (propertyRoles.count() == 1) { + if (propertyRoles.size() == 1) { hasModelData = true; const int role = names.begin().key(); const QByteArray propertyName = QByteArrayLiteral("modelData"); diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp index ad7ffd22ce..e3b4adce7b 100644 --- a/src/qmlmodels/qqmldelegatemodel.cpp +++ b/src/qmlmodels/qqmldelegatemodel.cpp @@ -415,7 +415,7 @@ void QQmlDelegateModel::setModel(const QVariant &model) d->connectToAbstractItemModel(); d->m_adaptorModel.replaceWatchedRoles(QList<QByteArray>(), d->m_watchedRoles); - for (int i = 0; d->m_parts && i < d->m_parts->models.count(); ++i) { + for (int i = 0; d->m_parts && i < d->m_parts->models.size(); ++i) { d->m_adaptorModel.replaceWatchedRoles( QList<QByteArray>(), d->m_parts->models.at(i)->watchedRoles()); } @@ -659,7 +659,7 @@ void QQmlDelegateModel::cancel(int index) Compositor::Cache, it.cacheIndex(), 1, Compositor::CacheFlag); d->m_cache.removeAt(it.cacheIndex()); delete cacheItem; - Q_ASSERT(d->m_cache.count() == d->m_compositor.count(Compositor::Cache)); + Q_ASSERT(d->m_cache.size() == d->m_compositor.count(Compositor::Cache)); } } } @@ -1086,7 +1086,7 @@ void QQmlDelegateModelPrivate::addCacheItem(QQmlDelegateModelItem *item, Composi { m_cache.insert(it.cacheIndex(), item); m_compositor.setFlags(it, 1, Compositor::CacheFlag); - Q_ASSERT(m_cache.count() == m_compositor.count(Compositor::Cache)); + Q_ASSERT(m_cache.size() == m_compositor.count(Compositor::Cache)); } void QQmlDelegateModelPrivate::removeCacheItem(QQmlDelegateModelItem *cacheItem) @@ -1096,7 +1096,7 @@ void QQmlDelegateModelPrivate::removeCacheItem(QQmlDelegateModelItem *cacheItem) m_compositor.clearFlags(Compositor::Cache, cidx, 1, Compositor::CacheFlag); m_cache.removeAt(cidx); } - Q_ASSERT(m_cache.count() == m_compositor.count(Compositor::Cache)); + Q_ASSERT(m_cache.size() == m_compositor.count(Compositor::Cache)); } void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incubationTask, QQmlIncubator::Status status) @@ -1492,7 +1492,7 @@ void QQmlDelegateModelPrivate::itemsInserted( if (movedItems && insert.isMove()) { QList<QQmlDelegateModelItem *> items = movedItems->take(insert.moveId); - Q_ASSERT(items.count() == insert.count); + Q_ASSERT(items.size() == insert.count); m_cache = m_cache.mid(0, insert.cacheIndex()) + items + m_cache.mid(insert.cacheIndex()); } @@ -1519,7 +1519,7 @@ void QQmlDelegateModelPrivate::itemsInserted( cacheIndex = insert.cacheIndex() + insert.count; } } - for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.count(); ++cacheIndex) + for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.size(); ++cacheIndex) incrementIndexes(cache.at(cacheIndex), m_groupCount, inserted); } @@ -1527,7 +1527,7 @@ void QQmlDelegateModelPrivate::itemsInserted(const QVector<Compositor::Insert> & { QVarLengthArray<QVector<QQmlChangeSet::Change>, Compositor::MaximumGroupCount> translatedInserts(m_groupCount); itemsInserted(inserts, &translatedInserts); - Q_ASSERT(m_cache.count() == m_compositor.count(Compositor::Cache)); + Q_ASSERT(m_cache.size() == m_compositor.count(Compositor::Cache)); if (!m_delegate) return; @@ -1545,7 +1545,7 @@ void QQmlDelegateModel::_q_itemsInserted(int index, int count) d->m_count += count; const QList<QQmlDelegateModelItem *> cache = d->m_cache; - for (int i = 0, c = cache.count(); i < c; ++i) { + for (int i = 0, c = cache.size(); i < c; ++i) { QQmlDelegateModelItem *item = cache.at(i); // layout change triggered by changing the modelIndex might have // already invalidated this item in d->m_cache and deleted it. @@ -1623,7 +1623,7 @@ void QQmlDelegateModelPrivate::itemsRemoved( delete cacheItem; --cacheIndex; ++removedCache; - Q_ASSERT(m_cache.count() == m_compositor.count(Compositor::Cache)); + Q_ASSERT(m_cache.size() == m_compositor.count(Compositor::Cache)); } else if (remove.groups() == cacheItem->groups) { cacheItem->groups = 0; if (QQDMIncubationTask *incubationTask = cacheItem->incubationTask) { @@ -1667,7 +1667,7 @@ void QQmlDelegateModelPrivate::itemsRemoved( } } - for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.count(); ++cacheIndex) + for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.size(); ++cacheIndex) incrementIndexes(cache.at(cacheIndex), m_groupCount, removed); } @@ -1675,7 +1675,7 @@ void QQmlDelegateModelPrivate::itemsRemoved(const QVector<Compositor::Remove> &r { QVarLengthArray<QVector<QQmlChangeSet::Change>, Compositor::MaximumGroupCount> translatedRemoves(m_groupCount); itemsRemoved(removes, &translatedRemoves); - Q_ASSERT(m_cache.count() == m_compositor.count(Compositor::Cache)); + Q_ASSERT(m_cache.size() == m_compositor.count(Compositor::Cache)); if (!m_delegate) return; @@ -1696,7 +1696,7 @@ void QQmlDelegateModel::_q_itemsRemoved(int index, int count) for (QQmlDelegateModelItem *item : cache) item->referenceObject(); - for (int i = 0, c = cache.count(); i < c; ++i) { + for (int i = 0, c = cache.size(); i < c; ++i) { QQmlDelegateModelItem *item = cache.at(i); // layout change triggered by removal of a previous item might have // already invalidated this item in d->m_cache and deleted it @@ -1733,7 +1733,7 @@ void QQmlDelegateModelPrivate::itemsMoved( QVarLengthArray<QVector<QQmlChangeSet::Change>, Compositor::MaximumGroupCount> translatedInserts(m_groupCount); itemsInserted(inserts, &translatedInserts, &movedItems); - Q_ASSERT(m_cache.count() == m_compositor.count(Compositor::Cache)); + Q_ASSERT(m_cache.size() == m_compositor.count(Compositor::Cache)); Q_ASSERT(movedItems.isEmpty()); if (!m_delegate) return; @@ -1756,7 +1756,7 @@ void QQmlDelegateModel::_q_itemsMoved(int from, int to, int count) const int difference = from > to ? count : -count; const QList<QQmlDelegateModelItem *> cache = d->m_cache; - for (int i = 0, c = cache.count(); i < c; ++i) { + for (int i = 0, c = cache.size(); i < c; ++i) { QQmlDelegateModelItem *item = cache.at(i); // layout change triggered by changing the modelIndex might have // already invalidated this item in d->m_cache and deleted it. @@ -1856,7 +1856,7 @@ void QQmlDelegateModel::_q_modelReset() for (QQmlDelegateModelItem *item : cache) item->referenceObject(); - for (int i = 0, c = cache.count(); i < c; ++i) { + for (int i = 0, c = cache.size(); i < c; ++i) { QQmlDelegateModelItem *item = cache.at(i); // layout change triggered by changing the modelIndex might have // already invalidated this item in d->m_cache and deleted it. @@ -1977,7 +1977,7 @@ void QQmlDelegateModel::_q_dataChanged(const QModelIndex &begin, const QModelInd bool QQmlDelegateModel::isDescendantOf(const QPersistentModelIndex& desc, const QList< QPersistentModelIndex >& parents) const { - for (int i = 0, c = parents.count(); i < c; ++i) { + for (int i = 0, c = parents.size(); i < c; ++i) { for (QPersistentModelIndex parent = desc; parent.isValid(); parent = parent.parent()) { if (parent == parents[i]) return true; @@ -2061,7 +2061,7 @@ bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const QQmlDelegateModelItemMetaType::QQmlDelegateModelItemMetaType( QV4::ExecutionEngine *engine, QQmlDelegateModel *model, const QStringList &groupNames) : model(model) - , groupCount(groupNames.count() + 1) + , groupCount(groupNames.size() + 1) , v4Engine(engine) , metaObject(nullptr) , groupNames(groupNames) @@ -2082,7 +2082,7 @@ void QQmlDelegateModelItemMetaType::initializeMetaObject() builder.setSuperClass(&QQmlDelegateModelAttached::staticMetaObject); int notifierId = 0; - for (int i = 0; i < groupNames.count(); ++i, ++notifierId) { + for (int i = 0; i < groupNames.size(); ++i, ++notifierId) { QString propertyName = QLatin1String("in") + groupNames.at(i); propertyName.replace(2, 1, propertyName.at(2).toUpper()); builder.addSignal("__" + propertyName.toUtf8() + "Changed()"); @@ -2090,7 +2090,7 @@ void QQmlDelegateModelItemMetaType::initializeMetaObject() propertyName.toUtf8(), "bool", notifierId); propertyBuilder.setWritable(true); } - for (int i = 0; i < groupNames.count(); ++i, ++notifierId) { + for (int i = 0; i < groupNames.size(); ++i, ++notifierId) { const QString propertyName = groupNames.at(i) + QLatin1String("Index"); builder.addSignal("__" + propertyName.toUtf8() + "Changed()"); QMetaPropertyBuilder propertyBuilder = builder.addProperty( @@ -2137,7 +2137,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() p->setSetter(nullptr); proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); - for (int i = 2; i < groupNames.count(); ++i) { + for (int i = 2; i < groupNames.size(); ++i) { QString propertyName = QLatin1String("in") + groupNames.at(i); propertyName.replace(2, 1, propertyName.at(2).toUpper()); s = v4Engine->newString(propertyName); @@ -2145,7 +2145,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() p->setSetter((f = QV4::DelegateModelGroupFunction::create(global, i + 1, QQmlDelegateModelItem::set_member))); proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); } - for (int i = 2; i < groupNames.count(); ++i) { + for (int i = 2; i < groupNames.size(); ++i) { const QString propertyName = groupNames.at(i) + QLatin1String("Index"); s = v4Engine->newString(propertyName); p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, i + 1, QQmlDelegateModelItem::get_index))); @@ -2450,7 +2450,7 @@ QQmlDelegateModelAttachedMetaObject::QQmlDelegateModelAttachedMetaObject( : metaType(metaType) , metaObject(metaObject) , memberPropertyOffset(QQmlDelegateModelAttached::staticMetaObject.propertyCount()) - , indexPropertyOffset(QQmlDelegateModelAttached::staticMetaObject.propertyCount() + metaType->groupNames.count()) + , indexPropertyOffset(QQmlDelegateModelAttached::staticMetaObject.propertyCount() + metaType->groupNames.size()) { // Don't reference count the meta-type here as that would create a circular reference. // Instead we rely the fact that the meta-type's reference count can't reach 0 without first @@ -3240,7 +3240,7 @@ void QQmlDelegateModelGroup::resolve(QQmlV4Function *args) Compositor::Cache, toIt.cacheIndex(), resolvedList, resolvedIndex, 1, Compositor::CacheFlag); - Q_ASSERT(model->m_cache.count() == model->m_compositor.count(Compositor::Cache)); + Q_ASSERT(model->m_cache.size() == model->m_compositor.count(Compositor::Cache)); if (!cacheItem->isReferenced()) { Q_ASSERT(toIt.cacheIndex() == model->m_cache.indexOf(cacheItem)); @@ -3248,7 +3248,7 @@ void QQmlDelegateModelGroup::resolve(QQmlV4Function *args) model->m_compositor.clearFlags( Compositor::Cache, toIt.cacheIndex(), 1, Compositor::CacheFlag); delete cacheItem; - Q_ASSERT(model->m_cache.count() == model->m_compositor.count(Compositor::Cache)); + Q_ASSERT(model->m_cache.size() == model->m_compositor.count(Compositor::Cache)); } else { cacheItem->resolveIndex(model->m_adaptorModel, resolvedIndex); if (cacheItem->attached) @@ -3904,7 +3904,7 @@ public: return engine->memoryManager->allocate<QQmlDelegateModelGroupChangeArray>(changes); } - quint32 count() const { return d()->changes->count(); } + quint32 count() const { return d()->changes->size(); } const QQmlChangeSet::Change &at(int index) const { return d()->changes->at(index); } static QV4::ReturnedValue virtualGet(const QV4::Managed *m, QV4::PropertyKey id, const QV4::Value *receiver, bool *hasProperty) diff --git a/src/qmlmodels/qqmlinstantiator.cpp b/src/qmlmodels/qqmlinstantiator.cpp index 5b5ac7766e..fca56dd45a 100644 --- a/src/qmlmodels/qqmlinstantiator.cpp +++ b/src/qmlmodels/qqmlinstantiator.cpp @@ -39,10 +39,10 @@ void QQmlInstantiatorPrivate::clear() Q_Q(QQmlInstantiator); if (!instanceModel) return; - if (!objects.count()) + if (!objects.size()) return; - for (int i=0; i < objects.count(); i++) { + for (int i=0; i < objects.size(); i++) { q->objectRemoved(i, objects[i]); instanceModel->release(objects[i]); } @@ -103,7 +103,7 @@ void QQmlInstantiatorPrivate::_q_createdItem(int idx, QObject* item) if (QObject *o = objects.at(idx)) instanceModel->release(o); objects.replace(idx, item); - if (objects.count() == 1) + if (objects.size() == 1) q->objectChanged(); q->objectAdded(idx, item); } @@ -126,8 +126,8 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo QHash<int, QVector<QPointer<QObject> > > moved; const QVector<QQmlChangeSet::Change> &removes = changeSet.removes(); for (const QQmlChangeSet::Change &remove : removes) { - int index = qMin(remove.index, objects.count()); - int count = qMin(remove.index + remove.count, objects.count()) - index; + int index = qMin(remove.index, objects.size()); + int count = qMin(remove.index + remove.count, objects.size()) - index; if (remove.isMove()) { moved.insert(remove.moveId, objects.mid(index, count)); objects.erase( @@ -146,7 +146,7 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo const QVector<QQmlChangeSet::Change> &inserts = changeSet.inserts(); for (const QQmlChangeSet::Change &insert : inserts) { - int index = qMin(insert.index, objects.count()); + int index = qMin(insert.index, objects.size()); if (insert.isMove()) { QVector<QPointer<QObject> > movedObjects = moved.value(insert.moveId); objects = objects.mid(0, index) + movedObjects + objects.mid(index); @@ -288,7 +288,7 @@ void QQmlInstantiator::setAsync(bool newVal) int QQmlInstantiator::count() const { Q_D(const QQmlInstantiator); - return d->objects.count(); + return d->objects.size(); } /*! @@ -420,7 +420,7 @@ void QQmlInstantiator::setModel(const QVariant &v) QObject *QQmlInstantiator::object() const { Q_D(const QQmlInstantiator); - if (d->objects.count()) + if (d->objects.size()) return d->objects[0]; return nullptr; } @@ -433,7 +433,7 @@ QObject *QQmlInstantiator::object() const QObject *QQmlInstantiator::objectAt(int index) const { Q_D(const QQmlInstantiator); - if (index >= 0 && index < d->objects.count()) + if (index >= 0 && index < d->objects.size()) return d->objects[index]; return nullptr; } diff --git a/src/qmlmodels/qqmllistaccessor.cpp b/src/qmlmodels/qqmllistaccessor.cpp index d68d0a2b90..0e57c3c4e9 100644 --- a/src/qmlmodels/qqmllistaccessor.cpp +++ b/src/qmlmodels/qqmllistaccessor.cpp @@ -94,16 +94,16 @@ qsizetype QQmlListAccessor::count() const switch(m_type) { case StringList: Q_ASSERT(d.metaType() == QMetaType::fromType<QStringList>()); - return reinterpret_cast<const QStringList *>(d.constData())->count(); + return reinterpret_cast<const QStringList *>(d.constData())->size(); case UrlList: Q_ASSERT(d.metaType() == QMetaType::fromType<QList<QUrl>>()); - return reinterpret_cast<const QList<QUrl> *>(d.constData())->count(); + return reinterpret_cast<const QList<QUrl> *>(d.constData())->size(); case VariantList: Q_ASSERT(d.metaType() == QMetaType::fromType<QVariantList>()); - return reinterpret_cast<const QVariantList *>(d.constData())->count(); + return reinterpret_cast<const QVariantList *>(d.constData())->size(); case ObjectList: Q_ASSERT(d.metaType() == QMetaType::fromType<QList<QObject *>>()); - return reinterpret_cast<const QList<QObject *> *>(d.constData())->count(); + return reinterpret_cast<const QList<QObject *> *>(d.constData())->size(); case ListProperty: Q_ASSERT(d.metaType() == QMetaType::fromType<QQmlListReference>()); return reinterpret_cast<const QQmlListReference *>(d.constData())->count(); diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp index 1fd30ed227..11b7f682f8 100644 --- a/src/qmlmodels/qqmllistmodel.cpp +++ b/src/qmlmodels/qqmllistmodel.cpp @@ -140,7 +140,7 @@ const ListLayout::Role &ListLayout::createRole(const QString &key, ListLayout::R currentBlockOffset = dataOffset + dataSize; } - int roleIndex = roles.count(); + int roleIndex = roles.size(); r->index = roleIndex; roles.append(r); @@ -151,7 +151,7 @@ const ListLayout::Role &ListLayout::createRole(const QString &key, ListLayout::R ListLayout::ListLayout(const ListLayout *other) : currentBlock(0), currentBlockOffset(0) { - const int otherRolesCount = other->roles.count(); + const int otherRolesCount = other->roles.size(); roles.reserve(otherRolesCount); for (int i=0 ; i < otherRolesCount; ++i) { Role *role = new Role(other->roles[i]); @@ -169,8 +169,8 @@ ListLayout::~ListLayout() void ListLayout::sync(ListLayout *src, ListLayout *target) { - int roleOffset = target->roles.count(); - int newRoleCount = src->roles.count() - roleOffset; + int roleOffset = target->roles.size(); + int newRoleCount = src->roles.size() - roleOffset; for (int i=0 ; i < newRoleCount ; ++i) { Role *role = new Role(src->roles[roleOffset + i]); @@ -271,7 +271,7 @@ void StringOrTranslation::setString(const QString &s) QString::DataPointer dataPointer = mutableString.data_ptr(); arrayData = dataPointer->d_ptr(); stringData = dataPointer->data(); - stringSize = mutableString.length(); + stringSize = mutableString.size(); if (arrayData) arrayData->ref(); } @@ -1671,10 +1671,10 @@ void ModelNodeMetaObject::updateValues() void ModelNodeMetaObject::updateValues(const QVector<int> &roles) { if (!m_initialized) { - emitDirectNotifies(roles.constData(), roles.count()); + emitDirectNotifies(roles.constData(), roles.size()); return; } - int roleCount = roles.count(); + int roleCount = roles.size(); for (int i=0 ; i < roleCount ; ++i) { int roleIndex = roles.at(i); const ListLayout::Role &role = m_model->m_listModel->getExistingRole(roleIndex); @@ -1872,7 +1872,7 @@ void DynamicRoleModelNode::updateValues(const QVariantMap &object, QVector<int> int roleIndex = m_owner->m_roles.indexOf(key); if (roleIndex == -1) { - roleIndex = m_owner->m_roles.count(); + roleIndex = m_owner->m_roles.size(); m_owner->m_roles.append(key); } @@ -2172,7 +2172,7 @@ bool QQmlListModel::sync(QQmlListModel *src, QQmlListModel *target) // Build hash of elements <-> uid for each of the lists QHash<int, ElementSync> elementHash; - for (int i = 0 ; i < target->m_modelObjects.count(); ++i) { + for (int i = 0 ; i < target->m_modelObjects.size(); ++i) { DynamicRoleModelNode *e = target->m_modelObjects.at(i); int uid = e->getUid(); ElementSync sync; @@ -2180,7 +2180,7 @@ bool QQmlListModel::sync(QQmlListModel *src, QQmlListModel *target) sync.targetIndex = i; elementHash.insert(uid, sync); } - for (int i = 0 ; i < src->m_modelObjects.count(); ++i) { + for (int i = 0 ; i < src->m_modelObjects.size(); ++i) { DynamicRoleModelNode *e = src->m_modelObjects.at(i); int uid = e->getUid(); @@ -2199,7 +2199,7 @@ bool QQmlListModel::sync(QQmlListModel *src, QQmlListModel *target) // Get list of elements that are in the target but no longer in the source. These get deleted first. int rowsRemoved = 0; - for (int i = 0 ; i < target->m_modelObjects.count() ; ++i) { + for (int i = 0 ; i < target->m_modelObjects.size() ; ++i) { DynamicRoleModelNode *element = target->m_modelObjects.at(i); ElementSync &s = elementHash.find(element->getUid()).value(); Q_ASSERT(s.targetIndex >= 0); @@ -2220,7 +2220,7 @@ bool QQmlListModel::sync(QQmlListModel *src, QQmlListModel *target) // Clear the target list, and append in correct order from the source target->m_modelObjects.clear(); - for (int i = 0 ; i < src->m_modelObjects.count() ; ++i) { + for (int i = 0 ; i < src->m_modelObjects.size() ; ++i) { DynamicRoleModelNode *element = src->m_modelObjects.at(i); ElementSync &s = elementHash.find(element->getUid()).value(); Q_ASSERT(s.srcIndex >= 0); @@ -2238,7 +2238,7 @@ bool QQmlListModel::sync(QQmlListModel *src, QQmlListModel *target) // to ensure things are kept in the correct order, emit inserts and moves first. This shouls ensure all persistent // model indices are updated correctly int rowsInserted = 0; - for (int i = 0 ; i < target->m_modelObjects.count() ; ++i) { + for (int i = 0 ; i < target->m_modelObjects.size() ; ++i) { DynamicRoleModelNode *element = target->m_modelObjects.at(i); ElementSync &s = elementHash.find(element->getUid()).value(); Q_ASSERT(s.srcIndex >= 0); @@ -2357,7 +2357,7 @@ QHash<int, QByteArray> QQmlListModel::roleNames() const QHash<int, QByteArray> roleNames; if (m_dynamicRoles) { - for (int i = 0 ; i < m_roles.count() ; ++i) + for (int i = 0 ; i < m_roles.size() ; ++i) roleNames.insert(i, m_roles.at(i).toUtf8()); } else { for (int i = 0 ; i < m_listModel->roleCount() ; ++i) { @@ -2404,7 +2404,7 @@ void QQmlListModel::setDynamicRoles(bool enableDynamicRoles) else m_dynamicRoles = true; } else { - if (m_roles.count()) { + if (m_roles.size()) { qmlWarning(this) << tr("unable to enable static roles as this model is not empty"); } else { m_dynamicRoles = false; @@ -2421,7 +2421,7 @@ void QQmlListModel::setDynamicRoles(bool enableDynamicRoles) */ int QQmlListModel::count() const { - return m_dynamicRoles ? m_modelObjects.count() : m_listModel->elementCount(); + return m_dynamicRoles ? m_modelObjects.size() : m_listModel->elementCount(); } /*! @@ -2678,7 +2678,7 @@ void QQmlListModel::append(QQmlV4Function *args) int index; if (m_dynamicRoles) { - index = m_modelObjects.count(); + index = m_modelObjects.size(); emitItemsAboutToBeInserted(index, 1); m_modelObjects.append(DynamicRoleModelNode::create(scope.engine->variantMapFromJS(argObject), this)); } else { @@ -2804,7 +2804,7 @@ void QQmlListModel::set(int index, const QJSValue &value) m_listModel->set(index, object, &roles); } - if (roles.count()) + if (roles.size()) emitItemsChanged(index, 1, roles); } } @@ -2832,7 +2832,7 @@ void QQmlListModel::setProperty(int index, const QString& property, const QVaria if (m_dynamicRoles) { int roleIndex = m_roles.indexOf(property); if (roleIndex == -1) { - roleIndex = m_roles.count(); + roleIndex = m_roles.size(); m_roles.append(property); } if (m_modelObjects[index]->setValue(property.toUtf8(), value)) @@ -3035,7 +3035,7 @@ void QQmlListModelParser::applyBindings(QObject *obj, const QQmlRefPointer<QV4:: bool QQmlListModelParser::definesEmptyList(const QString &s) { if (s.startsWith(QLatin1Char('[')) && s.endsWith(QLatin1Char(']'))) { - for (int i=1; i<s.length()-1; i++) { + for (int i=1; i<s.size()-1; i++) { if (!s[i].isSpace()) return false; } diff --git a/src/qmlmodels/qqmllistmodel_p_p.h b/src/qmlmodels/qqmllistmodel_p_p.h index 0499c6a1a0..4874f0deaa 100644 --- a/src/qmlmodels/qqmllistmodel_p_p.h +++ b/src/qmlmodels/qqmllistmodel_p_p.h @@ -202,7 +202,7 @@ public: const Role *getExistingRole(const QString &key) const; const Role *getExistingRole(QV4::String *key) const; - int roleCount() const { return roles.count(); } + int roleCount() const { return roles.size(); } static void sync(ListLayout *src, ListLayout *target); diff --git a/src/qmlmodels/qqmlobjectmodel.cpp b/src/qmlmodels/qqmlobjectmodel.cpp index 118b2fab78..970a1e541f 100644 --- a/src/qmlmodels/qqmlobjectmodel.cpp +++ b/src/qmlmodels/qqmlobjectmodel.cpp @@ -39,12 +39,12 @@ public: QQmlObjectModelPrivate() : QObjectPrivate(), moveId(0) {} static void children_append(QQmlListProperty<QObject> *prop, QObject *item) { - qsizetype index = static_cast<QQmlObjectModelPrivate *>(prop->data)->children.count(); + qsizetype index = static_cast<QQmlObjectModelPrivate *>(prop->data)->children.size(); static_cast<QQmlObjectModelPrivate *>(prop->data)->insert(index, item); } static qsizetype children_count(QQmlListProperty<QObject> *prop) { - return static_cast<QQmlObjectModelPrivate *>(prop->data)->children.count(); + return static_cast<QQmlObjectModelPrivate *>(prop->data)->children.size(); } static QObject *children_at(QQmlListProperty<QObject> *prop, qsizetype index) { @@ -61,13 +61,13 @@ public: static void children_removeLast(QQmlListProperty<QObject> *prop) { auto data = static_cast<QQmlObjectModelPrivate *>(prop->data); - data->remove(data->children.count() - 1, 1); + data->remove(data->children.size() - 1, 1); } void insert(int index, QObject *item) { Q_Q(QQmlObjectModel); children.insert(index, Item(item)); - for (int i = index; i < children.count(); ++i) { + for (int i = index; i < children.size(); ++i) { QQmlObjectModelAttached *attached = QQmlObjectModelAttached::properties(children.at(i).item); attached->setIndex(i); } @@ -126,7 +126,7 @@ public: attached->setIndex(-1); } children.erase(children.begin() + index, children.begin() + index + n); - for (int i = index; i < children.count(); ++i) { + for (int i = index; i < children.size(); ++i) { QQmlObjectModelAttached *attached = QQmlObjectModelAttached::properties(children.at(i).item); attached->setIndex(i); } @@ -142,11 +142,11 @@ public: const auto copy = children; for (const Item &child : copy) emit q->destroyingItem(child.item); - remove(0, children.count()); + remove(0, children.size()); } int indexOf(QObject *item) const { - for (int i = 0; i < children.count(); ++i) + for (int i = 0; i < children.size(); ++i) if (children.at(i).item == item) return i; return -1; @@ -231,7 +231,7 @@ QQmlListProperty<QObject> QQmlObjectModel::children() int QQmlObjectModel::count() const { Q_D(const QQmlObjectModel); - return d->children.count(); + return d->children.size(); } bool QQmlObjectModel::isValid() const @@ -265,7 +265,7 @@ QQmlInstanceModel::ReleaseFlags QQmlObjectModel::release(QObject *item, Reusable QVariant QQmlObjectModel::variantValue(int index, const QString &role) { Q_D(QQmlObjectModel); - if (index < 0 || index >= d->children.count()) + if (index < 0 || index >= d->children.size()) return QString(); return d->children.at(index).item->property(role.toUtf8().constData()); } @@ -308,7 +308,7 @@ QQmlObjectModelAttached *QQmlObjectModel::qmlAttachedProperties(QObject *obj) QObject *QQmlObjectModel::get(int index) const { Q_D(const QQmlObjectModel); - if (index < 0 || index >= d->children.count()) + if (index < 0 || index >= d->children.size()) return nullptr; return d->children.at(index).item; } diff --git a/src/qmlmodels/qqmltableinstancemodel.cpp b/src/qmlmodels/qqmltableinstancemodel.cpp index 39102c27c9..b6836be349 100644 --- a/src/qmlmodels/qqmltableinstancemodel.cpp +++ b/src/qmlmodels/qqmltableinstancemodel.cpp @@ -409,7 +409,7 @@ void QQmlTableInstanceModel::deleteIncubationTaskLater(QQmlIncubator *incubation // delete them while we're in the middle of an incubation change callback. Q_ASSERT(!m_finishedIncubationTasks.contains(incubationTask)); m_finishedIncubationTasks.append(incubationTask); - if (m_finishedIncubationTasks.count() == 1) + if (m_finishedIncubationTasks.size() == 1) QTimer::singleShot(1, this, &QQmlTableInstanceModel::deleteAllFinishedIncubationTasks); } diff --git a/src/qmlmodels/qqmltreemodeltotablemodel.cpp b/src/qmlmodels/qqmltreemodeltotablemodel.cpp index 930b113811..0bc6239014 100644 --- a/src/qmlmodels/qqmltreemodeltotablemodel.cpp +++ b/src/qmlmodels/qqmltreemodeltotablemodel.cpp @@ -133,7 +133,7 @@ int QQmlTreeModelToTableModel::rowCount(const QModelIndex &) const { if (!m_model) return 0; - return m_items.count(); + return m_items.size(); } int QQmlTreeModelToTableModel::columnCount(const QModelIndex &parent) const @@ -166,7 +166,7 @@ QVariant QQmlTreeModelToTableModel::headerData(int section, Qt::Orientation orie int QQmlTreeModelToTableModel::depthAtRow(int row) const { - if (row < 0 || row >= m_items.count()) + if (row < 0 || row >= m_items.size()) return 0; return m_items.at(row).depth; } @@ -177,7 +177,7 @@ int QQmlTreeModelToTableModel::itemIndex(const QModelIndex &index) const if (!index.isValid() || index == m_rootIndex || m_items.isEmpty()) return -1; - const int totalCount = m_items.count(); + const int totalCount = m_items.size(); // We start nearest to the lastViewedItem int localCount = qMin(m_lastItemIndex - 1, totalCount - m_lastItemIndex); @@ -232,7 +232,7 @@ QModelIndex QQmlTreeModelToTableModel::mapToModel(const QModelIndex &index) cons return QModelIndex(); const int row = index.row(); - if (row < 0 || row > m_items.count() - 1) + if (row < 0 || row > m_items.size() - 1) return QModelIndex(); const QModelIndex sourceIndex = m_items.at(row).index; @@ -245,7 +245,7 @@ QModelIndex QQmlTreeModelToTableModel::mapFromModel(const QModelIndex &index) co return QModelIndex(); int row = -1; - for (int i = 0; i < m_items.count(); ++i) { + for (int i = 0; i < m_items.size(); ++i) { const QModelIndex proxyIndex = m_items[i].index; if (proxyIndex.row() == index.row() && proxyIndex.parent() == index.parent()) { row = i; @@ -261,7 +261,7 @@ QModelIndex QQmlTreeModelToTableModel::mapFromModel(const QModelIndex &index) co QModelIndex QQmlTreeModelToTableModel::mapToModel(int row) const { - if (row < 0 || row >= m_items.count()) + if (row < 0 || row >= m_items.size()) return QModelIndex(); return m_items.at(row).index; } @@ -314,7 +314,7 @@ QItemSelection QQmlTreeModelToTableModel::selectionForRowRange(const QModelInde } QItemSelection sel; - sel.reserve(ranges.count()); + sel.reserve(ranges.size()); for (const MIPair &pair : qAsConst(ranges)) sel.append(QItemSelectionRange(pair.first, pair.second)); @@ -368,7 +368,7 @@ void QQmlTreeModelToTableModel::showModelChildItems(const TreeItem &parentItem, int rowDepth = rowIdx == 0 ? 0 : parentItem.depth + 1; if (doInsertRows) beginInsertRows(QModelIndex(), startIdx, startIdx + insertCount - 1); - m_items.reserve(m_items.count() + insertCount); + m_items.reserve(m_items.size() + insertCount); for (int i = 0; i < insertCount; i++) { const QModelIndex &cmi = m_model->index(start + i, 0, parentIndex); @@ -446,14 +446,14 @@ bool QQmlTreeModelToTableModel::isExpanded(const QModelIndex &index) const bool QQmlTreeModelToTableModel::isExpanded(int row) const { - if (row < 0 || row >= m_items.count()) + if (row < 0 || row >= m_items.size()) return false; return m_items.at(row).expanded; } bool QQmlTreeModelToTableModel::hasChildren(int row) const { - if (row < 0 || row >= m_items.count()) + if (row < 0 || row >= m_items.size()) return false; return m_model->hasChildren(m_items[row].index); } @@ -591,7 +591,7 @@ int QQmlTreeModelToTableModel::lastChildIndex(const QModelIndex &index) const parent = parent.parent(); } - int firstIndex = nextSiblingIndex.isValid() ? itemIndex(nextSiblingIndex) : m_items.count(); + int firstIndex = nextSiblingIndex.isValid() ? itemIndex(nextSiblingIndex) : m_items.size(); return firstIndex - 1; } @@ -607,7 +607,7 @@ void QQmlTreeModelToTableModel::removeVisibleRows(int startIndex, int endIndex, endRemoveRows(); /* We need to update the model index for all the items below the removed ones */ - int lastIndex = m_items.count() - 1; + int lastIndex = m_items.size() - 1; if (startIndex <= lastIndex) { const QModelIndex &topLeft = index(startIndex, 0, QModelIndex()); const QModelIndex &bottomRight = index(lastIndex, 0, QModelIndex()); @@ -647,7 +647,7 @@ void QQmlTreeModelToTableModel::modelDataChanged(const QModelIndex &topLeft, con for (int i = topLeft.row(); i <= bottomRight.row(); i++) { // Group items with same parent to minize the number of 'dataChanged()' emits int bottomIndex = topIndex; - while (bottomIndex < m_items.count()) { + while (bottomIndex < m_items.size()) { const QModelIndex &idx = m_items.at(bottomIndex).index; if (idx.parent() != parent) { --bottomIndex; @@ -663,7 +663,7 @@ void QQmlTreeModelToTableModel::modelDataChanged(const QModelIndex &topLeft, con if (i == bottomRight.row()) break; topIndex = bottomIndex + 1; - while (topIndex < m_items.count() + while (topIndex < m_items.size() && m_items.at(topIndex).index.parent() != parent) topIndex++; } @@ -730,7 +730,7 @@ void QQmlTreeModelToTableModel::modelLayoutChanged(const QList<QPersistentModelI showModelTopLevelItems(false /*doInsertRows*/); const QModelIndex &mi = m_model->index(0, 0); const int columnCount = m_model->columnCount(mi); - emit dataChanged(index(0, 0), index(m_items.count() - 1, columnCount - 1)); + emit dataChanged(index(0, 0), index(m_items.size() - 1, columnCount - 1)); emit layoutChanged(); return; } @@ -901,7 +901,7 @@ void QQmlTreeModelToTableModel::modelRowsAboutToBeMoved(const QModelIndex & sour } bufferCopyOffset = destIndex; } - for (int i = 0; i < buffer.length(); i++) { + for (int i = 0; i < buffer.size(); i++) { TreeItem item = buffer.at(i); item.depth += depthDifference; m_items.replace(bufferCopyOffset + i, item); @@ -970,7 +970,7 @@ void QQmlTreeModelToTableModel::dump() const { if (!m_model) return; - int count = m_items.count(); + int count = m_items.size(); if (count == 0) return; int countWidth = floor(log10(double(count))) + 1; @@ -1002,7 +1002,7 @@ bool QQmlTreeModelToTableModel::testConsistency(bool dumpOnFail) const QModelIndex parent = m_rootIndex; QStack<QModelIndex> ancestors; QModelIndex idx = m_model->index(0, 0, parent); - for (int i = 0; i < m_items.count(); i++) { + for (int i = 0; i < m_items.size(); i++) { bool isConsistent = true; const TreeItem &item = m_items.at(i); if (item.index != idx) { @@ -1015,9 +1015,9 @@ bool QQmlTreeModelToTableModel::testConsistency(bool dumpOnFail) const qWarning() << " stored index parent" << item.index.parent() << "model parent" << parent; isConsistent = false; } - if (item.depth != ancestors.count()) { + if (item.depth != ancestors.size()) { qWarning() << "Depth inconsistency" << i << item.index; - qWarning() << " item depth" << item.depth << "ancestors stack" << ancestors.count(); + qWarning() << " item depth" << item.depth << "ancestors stack" << ancestors.size(); isConsistent = false; } if (item.expanded && !m_expandedItems.contains(item.index)) { diff --git a/src/qmlmodels/qquickpackage.cpp b/src/qmlmodels/qquickpackage.cpp index a7532a49df..70a3a6c19b 100644 --- a/src/qmlmodels/qquickpackage.cpp +++ b/src/qmlmodels/qquickpackage.cpp @@ -80,7 +80,7 @@ public: } static qsizetype data_count(QQmlListProperty<QObject> *prop) { QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data); - return list->count(); + return list->size(); } static void data_replace(QQmlListProperty<QObject> *prop, qsizetype index, QObject *o) { QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data); @@ -135,7 +135,7 @@ QQmlListProperty<QObject> QQuickPackage::data() bool QQuickPackage::hasPart(const QString &name) { Q_D(QQuickPackage); - for (int ii = 0; ii < d->dataList.count(); ++ii) { + for (int ii = 0; ii < d->dataList.size(); ++ii) { QObject *obj = d->dataList.at(ii); QQuickPackageAttached *a = QQuickPackageAttached::attached.value(obj); if (a && a->name() == name) @@ -150,7 +150,7 @@ QObject *QQuickPackage::part(const QString &name) if (name.isEmpty() && !d->dataList.isEmpty()) return d->dataList.at(0); - for (int ii = 0; ii < d->dataList.count(); ++ii) { + for (int ii = 0; ii < d->dataList.size(); ++ii) { QObject *obj = d->dataList.at(ii); QQuickPackageAttached *a = QQuickPackageAttached::attached.value(obj); if (a && a->name() == name) diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index a048c43e76..766c633326 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -161,8 +161,8 @@ bool QQuickTest::qWaitForPolish(const QQuickWindow *window, int timeout) static inline QString stripQuotes(const QString &s) { - if (s.length() >= 2 && s.startsWith(QLatin1Char('"')) && s.endsWith(QLatin1Char('"'))) - return s.mid(1, s.length() - 2); + if (s.size() >= 2 && s.startsWith(QLatin1Char('"')) && s.endsWith(QLatin1Char('"'))) + return s.mid(1, s.size() - 2); else return s; } @@ -656,7 +656,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch qWarning() << "Could not find the following test functions:"; for (const QString &functionName : qAsConst(commandLineTestFunctions)) qWarning(" %s()", qUtf8Printable(functionName)); - return commandLineTestFunctions.count(); + return commandLineTestFunctions.size(); } // Return the number of failures as the exit code. diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp index 28d6c073fd..b1b8e60eab 100644 --- a/src/qmltest/quicktestevent.cpp +++ b/src/qmltest/quicktestevent.cpp @@ -57,7 +57,7 @@ bool QuickTestEvent::keyClick(int key, int modifiers, int delay) bool QuickTestEvent::keyPressChar(const QString &character, int modifiers, int delay) { - QTEST_ASSERT(character.length() == 1); + QTEST_ASSERT(character.size() == 1); QWindow *window = activeWindow(); if (!window) return false; @@ -67,7 +67,7 @@ bool QuickTestEvent::keyPressChar(const QString &character, int modifiers, int d bool QuickTestEvent::keyReleaseChar(const QString &character, int modifiers, int delay) { - QTEST_ASSERT(character.length() == 1); + QTEST_ASSERT(character.size() == 1); QWindow *window = activeWindow(); if (!window) return false; @@ -77,7 +77,7 @@ bool QuickTestEvent::keyReleaseChar(const QString &character, int modifiers, int bool QuickTestEvent::keyClickChar(const QString &character, int modifiers, int delay) { - QTEST_ASSERT(character.length() == 1); + QTEST_ASSERT(character.size() == 1); QWindow *window = activeWindow(); if (!window) return false; diff --git a/src/qmlworkerscript/qv4serialize.cpp b/src/qmlworkerscript/qv4serialize.cpp index 1906d164f6..d445299828 100644 --- a/src/qmlworkerscript/qv4serialize.cpp +++ b/src/qmlworkerscript/qv4serialize.cpp @@ -106,7 +106,7 @@ static inline void *popPtr(const char *&data) #define ALIGN(size) (((size) + 3) & ~3) static inline void serializeString(QByteArray &data, const QString &str, Type type) { - int length = str.length(); + int length = str.size(); if (length > 0xFFFFFF) { push(data, valueheader(WorkerUndefined)); return; @@ -174,7 +174,7 @@ void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine } else if (const RegExpObject *re = v.as<RegExpObject>()) { quint32 flags = re->flags(); QString pattern = re->source(); - int length = pattern.length() + 1; + int length = pattern.size() + 1; if (length > 0xFFFFFF) { push(data, valueheader(WorkerUndefined)); return; diff --git a/src/qmlxmllistmodel/qqmlxmllistmodel.cpp b/src/qmlxmllistmodel/qqmlxmllistmodel.cpp index 72c3b21e87..2f40bd525b 100644 --- a/src/qmlxmllistmodel/qqmlxmllistmodel.cpp +++ b/src/qmlxmllistmodel/qqmlxmllistmodel.cpp @@ -363,7 +363,7 @@ QVariant QQmlXmlListModel::data(const QModelIndex &index, int role) const QHash<int, QByteArray> QQmlXmlListModel::roleNames() const { QHash<int, QByteArray> roleNames; - for (int i = 0; i < m_roles.count(); ++i) + for (int i = 0; i < m_roles.size(); ++i) roleNames.insert(m_roles.at(i), m_roleNames.at(i).toUtf8()); return roleNames; } @@ -437,7 +437,7 @@ QQmlListProperty<QQmlXmlListModelRole> QQmlXmlListModel::roleObjects() void QQmlXmlListModel::appendRole(QQmlXmlListModelRole *role) { if (role) { - int i = m_roleObjects.count(); + int i = m_roleObjects.size(); m_roleObjects.append(role); if (m_roleNames.contains(role->name())) { qmlWarning(role) @@ -519,7 +519,7 @@ QQmlXmlListModelQueryJob QQmlXmlListModel::createJob(const QByteArray &data) job.data = data; job.query = m_query; - for (int i = 0; i < m_roleObjects.count(); i++) { + for (int i = 0; i < m_roleObjects.size(); i++) { if (!m_roleObjects.at(i)->isValid()) { job.roleNames << QString(); job.elementNames << QString(); @@ -744,7 +744,7 @@ void QQmlXmlListModel::dataCleared() void QQmlXmlListModel::queryError(void *object, const QString &error) { - for (int i = 0; i < m_roleObjects.count(); i++) { + for (int i = 0; i < m_roleObjects.size(); i++) { if (m_roleObjects.at(i) == static_cast<QQmlXmlListModelRole *>(object)) { qmlWarning(m_roleObjects.at(i)) << QQmlXmlListModel::tr("Query error: \"%1\"").arg(error); @@ -760,7 +760,7 @@ void QQmlXmlListModel::queryCompleted(const QQmlXmlListModelQueryResult &result) return; int origCount = m_size; - bool sizeChanged = result.data.count() != m_size; + bool sizeChanged = result.data.size() != m_size; if (m_source.isEmpty()) m_status = Null; @@ -773,7 +773,7 @@ void QQmlXmlListModel::queryCompleted(const QQmlXmlListModelQueryResult &result) beginRemoveRows(QModelIndex(), 0, origCount - 1); endRemoveRows(); } - m_size = result.data.count(); + m_size = result.data.size(); m_data = result.data; if (m_size > 0) { @@ -841,10 +841,10 @@ void QQmlXmlListModelQueryRunnable::doQueryJob(QQmlXmlListModelQueryResult *curr while (!reader.atEnd() && !m_promise.isCanceled()) { int i = 0; - while (i < items.count()) { + while (i < items.size()) { if (reader.readNextStartElement()) { if (reader.name() == items.at(i)) { - if (i != items.count() - 1) { + if (i != items.size() - 1) { i++; continue; } else { diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp index e891b5c132..c47a94e3aa 100644 --- a/src/quick/accessible/qaccessiblequickitem.cpp +++ b/src/quick/accessible/qaccessiblequickitem.cpp @@ -46,7 +46,7 @@ public: QString anchor() const override { const QVector<QQuickTextPrivate::LinkDesc> links = QQuickTextPrivate::get(textItem())->getLinks(); - if (linkIndex < links.count()) + if (linkIndex < links.size()) return links.at(linkIndex).m_anchor; return QString(); } @@ -54,7 +54,7 @@ public: QString anchorTarget() const override { const QVector<QQuickTextPrivate::LinkDesc> links = QQuickTextPrivate::get(textItem())->getLinks(); - if (linkIndex < links.count()) + if (linkIndex < links.size()) return links.at(linkIndex).m_anchorTarget; return QString(); } @@ -62,7 +62,7 @@ public: int startIndex() const override { const QVector<QQuickTextPrivate::LinkDesc> links = QQuickTextPrivate::get(textItem())->getLinks(); - if (linkIndex < links.count()) + if (linkIndex < links.size()) return links.at(linkIndex).m_startIndex; return -1; } @@ -70,7 +70,7 @@ public: int endIndex() const override { const QVector<QQuickTextPrivate::LinkDesc> links = QQuickTextPrivate::get(textItem())->getLinks(); - if (linkIndex < links.count()) + if (linkIndex < links.size()) return links.at(linkIndex).m_endIndex; return -1; } @@ -113,7 +113,7 @@ QWindow *QAccessibleHyperlink::window() const QRect QAccessibleHyperlink::rect() const { const QVector<QQuickTextPrivate::LinkDesc> links = QQuickTextPrivate::get(textItem())->getLinks(); - if (linkIndex < links.count()) { + if (linkIndex < links.size()) { const QPoint tl = itemScreenRect(textItem()).topLeft(); return links.at(linkIndex).rect.translated(tl); } @@ -232,9 +232,9 @@ int QAccessibleQuickItem::childCount() const // see comment in QAccessibleQuickItem::child() as to why we do this int cc = 0; if (QQuickText *textItem = qobject_cast<QQuickText*>(item())) { - cc = QQuickTextPrivate::get(textItem)->getLinks().count(); + cc = QQuickTextPrivate::get(textItem)->getLinks().size(); } - cc += childItems().count(); + cc += childItems().size(); return cc; } @@ -271,7 +271,7 @@ QAccessibleInterface *QAccessibleQuickItem::childAt(int x, int y) const // special case for text interfaces if (QQuickText *textItem = qobject_cast<QQuickText*>(item())) { - const auto hyperLinkChildCount = QQuickTextPrivate::get(textItem)->getLinks().count(); + const auto hyperLinkChildCount = QQuickTextPrivate::get(textItem)->getLinks().size(); for (auto i = 0; i < hyperLinkChildCount; i++) { QAccessibleInterface *iface = child(i); if (iface->rect().contains(x,y)) { @@ -282,7 +282,7 @@ QAccessibleInterface *QAccessibleQuickItem::childAt(int x, int y) const // general item hit test const QList<QQuickItem*> kids = accessibleUnignoredChildren(item(), true); - for (int i = kids.count() - 1; i >= 0; --i) { + for (int i = kids.size() - 1; i >= 0; --i) { QAccessibleInterface *childIface = QAccessible::queryAccessibleInterface(kids.at(i)); if (QAccessibleInterface *childChild = childIface->childAt(x, y)) return childChild; @@ -344,7 +344,7 @@ QAccessibleInterface *QAccessibleQuickItem::child(int index) const if (QQuickText *textItem = qobject_cast<QQuickText*>(item())) { - const int hyperLinkChildCount = QQuickTextPrivate::get(textItem)->getLinks().count(); + const int hyperLinkChildCount = QQuickTextPrivate::get(textItem)->getLinks().size(); if (index < hyperLinkChildCount) { auto it = m_childToId.constFind(index); if (it != m_childToId.constEnd()) @@ -359,7 +359,7 @@ QAccessibleInterface *QAccessibleQuickItem::child(int index) const } QList<QQuickItem *> children = childItems(); - if (index < children.count()) { + if (index < children.size()) { QQuickItem *child = children.at(index); return QAccessible::queryAccessibleInterface(child); } @@ -370,7 +370,7 @@ int QAccessibleQuickItem::indexOfChild(const QAccessibleInterface *iface) const { int hyperLinkChildCount = 0; if (QQuickText *textItem = qobject_cast<QQuickText*>(item())) { - hyperLinkChildCount = QQuickTextPrivate::get(textItem)->getLinks().count(); + hyperLinkChildCount = QQuickTextPrivate::get(textItem)->getLinks().size(); if (QAccessibleHyperlinkInterface *hyperLinkIface = const_cast<QAccessibleInterface *>(iface)->hyperlinkInterface()) { // ### assumes that there is only one subclass implementing QAccessibleHyperlinkInterface // Alternatively, we could simply iterate with child() and do a linear search for it diff --git a/src/quick/accessible/qaccessiblequickview.cpp b/src/quick/accessible/qaccessiblequickview.cpp index 3f327619c8..5cd93b9613 100644 --- a/src/quick/accessible/qaccessiblequickview.cpp +++ b/src/quick/accessible/qaccessiblequickview.cpp @@ -28,7 +28,7 @@ QList<QQuickItem *> QAccessibleQuickWindow::rootItems() const int QAccessibleQuickWindow::childCount() const { - return rootItems().count(); + return rootItems().size(); } QAccessibleInterface *QAccessibleQuickWindow::parent() const @@ -40,7 +40,7 @@ QAccessibleInterface *QAccessibleQuickWindow::parent() const QAccessibleInterface *QAccessibleQuickWindow::child(int index) const { const QList<QQuickItem*> &kids = rootItems(); - if (index >= 0 && index < kids.count()) + if (index >= 0 && index < kids.size()) return QAccessible::queryAccessibleInterface(kids.at(index)); return nullptr; } @@ -109,7 +109,7 @@ int QAccessibleQuickWindow::indexOfChild(const QAccessibleInterface *iface) cons int i = -1; if (iface) { const QList<QQuickItem *> &roots = rootItems(); - i = roots.count() - 1; + i = roots.size() - 1; while (i >= 0) { if (iface->object() == roots.at(i)) break; diff --git a/src/quick/designer/qqmldesignermetaobject.cpp b/src/quick/designer/qqmldesignermetaobject.cpp index 4bd221481b..e368f5f443 100644 --- a/src/quick/designer/qqmldesignermetaobject.cpp +++ b/src/quick/designer/qqmldesignermetaobject.cpp @@ -17,7 +17,7 @@ static void (*notifyPropertyChangeCallBack)(QObject*, const QQuickDesignerSuppor struct MetaPropertyData { inline QPair<QVariant, bool> &getDataRef(int idx) { - while (m_data.count() <= idx) + while (m_data.size() <= idx) m_data << QPair<QVariant, bool>(QVariant(), false); return m_data[idx]; } @@ -32,12 +32,12 @@ struct MetaPropertyData { } inline bool hasData(int idx) const { - if (idx >= m_data.count()) + if (idx >= m_data.size()) return false; return m_data[idx].second; } - inline int count() { return m_data.count(); } + inline int count() { return m_data.size(); } QVector<QPair<QVariant, bool> > m_data; }; diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp index f90dd305d9..c31eb13d98 100644 --- a/src/quick/handlers/qquickdraghandler.cpp +++ b/src/quick/handlers/qquickdraghandler.cpp @@ -186,7 +186,7 @@ void QQuickDragHandler::handlePointerEventImpl(QPointerEvent *event) QVector<QEventPoint> chosenPoints; if (event->isBeginEvent()) - m_pressedInsideTarget = target() && currentPoints().count() > 0; + m_pressedInsideTarget = target() && currentPoints().size() > 0; for (const QQuickHandlerPoint &p : currentPoints()) { if (!allOverThreshold) diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp index 2028c5c8ec..1d2184d428 100644 --- a/src/quick/handlers/qquickhandlerpoint.cpp +++ b/src/quick/handlers/qquickhandlerpoint.cpp @@ -105,7 +105,7 @@ void QQuickHandlerPoint::reset(const QVector<QQuickHandlerPoint> &points) qWarning("reset: no points"); return; } - if (points.count() == 1) { + if (points.size() == 1) { *this = points.first(); // copy all values return; } diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp index ce3e60c058..5fc4abe20c 100644 --- a/src/quick/handlers/qquickmultipointhandler.cpp +++ b/src/quick/handlers/qquickmultipointhandler.cpp @@ -51,7 +51,7 @@ bool QQuickMultiPointHandler::wantsPointerEvent(QPointerEvent *event) // currentPoints, because we don't want to lose the pressPosition, and do // not want to reshuffle the order either). const auto candidatePoints = eligiblePoints(event); - if (candidatePoints.count() != d->currentPoints.count()) { + if (candidatePoints.size() != d->currentPoints.size()) { d->currentPoints.clear(); if (active()) { setActive(false); @@ -64,7 +64,7 @@ bool QQuickMultiPointHandler::wantsPointerEvent(QPointerEvent *event) ret = ret || (candidatePoints.size() >= minimumPointCount() && candidatePoints.size() <= maximumPointCount()); if (ret) { - const int c = candidatePoints.count(); + const int c = candidatePoints.size(); d->currentPoints.resize(c); for (int i = 0; i < c; ++i) { d->currentPoints[i].reset(event, candidatePoints[i]); @@ -302,7 +302,7 @@ QVector<QQuickMultiPointHandler::PointData> QQuickMultiPointHandler::angles(cons { Q_D(const QQuickMultiPointHandler); QVector<PointData> angles; - angles.reserve(d->currentPoints.count()); + angles.reserve(d->currentPoints.size()); for (const QQuickHandlerPoint &p : d->currentPoints) { qreal angle = QLineF(ref, p.scenePosition()).angle(); angles.append(PointData(p.id(), -angle)); // convert to clockwise, to be consistent with QQuickItem::rotation diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp index 2c8272301f..aaf09c1624 100644 --- a/src/quick/handlers/qquickpinchhandler.cpp +++ b/src/quick/handlers/qquickpinchhandler.cpp @@ -334,9 +334,9 @@ void QQuickPinchHandler::handlePointerEventImpl(QPointerEvent *event) } const bool requiredNumberOfPointsDraggedOverThreshold = numberOfPointsDraggedOverThreshold >= minimumPointCount() && numberOfPointsDraggedOverThreshold <= maximumPointCount(); - accumulatedMovementMagnitude /= currentPoints().count(); + accumulatedMovementMagnitude /= currentPoints().size(); - QVector2D avgDrag = accumulatedDrag / currentPoints().count(); + QVector2D avgDrag = accumulatedDrag / currentPoints().size(); if (!xAxis()->enabled()) avgDrag.setX(0); if (!yAxis()->enabled()) diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index d2e24a8b30..d053da4766 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -101,7 +101,7 @@ Q_QUICK_PRIVATE_EXPORT QColor qt_color_from_string(const QV4::Value &name) QByteArray str = name.toQString().toUtf8(); char *p = str.data(); - int len = str.length(); + int len = str.size(); //rgb/hsl color string has at least 7 characters if (!p || len > 255 || len <= 7) return QColor::fromString(p); diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h index 3c18c68856..52ba4896ed 100644 --- a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h +++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h @@ -168,7 +168,7 @@ public: inline void setLineDash(const QVector<qreal> &pattern) { commands << QQuickContext2D::LineDash; - reals << pattern.length(); + reals << pattern.size(); for (qreal r : pattern) reals << r; } diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp index a553d758c5..1c865a6327 100644 --- a/src/quick/items/qquickdroparea.cpp +++ b/src/quick/items/qquickdroparea.cpp @@ -125,7 +125,7 @@ void QQuickDropArea::setKeys(const QStringList &keys) d->keyRegExp = QRegularExpression(); } else { QString pattern = QLatin1Char('(') + QRegularExpression::escape(keys.first()); - for (int i = 1; i < keys.count(); ++i) + for (int i = 1; i < keys.size(); ++i) pattern += QLatin1Char('|') + QRegularExpression::escape(keys.at(i)); pattern += QLatin1Char(')'); d->keyRegExp = QRegularExpression( diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index d3dfe51d11..153931c0ed 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -462,7 +462,7 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal { qreal colPos = colPosAt(visibleIndex); qreal rowPos = rowPosAt(visibleIndex); - if (visibleItems.count()) { + if (visibleItems.size()) { FxGridItemSG *lastItem = static_cast<FxGridItemSG*>(visibleItems.constLast()); rowPos = lastItem->rowPos(); int colNum = qFloor((lastItem->colPos()+colSize()/2) / colSize()); @@ -476,7 +476,7 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal int modelIndex = findLastVisibleIndex(); modelIndex = modelIndex < 0 ? visibleIndex : modelIndex + 1; - if (visibleItems.count() && (bufferFrom > rowPos + rowSize()*2 + if (visibleItems.size() && (bufferFrom > rowPos + rowSize()*2 || bufferTo < rowPosAt(visibleIndex) - rowSize())) { // We've jumped more than a page. Estimate which items are now // visible and fill from there. @@ -520,7 +520,7 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal return changed; // Find first column - if (visibleItems.count()) { + if (visibleItems.size()) { FxGridItemSG *firstItem = static_cast<FxGridItemSG*>(visibleItems.constFirst()); rowPos = firstItem->rowPos(); colPos = firstItem->colPos(); @@ -569,7 +569,7 @@ bool QQuickGridViewPrivate::removeNonVisibleItems(qreal bufferFrom, qreal buffer FxGridItemSG *item = nullptr; bool changed = false; - while (visibleItems.count() > 1 + while (visibleItems.size() > 1 && (item = static_cast<FxGridItemSG*>(visibleItems.constFirst())) && item->rowPos()+rowSize()-1 < bufferFrom - rowSize()*(item->colPos()/colSize()+1)/(columns+1)) { if (item->attached->delayRemove()) @@ -581,12 +581,12 @@ bool QQuickGridViewPrivate::removeNonVisibleItems(qreal bufferFrom, qreal buffer removeItem(item); changed = true; } - while (visibleItems.count() > 1 + while (visibleItems.size() > 1 && (item = static_cast<FxGridItemSG*>(visibleItems.constLast())) && item->rowPos() > bufferTo + rowSize()*(columns - item->colPos()/colSize())/(columns+1)) { if (item->attached->delayRemove()) break; - qCDebug(lcItemViewDelegateLifecycle) << "refill: remove last" << visibleIndex+visibleItems.count()-1; + qCDebug(lcItemViewDelegateLifecycle) << "refill: remove last" << visibleIndex+visibleItems.size()-1; visibleItems.removeLast(); removeItem(item); changed = true; @@ -603,7 +603,7 @@ void QQuickGridViewPrivate::updateViewport() void QQuickGridViewPrivate::layoutVisibleItems(int fromModelIndex) { - if (visibleItems.count()) { + if (visibleItems.size()) { const qreal from = isContentFlowReversed() ? -position()-displayMarginBeginning-size() : position()-displayMarginBeginning; const qreal to = isContentFlowReversed() ? -position()+displayMarginEnd : position()+size()+displayMarginEnd; @@ -616,7 +616,7 @@ void QQuickGridViewPrivate::layoutVisibleItems(int fromModelIndex) firstItem->setPosition(colPos, rowPos); } firstItem->setVisible(firstItem->rowPos() + rowSize() >= from && firstItem->rowPos() <= to); - for (int i = 1; i < visibleItems.count(); ++i) { + for (int i = 1; i < visibleItems.size(); ++i) { FxGridItemSG *item = static_cast<FxGridItemSG*>(visibleItems.at(i)); if (++col >= columns) { col = 0; @@ -669,7 +669,7 @@ void QQuickGridViewPrivate::resetFirstItemPosition(qreal pos) void QQuickGridViewPrivate::adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible) { - if (!visibleItems.count()) + if (!visibleItems.size()) return; int moveCount = (forwards - backwards) / rowSize(); @@ -802,7 +802,7 @@ void QQuickGridViewPrivate::updateFooter() else rowOffset += gridItem->item->height() - cellHeight; } - if (visibleItems.count()) { + if (visibleItems.size()) { qreal endPos = lastPosition(); if (findLastVisibleIndex() == model->count()-1) { gridItem->setPosition(colOffset, endPos + rowOffset); @@ -855,7 +855,7 @@ void QQuickGridViewPrivate::updateHeader() else rowOffset += gridItem->item->height() - cellHeight; } - if (visibleItems.count()) { + if (visibleItems.size()) { qreal startPos = originPosition(); if (visibleIndex == 0) { gridItem->setPosition(colOffset, startPos + rowOffset); @@ -2359,15 +2359,15 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch int modelIndex = change.index; int count = change.count; - int index = visibleItems.count() ? mapFromModel(modelIndex) : 0; + int index = visibleItems.size() ? mapFromModel(modelIndex) : 0; if (index < 0) { - int i = visibleItems.count() - 1; + int i = visibleItems.size() - 1; while (i > 0 && visibleItems.at(i)->index == -1) --i; if (visibleItems.at(i)->index + 1 == modelIndex) { // Special case of appending an item to the model. - index = visibleItems.count(); + index = visibleItems.size(); } else { if (modelIndex <= visibleIndex) { // Insert before visible items @@ -2385,8 +2385,8 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch qreal colPos = 0; qreal rowPos = 0; int colNum = 0; - if (visibleItems.count()) { - if (index < visibleItems.count()) { + if (visibleItems.size()) { + if (index < visibleItems.size()) { FxGridItemSG *gridItem = static_cast<FxGridItemSG*>(visibleItems.at(index)); colPos = gridItem->colPos(); rowPos = gridItem->rowPos(); @@ -2415,7 +2415,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } } - int prevVisibleCount = visibleItems.count(); + int prevVisibleCount = visibleItems.size(); if (insertResult->visiblePos.isValid() && rowPos < insertResult->visiblePos) { // Insert items before the visible item. int insertionIdx = index; @@ -2464,7 +2464,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch // of the index shift/update done before the insertion just above. // Find if there is any... int firstOkIdx = -1; - for (int i = 0; i <= insertionIdx && i < visibleItems.count() - 1; i++) { + for (int i = 0; i <= insertionIdx && i < visibleItems.size() - 1; i++) { if (visibleItems.at(i)->index + 1 != visibleItems.at(i + 1)->index) { firstOkIdx = i + 1; break; @@ -2520,7 +2520,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch updateVisibleIndex(); - return visibleItems.count() > prevVisibleCount; + return visibleItems.size() > prevVisibleCount; } void QQuickGridViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) @@ -2529,7 +2529,7 @@ void QQuickGridViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex return; int markerItemIndex = -1; - for (int i=0; i<visibleItems.count(); i++) { + for (int i=0; i<visibleItems.size(); i++) { if (visibleItems.at(i)->index == afterModelIndex) { markerItemIndex = i; break; @@ -2548,7 +2548,7 @@ void QQuickGridViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex countItemsRemoved -= removalResult.countChangeAfterVisibleItems; - for (int i=markerItemIndex+1; i<visibleItems.count(); i++) { + for (int i=markerItemIndex+1; i<visibleItems.size(); i++) { FxGridItemSG *gridItem = static_cast<FxGridItemSG *>(visibleItems.at(i)); if (gridItem->position() >= viewEndPos) break; diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index 2a79908a3e..51fd2a3588 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -173,7 +173,7 @@ struct QQuickParentAnimationData : public QAbstractAnimationAction QList<QQuickParentChange *> pc; void doAction() override { - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { const QQuickStateAction &action = actions.at(ii); if (reverse) action.event->reverse(); @@ -329,7 +329,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act } } - if (data->actions.count()) { + if (data->actions.size()) { QSequentialAnimationGroupJob *topLevelGroup = new QSequentialAnimationGroupJob; QActionAnimation *viaAction = d->via ? new QActionAnimation : nullptr; QActionAnimation *targetAction = new QActionAnimation; @@ -343,7 +343,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act //take care of any child animations bool valid = d->defaultProperty.isValid(); QAbstractAnimationJob* anim; - for (int ii = 0; ii < d->animations.count(); ++ii) { + for (int ii = 0; ii < d->animations.size(); ++ii) { if (valid) d->animations.at(ii)->setDefaultTarget(d->defaultProperty); anim = d->animations.at(ii)->transition(actions, modified, direction, defaultTarget); @@ -488,7 +488,7 @@ QAbstractAnimationJob* QQuickAnchorAnimation::transition(QQuickStateActions &act data->fromIsSourced = false; data->fromIsDefined = false; - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { QQuickStateAction &action = actions[ii]; if (action.event && action.event->type() == QQuickStateActionEvent::AnchorChanges && (d->targets.isEmpty() || d->targets.contains(static_cast<QQuickAnchorChanges*>(action.event)->object()))) { @@ -497,7 +497,7 @@ QAbstractAnimationJob* QQuickAnchorAnimation::transition(QQuickStateActions &act } QQuickBulkValueAnimator *animator = new QQuickBulkValueAnimator; - if (data->actions.count()) { + if (data->actions.size()) { animator->setAnimValue(data); animator->setFromIsSourcedValue(&data->fromIsSourced); } else { @@ -823,9 +823,9 @@ QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actio data->fromIsSourced = false; data->fromIsDefined = (d->path && d->path->hasStartX() && d->path->hasStartY()) ? true : false; data->toIsDefined = d->path ? true : false; - int origModifiedSize = modified.count(); + int origModifiedSize = modified.size(); - for (int i = 0; i < actions.count(); ++i) { + for (int i = 0; i < actions.size(); ++i) { QQuickStateAction &action = actions[i]; if (action.event) continue; @@ -841,7 +841,7 @@ QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actio } } - if (target && d->path && (modified.count() > origModifiedSize || data->toIsDefined)) { + if (target && d->path && (modified.size() > origModifiedSize || data->toIsDefined)) { data->target = target; data->path = d->path; data->path->invalidateSequentialHistory(); diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 627ee1e933..33c2f0f917 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -964,7 +964,7 @@ void QQuickItemViewPrivate::applyPendingChanges() int QQuickItemViewPrivate::findMoveKeyIndex(QQmlChangeSet::MoveKey key, const QVector<QQmlChangeSet::Change> &changes) const { - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { for (int j=changes[i].index; j<changes[i].index + changes[i].count; j++) { if (changes[i].moveKey(j) == key) return j; @@ -1101,7 +1101,7 @@ void QQuickItemViewPrivate::applyDelegateChange() void QQuickItemViewPrivate::checkVisible() const { int skip = 0; - for (int i = 0; i < visibleItems.count(); ++i) { + for (int i = 0; i < visibleItems.size(); ++i) { FxViewItem *item = visibleItems.at(i); if (item->index == -1) { ++skip; @@ -1564,8 +1564,8 @@ int QQuickItemViewPrivate::findLastVisibleIndex(int defaultValue) const } FxViewItem *QQuickItemViewPrivate::visibleItem(int modelIndex) const { - if (modelIndex >= visibleIndex && modelIndex < visibleIndex + visibleItems.count()) { - for (int i = modelIndex - visibleIndex; i < visibleItems.count(); ++i) { + if (modelIndex >= visibleIndex && modelIndex < visibleIndex + visibleItems.size()) { + for (int i = modelIndex - visibleIndex; i < visibleItems.size(); ++i) { FxViewItem *item = visibleItems.at(i); if (item->index == modelIndex) return item; @@ -1580,7 +1580,7 @@ FxViewItem *QQuickItemViewPrivate::firstItemInView() const { if (item->index != -1 && item->endPosition() > pos) return item; } - return visibleItems.count() ? visibleItems.first() : 0; + return visibleItems.size() ? visibleItems.first() : 0; } int QQuickItemViewPrivate::findLastIndexInView() const @@ -1599,9 +1599,9 @@ int QQuickItemViewPrivate::findLastIndexInView() const // e.g. doing a removal animation int QQuickItemViewPrivate::mapFromModel(int modelIndex) const { - if (modelIndex < visibleIndex || modelIndex >= visibleIndex + visibleItems.count()) + if (modelIndex < visibleIndex || modelIndex >= visibleIndex + visibleItems.size()) return -1; - for (int i = 0; i < visibleItems.count(); ++i) { + for (int i = 0; i < visibleItems.size(); ++i) { FxViewItem *item = visibleItems.at(i); if (item->index == modelIndex) return i; @@ -1832,7 +1832,7 @@ void QQuickItemViewPrivate::layout() // viewBounds contains bounds before any add/remove/move operation to the view QRectF viewBounds(q->contentX(), q->contentY(), q->width(), q->height()); - if (!isValid() && !visibleItems.count()) { + if (!isValid() && !visibleItems.size()) { clear(); setPosition(contentStartOffset()); updateViewport(); @@ -1846,7 +1846,7 @@ void QQuickItemViewPrivate::layout() && transitioner->canTransition(QQuickItemViewTransitioner::RemoveTransition, false)) { // assume that any items moving now are moving due to the remove - if they schedule // a different transition, that will override this one anyway - for (int i=0; i<visibleItems.count(); i++) + for (int i=0; i<visibleItems.size(); i++) visibleItems[i]->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, false); } @@ -1903,14 +1903,14 @@ void QQuickItemViewPrivate::layout() prepareVisibleItemTransitions(); // We cannot use iterators here as erasing from a container invalidates them. - for (int i = 0, count = releasePendingTransition.count(); i < count;) { + for (int i = 0, count = releasePendingTransition.size(); i < count;) { auto success = prepareNonVisibleItemTransition(releasePendingTransition[i], viewBounds); // prepareNonVisibleItemTransition() may remove items while in fast flicking. // Invisible animating items are kicked in or out the viewPort. // Recheck count to test if the item got removed. In that case the same index points // to a different item now. const int old_count = count; - count = releasePendingTransition.count(); + count = releasePendingTransition.size(); if (old_count > count) continue; @@ -1923,9 +1923,9 @@ void QQuickItemViewPrivate::layout() } } - for (int i=0; i<visibleItems.count(); i++) + for (int i=0; i<visibleItems.size(); i++) visibleItems[i]->startTransition(transitioner); - for (int i=0; i<releasePendingTransition.count(); i++) + for (int i=0; i<releasePendingTransition.size(); i++) releasePendingTransition[i]->startTransition(transitioner); transitioner->setPopulateTransitionEnabled(false); @@ -1949,9 +1949,9 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult updateUnrequestedIndexes(); - FxViewItem *prevVisibleItemsFirst = visibleItems.count() ? *visibleItems.constBegin() : nullptr; + FxViewItem *prevVisibleItemsFirst = visibleItems.size() ? *visibleItems.constBegin() : nullptr; int prevItemCount = itemCount; - int prevVisibleItemsCount = visibleItems.count(); + int prevVisibleItemsCount = visibleItems.size(); bool visibleAffected = false; bool viewportChanged = !currentChanges.pendingChanges.removes().isEmpty() || !currentChanges.pendingChanges.inserts().isEmpty(); @@ -1963,7 +1963,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult prevFirstItemInViewPos = prevFirstItemInView->position(); prevFirstItemInViewIndex = prevFirstItemInView->index; } - qreal prevVisibleItemsFirstPos = visibleItems.count() ? firstVisibleItemPosition : 0.0; + qreal prevVisibleItemsFirstPos = visibleItems.size() ? firstVisibleItemPosition : 0.0; totalInsertionResult->visiblePos = prevFirstItemInViewPos; totalRemovalResult->visiblePos = prevFirstItemInViewPos; @@ -2016,7 +2016,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult QList<FxViewItem *> newItems; QList<MovedItem> movingIntoView; - for (int i=0; i<insertions.count(); i++) { + for (int i=0; i<insertions.size(); i++) { bool wasEmpty = visibleItems.isEmpty(); if (applyInsertionChange(insertions[i], &insertionResult, &newItems, &movingIntoView)) visibleAffected = true; @@ -2027,7 +2027,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult *totalInsertionResult += insertionResult; // set positions correctly for the next insertion - if (i < insertions.count() - 1) { + if (i < insertions.size() - 1) { repositionFirstItem(prevVisibleItemsFirst, prevVisibleItemsFirstPos, prevFirstItemInView, &insertionResult, &removalResult); layoutVisibleItems(insertions[i].index); storeFirstVisibleItemPosition(); @@ -2099,7 +2099,7 @@ bool QQuickItemViewPrivate::applyRemovalChange(const QQmlChangeSet::Change &remo Q_Q(QQuickItemView); bool visibleAffected = false; - if (visibleItems.count() && removal.index + removal.count > visibleItems.constLast()->index) { + if (visibleItems.size() && removal.index + removal.count > visibleItems.constLast()->index) { if (removal.index > visibleItems.constLast()->index) removeResult->countChangeAfterVisibleItems += removal.count; else @@ -2177,7 +2177,7 @@ void QQuickItemViewPrivate::repositionFirstItem(FxViewItem *prevVisibleItemsFirs const QQmlNullableValue<qreal> prevViewPos = insertionResult->visiblePos; // reposition visibleItems.first() correctly so that the content y doesn't jump - if (visibleItems.count()) { + if (visibleItems.size()) { if (prevVisibleItemsFirst && insertionResult->changedFirstItem) resetFirstItemPosition(prevVisibleItemsFirstPos); @@ -2224,7 +2224,7 @@ void QQuickItemViewPrivate::prepareVisibleItemTransitions() // must call for every visible item to init or discard transitions QRectF viewBounds(q->contentX(), q->contentY(), q->width(), q->height()); - for (int i=0; i<visibleItems.count(); i++) + for (int i=0; i<visibleItems.size(); i++) visibleItems[i]->prepareTransition(transitioner, viewBounds); } @@ -2276,7 +2276,7 @@ bool QQuickItemViewPrivate::prepareNonVisibleItemTransition(FxViewItem *item, co void QQuickItemViewPrivate::viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) { - for (int i=0; i<releasePendingTransition.count(); i++) { + for (int i=0; i<releasePendingTransition.size(); i++) { if (releasePendingTransition.at(i)->transitionableItem == item) { releaseItem(releasePendingTransition.takeAt(i), reusableFlag); return; @@ -2296,7 +2296,7 @@ FxViewItem *QQuickItemViewPrivate::createItem(int modelIndex, QQmlIncubator::Inc if (requestedIndex == modelIndex && incubationMode == QQmlIncubator::Asynchronous) return nullptr; - for (int i=0; i<releasePendingTransition.count(); i++) { + for (int i=0; i<releasePendingTransition.size(); i++) { if (releasePendingTransition.at(i)->index == modelIndex && !releasePendingTransition.at(i)->isPendingRemoval()) { releasePendingTransition[i]->releaseAfterTransition = false; diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 5f9bd84ada..5bf791977d 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -451,7 +451,7 @@ FxViewItem *QQuickListViewPrivate::itemBefore(int modelIndex) const return nullptr; int idx = 1; int lastIndex = -1; - while (idx < visibleItems.count()) { + while (idx < visibleItems.size()) { FxViewItem *item = visibleItems.at(idx); if (item->index != -1) lastIndex = item->index; @@ -497,7 +497,7 @@ qreal QQuickListViewPrivate::lastPosition() const if (!visibleItems.isEmpty()) { int invisibleCount = INT_MIN; int delayRemovedCount = 0; - for (int i = visibleItems.count()-1; i >= 0; --i) { + for (int i = visibleItems.size()-1; i >= 0; --i) { FxViewItem *item = visibleItems.at(i); if (item->index != -1) { // Find the invisible count after the last visible item with known index @@ -576,7 +576,7 @@ qreal QQuickListViewPrivate::snapPosAt(qreal pos) { if (FxListItemSG *snapItem = static_cast<FxListItemSG*>(snapItemAt(pos))) return snapItem->itemPosition(); - if (visibleItems.count()) { + if (visibleItems.size()) { qreal firstPos = (*visibleItems.constBegin())->position(); qreal endPos = (*(visibleItems.constEnd() - 1))->position(); if (pos < firstPos) { @@ -721,7 +721,7 @@ bool QQuickListViewPrivate::releaseItem(FxViewItem *item, QQmlInstanceModel::Reu bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) { qreal itemEnd = visiblePos; - if (visibleItems.count()) { + if (visibleItems.size()) { visiblePos = (*visibleItems.constBegin())->position(); itemEnd = (*(visibleItems.constEnd() - 1))->endPosition() + spacing; } @@ -807,7 +807,7 @@ bool QQuickListViewPrivate::removeNonVisibleItems(qreal bufferFrom, qreal buffer // removed, otherwise a zero-sized item is infinitely added and removed over and // over by refill(). int index = 0; - while (visibleItems.count() > 1 && index < visibleItems.count() + while (visibleItems.size() > 1 && index < visibleItems.size() && (item = visibleItems.at(index)) && item->endPosition() < bufferFrom) { if (item->attached->delayRemove()) break; @@ -830,10 +830,10 @@ bool QQuickListViewPrivate::removeNonVisibleItems(qreal bufferFrom, qreal buffer } } - while (visibleItems.count() > 1 && (item = visibleItems.constLast()) && item->position() > bufferTo) { + while (visibleItems.size() > 1 && (item = visibleItems.constLast()) && item->position() > bufferTo) { if (item->attached->delayRemove()) break; - qCDebug(lcItemViewDelegateLifecycle) << "refill: remove last" << visibleIndex+visibleItems.count()-1 << item->position() << (QObject *)(item->item); + qCDebug(lcItemViewDelegateLifecycle) << "refill: remove last" << visibleIndex+visibleItems.size()-1 << item->position() << (QObject *)(item->item); visibleItems.removeLast(); removeItem(item); changed = true; @@ -844,7 +844,7 @@ bool QQuickListViewPrivate::removeNonVisibleItems(qreal bufferFrom, qreal buffer void QQuickListViewPrivate::visibleItemsChanged() { - if (visibleItems.count()) + if (visibleItems.size()) visiblePos = (*visibleItems.constBegin())->position(); updateAverage(); if (currentIndex >= 0 && currentItem && !visibleItem(currentIndex)) { @@ -874,7 +874,7 @@ void QQuickListViewPrivate::layoutVisibleItems(int fromModelIndex) if (firstItem->section()) firstItem->setPosition(firstItem->position()); - for (int i=1; i < visibleItems.count(); ++i) { + for (int i=1; i < visibleItems.size(); ++i) { FxListItemSG *item = static_cast<FxListItemSG*>(visibleItems.at(i)); if (item->index >= fromModelIndex) { item->setPosition(pos); @@ -884,7 +884,7 @@ void QQuickListViewPrivate::layoutVisibleItems(int fromModelIndex) sum += item->size(); fixedCurrent = fixedCurrent || (currentItem && item->item == currentItem->item); } - averageSize = qRound(sum / visibleItems.count()); + averageSize = qRound(sum / visibleItems.size()); // move current item if it is not a visible item. if (currentIndex >= 0 && currentItem && !fixedCurrent) @@ -929,7 +929,7 @@ void QQuickListViewPrivate::resetFirstItemPosition(qreal pos) void QQuickListViewPrivate::adjustFirstItem(qreal forwards, qreal backwards, int) { - if (!visibleItems.count()) + if (!visibleItems.size()) return; qreal diff = forwards - backwards; static_cast<FxListItemSG*>(visibleItems.constFirst())->setPosition(visibleItems.constFirst()->position() + diff); @@ -1166,7 +1166,7 @@ void QQuickListViewPrivate::updateStickySections() QQuickItem *sectionItem = nullptr; QQuickItem *lastSectionItem = nullptr; int index = 0; - while (index < visibleItems.count()) { + while (index < visibleItems.size()) { if (QQuickItem *section = static_cast<FxListItemSG *>(visibleItems.at(index))->section()) { // Find the current section header and last visible section header // and hide them if they will overlap a static section header. @@ -1193,7 +1193,7 @@ void QQuickListViewPrivate::updateStickySections() } // Current section header - if (sectionCriteria->labelPositioning() & QQuickViewSection::CurrentLabelAtStart && isValid() && visibleItems.count()) { + if (sectionCriteria->labelPositioning() & QQuickViewSection::CurrentLabelAtStart && isValid() && visibleItems.size()) { if (!currentSectionItem) { currentSectionItem = getSectionItem(currentSection); } else if (QString::compare(currentStickySection, currentSection, Qt::CaseInsensitive)) { @@ -1227,7 +1227,7 @@ void QQuickListViewPrivate::updateStickySections() } // Next section footer - if (sectionCriteria->labelPositioning() & QQuickViewSection::NextLabelAtEnd && isValid() && visibleItems.count()) { + if (sectionCriteria->labelPositioning() & QQuickViewSection::NextLabelAtEnd && isValid() && visibleItems.size()) { if (!nextSectionItem) { nextSectionItem = getSectionItem(nextSection); } else if (QString::compare(nextStickySection, nextSection, Qt::CaseInsensitive)) { @@ -1315,7 +1315,7 @@ void QQuickListViewPrivate::updateCurrentSection() qreal startPos = hasStickyHeader() ? header->endPosition() : viewPos; int index = 0; int modelIndex = visibleIndex; - while (index < visibleItems.count()) { + while (index < visibleItems.size()) { FxViewItem *item = visibleItems.at(index); if (item->endPosition() > startPos) break; @@ -1325,7 +1325,7 @@ void QQuickListViewPrivate::updateCurrentSection() } QString newSection = currentSection; - if (index < visibleItems.count()) + if (index < visibleItems.size()) newSection = visibleItems.at(index)->attached->section(); else newSection = (*visibleItems.constBegin())->attached->section(); @@ -1344,7 +1344,7 @@ void QQuickListViewPrivate::updateCurrentSection() qreal endPos = hasStickyFooter() ? footer->position() : viewPos + size(); if (nextSectionItem && !inlineSections) endPos -= orient == QQuickListView::Vertical ? nextSectionItem->height() : nextSectionItem->width(); - while (index < visibleItems.count()) { + while (index < visibleItems.size()) { FxListItemSG *listItem = static_cast<FxListItemSG *>(visibleItems.at(index)); if (listItem->itemPosition() >= endPos) break; @@ -1379,7 +1379,7 @@ void QQuickListViewPrivate::initializeCurrentItem() // don't reposition the item if it is already in the visibleItems list FxViewItem *actualItem = visibleItem(currentIndex); if (!actualItem) { - if (currentIndex == visibleIndex - 1 && visibleItems.count()) { + if (currentIndex == visibleIndex - 1 && visibleItems.size()) { // We can calculate exact postion in this case listItem->setPosition(visibleItems.constFirst()->position() - currentItem->size() - spacing); } else { @@ -1396,12 +1396,12 @@ void QQuickListViewPrivate::initializeCurrentItem() void QQuickListViewPrivate::updateAverage() { - if (!visibleItems.count()) + if (!visibleItems.size()) return; qreal sum = 0.0; for (FxViewItem *item : qAsConst(visibleItems)) sum += item->size(); - averageSize = qRound(sum / visibleItems.count()); + averageSize = qRound(sum / visibleItems.size()); } qreal QQuickListViewPrivate::headerSize() const @@ -1440,7 +1440,7 @@ void QQuickListViewPrivate::updateFooter() FxListItemSG *listItem = static_cast<FxListItemSG*>(footer); if (footerPositioning == QQuickListView::OverlayFooter) { listItem->setPosition(isContentFlowReversed() ? -position() - footerSize() : position() + size() - footerSize()); - } else if (visibleItems.count()) { + } else if (visibleItems.size()) { if (footerPositioning == QQuickListView::PullBackFooter) { qreal viewPos = isContentFlowReversed() ? -position() : position() + size(); qreal clampedPos = qBound(originPosition() - footerSize() + size(), listItem->position(), lastPosition()); @@ -1473,7 +1473,7 @@ void QQuickListViewPrivate::fixupHeader() { FxListItemSG *listItem = static_cast<FxListItemSG*>(header); const bool fixingUp = (orient == QQuickListView::Vertical ? vData : hData).fixingUp; - if (fixingUp && headerPositioning == QQuickListView::PullBackHeader && visibleItems.count()) { + if (fixingUp && headerPositioning == QQuickListView::PullBackHeader && visibleItems.size()) { int fixupDura = timeline.duration(); if (fixupDura < 0) fixupDura = fixupDuration/2; @@ -1504,7 +1504,7 @@ void QQuickListViewPrivate::updateHeader() FxListItemSG *listItem = static_cast<FxListItemSG*>(header); if (headerPositioning == QQuickListView::OverlayHeader) { listItem->setPosition(isContentFlowReversed() ? -position() - size() : position()); - } else if (visibleItems.count()) { + } else if (visibleItems.size()) { const bool fixingUp = (orient == QQuickListView::Vertical ? vData : hData).fixingUp; if (headerPositioning == QQuickListView::PullBackHeader) { qreal headerPosition = listItem->position(); @@ -1573,7 +1573,7 @@ void QQuickListViewPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometry // if visibleItems.first() has resized, adjust its pos since it is used to // position all subsequent items - if (visibleItems.count() && item == visibleItems.constFirst()->item) { + if (visibleItems.size() && item == visibleItems.constFirst()->item) { FxListItemSG *listItem = static_cast<FxListItemSG*>(visibleItems.constFirst()); if (listItem->transitionScheduledOrRunning()) return; @@ -1619,7 +1619,7 @@ void QQuickListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExte } // update footer if all visible items have been removed - if (visibleItems.count() == 0) + if (visibleItems.size() == 0) updateFooter(); correctFlick = false; @@ -3610,20 +3610,20 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch int count = change.count; qreal tempPos = isContentFlowReversed() ? -position()-size() : position(); - int index = visibleItems.count() ? mapFromModel(modelIndex) : 0; + int index = visibleItems.size() ? mapFromModel(modelIndex) : 0; qreal lastVisiblePos = buffer + displayMarginEnd + tempPos + size(); if (index < 0) { - int i = visibleItems.count() - 1; + int i = visibleItems.size() - 1; while (i > 0 && visibleItems.at(i)->index == -1) --i; if (i == 0 && visibleItems.constFirst()->index == -1) { // there are no visible items except items marked for removal - index = visibleItems.count(); + index = visibleItems.size(); } else if (visibleItems.at(i)->index + 1 == modelIndex && visibleItems.at(i)->endPosition() <= lastVisiblePos) { // Special case of appending an item to the model. - index = visibleItems.count(); + index = visibleItems.size(); } else { if (modelIndex < visibleIndex) { // Insert before visible items @@ -3639,8 +3639,8 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch // index can be the next item past the end of the visible items list (i.e. appended) qreal pos = 0; - if (visibleItems.count()) { - pos = index < visibleItems.count() ? visibleItems.at(index)->position() + if (visibleItems.size()) { + pos = index < visibleItems.size() ? visibleItems.at(index)->position() : visibleItems.constLast()->endPosition() + spacing; } @@ -3698,7 +3698,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } int firstOkIdx = -1; - for (int i = 0; i <= insertionIdx && i < visibleItems.count() - 1; i++) { + for (int i = 0; i <= insertionIdx && i < visibleItems.size() - 1; i++) { if (visibleItems.at(i)->index + 1 != visibleItems.at(i + 1)->index) { firstOkIdx = i + 1; break; @@ -3749,13 +3749,13 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } it.disconnect(); - if (0 < index && index < visibleItems.count()) { + if (0 < index && index < visibleItems.size()) { FxViewItem *prevItem = visibleItems.at(index - 1); FxViewItem *item = visibleItems.at(index); if (prevItem->index != item->index - 1) { int i = index; qreal prevPos = prevItem->position(); - while (i < visibleItems.count()) { + while (i < visibleItems.size()) { FxListItemSG *nvItem = static_cast<FxListItemSG *>(visibleItems.takeLast()); insertResult->sizeChangesAfterVisiblePos -= nvItem->size() + spacing; addedItems->removeOne(nvItem); @@ -3780,7 +3780,7 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex return; int markerItemIndex = -1; - for (int i=0; i<visibleItems.count(); i++) { + for (int i=0; i<visibleItems.size(); i++) { if (visibleItems.at(i)->index == afterModelIndex) { markerItemIndex = i; break; @@ -3793,7 +3793,7 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex qreal sizeRemoved = -removalResult.sizeChangesAfterVisiblePos - (removalResult.countChangeAfterVisibleItems * (averageSize + spacing)); - for (int i=markerItemIndex+1; i<visibleItems.count(); i++) { + for (int i=markerItemIndex+1; i<visibleItems.size(); i++) { FxListItemSG *listItem = static_cast<FxListItemSG *>(visibleItems.at(i)); if (listItem->position() >= viewEndPos) break; diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 75b67d01e3..4e361d833f 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -117,7 +117,7 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i } QList<QQuickItem *> children = itemPrivate->paintOrderChildItems(); - for (int ii = children.count() - 1; ii >= 0; --ii) { + for (int ii = children.size() - 1; ii >= 0; --ii) { QQuickItem *child = children.at(ii); if (!child->isVisible() || !child->isEnabled()) continue; diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index d594861ee7..3686553d5e 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -578,7 +578,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event, RemapEventPoints break; } - int numTouchPoints = touchPoints.count(); + int numTouchPoints = touchPoints.size(); //always remove released touches, and make sure we handle all releases before adds. for (const QEventPoint &p : qAsConst(touchPoints)) { QEventPoint::State touchPointState = p.state(); @@ -743,7 +743,7 @@ void QQuickMultiPointTouchArea::setTouchEventsEnabled(bool enable) void QQuickMultiPointTouchArea::addTouchPrototype(QQuickTouchPoint *prototype) { - int id = _touchPrototypes.count(); + int id = _touchPrototypes.size(); prototype->setPointId(id); _touchPrototypes.insert(id, prototype); } @@ -796,7 +796,7 @@ void QQuickMultiPointTouchArea::mousePressEvent(QMouseEvent *event) if (event->source() != Qt::MouseEventNotSynthesized && event->source() != Qt::MouseEventSynthesizedByQt) return; - if (_touchPoints.count() >= _minimumTouchPoints - 1 && _touchPoints.count() < _maximumTouchPoints) { + if (_touchPoints.size() >= _minimumTouchPoints - 1 && _touchPoints.size() < _maximumTouchPoints) { updateTouchData(event); } } @@ -844,7 +844,7 @@ void QQuickMultiPointTouchArea::ungrab(bool normalRelease) if (!normalRelease) ungrabTouchPoints(); - if (_touchPoints.count()) { + if (_touchPoints.size()) { for (QObject *obj : qAsConst(_touchPoints)) static_cast<QQuickTouchPoint*>(obj)->setPressed(false); if (!normalRelease) diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index f6d2886716..f92705f28e 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -210,7 +210,7 @@ public: static qsizetype touchPoint_count(QQmlListProperty<QQuickTouchPoint> *list) { QQuickMultiPointTouchArea *q = static_cast<QQuickMultiPointTouchArea*>(list->object); - return q->_touchPrototypes.count(); + return q->_touchPrototypes.size(); } static QQuickTouchPoint* touchPoint_at(QQmlListProperty<QQuickTouchPoint> *list, qsizetype index) { diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 3b4ced67c3..ba20c5ebdd 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1619,21 +1619,21 @@ void QQuickPathView::mousePressEvent(QMouseEvent *event) void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event) { Q_Q(QQuickPathView); - if (!interactive || !items.count() || !model || !modelCount) + if (!interactive || !items.size() || !model || !modelCount) return; velocityBuffer.clear(); int idx = 0; - for (; idx < items.count(); ++idx) { + for (; idx < items.size(); ++idx) { QQuickItem *item = items.at(idx); if (item->contains(item->mapFromScene(event->scenePosition()))) break; } - if (idx == items.count() && qFuzzyIsNull(dragMargin)) // didn't click on an item + if (idx == items.size() && qFuzzyIsNull(dragMargin)) // didn't click on an item return; startPoint = pointNear(event->position(), &startPc); startPos = event->position(); - if (idx == items.count()) { + if (idx == items.size()) { qreal distance = qAbs(event->position().x() - startPoint.x()) + qAbs(event->position().y() - startPoint.y()); if (distance > dragMargin) return; @@ -1978,7 +1978,7 @@ void QQuickPathView::refill() bool waiting = false; if (d->modelCount) { // add items as needed - if (d->items.count() < count+d->cacheSize) { + if (d->items.size() < count+d->cacheSize) { int endIdx = 0; qreal endPos; int startIdx = 0; @@ -2016,9 +2016,9 @@ void QQuickPathView::refill() if (idx >= d->modelCount) idx = 0; qreal nextPos = d->positionOfIndex(idx); - while ((d->isInBound(nextPos, endPos, 1 + d->mappedCache) || !d->items.count()) - && d->items.count() < count+d->cacheSize) { - qCDebug(lcItemViewDelegateLifecycle) << "append" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count(); + while ((d->isInBound(nextPos, endPos, 1 + d->mappedCache) || !d->items.size()) + && d->items.size() < count+d->cacheSize) { + qCDebug(lcItemViewDelegateLifecycle) << "append" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.size(); QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1); if (!item) { waiting = true; @@ -2049,8 +2049,8 @@ void QQuickPathView::refill() idx = d->modelCount - 1; nextPos = d->positionOfIndex(idx); while (!waiting && d->isInBound(nextPos, d->mappedRange - d->mappedCache, startPos) - && d->items.count() < count+d->cacheSize) { - qCDebug(lcItemViewDelegateLifecycle) << "prepend" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count(); + && d->items.size() < count+d->cacheSize) { + qCDebug(lcItemViewDelegateLifecycle) << "prepend" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.size(); QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1); if (!item) { waiting = true; @@ -2078,8 +2078,8 @@ void QQuickPathView::refill() // new items appear in the middle. This more generic addition iteration handles this // Since this is the rare case, we try append/prepend first and only do this if // there are gaps still left to fill. - if (!waiting && d->items.count() < count+d->cacheSize) { - qCDebug(lcItemViewDelegateLifecycle) << "Checking for pathview middle inserts, items count was" << d->items.count(); + if (!waiting && d->items.size() < count+d->cacheSize) { + qCDebug(lcItemViewDelegateLifecycle) << "Checking for pathview middle inserts, items count was" << d->items.size(); idx = startIdx; QQuickItem *lastItem = d->items.at(0); while (idx != endIdx) { @@ -2095,7 +2095,7 @@ void QQuickPathView::refill() if (!d->items.contains(item)) { //We found a hole qCDebug(lcItemViewDelegateLifecycle) << "middle insert" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") - << "items count was" << d->items.count(); + << "items count was" << d->items.size(); if (d->currentIndex == idx) { currentVisible = true; d->currentItemOffset = nextPos; @@ -2288,7 +2288,7 @@ void QQuickPathView::movementEnding() int QQuickPathViewPrivate::calcCurrentIndex() { int current = 0; - if (modelCount && model && items.count()) { + if (modelCount && model && items.size()) { offset = std::fmod(offset, qreal(modelCount)); if (offset < 0) offset += modelCount; @@ -2360,7 +2360,7 @@ void QQuickPathViewPrivate::fixOffsetCallback(void *d) void QQuickPathViewPrivate::fixOffset() { Q_Q(QQuickPathView); - if (model && items.count()) { + if (model && items.size()) { if (haveHighlightRange && (highlightRangeMode == QQuickPathView::StrictlyEnforceRange || snapMode != QQuickPathView::NoSnap)) { int curr = calcCurrentIndex(); diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 6468153804..d547fae6c9 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -324,7 +324,7 @@ void QQuickPinchArea::touchEvent(QTouchEvent *event) void QQuickPinchArea::clearPinch(QTouchEvent *event) { Q_D(QQuickPinchArea); - qCDebug(lcPA, "clear: %" PRIdQSIZETYPE " touchpoints", d->touchPoints.count()); + qCDebug(lcPA, "clear: %" PRIdQSIZETYPE " touchpoints", d->touchPoints.size()); d->touchPoints.clear(); if (d->inPinch) { d->inPinch = false; @@ -360,7 +360,7 @@ void QQuickPinchArea::clearPinch(QTouchEvent *event) void QQuickPinchArea::cancelPinch(QTouchEvent *event) { Q_D(QQuickPinchArea); - qCDebug(lcPA, "cancel: %" PRIdQSIZETYPE " touchpoints", d->touchPoints.count()); + qCDebug(lcPA, "cancel: %" PRIdQSIZETYPE " touchpoints", d->touchPoints.size()); d->touchPoints.clear(); if (d->inPinch) { d->inPinch = false; @@ -403,7 +403,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering) { Q_D(QQuickPinchArea); - if (d->touchPoints.count() < 2) { + if (d->touchPoints.size() < 2) { // A pinch gesture is not occurring, so stealing the grab is permitted. setKeepTouchGrab(false); setKeepMouseGrab(false); @@ -417,7 +417,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering) event->setExclusiveGrabber(d->touchPoints.first(), nullptr); } - if (d->touchPoints.count() == 0) { + if (d->touchPoints.size() == 0) { if (d->inPinch) { d->inPinch = false; QPointF pinchCenter = mapFromScene(d->sceneLastCenter); @@ -444,7 +444,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering) } QEventPoint touchPoint1 = d->touchPoints.at(0); - QEventPoint touchPoint2 = d->touchPoints.at(d->touchPoints. count() >= 2 ? 1 : 0); + QEventPoint touchPoint2 = d->touchPoints.at(d->touchPoints.size() >= 2 ? 1 : 0); if (touchPoint1.state() == QEventPoint::State::Pressed) d->sceneStartPoint1 = touchPoint1.scenePosition(); @@ -458,7 +458,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering) // Pinch is not started unless there are exactly two touch points // AND one or more of the points has just now been pressed (wasn't pressed already) // AND both points are inside the bounds. - if (d->touchPoints.count() == 2 + if (d->touchPoints.size() == 2 && (touchPoint1.state() == QEventPoint::State::Pressed || touchPoint2.state() == QEventPoint::State::Pressed) && bounds.contains(touchPoint1.position()) && bounds.contains(touchPoint2.position())) { d->id1 = touchPoint1.id(); @@ -480,7 +480,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering) qreal dist = qSqrt(dx*dx + dy*dy); QPointF sceneCenter = (p1 + p2)/2; qreal angle = QLineF(p1, p2).angle(); - if (d->touchPoints.count() == 1) { + if (d->touchPoints.size() == 1) { // If we only have one point then just move the center if (d->id1 == touchPoint1.id()) sceneCenter = d->sceneLastCenter + touchPoint1.scenePosition() - d->lastPoint1; @@ -494,7 +494,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering) qCDebug(lcPA, "pinch \u2316 %.1lf,%.1lf \u21e4%.1lf\u21e5 \u2220 %.1lf", sceneCenter.x(), sceneCenter.y(), dist, angle); if (!d->inPinch || d->initPinch) { - if (d->touchPoints.count() >= 2) { + if (d->touchPoints.size() >= 2) { if (d->initPinch) { if (!d->inPinch) d->pinchStartDist = dist; @@ -525,7 +525,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering) pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); pe.setPoint1(mapFromScene(d->lastPoint1)); pe.setPoint2(mapFromScene(d->lastPoint2)); - pe.setPointCount(d->touchPoints.count()); + pe.setPointCount(d->touchPoints.size()); emit pinchStarted(&pe); if (pe.accepted()) { d->inPinch = true; @@ -568,7 +568,7 @@ void QQuickPinchArea::updatePinch(QTouchEvent *event, bool filtering) pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); pe.setPoint1(touchPoint1.position()); pe.setPoint2(touchPoint2.position()); - pe.setPointCount(d->touchPoints.count()); + pe.setPointCount(d->touchPoints.size()); d->pinchLastScale = scale; d->sceneLastCenter = sceneCenter; d->pinchLastAngle = angle; diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index f7eca278ea..5bb1f4f6d9 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -223,7 +223,7 @@ void QQuickBasePositioner::componentComplete() QQuickItem::componentComplete(); if (d->transitioner) d->transitioner->setPopulateTransitionEnabled(true); - positionedItems.reserve(childItems().count()); + positionedItems.reserve(childItems().size()); prePositioning(); if (d->transitioner) d->transitioner->setPopulateTransitionEnabled(false); @@ -277,7 +277,7 @@ void QQuickBasePositioner::prePositioning() unpositionedItems.clear(); int addedIndex = -1; - for (int ii = 0; ii < children.count(); ++ii) { + for (int ii = 0; ii < children.size(); ++ii) { QQuickItem *child = children.at(ii); if (QQuickItemPrivate::get(child)->isTransparentForPositioner()) continue; diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp index 811ea316fc..997ec17f4e 100644 --- a/src/quick/items/qquickrepeater.cpp +++ b/src/quick/items/qquickrepeater.cpp @@ -297,7 +297,7 @@ int QQuickRepeater::count() const QQuickItem *QQuickRepeater::itemAt(int index) const { Q_D(const QQuickRepeater); - if (index >= 0 && index < d->deletables.count()) + if (index >= 0 && index < d->deletables.size()) return d->deletables[index]; return nullptr; } @@ -329,7 +329,7 @@ void QQuickRepeater::clear() if (d->model) { // We remove in reverse order deliberately; so that signals are emitted // with sensible indices. - for (int i = d->deletables.count() - 1; i >= 0; --i) { + for (int i = d->deletables.size() - 1; i >= 0; --i) { if (QQuickItem *item = d->deletables.at(i)) { if (complete) emit itemRemoved(i, item); @@ -441,8 +441,8 @@ void QQuickRepeater::modelUpdated(const QQmlChangeSet &changeSet, bool reset) int difference = 0; QHash<int, QVector<QPointer<QQuickItem> > > moved; for (const QQmlChangeSet::Change &remove : changeSet.removes()) { - int index = qMin(remove.index, d->deletables.count()); - int count = qMin(remove.index + remove.count, d->deletables.count()) - index; + int index = qMin(remove.index, d->deletables.size()); + int count = qMin(remove.index + remove.count, d->deletables.size()) - index; if (remove.isMove()) { moved.insert(remove.moveId, d->deletables.mid(index, count)); d->deletables.erase( @@ -463,16 +463,16 @@ void QQuickRepeater::modelUpdated(const QQmlChangeSet &changeSet, bool reset) } for (const QQmlChangeSet::Change &insert : changeSet.inserts()) { - int index = qMin(insert.index, d->deletables.count()); + int index = qMin(insert.index, d->deletables.size()); if (insert.isMove()) { QVector<QPointer<QQuickItem> > items = moved.value(insert.moveId); d->deletables = d->deletables.mid(0, index) + items + d->deletables.mid(index); - QQuickItem *stackBefore = index + items.count() < d->deletables.count() - ? d->deletables.at(index + items.count()) + QQuickItem *stackBefore = index + items.size() < d->deletables.size() + ? d->deletables.at(index + items.size()) : this; if (stackBefore) { - for (int i = index; i < index + items.count(); ++i) { - if (i < d->deletables.count()) { + for (int i = index; i < index + items.size(); ++i) { + if (i < d->deletables.size()) { QPointer<QQuickItem> item = d->deletables.at(i); if (item) item->stackBefore(stackBefore); diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 75a75b373a..c383354030 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -1402,7 +1402,7 @@ void QQuickShaderEffectImpl::updateShaderVars(Shader shaderType) const bool texturesSeparate = mgr->hasSeparateSamplerAndTextureObjects(); - const int varCount = m_shaders[shaderType].shaderInfo.variables.count(); + const int varCount = m_shaders[shaderType].shaderInfo.variables.size(); m_shaders[shaderType].varData.resize(varCount); // Recreate signal mappers when the shader has changed. @@ -1499,7 +1499,7 @@ void QQuickShaderEffectImpl::updateShaderVars(Shader shaderType) bool QQuickShaderEffectImpl::sourceIsUnique(QQuickItem *source, Shader typeToSkip, int indexToSkip) const { for (int shaderType = 0; shaderType < NShader; ++shaderType) { - for (int idx = 0; idx < m_shaders[shaderType].varData.count(); ++idx) { + for (int idx = 0; idx < m_shaders[shaderType].varData.size(); ++idx) { if (shaderType != typeToSkip || idx != indexToSkip) { const auto &vd(m_shaders[shaderType].varData[idx]); if (vd.specialType == QSGShaderEffectNode::VariableData::Source && qvariant_cast<QObject *>(vd.value) == source) @@ -1514,7 +1514,7 @@ std::optional<int> QQuickShaderEffectImpl::findMappedShaderVariableId(const QByt { for (int shaderType = 0; shaderType < NShader; ++shaderType) { const auto &vars = m_shaders[shaderType].shaderInfo.variables; - for (int idx = 0; idx < vars.count(); ++idx) { + for (int idx = 0; idx < vars.size(); ++idx) { if (vars[idx].name == name) return indexToMappedId(shaderType, idx); } diff --git a/src/quick/items/qquickshadereffectmesh.cpp b/src/quick/items/qquickshadereffectmesh.cpp index 118ae18df5..2acd1bcf31 100644 --- a/src/quick/items/qquickshadereffectmesh.cpp +++ b/src/quick/items/qquickshadereffectmesh.cpp @@ -54,7 +54,7 @@ QQuickGridMesh::QQuickGridMesh(QObject *parent) bool QQuickGridMesh::validateAttributes(const QList<QByteArray> &attributes, int *posIndex) { - const int attrCount = attributes.count(); + const int attrCount = attributes.size(); int positionIndex = attributes.indexOf(qtPositionAttributeName()); int texCoordIndex = attributes.indexOf(qtTexCoordAttributeName()); diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index fd5b28b2ed..1ae000c695 100644 --- a/src/quick/items/qquickspriteengine.cpp +++ b/src/quick/items/qquickspriteengine.cpp @@ -267,7 +267,7 @@ int QQuickSpriteEngine::spriteCount() const //TODO: Actually image state count, void QQuickStochasticEngine::setGoal(int state, int sprite, bool jump) { - if (sprite >= m_things.count() || state >= m_states.count() + if (sprite >= m_things.size() || state >= m_states.size() || sprite < 0 || state < 0) return; if (!jump){ @@ -488,7 +488,7 @@ void QQuickStochasticEngine::setCount(int c) void QQuickStochasticEngine::start(int index, int state) { - if (index >= m_things.count()) + if (index >= m_things.size()) return; m_things[index] = state; m_duration[index] = m_states.at(state)->variedDuration(); @@ -504,10 +504,10 @@ void QQuickStochasticEngine::start(int index, int state) void QQuickStochasticEngine::stop(int index) { - if (index >= m_things.count()) + if (index >= m_things.size()) return; //Will never change until start is called again with a new state (or manually advanced) - this is not a 'pause' - for (int i=0; i<m_stateUpdates.count(); i++) + for (int i=0; i<m_stateUpdates.size(); i++) m_stateUpdates[i].second.removeAll(index); } @@ -520,7 +520,7 @@ void QQuickStochasticEngine::restart(int index) if (randomStart) m_startTimes[index] -= QRandomGenerator::global()->bounded(m_duration.at(index)); int time = m_duration.at(index) + m_startTimes.at(index); - for (int i=0; i<m_stateUpdates.count(); i++) + for (int i=0; i<m_stateUpdates.size(); i++) m_stateUpdates[i].second.removeAll(index); if (m_duration.at(index) >= 0) addToUpdateList(time, index); @@ -546,7 +546,7 @@ void QQuickSpriteEngine::restart(int index) //Reimplemented to recognize and han time += spriteDuration(index); } - for (int i=0; i<m_stateUpdates.count(); i++) + for (int i=0; i<m_stateUpdates.size(); i++) m_stateUpdates[i].second.removeAll(index); addToUpdateList(time, index); } @@ -554,7 +554,7 @@ void QQuickSpriteEngine::restart(int index) //Reimplemented to recognize and han void QQuickStochasticEngine::advance(int idx) { - if (idx >= m_things.count()) + if (idx >= m_things.size()) return;//TODO: Proper fix(because this has happened and I just ignored it) int nextIdx = nextState(m_things.at(idx), idx); m_things[idx] = nextIdx; @@ -571,7 +571,7 @@ void QQuickSpriteEngine::advance(int idx) //Reimplemented to recognize and handl return; } - if (idx >= m_things.count()) + if (idx >= m_things.size()) return;//TODO: Proper fix(because this has happened and I just ignored it) if (m_duration.at(idx) == 0) { if (m_sprites.at(m_things.at(idx))->frameSync()) { @@ -614,7 +614,7 @@ int QQuickStochasticEngine::nextState(int curState, int curThing) iter!=m_states.at(curState)->m_to.constEnd(); ++iter){ if (r < (*iter).toReal()){ bool superBreak = false; - for (int i=0; i<m_states.count(); i++){ + for (int i=0; i<m_states.size(); i++){ if (m_states.at(i)->name() == iter.key()){ nextIdx = i; superBreak = true; @@ -640,7 +640,7 @@ uint QQuickStochasticEngine::updateSprites(uint time)//### would returning a lis m_timeOffset = time; m_addAdvance = false; int i = 0; - for (; i < m_stateUpdates.count() && time >= m_stateUpdates.at(i).first; ++i) { + for (; i < m_stateUpdates.size() && time >= m_stateUpdates.at(i).first; ++i) { const auto copy = m_stateUpdates.at(i).second; for (int idx : copy) advance(idx); @@ -665,16 +665,16 @@ int QQuickStochasticEngine::goalSeek(int curIdx, int spriteIdx, int dist) return -1; //TODO: caching instead of excessively redoing iterative deepening (which was chosen arbitrarily anyways) // Paraphrased - implement in an *efficient* manner - for (int i=0; i<m_states.count(); i++) + for (int i=0; i<m_states.size(); i++) if (m_states.at(curIdx)->name() == goalName) return curIdx; if (dist < 0) - dist = m_states.count(); + dist = m_states.size(); QQuickStochasticState* curState = m_states.at(curIdx); for (QVariantMap::const_iterator iter = curState->m_to.constBegin(); iter!=curState->m_to.constEnd(); ++iter){ if (iter.key() == goalName) - for (int i=0; i<m_states.count(); i++) + for (int i=0; i<m_states.size(); i++) if (m_states.at(i)->name() == goalName) return i; } @@ -683,7 +683,7 @@ int QQuickStochasticEngine::goalSeek(int curIdx, int spriteIdx, int dist) for (QVariantMap::const_iterator iter = curState->m_to.constBegin(); iter!=curState->m_to.constEnd(); ++iter){ int option = -1; - for (int j=0; j<m_states.count(); j++)//One place that could be a lot more efficient... + for (int j=0; j<m_states.size(); j++)//One place that could be a lot more efficient... if (m_states.at(j)->name() == iter.key()) if (goalSeek(j, spriteIdx, i) != -1) option = j; @@ -691,7 +691,7 @@ int QQuickStochasticEngine::goalSeek(int curIdx, int spriteIdx, int dist) options << option; } if (!options.isEmpty()){ - if (options.count()==1) + if (options.size()==1) return *(options.begin()); int option = -1; qreal r = QRandomGenerator::global()->generateDouble(); @@ -703,7 +703,7 @@ int QQuickStochasticEngine::goalSeek(int curIdx, int spriteIdx, int dist) for (QVariantMap::const_iterator iter = curState->m_to.constBegin(); iter!=curState->m_to.constEnd(); ++iter){ bool superContinue = true; - for (int j=0; j<m_states.count(); j++) + for (int j=0; j<m_states.size(); j++) if (m_states.at(j)->name() == iter.key()) if (options.contains(j)) superContinue = false; @@ -711,7 +711,7 @@ int QQuickStochasticEngine::goalSeek(int curIdx, int spriteIdx, int dist) continue; if (r < (*iter).toReal()){ bool superBreak = false; - for (int j=0; j<m_states.count(); j++){ + for (int j=0; j<m_states.size(); j++){ if (m_states.at(j)->name() == iter.key()){ option = j; superBreak = true; @@ -731,7 +731,7 @@ int QQuickStochasticEngine::goalSeek(int curIdx, int spriteIdx, int dist) void QQuickStochasticEngine::addToUpdateList(uint t, int idx) { - for (int i=0; i<m_stateUpdates.count(); i++){ + for (int i=0; i<m_stateUpdates.size(); i++){ if (m_stateUpdates.at(i).first == t){ m_stateUpdates[i].second << idx; return; diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h index 3b74df241a..ee2fa34f72 100644 --- a/src/quick/items/qquickspriteengine_p.h +++ b/src/quick/items/qquickspriteengine_p.h @@ -168,7 +168,7 @@ public: return m_globalGoal; } - int count() const {return m_things.count();} + int count() const {return m_things.size();} void setCount(int c); void setGoal(int state, int sprite=0, bool jump=false); @@ -181,13 +181,13 @@ public: QQuickStochasticState* state(int idx) const {return m_states[idx];} int stateIndex(QQuickStochasticState* s) const {return m_states.indexOf(s);} int stateIndex(const QString& s) const { - for (int i=0; i<m_states.count(); i++) + for (int i=0; i<m_states.size(); i++) if (m_states[i]->name() == s) return i; return -1; } - int stateCount() {return m_states.count();} + int stateCount() {return m_states.size();} private: Q_SIGNALS: @@ -291,7 +291,7 @@ inline void spriteClear(QQmlListProperty<QQuickSprite> *p) inline qsizetype spriteCount(QQmlListProperty<QQuickSprite> *p) { - return reinterpret_cast<QList<QQuickSprite *> *>(p->data)->count(); + return reinterpret_cast<QList<QQuickSprite *> *>(p->data)->size(); } inline void spriteReplace(QQmlListProperty<QQuickSprite> *p, qsizetype idx, QQuickSprite *s) diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp index 7e005935e4..4feb3402b1 100644 --- a/src/quick/items/qquickspritesequence.cpp +++ b/src/quick/items/qquickspritesequence.cpp @@ -161,7 +161,7 @@ void QQuickSpriteSequence::createEngine() //TODO: delay until component complete if (d->m_spriteEngine) delete d->m_spriteEngine; - if (d->m_sprites.count()) { + if (d->m_sprites.size()) { d->m_spriteEngine = new QQuickSpriteEngine(d->m_sprites, this); if (!d->m_goalState.isEmpty()) d->m_spriteEngine->setGoal(d->m_spriteEngine->stateIndex(d->m_goalState)); diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp index 9e1d771364..a6e5eed56c 100644 --- a/src/quick/items/qquickstateoperations.cpp +++ b/src/quick/items/qquickstateoperations.cpp @@ -504,7 +504,7 @@ void QQuickParentChange::saveCurrentValues() return; QList<QQuickItem *> children = d->rewind->parent->childItems(); - for (int ii = 0; ii < children.count() - 1; ++ii) { + for (int ii = 0; ii < children.size() - 1; ++ii) { if (children.at(ii) == d->target) { d->rewind->stackBefore = children.at(ii + 1); break; diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h index 608eee8558..d189669f94 100644 --- a/src/quick/items/qquicktableview_p_p.h +++ b/src/quick/items/qquicktableview_p_p.h @@ -105,7 +105,7 @@ public: inline bool isActive() const { return m_active; } inline QPoint currentCell() const { return cellAt(m_currentIndex); } - inline bool hasCurrentCell() const { return m_currentIndex < m_visibleCellsInEdge.count(); } + inline bool hasCurrentCell() const { return m_currentIndex < m_visibleCellsInEdge.size(); } inline void moveToNextCell() { ++m_currentIndex; } inline Qt::Edge edge() const { return m_edge; } diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 2043404363..cdaf5cf601 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -617,7 +617,7 @@ void QQuickTextPrivate::elideFormats( { const int end = start + length; const QVector<QTextLayout::FormatRange> formats = layout.formats(); - for (int i = 0; i < formats.count(); ++i) { + for (int i = 0; i < formats.size(); ++i) { QTextLayout::FormatRange format = formats.at(i); const int formatLength = qMin(format.start + format.length, end) - qMax(format.start, start); if (formatLength > 0) { @@ -641,7 +641,7 @@ QString QQuickTextPrivate::elidedText(qreal lineWidth, const QTextLine &line, QT QString elideText = layout.text().mid(line.textStart(), line.textLength()); if (!styledText) { // QFontMetrics won't help eliding styled text. - elideText[elideText.length() - 1] = elideChar; + elideText[elideText.size() - 1] = elideChar; // Appending the elide character may push the line over the maximum width // in which case the elided text will need to be elided. QFontMetricsF metrics(layout.font()); @@ -797,7 +797,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) if (noBreakLastLine && visibleCount == maxLineCount) layout.engine()->option.setWrapMode(QTextOption::WrapAnywhere); if (customLayout) { - setupCustomLineGeometry(line, naturalHeight, layoutText.length()); + setupCustomLineGeometry(line, naturalHeight, layoutText.size()); } else { setLineGeometry(line, lineWidth, naturalHeight); } @@ -911,8 +911,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) // implicit width. const int eol = line.isValid() ? line.textStart() + line.textLength() - : layoutText.length(); - if (eol < layoutText.length() && layoutText.at(eol) != QChar::LineSeparator) + : layoutText.size(); + if (eol < layoutText.size() && layoutText.at(eol) != QChar::LineSeparator) line = layout.createLine(); for (; line.isValid() && unwrappedLineCount <= maxLineCount; ++unwrappedLineCount) line = layout.createLine(); @@ -1109,18 +1109,18 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) QVector<QTextLayout::FormatRange> formats; switch (elideMode) { case QQuickText::ElideRight: - elideFormats(elideStart, elideText.length() - 1, 0, &formats); + elideFormats(elideStart, elideText.size() - 1, 0, &formats); break; case QQuickText::ElideLeft: - elideFormats(elideEnd - elideText.length() + 1, elideText.length() - 1, 1, &formats); + elideFormats(elideEnd - elideText.size() + 1, elideText.size() - 1, 1, &formats); break; case QQuickText::ElideMiddle: { const int index = elideText.indexOf(elideChar); if (index != -1) { elideFormats(elideStart, index, 0, &formats); elideFormats( - elideEnd - elideText.length() + index + 1, - elideText.length() - index - 1, + elideEnd - elideText.size() + index + 1, + elideText.size() - index - 1, index + 1, &formats); } @@ -1140,7 +1140,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) QTextLine elidedLine = elideLayout->createLine(); elidedLine.setPosition(QPointF(0, height)); if (customLayout) { - setupCustomLineGeometry(elidedLine, height, elideText.length(), visibleCount - 1); + setupCustomLineGeometry(elidedLine, height, elideText.size(), visibleCount - 1); } else { setLineGeometry(elidedLine, lineWidth, height); } diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index d6392e5e7e..929ce10136 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -962,7 +962,7 @@ QRectF QQuickTextControlPrivate::rectForPosition(int position) const if (relativePos == preeditPos) relativePos += preeditCursor; else if (relativePos > preeditPos) - relativePos += layout->preeditAreaText().length(); + relativePos += layout->preeditAreaText().size(); } #endif QTextLine line = layout->lineForTextPosition(relativePos); @@ -1271,7 +1271,7 @@ bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, cons QTextLayout *layout = cursor.block().layout(); int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position(); - if (cursorPos >= 0 && cursorPos <= layout->preeditAreaText().length()) { + if (cursorPos >= 0 && cursorPos <= layout->preeditAreaText().size()) { if (e->type() == QEvent::MouseButtonRelease) { QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, cursorPos); } @@ -1343,7 +1343,7 @@ void QQuickTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) emit q->preeditTextChanged(); } QVector<QTextLayout::FormatRange> overrides; - preeditCursor = e->preeditString().length(); + preeditCursor = e->preeditString().size(); hasImState = !e->preeditString().isEmpty(); cursorVisible = true; for (int i = 0; i < e->attributes().size(); ++i) { @@ -1416,7 +1416,7 @@ QVariant QQuickTextControl::inputMethodQuery(Qt::InputMethodQuery property, cons QTextCursor tmpCursor = d->cursor; int localPos = d->cursor.position() - block.position(); QString result = block.text().mid(localPos); - while (result.length() < maxLength) { + while (result.size() < maxLength) { int currentBlock = tmpCursor.blockNumber(); tmpCursor.movePosition(QTextCursor::NextBlock); if (tmpCursor.blockNumber() == currentBlock) diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 33d47757fd..88eb4c166e 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -1093,7 +1093,7 @@ int QQuickTextEdit::positionAt(qreal x, qreal y) const // preedit or the next text block. QTextLayout *layout = cursor.block().layout(); const int preeditLength = layout - ? layout->preeditAreaText().length() + ? layout->preeditAreaText().size() : 0; if (preeditLength > 0 && d->document->documentLayout()->blockBoundingRect(cursor.block()).contains(x, y)) { diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index bf20cff5f1..bec0a5a990 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -173,7 +173,7 @@ void QQuickTextInput::setRenderType(QQuickTextInput::RenderType renderType) int QQuickTextInput::length() const { Q_D(const QQuickTextInput); - return d->m_text.length(); + return d->m_text.size(); } /*! @@ -833,7 +833,7 @@ int QQuickTextInput::cursorPosition() const void QQuickTextInput::setCursorPosition(int cp) { Q_D(QQuickTextInput); - if (cp < 0 || cp > text().length()) + if (cp < 0 || cp > text().size()) return; d->moveCursor(cp); } @@ -866,7 +866,7 @@ QRectF QQuickTextInput::cursorRectangle() const qreal y = l.y() - d->vscroll + topPadding(); qreal w = 1; if (d->overwriteMode) { - if (c < text().length()) + if (c < text().size()) w = l.cursorToX(c + 1) - x; else w = QFontMetrics(font()).horizontalAdvance(QLatin1Char(' ')); // in sync with QTextLine::draw() @@ -922,7 +922,7 @@ int QQuickTextInput::selectionEnd() const void QQuickTextInput::select(int start, int end) { Q_D(QQuickTextInput); - if (start < 0 || end < 0 || start > d->m_text.length() || end > d->m_text.length()) + if (start < 0 || end < 0 || start > d->m_text.size() || end > d->m_text.size()) return; d->setSelection(start, end-start); } @@ -1365,7 +1365,7 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const pos = 0; #if QT_CONFIG(im) else if (pos > d->m_cursor) - pos += d->preeditAreaText().length(); + pos += d->preeditAreaText().size(); #endif QTextLine l = d->m_textLayout.lineForTextPosition(pos); if (!l.isValid()) @@ -1374,7 +1374,7 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const qreal y = l.y() - d->vscroll; qreal w = 1; if (d->overwriteMode) { - if (pos < text().length()) + if (pos < text().size()) w = l.cursorToX(pos + 1) - x; else w = QFontMetrics(font()).horizontalAdvance(QLatin1Char(' ')); // in sync with QTextLine::draw() @@ -1435,7 +1435,7 @@ void QQuickTextInput::positionAt(QQmlV4Function *args) const const int cursor = d->m_cursor; if (pos > cursor) { #if QT_CONFIG(im) - const int preeditLength = d->preeditAreaText().length(); + const int preeditLength = d->preeditAreaText().size(); pos = pos > cursor + preeditLength ? pos - preeditLength : cursor; @@ -1503,7 +1503,7 @@ void QQuickTextInput::keyPressEvent(QKeyEvent* ev) int cursorPosition = d->m_cursor; if (cursorPosition == 0) ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Left : Qt::Key_Right); - if (!ignore && cursorPosition == d->m_text.length()) + if (!ignore && cursorPosition == d->m_text.size()) ignore = ev->key() == (d->layoutDirection() == Qt::LeftToRight ? Qt::Key_Right : Qt::Key_Left); } if (ignore) { @@ -1666,7 +1666,7 @@ bool QQuickTextInputPrivate::sendMouseEventToInputContext(QMouseEvent *event) if (composeMode()) { int tmp_cursor = positionAt(event->position()); int mousePos = tmp_cursor - m_cursor; - if (mousePos >= 0 && mousePos <= m_textLayout.preeditAreaText().length()) { + if (mousePos >= 0 && mousePos <= m_textLayout.preeditAreaText().size()) { if (event->type() == QEvent::MouseButtonRelease) { QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, mousePos); } @@ -1810,7 +1810,7 @@ void QQuickTextInputPrivate::updateHorizontalScroll() { if (autoScroll && m_echoMode != QQuickTextInput::NoEcho) { #if QT_CONFIG(im) - const int preeditLength = m_textLayout.preeditAreaText().length(); + const int preeditLength = m_textLayout.preeditAreaText().size(); ensureVisible(m_cursor, m_preeditCursor, preeditLength); #else ensureVisible(m_cursor); @@ -1824,7 +1824,7 @@ void QQuickTextInputPrivate::updateVerticalScroll() { Q_Q(QQuickTextInput); #if QT_CONFIG(im) - const int preeditLength = m_textLayout.preeditAreaText().length(); + const int preeditLength = m_textLayout.preeditAreaText().size(); #endif const qreal height = qMax<qreal>(0, q->height() - q->topPadding() - q->bottomPadding()); qreal heightUsed = contentSize.height(); @@ -2049,7 +2049,7 @@ void QQuickTextInput::deselect() void QQuickTextInput::selectAll() { Q_D(QQuickTextInput); - d->setSelection(0, text().length()); + d->setSelection(0, text().size()); } /*! @@ -2162,7 +2162,7 @@ void QQuickTextInput::insert(int position, const QString &text) if (d->m_passwordMaskDelay > 0) d->m_passwordEchoTimer.start(d->m_passwordMaskDelay, this); } - if (position < 0 || position > d->m_text.length()) + if (position < 0 || position > d->m_text.size()) return; const int priorState = d->m_undoState; @@ -2175,31 +2175,31 @@ void QQuickTextInput::insert(int position, const QString &text) } if (d->m_maskData) { insertText = d->maskString(position, insertText); - for (int i = 0; i < insertText.length(); ++i) { + for (int i = 0; i < insertText.size(); ++i) { d->addCommand(QQuickTextInputPrivate::Command( QQuickTextInputPrivate::DeleteSelection, position + i, d->m_text.at(position + i), -1, -1)); d->addCommand(QQuickTextInputPrivate::Command( QQuickTextInputPrivate::Insert, position + i, insertText.at(i), -1, -1)); } - d->m_text.replace(position, insertText.length(), insertText); + d->m_text.replace(position, insertText.size(), insertText); if (!insertText.isEmpty()) d->m_textDirty = true; - if (position < d->m_selend && position + insertText.length() > d->m_selstart) + if (position < d->m_selend && position + insertText.size() > d->m_selstart) d->m_selDirty = true; } else { - int remaining = d->m_maxLength - d->m_text.length(); + int remaining = d->m_maxLength - d->m_text.size(); if (remaining != 0) { insertText = insertText.left(remaining); d->m_text.insert(position, insertText); - for (int i = 0; i < insertText.length(); ++i) + for (int i = 0; i < insertText.size(); ++i) d->addCommand(QQuickTextInputPrivate::Command( QQuickTextInputPrivate::Insert, position + i, insertText.at(i), -1, -1)); if (d->m_cursor >= position) - d->m_cursor += insertText.length(); + d->m_cursor += insertText.size(); if (d->m_selstart >= position) - d->m_selstart += insertText.length(); + d->m_selstart += insertText.size(); if (d->m_selend >= position) - d->m_selend += insertText.length(); + d->m_selend += insertText.size(); d->m_textDirty = true; if (position >= d->m_selstart && position <= d->m_selend) d->m_selDirty = true; @@ -2232,8 +2232,8 @@ void QQuickTextInput::remove(int start, int end) { Q_D(QQuickTextInput); - start = qBound(0, start, d->m_text.length()); - end = qBound(0, end, d->m_text.length()); + start = qBound(0, start, d->m_text.size()); + end = qBound(0, end, d->m_text.size()); if (start > end) qSwap(start, end); @@ -2331,7 +2331,7 @@ QString QQuickTextInput::passwordCharacter() const void QQuickTextInput::setPasswordCharacter(const QString &str) { Q_D(QQuickTextInput); - if (str.length() < 1) + if (str.size() < 1) return; d->m_passwordCharacter = str.constData()[0]; if (d->m_echoMode == Password || d->m_echoMode == PasswordEchoOnEdit) @@ -2630,7 +2630,7 @@ void QQuickTextInput::moveCursorSelection(int pos, SelectionMode mode) finder.setPosition(anchor); const QTextBoundaryFinder::BoundaryReasons reasons = finder.boundaryReasons(); - if (anchor < text.length() && (reasons == QTextBoundaryFinder::NotAtBoundary + if (anchor < text.size() && (reasons == QTextBoundaryFinder::NotAtBoundary || (reasons & QTextBoundaryFinder::EndOfItem))) { finder.toPreviousBoundary(); } @@ -2639,7 +2639,7 @@ void QQuickTextInput::moveCursorSelection(int pos, SelectionMode mode) finder.setPosition(pos); if (pos > 0 && !finder.boundaryReasons()) finder.toNextBoundary(); - const int cursor = finder.position() != -1 ? finder.position() : text.length(); + const int cursor = finder.position() != -1 ? finder.position() : text.size(); d->setSelection(anchor, cursor - anchor); } else if (anchor > pos || (anchor == pos && cursor > pos)) { @@ -2652,10 +2652,10 @@ void QQuickTextInput::moveCursorSelection(int pos, SelectionMode mode) || (reasons & QTextBoundaryFinder::StartOfItem))) { finder.toNextBoundary(); } - anchor = finder.position() != -1 ? finder.position() : text.length(); + anchor = finder.position() != -1 ? finder.position() : text.size(); finder.setPosition(pos); - if (pos < text.length() && !finder.boundaryReasons()) + if (pos < text.size() && !finder.boundaryReasons()) finder.toPreviousBoundary(); const int cursor = finder.position() != -1 ? finder.position() : 0; @@ -2911,7 +2911,7 @@ void QQuickTextInputPrivate::updateDisplayText(bool forceUpdate) if (m_echoMode == QQuickTextInput::Password) { str.fill(m_passwordCharacter); - if (m_passwordEchoTimer.isActive() && m_cursor > 0 && m_cursor <= m_text.length()) { + if (m_passwordEchoTimer.isActive() && m_cursor > 0 && m_cursor <= m_text.size()) { int cursor = m_cursor - 1; QChar uc = m_text.at(cursor); str[cursor] = uc; @@ -2931,7 +2931,7 @@ void QQuickTextInputPrivate::updateDisplayText(bool forceUpdate) // drawing boxes when using fonts that don't have glyphs for such // characters) QChar* uc = str.data(); - for (int i = 0; i < str.length(); ++i) { + for (int i = 0; i < str.size(); ++i) { if (uc[i] == QChar::LineSeparator || uc[i] == QChar::ParagraphSeparator || uc[i] == QChar::ObjectReplacementCharacter) @@ -3303,7 +3303,7 @@ void QQuickTextInputPrivate::clear() int priorState = m_undoState; separateSelection(); m_selstart = 0; - m_selend = m_text.length(); + m_selend = m_text.size(); removeSelectedText(); separate(); finishChange(priorState, /*update*/false, /*edited*/false); @@ -3324,7 +3324,7 @@ void QQuickTextInputPrivate::setSelection(int start, int length) commitPreedit(); #endif - if (start < 0 || start > m_text.length()) { + if (start < 0 || start > m_text.size()) { qWarning("QQuickTextInputPrivate::setSelection: Invalid start position"); return; } @@ -3333,7 +3333,7 @@ void QQuickTextInputPrivate::setSelection(int start, int length) if (start == m_selstart && start + length == m_selend && m_cursor == m_selend) return; m_selstart = start; - m_selend = qMin(start + length, m_text.length()); + m_selend = qMin(start + length, m_text.size()); m_cursor = m_selend; } else if (length < 0) { if (start == m_selend && start + length == m_selstart && m_cursor == m_selstart) @@ -3465,14 +3465,14 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) if (m_echoMode == QQuickTextInput::PasswordEchoOnEdit && !m_passwordEchoEditing) { updatePasswordEchoEditing(true); m_selstart = 0; - m_selend = m_text.length(); + m_selend = m_text.size(); } removeSelectedText(); } int c = m_cursor; // cursor position after insertion of commit string if (event->replacementStart() <= 0) - c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength()); + c += event->commitString().size() - qMin(-event->replacementStart(), event->replacementLength()); int cursorInsertPos = m_cursor + event->replacementStart(); if (cursorInsertPos < 0) @@ -3482,7 +3482,7 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) if (event->replacementLength()) { m_selstart = cursorInsertPos; m_selend = m_selstart + event->replacementLength(); - m_selend = qMin(m_selend, m_text.length()); + m_selend = qMin(m_selend, m_text.size()); removeSelectedText(); } m_cursor = cursorInsertPos; @@ -3491,7 +3491,7 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) internalInsert(event->commitString()); cursorPositionChanged = true; } else { - m_cursor = qBound(0, c, m_text.length()); + m_cursor = qBound(0, c, m_text.size()); } for (int i = 0; i < event->attributes().size(); ++i) { @@ -3502,9 +3502,9 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) // not seem to take the mask into account, so it will reset cursor // to an invalid position in such case. if (!cursorPositionChanged) - m_cursor = qBound(0, a.start + a.length, m_text.length()); + m_cursor = qBound(0, a.start + a.length, m_text.size()); if (a.length) { - m_selstart = qMax(0, qMin(a.start, m_text.length())); + m_selstart = qMax(0, qMin(a.start, m_text.size())); m_selend = m_cursor; if (m_selend < m_selstart) { qSwap(m_selstart, m_selend); @@ -3525,7 +3525,7 @@ void QQuickTextInputPrivate::processInputMethodEvent(QInputMethodEvent *event) m_undoPreeditState = priorState; } const int oldPreeditCursor = m_preeditCursor; - m_preeditCursor = event->preeditString().length(); + m_preeditCursor = event->preeditString().size(); hasImState = !event->preeditString().isEmpty(); bool cursorVisible = true; QVector<QTextLayout::FormatRange> formats; @@ -3653,7 +3653,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo validateFromState = m_undoPreeditState; #endif if (validateFromState >= 0 && wasValidInput && !m_validInput) { - if (m_transactions.count()) + if (m_transactions.size()) return false; internalUndo(validateFromState); m_history.resize(m_undoState); @@ -3718,7 +3718,7 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e QString oldText = m_text; if (m_maskData) { m_text = maskString(0, txt, true); - m_text += clearString(m_text.length(), m_maxLength - m_text.length()); + m_text += clearString(m_text.size(), m_maxLength - m_text.size()); } else { m_text = txt.isEmpty() ? txt : txt.left(m_maxLength); } @@ -3727,7 +3727,7 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e #if QT_CONFIG(im) m_undoPreeditState = -1; #endif - m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos; + m_cursor = (pos < 0 || pos > m_text.size()) ? m_text.size() : pos; m_textDirty = (oldText != m_text); bool changed = finishChange(-1, true, edited); @@ -3783,16 +3783,16 @@ void QQuickTextInputPrivate::internalInsert(const QString &s) Q_ASSERT(!hasSelectedText()); // insert(), processInputMethodEvent() call removeSelectedText() first. if (m_maskData) { QString ms = maskString(m_cursor, s); - for (int i = 0; i < ms.length(); ++i) { + for (int i = 0; i < ms.size(); ++i) { addCommand (Command(DeleteSelection, m_cursor + i, m_text.at(m_cursor + i), -1, -1)); addCommand(Command(Insert, m_cursor + i, ms.at(i), -1, -1)); } - m_text.replace(m_cursor, ms.length(), ms); - m_cursor += ms.length(); + m_text.replace(m_cursor, ms.size(), ms); + m_cursor += ms.size(); m_cursor = nextMaskBlank(m_cursor); m_textDirty = true; } else { - int remaining = m_maxLength - m_text.length(); + int remaining = m_maxLength - m_text.size(); if (remaining != 0) { const QStringView remainingStr = QStringView{s}.left(remaining); m_text.insert(m_cursor, remainingStr); @@ -3816,7 +3816,7 @@ void QQuickTextInputPrivate::internalInsert(const QString &s) */ void QQuickTextInputPrivate::internalDelete(bool wasBackspace) { - if (m_cursor < m_text.length()) { + if (m_cursor < m_text.size()) { cancelPasswordEchoTimer(); Q_ASSERT(!hasSelectedText()); // del(), backspace() call removeSelectedText() first. addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)), @@ -3842,7 +3842,7 @@ void QQuickTextInputPrivate::internalDelete(bool wasBackspace) */ void QQuickTextInputPrivate::removeSelectedText() { - if (m_selstart < m_selend && m_selend <= m_text.length()) { + if (m_selstart < m_selend && m_selend <= m_text.size()) { cancelPasswordEchoTimer(); int i ; if (m_selstart <= m_cursor && m_cursor < m_selend) { @@ -3912,13 +3912,13 @@ void QQuickTextInputPrivate::parseInputMask(const QString &maskFields) m_inputMask = maskFields; } else { m_inputMask = maskFields.left(delimiter); - m_blank = (delimiter + 1 < maskFields.length()) ? maskFields[delimiter + 1] : QLatin1Char(' '); + m_blank = (delimiter + 1 < maskFields.size()) ? maskFields[delimiter + 1] : QLatin1Char(' '); } // calculate m_maxLength / m_maskData length m_maxLength = 0; QChar c = u'\0'; - for (int i=0; i<m_inputMask.length(); i++) { + for (int i=0; i<m_inputMask.size(); i++) { c = m_inputMask.at(i); if (i > 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) { m_maxLength++; @@ -3938,7 +3938,7 @@ void QQuickTextInputPrivate::parseInputMask(const QString &maskFields) bool s; bool escape = false; int index = 0; - for (int i = 0; i < m_inputMask.length(); i++) { + for (int i = 0; i < m_inputMask.size(); i++) { c = m_inputMask.at(i); if (escape) { s = true; @@ -4089,7 +4089,7 @@ QQuickTextInputPrivate::ValidatorState QQuickTextInputPrivate::hasAcceptableInpu if (!m_maskData) return AcceptableInput; - if (str.length() != m_maxLength) + if (str.size() != m_maxLength) return InvalidInput; for (int i=0; i < m_maxLength; ++i) { @@ -4124,7 +4124,7 @@ QString QQuickTextInputPrivate::maskString(uint pos, const QString &str, bool cl QString s = QString::fromLatin1(""); int i = pos; while (i < m_maxLength) { - if (strIndex < str.length()) { + if (strIndex < str.size()) { if (m_maskData[i].separator) { s += m_maskData[i].maskChar; if (str[strIndex] == m_maskData[i].maskChar) @@ -4147,7 +4147,7 @@ QString QQuickTextInputPrivate::maskString(uint pos, const QString &str, bool cl // search for separator first int n = findInMask(i, true, true, str[strIndex]); if (n != -1) { - if (str.length() != 1 || i == 0 || (i > 0 && (!m_maskData[i-1].separator || m_maskData[i-1].maskChar != str[strIndex]))) { + if (str.size() != 1 || i == 0 || (i > 0 && (!m_maskData[i-1].separator || m_maskData[i-1].maskChar != str[strIndex]))) { s += QStringView{fill}.mid(i, n-i+1); i = n + 1; // update i to find + 1 } @@ -4215,7 +4215,7 @@ QString QQuickTextInputPrivate::stripString(const QString &str) const return str; QString s; - int end = qMin(m_maxLength, str.length()); + int end = qMin(m_maxLength, str.size()); for (int i = 0; i < end; ++i) { if (m_maskData[i].separator) s += m_maskData[i].maskChar; @@ -4640,7 +4640,7 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) // no need to call del() if we have a selection, insert // does it already && !hasSelectedText() - && !(m_cursor == q_func()->text().length())) { + && !(m_cursor == q_func()->text().size())) { del(); } diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h index 3facf42496..01d90f6b10 100644 --- a/src/quick/items/qquicktextinput_p_p.h +++ b/src/quick/items/qquicktextinput_p_p.h @@ -315,7 +315,7 @@ public: #endif } - bool allSelected() const { return !m_text.isEmpty() && m_selstart == 0 && m_selend == (int)m_text.length(); } + bool allSelected() const { return !m_text.isEmpty() && m_selstart == 0 && m_selend == (int)m_text.size(); } bool hasSelectedText() const { return !m_text.isEmpty() && m_selend > m_selstart; } void setSelection(int start, int length); @@ -342,7 +342,7 @@ public: } int start() const { return 0; } - int end() const { return m_text.length(); } + int end() const { return m_text.size(); } QString realText() const; @@ -379,18 +379,18 @@ public: void cursorWordBackward(bool mark) { moveCursor(m_textLayout.previousCursorPosition(m_cursor, QTextLayout::SkipWords), mark); } void home(bool mark) { moveCursor(0, mark); } - void end(bool mark) { moveCursor(q_func()->text().length(), mark); } + void end(bool mark) { moveCursor(q_func()->text().size(), mark); } void backspace(); void del(); void deselect() { internalDeselect(); finishChange(); } - void selectAll() { m_selstart = m_selend = m_cursor = 0; moveCursor(m_text.length(), true); } + void selectAll() { m_selstart = m_selend = m_cursor = 0; moveCursor(m_text.size(), true); } void insert(const QString &); void clear(); void selectWordAtPos(int); - void setCursorPosition(int pos) { if (pos <= m_text.length()) moveCursor(qMax(0, pos)); } + void setCursorPosition(int pos) { if (pos <= m_text.size()) moveCursor(qMax(0, pos)); } bool fixup(); diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp index 84fae432d3..171cbdee8b 100644 --- a/src/quick/items/qquicktextnode.cpp +++ b/src/quick/items/qquicktextnode.cpp @@ -223,7 +223,7 @@ void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLay engine.setPosition(position); #if QT_CONFIG(im) - int preeditLength = textLayout->preeditAreaText().length(); + int preeditLength = textLayout->preeditAreaText().size(); int preeditPosition = textLayout->preeditAreaPosition(); #endif diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index df96a4af41..d47bb7c3f3 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -960,7 +960,7 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText { Q_ASSERT(textDocument); #if QT_CONFIG(im) - int preeditLength = block.isValid() ? block.layout()->preeditAreaText().length() : 0; + int preeditLength = block.isValid() ? block.layout()->preeditAreaText().size() : 0; int preeditPosition = block.isValid() ? block.layout()->preeditAreaPosition() : -1; #endif @@ -1082,14 +1082,14 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText } QQuickTextNodeEngine::SelectionState selectionState = - (selectionStart < textPos + text.length() + (selectionStart < textPos + text.size() && selectionEnd >= textPos) ? QQuickTextNodeEngine::Selected : QQuickTextNodeEngine::Unselected; addTextObject(block, QPointF(), charFormat, selectionState, textDocument, textPos); } - textPos += text.length(); + textPos += text.size(); } else { if (charFormat.foreground().style() != Qt::NoBrush) setTextColor(charFormat.foreground().color()); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 02f8539c86..3d8115b1bc 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -280,7 +280,7 @@ struct PolishLoopDetector **/ bool check(QQuickItem *item, int itemsRemainingBeforeUpdatePolish) { - if (itemsToPolish.count() > itemsRemainingBeforeUpdatePolish) { + if (itemsToPolish.size() > itemsRemainingBeforeUpdatePolish) { // Detected potential polish loop. ++numPolishLoopsInSequence; if (numPolishLoopsInSequence >= 1000) { @@ -339,7 +339,7 @@ void QQuickWindowPrivate::polishItems() QQuickItem *item = itemsToPolish.takeLast(); QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); itemPrivate->polishScheduled = false; - const int itemsRemaining = itemsToPolish.count(); + const int itemsRemaining = itemsToPolish.size(); itemPrivate->updatePolish(); item->updatePolish(); if (polishLoopDetector.check(item, itemsRemaining) == true) @@ -1695,7 +1695,7 @@ QPair<QQuickItem*, QQuickPointerHandler*> QQuickWindowPrivate::findCursorItemAnd if (itemPrivate->subtreeCursorEnabled) { QList<QQuickItem *> children = itemPrivate->paintOrderChildItems(); - for (int ii = children.count() - 1; ii >= 0; --ii) { + for (int ii = children.size() - 1; ii >= 0; --ii) { QQuickItem *child = children.at(ii); if (!child->isVisible() || !child->isEnabled() || QQuickItemPrivate::get(child)->culled) continue; @@ -1818,7 +1818,7 @@ void QQuickWindowPrivate::rhiCreationFailureMessage(const QString &backendName, void QQuickWindowPrivate::cleanupNodes() { - for (int ii = 0; ii < cleanupNodeList.count(); ++ii) + for (int ii = 0; ii < cleanupNodeList.size(); ++ii) delete cleanupNodeList.at(ii); cleanupNodeList.clear(); } @@ -1853,7 +1853,7 @@ void QQuickWindowPrivate::cleanupNodesOnShutdown(QQuickItem *item) } } - for (int ii = 0; ii < p->childItems.count(); ++ii) + for (int ii = 0; ii < p->childItems.size(); ++ii) cleanupNodesOnShutdown(p->childItems.at(ii)); } @@ -1908,7 +1908,7 @@ static QSGNode *fetchNextNode(QQuickItemPrivate *itemPriv, int &ii, bool &return { QList<QQuickItem *> orderedChildren = itemPriv->paintOrderChildItems(); - for (; ii < orderedChildren.count() && orderedChildren.at(ii)->z() < 0; ++ii) { + for (; ii < orderedChildren.size() && orderedChildren.at(ii)->z() < 0; ++ii) { QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(orderedChildren.at(ii)); if (!childPrivate->explicitVisible && (!childPrivate->extra.isAllocated() || !childPrivate->extra->effectRefCount)) @@ -1923,7 +1923,7 @@ static QSGNode *fetchNextNode(QQuickItemPrivate *itemPriv, int &ii, bool &return return itemPriv->paintNode; } - for (; ii < orderedChildren.count(); ++ii) { + for (; ii < orderedChildren.size(); ++ii) { QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(orderedChildren.at(ii)); if (!childPrivate->explicitVisible && (!childPrivate->extra.isAllocated() || !childPrivate->extra->effectRefCount)) @@ -1951,7 +1951,7 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) if (itemPriv->x != 0. || itemPriv->y != 0.) matrix.translate(itemPriv->x, itemPriv->y); - for (int ii = itemPriv->transforms.count() - 1; ii >= 0; --ii) + for (int ii = itemPriv->transforms.size() - 1; ii >= 0; --ii) itemPriv->transforms.at(ii)->applyTo(&matrix); if (itemPriv->scale() != 1. || itemPriv->rotation() != 0.) { diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp index 71e9c7b2aa..2e8ca9686e 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp @@ -93,7 +93,7 @@ void QSGSoftwareInternalRectangleNode::setGradientStops(const QGradientStops &st if (needsNormalization) { QGradientStops normalizedStops; - if (stops.count() == 1) { + if (stops.size() == 1) { //If there is only one stop, then the position does not matter //It is just treated as a color QGradientStop stop = stops.at(0); @@ -104,7 +104,7 @@ void QSGSoftwareInternalRectangleNode::setGradientStops(const QGradientStops &st int below = -1; int above = -1; QVector<int> between; - for (int i = 0; i < stops.count(); ++i) { + for (int i = 0; i < stops.size(); ++i) { if (stops.at(i).first < 0.0) { below = i; } else if (stops.at(i).first > 1.0) { @@ -118,7 +118,7 @@ void QSGSoftwareInternalRectangleNode::setGradientStops(const QGradientStops &st //Interpoloate new color values for above and below if (below != -1 ) { //If there are more than one stops left, interpolate - if (below + 1 < stops.count()) { + if (below + 1 < stops.size()) { normalizedStops.append(interpolateStop(stops.at(below), stops.at(below + 1), 0.0)); } else { QGradientStop singleStop; @@ -128,7 +128,7 @@ void QSGSoftwareInternalRectangleNode::setGradientStops(const QGradientStops &st } } - for (int i = 0; i < between.count(); ++i) + for (int i = 0; i < between.size(); ++i) normalizedStops.append(stops.at(between.at(i))); if (above != -1) { @@ -249,7 +249,7 @@ bool QSGSoftwareInternalRectangleNode::isOpaque() const return false; if (m_penWidth > 0.0f && m_penColor.alpha() < 255) return false; - if (m_stops.count() > 0) { + if (m_stops.size() > 0) { for (const QGradientStop &stop : qAsConst(m_stops)) { if (stop.second.alpha() < 255) return false; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp index 56400161bb..20e1ca5b8b 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp @@ -47,7 +47,7 @@ void QSGSoftwareRenderableNodeUpdater::endVisit(QSGTransformNode *) bool QSGSoftwareRenderableNodeUpdater::visit(QSGClipNode *node) { // Make sure to translate the clip rect into world coordinates - if (m_clipState.count() == 0 || (m_clipState.count() == 1 && m_clipState.top().isNull())) { + if (m_clipState.size() == 0 || (m_clipState.size() == 1 && m_clipState.top().isNull())) { m_clipState.push(m_transformState.top().map(QRegion(node->clipRect().toRect()))); m_hasClip = true; } else { @@ -61,7 +61,7 @@ bool QSGSoftwareRenderableNodeUpdater::visit(QSGClipNode *node) void QSGSoftwareRenderableNodeUpdater::endVisit(QSGClipNode *) { m_clipState.pop(); - if (m_clipState.count() == 0 || (m_clipState.count() == 1 && m_clipState.top().isNull())) + if (m_clipState.size() == 0 || (m_clipState.size() == 1 && m_clipState.top().isNull())) m_hasClip = false; } diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture_p.h b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture_p.h index 8ae245f07e..46c2c1022f 100644 --- a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture_p.h +++ b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture_p.h @@ -63,7 +63,7 @@ public: QSGTexture *removedFromAtlas(QRhiResourceUpdateBatch *) const override; const QByteArray &data() const { return m_data; } - int sizeInBytes() const { return m_data.length(); } + int sizeInBytes() const { return m_data.size(); } private: QRectF m_texture_coords_rect; diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 37dbadbeb7..d822b66729 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -2875,11 +2875,11 @@ void Renderer::updateMaterialDynamicData(ShaderManager::Shader *sms, pd->samplerBindingTable[binding] = samplers; // does not own } - if (pd->textureBindingTable[binding].count() == pd->samplerBindingTable[binding].count()) { + if (pd->textureBindingTable[binding].size() == pd->samplerBindingTable[binding].size()) { QVarLengthArray<QRhiShaderResourceBinding::TextureAndSampler, 4> textureSamplers; - for (int i = 0; i < pd->textureBindingTable[binding].count(); ++i) { + for (int i = 0; i < pd->textureBindingTable[binding].size(); ++i) { QRhiTexture *texture = pd->textureBindingTable[binding].at(i)->rhiTexture(); @@ -2966,7 +2966,7 @@ void Renderer::updateMaterialDynamicData(ShaderManager::Shader *sms, // with increasing binding points afterwards, so the list is already sorted based // on the binding points, thus we can save some time by telling the QRhi backend // not to sort again. - if (pd->ubufBinding <= 0 || bindings.count() <= 1) + if (pd->ubufBinding <= 0 || bindings.size() <= 1) flags |= QRhiShaderResourceBindings::BindingsAreSorted; e->srb->updateResources(flags); @@ -3446,7 +3446,7 @@ void Renderer::releaseElement(Element *e, bool inDestructor) } else { if (e->srb) { if (!inDestructor) { - if (m_shaderManager->srbPool.count() < m_srbPoolThreshold) + if (m_shaderManager->srbPool.size() < m_srbPoolThreshold) m_shaderManager->srbPool.insert(e->srb->serializedLayoutDescription(), e->srb); else delete e->srb; @@ -3789,7 +3789,7 @@ void Renderer::recordRenderPass(RenderPassContext *ctx) QRhiCommandBuffer *cb = commandBuffer(); cb->debugMarkBegin(QByteArrayLiteral("Qt Quick scene render")); - for (int i = 0, ie = ctx->opaqueRenderBatches.count(); i != ie; ++i) { + for (int i = 0, ie = ctx->opaqueRenderBatches.size(); i != ie; ++i) { PreparedRenderBatch *renderBatch = &ctx->opaqueRenderBatches[i]; if (renderBatch->batch->merged) renderMergedBatch(renderBatch); @@ -3797,7 +3797,7 @@ void Renderer::recordRenderPass(RenderPassContext *ctx) renderUnmergedBatch(renderBatch); } - for (int i = 0, ie = ctx->alphaRenderBatches.count(); i != ie; ++i) { + for (int i = 0, ie = ctx->alphaRenderBatches.size(); i != ie; ++i) { PreparedRenderBatch *renderBatch = &ctx->alphaRenderBatches[i]; if (renderBatch->batch->merged) renderMergedBatch(renderBatch); @@ -3809,7 +3809,7 @@ void Renderer::recordRenderPass(RenderPassContext *ctx) if (m_renderMode == QSGRendererInterface::RenderMode3D) { // depth post-pass - for (int i = 0, ie = ctx->alphaRenderBatches.count(); i != ie; ++i) { + for (int i = 0, ie = ctx->alphaRenderBatches.size(); i != ie; ++i) { PreparedRenderBatch *renderBatch = &ctx->alphaRenderBatches[i]; if (renderBatch->batch->merged) renderMergedBatch(renderBatch, true); diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index 06771d2686..5b0c024466 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -115,7 +115,7 @@ public: // one. when an item is released, we'll reset m_freePage anyway. if (!p) { p = new AllocatorPage<Type, PageSize>(); - m_freePage = pages.count(); + m_freePage = pages.size(); pages.push_back(p); } uint pos = p->blocks[PageSize - p->available]; diff --git a/src/quick/scenegraph/coreapi/qsgmaterialshader.cpp b/src/quick/scenegraph/coreapi/qsgmaterialshader.cpp index e1edbc2445..a3e8b179b3 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterialshader.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterialshader.cpp @@ -247,7 +247,7 @@ void QSGMaterialShaderPrivate::prepare(QShader::Variant vertexShaderVariant) const QShaderDescription desc = it->shader.description(); const QVector<QShaderDescription::UniformBlock> ubufs = desc.uniformBlocks(); - const int ubufCount = ubufs.count(); + const int ubufCount = ubufs.size(); if (ubufCount > 1) { qWarning("Multiple uniform blocks found in shader. " "This should be avoided as Qt Quick supports only one."); @@ -272,7 +272,7 @@ void QSGMaterialShaderPrivate::prepare(QShader::Variant vertexShaderVariant) } const QVector<QShaderDescription::InOutVariable> imageSamplers = desc.combinedImageSamplers(); - const int imageSamplersCount = imageSamplers.count(); + const int imageSamplersCount = imageSamplers.size(); for (int i = 0; i < imageSamplersCount; ++i) { const QShaderDescription::InOutVariable &var(imageSamplers[i]); diff --git a/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp b/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp index 4352b9e795..9183de29d9 100644 --- a/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp @@ -275,7 +275,7 @@ QRhiGraphicsPipeline *RhiVisualizer::PipelineCache::pipeline(RhiVisualizer *visu quint32 vertexStride, bool blendOneOne) { - for (int i = 0, ie = pipelines.count(); i != ie; ++i) { + for (int i = 0, ie = pipelines.size(); i != ie; ++i) { const Pipeline &p(pipelines.at(i)); if (p.topology == topology && p.format == vertexFormat && p.stride == vertexStride) return p.ps; @@ -316,7 +316,7 @@ QRhiGraphicsPipeline *RhiVisualizer::PipelineCache::pipeline(RhiVisualizer *visu void RhiVisualizer::PipelineCache::releaseResources() { - for (int i = 0, ie = pipelines.count(); i != ie; ++i) + for (int i = 0, ie = pipelines.size(); i != ie; ++i) delete pipelines.at(i).ps; pipelines.clear(); diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index b2932a12ea..eca8a1b35a 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -91,7 +91,7 @@ void QSGDistanceFieldGlyphCache::populate(const QVector<glyph_t> &glyphs) { QSet<glyph_t> referencedGlyphs; QSet<glyph_t> newGlyphs; - int count = glyphs.count(); + int count = glyphs.size(); for (int i = 0; i < count; ++i) { glyph_t glyphIndex = glyphs.at(i); if ((int) glyphIndex >= glyphCount() && glyphCount() > 0) { @@ -124,7 +124,7 @@ void QSGDistanceFieldGlyphCache::populate(const QVector<glyph_t> &glyphs) void QSGDistanceFieldGlyphCache::release(const QVector<glyph_t> &glyphs) { QSet<glyph_t> unusedGlyphs; - int count = glyphs.count(); + int count = glyphs.size(); for (int i = 0; i < count; ++i) { glyph_t glyphIndex = glyphs.at(i); GlyphData &gd = glyphData(glyphIndex); @@ -203,7 +203,7 @@ void QSGDistanceFieldGlyphCache::setGlyphsPosition(const QList<GlyphPosition> &g { QVector<quint32> invalidatedGlyphs; - int count = glyphs.count(); + int count = glyphs.size(); for (int i = 0; i < count; ++i) { GlyphPosition glyph = glyphs.at(i); GlyphData &gd = glyphData(glyph.glyph); @@ -254,7 +254,7 @@ void QSGDistanceFieldGlyphCache::setGlyphsTexture(const QVector<glyph_t> &glyphs QVector<quint32> invalidatedGlyphs; - int count = glyphs.count(); + int count = glyphs.size(); for (int j = 0; j < count; ++j) { glyph_t glyphIndex = glyphs.at(j); GlyphData &gd = glyphData(glyphIndex); @@ -272,14 +272,14 @@ void QSGDistanceFieldGlyphCache::setGlyphsTexture(const QVector<glyph_t> &glyphs void QSGDistanceFieldGlyphCache::markGlyphsToRender(const QVector<glyph_t> &glyphs) { - int count = glyphs.count(); + int count = glyphs.size(); for (int i = 0; i < count; ++i) m_pendingGlyphs.add(glyphs.at(i)); } void QSGDistanceFieldGlyphCache::updateRhiTexture(QRhiTexture *oldTex, QRhiTexture *newTex, const QSize &newTexSize) { - int count = m_textures.count(); + int count = m_textures.size(); for (int i = 0; i < count; ++i) { Texture &tex = m_textures[i]; if (tex.texture == oldTex) { diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 192bd565a9..389aaa9b11 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -81,7 +81,7 @@ QSGAdaptationBackendData *contextFactory() const QStringList args = QGuiApplication::arguments(); QString requestedBackend = backendData->quickWindowBackendRequest; // empty or set via QQuickWindow::setSceneGraphBackend() - for (int index = 0; index < args.count(); ++index) { + for (int index = 0; index < args.size(); ++index) { if (args.at(index).startsWith(QLatin1String("--device="))) { requestedBackend = args.at(index).mid(9); break; diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp index bff5d0404d..64f862f948 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp @@ -101,11 +101,11 @@ void QSGDistanceFieldGlyphNode::setGlyphs(const QPointF &position, const QGlyphR m_glyph_cache->populate(glyphs.glyphIndexes()); const QVector<quint32> glyphIndexes = m_glyphs.glyphIndexes(); - for (int i = 0; i < glyphIndexes.count(); ++i) + for (int i = 0; i < glyphIndexes.size(); ++i) m_allGlyphIndexesLookup.insert(glyphIndexes.at(i)); qCDebug(lcSgText, "inserting %" PRIdQSIZETYPE " glyphs, %" PRIdQSIZETYPE " unique", - glyphIndexes.count(), - m_allGlyphIndexesLookup.count()); + glyphIndexes.size(), + m_allGlyphIndexesLookup.size()); #ifdef QSG_RUNTIME_DESCRIPTION qsgnode_set_description(this, QString::number(glyphs.glyphIndexes().count()) + QStringLiteral(" DF glyphs: ") + m_glyphs.rawFont().familyName() + QStringLiteral(" ") + QString::number(m_glyphs.rawFont().pixelSize())); @@ -147,7 +147,7 @@ void QSGDistanceFieldGlyphNode::invalidateGlyphs(const QVector<quint32> &glyphs) if (m_dirtyGeometry) return; - for (int i = 0; i < glyphs.count(); ++i) { + for (int i = 0; i < glyphs.size(); ++i) { if (m_allGlyphIndexesLookup.contains(glyphs.at(i))) { m_dirtyGeometry = true; setFlag(UsePreprocess); @@ -289,12 +289,12 @@ void QSGDistanceFieldGlyphNode::updateGeometry() Q_ASSERT(m_glyphsInOtherTextures.isEmpty()); } else { if (!m_glyphsInOtherTextures.isEmpty()) - qCDebug(lcSgText, "%" PRIdQSIZETYPE " 'other' textures", m_glyphsInOtherTextures.count()); + qCDebug(lcSgText, "%" PRIdQSIZETYPE " 'other' textures", m_glyphsInOtherTextures.size()); QHash<const QSGDistanceFieldGlyphCache::Texture *, GlyphInfo>::const_iterator ite = m_glyphsInOtherTextures.constBegin(); while (ite != m_glyphsInOtherTextures.constEnd()) { QGlyphRun subNodeGlyphRun(m_glyphs); - for (int i = 0; i < ite->indexes.count(); i += maxIndexCount) { - int len = qMin(maxIndexCount, ite->indexes.count() - i); + for (int i = 0; i < ite->indexes.size(); i += maxIndexCount) { + int len = qMin(maxIndexCount, ite->indexes.size() - i); subNodeGlyphRun.setRawData(ite->indexes.constData() + i, ite->positions.constData() + i, len); qCDebug(lcSgText) << "subNodeGlyphRun has" << len << "positions:" << *(ite->positions.constData() + i) << "->" << *(ite->positions.constData() + i + len - 1); diff --git a/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp index f91aaa6649..f452831bfb 100644 --- a/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp @@ -35,7 +35,7 @@ QSGRhiDistanceFieldGlyphCache::~QSGRhiDistanceFieldGlyphCache() // A plain delete should work, but just in case commitResourceUpdates was // not called and something is enqueued on the update batch for a texture, // defer until the end of the frame. - for (int i = 0; i < m_textures.count(); ++i) { + for (int i = 0; i < m_textures.size(); ++i) { if (m_textures[i].texture) m_textures[i].texture->deleteLater(); } diff --git a/src/quick/scenegraph/qsgrhidistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgrhidistancefieldglyphcache_p.h index d9e0fb7cd9..b7653881f5 100644 --- a/src/quick/scenegraph/qsgrhidistancefieldglyphcache_p.h +++ b/src/quick/scenegraph/qsgrhidistancefieldglyphcache_p.h @@ -71,7 +71,7 @@ private: TextureInfo *textureInfo(int index) { - for (int i = m_textures.count(); i <= index; ++i) { + for (int i = m_textures.size(); i <= index; ++i) { if (createFullSizeTextures()) m_textures.append(QRect(0, 0, maxTextureSize(), maxTextureSize())); else diff --git a/src/quick/scenegraph/qsgrhishadereffectnode.cpp b/src/quick/scenegraph/qsgrhishadereffectnode.cpp index 3cbe45ecf3..8007ea3f80 100644 --- a/src/quick/scenegraph/qsgrhishadereffectnode.cpp +++ b/src/quick/scenegraph/qsgrhishadereffectnode.cpp @@ -36,10 +36,10 @@ void QSGRhiShaderLinker::reset(const QShader &vs, const QShader &fs) void QSGRhiShaderLinker::feedConstants(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices) { - Q_ASSERT(shader.shaderInfo.variables.count() == shader.varData.count()); + Q_ASSERT(shader.shaderInfo.variables.size() == shader.varData.size()); if (!dirtyIndices) { m_constantBufferSize = qMax(m_constantBufferSize, shader.shaderInfo.constantDataSize); - for (int i = 0; i < shader.shaderInfo.variables.count(); ++i) { + for (int i = 0; i < shader.shaderInfo.variables.size(); ++i) { const QSGGuiThreadShaderEffectManager::ShaderInfo::Variable &var(shader.shaderInfo.variables.at(i)); if (var.type == QSGGuiThreadShaderEffectManager::ShaderInfo::Constant) { const QSGShaderEffectNode::VariableData &vd(shader.varData.at(i)); @@ -80,7 +80,7 @@ void QSGRhiShaderLinker::feedConstants(const QSGShaderEffectNode::ShaderData &sh void QSGRhiShaderLinker::feedSamplers(const QSGShaderEffectNode::ShaderData &shader, const QSet<int> *dirtyIndices) { if (!dirtyIndices) { - for (int i = 0; i < shader.shaderInfo.variables.count(); ++i) { + for (int i = 0; i < shader.shaderInfo.variables.size(); ++i) { const QSGGuiThreadShaderEffectManager::ShaderInfo::Variable &var(shader.shaderInfo.variables.at(i)); const QSGShaderEffectNode::VariableData &vd(shader.varData.at(i)); if (var.type == QSGGuiThreadShaderEffectManager::ShaderInfo::Sampler) { @@ -457,7 +457,7 @@ int QSGRhiShaderEffectMaterial::compare(const QSGMaterial *other) const if (int diff = m_cullMode - o->m_cullMode) return diff; - if (int diff = m_textureProviders.count() - o->m_textureProviders.count()) + if (int diff = m_textureProviders.size() - o->m_textureProviders.size()) return diff; if (m_linker.m_constants != o->m_linker.m_constants) @@ -469,7 +469,7 @@ int QSGRhiShaderEffectMaterial::compare(const QSGMaterial *other) const if (hasAtlasTexture(o->m_textureProviders) && !o->m_geometryUsesTextureSubRect) return 1; - for (int binding = 0, count = m_textureProviders.count(); binding != count; ++binding) { + for (int binding = 0, count = m_textureProviders.size(); binding != count; ++binding) { QSGTextureProvider *tp1 = m_textureProviders.at(binding); QSGTextureProvider *tp2 = o->m_textureProviders.at(binding); if (tp1 && tp2) { @@ -569,7 +569,7 @@ QRectF QSGRhiShaderEffectNode::updateNormalizedTextureSubRect(bool supportsAtlas bool geometryUsesTextureSubRect = false; if (supportsAtlasTextures) { QSGTextureProvider *tp = nullptr; - for (int binding = 0, count = m_material.m_textureProviders.count(); binding != count; ++binding) { + for (int binding = 0, count = m_material.m_textureProviders.size(); binding != count; ++binding) { if (QSGTextureProvider *candidate = m_material.m_textureProviders.at(binding)) { if (!tp) { tp = candidate; @@ -834,7 +834,7 @@ bool QSGRhiGuiThreadShaderEffectManager::reflect(ShaderInfo *result) int ubufBinding = -1; const QVector<QShaderDescription::UniformBlock> ubufs = desc.uniformBlocks(); - const int ubufCount = ubufs.count(); + const int ubufCount = ubufs.size(); for (int i = 0; i < ubufCount; ++i) { const QShaderDescription::UniformBlock &ubuf(ubufs[i]); if (ubufBinding == -1 && ubuf.binding >= 0) { @@ -855,7 +855,7 @@ bool QSGRhiGuiThreadShaderEffectManager::reflect(ShaderInfo *result) } const QVector<QShaderDescription::InOutVariable> combinedImageSamplers = desc.combinedImageSamplers(); - const int samplerCount = combinedImageSamplers.count(); + const int samplerCount = combinedImageSamplers.size(); for (int i = 0; i < samplerCount; ++i) { const QShaderDescription::InOutVariable &combinedImageSampler(combinedImageSamplers[i]); ShaderInfo::Variable v; diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index ede98e865a..d37786901c 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -883,7 +883,7 @@ int QSGRhiSupport::chooseSampleCount(int samples, QRhi *rhi) const QVector<int> supportedSampleCounts = rhi->supportedSampleCounts(); if (!supportedSampleCounts.contains(msaaSampleCount)) { int reducedSampleCount = 1; - for (int i = supportedSampleCounts.count() - 1; i >= 0; --i) { + for (int i = supportedSampleCounts.size() - 1; i >= 0; --i) { if (supportedSampleCounts[i] <= msaaSampleCount) { reducedSampleCount = supportedSampleCounts[i]; break; diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index b2bf0c6d19..2c3119b2f2 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -965,7 +965,7 @@ void QQuickScriptActionPrivate::debugAction(QDebug d, int indentLevel) const QString exprStr = expr.expression(); int endOfFirstLine = exprStr.indexOf(u'\n'); d << "\n" << ind.constData() << QStringView{exprStr}.left(endOfFirstLine); - if (endOfFirstLine != -1 && endOfFirstLine < exprStr.length()) + if (endOfFirstLine != -1 && endOfFirstLine < exprStr.size()) d << "..."; } } @@ -998,7 +998,7 @@ QAbstractAnimationJob* QQuickScriptAction::transition(QQuickStateActions &action d->hasRunScriptScript = false; d->reversing = (direction == Backward); if (!d->name.isEmpty()) { - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { QQuickStateAction &action = actions[ii]; if (action.event && action.event->type() == QQuickStateActionEvent::Script @@ -1178,14 +1178,14 @@ QAbstractAnimationJob* QQuickPropertyAction::transition(QQuickStateActions &acti QQuickStateActions actions; void doAction() override { - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { const QQuickStateAction &action = actions.at(ii); QQmlPropertyPrivate::write(action.property, action.toValue, QQmlPropertyData::BypassInterceptor | QQmlPropertyData::DontRemoveBinding); } } void debugAction(QDebug d, int indentLevel) const override { QByteArray ind(indentLevel, ' '); - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { const QQuickStateAction &action = actions.at(ii); d << "\n" << ind.constData() << "target:" << action.property.object() << "property:" << action.property.name() << "value:" << action.toValue; @@ -1194,7 +1194,7 @@ QAbstractAnimationJob* QQuickPropertyAction::transition(QQuickStateActions &acti }; QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(',')); - for (int ii = 0; ii < props.count(); ++ii) + for (int ii = 0; ii < props.size(); ++ii) props[ii] = props.at(ii).trimmed(); if (!d->propertyName.isEmpty()) props << d->propertyName; @@ -1218,8 +1218,8 @@ QAbstractAnimationJob* QQuickPropertyAction::transition(QQuickStateActions &acti bool hasExplicit = false; //an explicit animation has been specified if (d->value.isValid()) { - for (int i = 0; i < props.count(); ++i) { - for (int j = 0; j < targets.count(); ++j) { + for (int i = 0; i < props.size(); ++i) { + for (int j = 0; j < targets.size(); ++j) { QQuickStateAction myAction; myAction.property = d->createProperty(targets.at(j), props.at(i), this); if (myAction.property.isValid()) { @@ -1227,7 +1227,7 @@ QAbstractAnimationJob* QQuickPropertyAction::transition(QQuickStateActions &acti QQuickPropertyAnimationPrivate::convertVariant(myAction.toValue, myAction.property.propertyMetaType()); data->actions << myAction; hasExplicit = true; - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { QQuickStateAction &action = actions[ii]; if (action.property.object() == myAction.property.object() && myAction.property.name() == action.property.name()) { @@ -1241,7 +1241,7 @@ QAbstractAnimationJob* QQuickPropertyAction::transition(QQuickStateActions &acti } if (!hasExplicit) - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { QQuickStateAction &action = actions[ii]; QObject *obj = action.property.object(); @@ -1266,7 +1266,7 @@ QAbstractAnimationJob* QQuickPropertyAction::transition(QQuickStateActions &acti } QActionAnimation *action = new QActionAnimation; - if (data->actions.count()) { + if (data->actions.size()) { action->setAnimAction(data); } else { delete data; @@ -1688,7 +1688,7 @@ QQuickAbstractAnimation *QQuickAnimationGroupPrivate::at_animation(QQmlListPrope qsizetype QQuickAnimationGroupPrivate::count_animation(QQmlListProperty<QQuickAbstractAnimation> *list) { if (auto q = qmlobject_cast<QQuickAnimationGroup *>(list->object)) - return q->d_func()->animations.count(); + return q->d_func()->animations.size(); return 0; } @@ -1696,7 +1696,7 @@ void QQuickAnimationGroupPrivate::clear_animation(QQmlListProperty<QQuickAbstrac { QQuickAnimationGroup *q = qobject_cast<QQuickAnimationGroup *>(list->object); if (q) { - while (q->d_func()->animations.count()) { + while (q->d_func()->animations.size()) { QQuickAbstractAnimation *firstAnim = q->d_func()->animations.at(0); firstAnim->setGroup(nullptr); } @@ -1723,7 +1723,7 @@ void QQuickAnimationGroupPrivate::removeLast_animation(QQmlListProperty<QQuickAb QQuickAnimationGroup::~QQuickAnimationGroup() { Q_D(QQuickAnimationGroup); - for (int i = 0; i < d->animations.count(); ++i) + for (int i = 0; i < d->animations.size(); ++i) d->animations.at(i)->d_func()->group = nullptr; d->animations.clear(); } @@ -1812,14 +1812,14 @@ QAbstractAnimationJob* QQuickSequentialAnimation::transition(QQuickStateActions int from = 0; if (direction == Backward) { inc = -1; - from = d->animations.count() - 1; + from = d->animations.size() - 1; } ThreadingModel execution = threadingModel(); bool valid = d->defaultProperty.isValid(); QAbstractAnimationJob* anim; - for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) { + for (int ii = from; ii < d->animations.size() && ii >= 0; ii += inc) { if (valid) d->animations.at(ii)->setDefaultTarget(d->defaultProperty); anim = d->animations.at(ii)->transition(actions, modified, direction, defaultTarget); @@ -1902,7 +1902,7 @@ QAbstractAnimationJob* QQuickParallelAnimation::transition(QQuickStateActions &a bool valid = d->defaultProperty.isValid(); QAbstractAnimationJob* anim; - for (int ii = 0; ii < d->animations.count(); ++ii) { + for (int ii = 0; ii < d->animations.size(); ++ii) { if (valid) d->animations.at(ii)->setDefaultTarget(d->defaultProperty); anim = d->animations.at(ii)->transition(actions, modified, direction, defaultTarget); @@ -2594,7 +2594,7 @@ void QQuickAnimationPropertyUpdater::setValue(qreal v) wasDeleted = &deleted; if (reverse) v = 1 - v; - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { QQuickStateAction &action = actions[ii]; if (v == 1.) { @@ -2626,7 +2626,7 @@ void QQuickAnimationPropertyUpdater::setValue(qreal v) void QQuickAnimationPropertyUpdater::debugUpdater(QDebug d, int indentLevel) const { QByteArray ind(indentLevel, ' '); - for (int i = 0; i < actions.count(); ++i) { + for (int i = 0; i < actions.size(); ++i) { const QQuickStateAction &action = actions.at(i); d << "\n" << ind.constData() << "target:" << action.property.object() << "property:" << action.property.name() << "from:" << action.fromValue << "to:" << action.toValue; @@ -2641,7 +2641,7 @@ QQuickStateActions QQuickPropertyAnimation::createTransitionActions(QQuickStateA QQuickStateActions newActions; QStringList props = d->properties.isEmpty() ? QStringList() : d->properties.split(QLatin1Char(',')); - for (int ii = 0; ii < props.count(); ++ii) + for (int ii = 0; ii < props.size(); ++ii) props[ii] = props.at(ii).trimmed(); if (!d->propertyName.isEmpty()) props << d->propertyName; @@ -2673,8 +2673,8 @@ QQuickStateActions QQuickPropertyAnimation::createTransitionActions(QQuickStateA QVector<QString> errorMessages; bool successfullyCreatedDefaultProperty = false; - for (int i = 0; i < props.count(); ++i) { - for (int j = 0; j < targets.count(); ++j) { + for (int i = 0; i < props.size(); ++i) { + for (int j = 0; j < targets.size(); ++j) { QQuickStateAction myAction; QString errorMessage; const QString &propertyName = props.at(i); @@ -2691,7 +2691,7 @@ QQuickStateActions QQuickPropertyAnimation::createTransitionActions(QQuickStateA d->convertVariant(myAction.toValue, d->interpolatorType ? QMetaType(d->interpolatorType) : myAction.property.propertyMetaType()); newActions << myAction; hasExplicit = true; - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { QQuickStateAction &action = actions[ii]; if (action.property.object() == myAction.property.object() && myAction.property.name() == action.property.name()) { @@ -2712,7 +2712,7 @@ QQuickStateActions QQuickPropertyAnimation::createTransitionActions(QQuickStateA } if (!hasExplicit) - for (int ii = 0; ii < actions.count(); ++ii) { + for (int ii = 0; ii < actions.size(); ++ii) { QQuickStateAction &action = actions[ii]; QObject *obj = action.property.object(); diff --git a/src/quick/util/qquickapplication.cpp b/src/quick/util/qquickapplication.cpp index ee3e15d15f..bee3b7313f 100644 --- a/src/quick/util/qquickapplication.cpp +++ b/src/quick/util/qquickapplication.cpp @@ -277,7 +277,7 @@ void QQuickApplication::setDisplayName(const QString &displayName) qsizetype screens_count(QQmlListProperty<QQuickScreenInfo> *prop) { - return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->count(); + return static_cast<QVector<QQuickScreenInfo *> *>(prop->data)->size(); } QQuickScreenInfo *screens_at(QQmlListProperty<QQuickScreenInfo> *prop, qsizetype idx) @@ -294,8 +294,8 @@ QQmlListProperty<QQuickScreenInfo> QQuickApplication::screens() void QQuickApplication::updateScreens() { const QList<QScreen *> screenList = QGuiApplication::screens(); - m_screens.resize(screenList.count()); - for (int i = 0; i < screenList.count(); ++i) { + m_screens.resize(screenList.size()); + for (int i = 0; i < screenList.size(); ++i) { if (!m_screens[i]) m_screens[i] = new QQuickScreenInfo(this); m_screens[i]->setWrappedScreen(screenList[i]); diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp index dcea1e815f..cb72aeb05f 100644 --- a/src/quick/util/qquickdeliveryagent.cpp +++ b/src/quick/util/qquickdeliveryagent.cpp @@ -120,7 +120,7 @@ bool QQuickDeliveryAgentPrivate::deliverTouchAsMouse(QQuickItem *item, QTouchEve // FIXME: make this work for mouse events too and get rid of the asTouchEvent in here. QMutableTouchEvent event; QQuickItemPrivate::get(item)->localizedTouchEvent(pointerEvent, false, &event); - if (!event.points().count()) + if (!event.points().size()) return false; // For each point, check if it is accepted, if not, try the next point. @@ -425,7 +425,7 @@ void QQuickDeliveryAgentPrivate::setFocusInScope(QQuickItem *scope, QQuickItem * emit rootItem->window()->focusObjectChanged(activeFocusItem); if (!changed.isEmpty()) - notifyFocusChangesRecur(changed.data(), changed.count() - 1, reason); + notifyFocusChangesRecur(changed.data(), changed.size() - 1, reason); if (isSubsceneAgent) { auto da = QQuickWindowPrivate::get(rootItem->window())->deliveryAgent; qCDebug(lcFocus) << " delegating setFocusInScope to" << da; @@ -525,7 +525,7 @@ void QQuickDeliveryAgentPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem emit rootItem->window()->focusObjectChanged(activeFocusItem); if (!changed.isEmpty()) - notifyFocusChangesRecur(changed.data(), changed.count() - 1, reason); + notifyFocusChangesRecur(changed.data(), changed.size() - 1, reason); if (isSubsceneAgent) { auto da = QQuickWindowPrivate::get(rootItem->window())->deliveryAgent; qCDebug(lcFocus) << " delegating clearFocusInScope to" << da; @@ -1065,7 +1065,7 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEventRecursive( const QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); const QList<QQuickItem *> children = itemPrivate->paintOrderChildItems(); - for (int ii = children.count() - 1; ii >= 0; --ii) { + for (int ii = children.size() - 1; ii >= 0; --ii) { QQuickItem *child = children.at(ii); const QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); @@ -1197,7 +1197,7 @@ bool QQuickDeliveryAgentPrivate::deliverHoverEventToItem( // in the usual reverse-paint-order until propagation is stopped bool QQuickDeliveryAgentPrivate::deliverSinglePointEventUntilAccepted(QPointerEvent *event) { - Q_ASSERT(event->points().count() == 1); + Q_ASSERT(event->points().size() == 1); QQuickPointerHandlerPrivate::deviceDeliveryTargets(event->pointingDevice()).clear(); QEventPoint &point = event->point(0); QVector<QQuickItem *> targetItems = pointerTargets(rootItem, event, point, false, false); @@ -1607,7 +1607,7 @@ void QQuickDeliveryAgentPrivate::handleMouseEvent(QMouseEvent *event) const QPointF last = lastMousePosition.isNull() ? event->scenePosition() : lastMousePosition; lastMousePosition = event->scenePosition(); qCDebug(lcHoverTrace) << q << "mouse pos" << last << "->" << lastMousePosition; - if (!event->points().count() || !event->exclusiveGrabber(event->point(0))) { + if (!event->points().size() || !event->exclusiveGrabber(event->point(0))) { bool accepted = deliverHoverEvent(event->scenePosition(), last, event->modifiers(), event->timestamp()); event->setAccepted(accepted); } @@ -1884,7 +1884,7 @@ QVector<QQuickItem *> QQuickDeliveryAgentPrivate::pointerTargets(QQuickItem *ite children.insert(it, item); } - for (int ii = children.count() - 1; ii >= 0; --ii) { + for (int ii = children.size() - 1; ii >= 0; --ii) { QQuickItem *child = children.at(ii); auto childPrivate = QQuickItemPrivate::get(child); if (!child->isVisible() || !child->isEnabled() || childPrivate->culled || @@ -1908,8 +1908,8 @@ QVector<QQuickItem *> QQuickDeliveryAgentPrivate::mergePointerTargets(const QVec // start at the end of list2 // if item not in list, append it // if item found, move to next one, inserting before the last found one - int insertPosition = targets.length(); - for (int i = list2.length() - 1; i >= 0; --i) { + int insertPosition = targets.size(); + for (int i = list2.size() - 1; i >= 0; --i) { int newInsertPosition = targets.lastIndexOf(list2.at(i), insertPosition); if (newInsertPosition >= 0) { Q_ASSERT(newInsertPosition <= insertPosition); @@ -1965,7 +1965,7 @@ void QQuickDeliveryAgentPrivate::deliverUpdatedPoints(QPointerEvent *event) continue; } QList<QPointer<QObject>> relevantPassiveGrabbers; - for (int i = 0; i < epd->passiveGrabbersContext.count(); ++i) { + for (int i = 0; i < epd->passiveGrabbersContext.size(); ++i) { if (epd->passiveGrabbersContext.at(i).data() == q) relevantPassiveGrabbers << epd->passiveGrabbers.at(i); } @@ -1985,7 +1985,7 @@ void QQuickDeliveryAgentPrivate::deliverUpdatedPoints(QPointerEvent *event) if (point.state() == QEventPoint::Pressed || qmlobject_cast<QQuickItem *>(event->exclusiveGrabber(point))) continue; QVector<QQuickItem *> targetItemsForPoint = pointerTargets(rootItem, event, point, false, false); - if (targetItems.count()) { + if (targetItems.size()) { targetItems = mergePointerTargets(targetItems, targetItemsForPoint); } else { targetItems = targetItemsForPoint; @@ -2028,7 +2028,7 @@ bool QQuickDeliveryAgentPrivate::deliverPressOrReleaseEvent(QPointerEvent *event for (int i = 0; i < event->pointCount(); ++i) { auto &point = event->point(i); QVector<QQuickItem *> targetItemsForPoint = pointerTargets(rootItem, event, point, !isTouch, isTouch); - if (targetItems.count()) { + if (targetItems.size()) { targetItems = mergePointerTargets(targetItems, targetItemsForPoint); } else { targetItems = targetItemsForPoint; @@ -2306,7 +2306,7 @@ bool QQuickDeliveryAgentPrivate::deliverDragEvent( QList<QQuickItem *> children = itemPrivate->paintOrderChildItems(); // Check children in front of this item first - for (int ii = children.count() - 1; ii >= 0; --ii) { + for (int ii = children.size() - 1; ii >= 0; --ii) { if (children.at(ii)->z() < 0) continue; if (deliverDragEvent(grabber, children.at(ii), &enterEvent, currentGrabItems, formerTarget)) @@ -2361,7 +2361,7 @@ bool QQuickDeliveryAgentPrivate::deliverDragEvent( } // Check children behind this item if this item or any higher children have not accepted - for (int ii = children.count() - 1; ii >= 0; --ii) { + for (int ii = children.size() - 1; ii >= 0; --ii) { if (children.at(ii)->z() >= 0) continue; if (deliverDragEvent(grabber, children.at(ii), &enterEvent, currentGrabItems, formerTarget)) diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 1e9a419cfb..c6cb18058f 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -72,7 +72,7 @@ void QQmlQtQuick2DebugStatesDelegate::buildStatesList(bool cleanList, m_allStates.clear(); //only root context has all instances - for (int ii = 0; ii < instances.count(); ++ii) { + for (int ii = 0; ii < instances.size(); ++ii) { buildStatesList(instances.at(ii)); } } @@ -84,7 +84,7 @@ void QQmlQtQuick2DebugStatesDelegate::buildStatesList(QObject *obj) } QObjectList children = obj->children(); - for (int ii = 0; ii < children.count(); ++ii) { + for (int ii = 0; ii < children.size(); ++ii) { buildStatesList(children.at(ii)); } } diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index b8aaf4e7ae..bc65acedf0 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -271,7 +271,7 @@ qsizetype QQuickPath::pathElements_count(QQmlListProperty<QQuickPathElement> *pr { QQuickPathPrivate *d = privatePath(property->object); - return d->_pathElements.count(); + return d->_pathElements.size(); } void QQuickPath::pathElements_clear(QQmlListProperty<QQuickPathElement> *property) @@ -327,10 +327,10 @@ void QQuickPath::endpoint(const QString &name) Q_D(QQuickPath); const AttributePoint &first = d->_attributePoints.first(); qreal val = first.values.value(name); - for (int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) { + for (int ii = d->_attributePoints.size() - 1; ii >= 0; ii--) { const AttributePoint &point = d->_attributePoints.at(ii); if (point.values.contains(name)) { - for (int jj = ii + 1; jj < d->_attributePoints.count(); ++jj) { + for (int jj = ii + 1; jj < d->_attributePoints.size(); ++jj) { AttributePoint &setPoint = d->_attributePoints[jj]; setPoint.values.insert(name, val); } @@ -343,10 +343,10 @@ void QQuickPath::endpoint(QList<AttributePoint> &attributePoints, const QString { const AttributePoint &first = attributePoints.first(); qreal val = first.values.value(name); - for (int ii = attributePoints.count() - 1; ii >= 0; ii--) { + for (int ii = attributePoints.size() - 1; ii >= 0; ii--) { const AttributePoint &point = attributePoints.at(ii); if (point.values.contains(name)) { - for (int jj = ii + 1; jj < attributePoints.count(); ++jj) { + for (int jj = ii + 1; jj < attributePoints.size(); ++jj) { AttributePoint &setPoint = attributePoints[jj]; setPoint.values.insert(name, val); } @@ -401,7 +401,7 @@ QPainterPath QQuickPath::createPath(const QPointF &startPoint, const QPointF &en QPainterPath path; AttributePoint first; - for (int ii = 0; ii < attributes.count(); ++ii) + for (int ii = 0; ii < attributes.size(); ++ii) first.values[attributes.at(ii)] = 0; attributePoints << first; @@ -427,11 +427,11 @@ QPainterPath QQuickPath::createPath(const QPointF &startPoint, const QPointF &en } else if (QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement)) { AttributePoint &point = attributePoints.last(); point.values[attribute->name()] = attribute->value(); - interpolate(attributePoints, attributePoints.count() - 1, attribute->name(), attribute->value()); + interpolate(attributePoints, attributePoints.size() - 1, attribute->name(), attribute->value()); } else if (QQuickPathPercent *percent = qobject_cast<QQuickPathPercent *>(pathElement)) { AttributePoint &point = attributePoints.last(); point.values[percentString] = percent->value(); - interpolate(attributePoints, attributePoints.count() - 1, percentString, percent->value()); + interpolate(attributePoints, attributePoints.size() - 1, percentString, percent->value()); usesPercent = true; } else if (QQuickPathText *text = qobject_cast<QQuickPathText *>(pathElement)) { text->addToPath(path); @@ -440,13 +440,13 @@ QPainterPath QQuickPath::createPath(const QPointF &startPoint, const QPointF &en // Fixup end points const AttributePoint &last = attributePoints.constLast(); - for (int ii = 0; ii < attributes.count(); ++ii) { + for (int ii = 0; ii < attributes.size(); ++ii) { if (!last.values.contains(attributes.at(ii))) endpoint(attributePoints, attributes.at(ii)); } if (usesPercent && !last.values.contains(percentString)) { d->_attributePoints.last().values[percentString] = 1; - interpolate(d->_attributePoints.count() - 1, percentString, 1); + interpolate(d->_attributePoints.size() - 1, percentString, 1); } scalePath(path, d->scale); @@ -454,7 +454,7 @@ QPainterPath QQuickPath::createPath(const QPointF &startPoint, const QPointF &en qreal length = path.length(); qreal prevpercent = 0; qreal prevorigpercent = 0; - for (int ii = 0; ii < attributePoints.count(); ++ii) { + for (int ii = 0; ii < attributePoints.size(); ++ii) { const AttributePoint &point = attributePoints.at(ii); if (point.values.contains(percentString)) { //special string for QQuickPathPercent if ( ii > 0) { @@ -676,10 +676,10 @@ void QQuickPath::createPointCache() const //find which set we are in qreal prevPercent = 0; qreal prevOrigPercent = 0; - for (int ii = 0; ii < d->_attributePoints.count(); ++ii) { + for (int ii = 0; ii < d->_attributePoints.size(); ++ii) { qreal percent = qreal(i)/segments; const AttributePoint &point = d->_attributePoints.at(ii); - if (percent < point.percent || ii == d->_attributePoints.count() - 1) { //### || is special case for very last item + if (percent < point.percent || ii == d->_attributePoints.size() - 1) { //### || is special case for very last item qreal elementPercent = (percent - prevPercent); qreal spc = prevOrigPercent + elementPercent * point.scale; @@ -773,10 +773,10 @@ QPointF QQuickPath::forwardsPointAt(const QPainterPath &path, const qreal &pathL //find which set we are in qreal prevPercent = 0; qreal prevOrigPercent = 0; - for (int ii = 0; ii < attributePoints.count(); ++ii) { + for (int ii = 0; ii < attributePoints.size(); ++ii) { qreal percent = p; const AttributePoint &point = attributePoints.at(ii); - if (percent < point.percent || ii == attributePoints.count() - 1) { + if (percent < point.percent || ii == attributePoints.size() - 1) { qreal elementPercent = (percent - prevPercent); qreal spc = prevOrigPercent + elementPercent * point.scale; @@ -827,7 +827,7 @@ QPointF QQuickPath::backwardsPointAt(const QPainterPath &path, const qreal &path qreal prevLength = currLength - bezLength; qreal epc = prevLength / pathLength; - for (int ii = attributePoints.count() - 1; ii > 0; --ii) { + for (int ii = attributePoints.size() - 1; ii > 0; --ii) { qreal percent = p; const AttributePoint &point = attributePoints.at(ii); const AttributePoint &prevPoint = attributePoints.at(ii-1); @@ -928,7 +928,7 @@ qreal QQuickPath::attributeAt(const QString &name, qreal percent) const if (percent < 0 || percent > 1) return 0; - for (int ii = 0; ii < d->_attributePoints.count(); ++ii) { + for (int ii = 0; ii < d->_attributePoints.size(); ++ii) { const AttributePoint &point = d->_attributePoints.at(ii); if (point.percent == percent) { @@ -1711,17 +1711,17 @@ void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathDa } else { prev = path.currentPosition(); bool prevFarSet = false; - if (index == -1 && data.curves.count() > 1) { - if (qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(data.curves.count()-1))) { + if (index == -1 && data.curves.size() > 1) { + if (qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(data.curves.size()-1))) { //TODO: profile and optimize QPointF pos = prev; QQuickPathData loopData; loopData.endPoint = data.endPoint; loopData.curves = data.curves; - for (int i = data.index; i < data.curves.count(); ++i) { + for (int i = data.index; i < data.curves.size(); ++i) { loopData.index = i; pos = positionForCurve(loopData, pos); - if (i == data.curves.count()-2) + if (i == data.curves.size()-2) prevFar = pos; } if (pos == QPointF(path.elementAt(0))) { @@ -1740,7 +1740,7 @@ void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathDa //get next point index = data.index + 1; - if (index < data.curves.count() && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(index))) { + if (index < data.curves.size() && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(index))) { QQuickPathData nextData; nextData.index = index; nextData.endPoint = data.endPoint; diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index a6e45d769d..61294b3312 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -466,7 +466,7 @@ static QString existingImageFileForPath(const QString &localFile) return localFile; QString tryFile = localFile + QStringLiteral(".xxxx"); - const int suffixIdx = localFile.length() + 1; + const int suffixIdx = localFile.size() + 1; for (const QString &suffix : backendSupport()->fileSuffixes) { tryFile.replace(suffixIdx, 10, suffix); if (QFileInfo::exists(tryFile)) @@ -660,7 +660,7 @@ void QQuickPixmapReader::processJobs() // Clean cancelled jobs if (!cancelled.isEmpty()) { - for (int i = 0; i < cancelled.count(); ++i) { + for (int i = 0; i < cancelled.size(); ++i) { QQuickPixmapReply *job = cancelled.at(i); #if QT_CONFIG(qml_network) QNetworkReply *reply = networkJobs.key(job, 0); @@ -688,7 +688,7 @@ void QQuickPixmapReader::processJobs() if (!jobs.isEmpty()) { // Find a job we can use bool usableJob = false; - for (int i = jobs.count() - 1; !usableJob && i >= 0; i--) { + for (int i = jobs.size() - 1; !usableJob && i >= 0; i--) { QQuickPixmapReply *job = jobs.at(i); const QUrl url = job->url; QString localFile; @@ -706,7 +706,7 @@ void QQuickPixmapReader::processJobs() localFile = QQmlFile::urlToLocalFileOrQrc(url); usableJob = !localFile.isEmpty() #if QT_CONFIG(qml_network) - || networkJobs.count() < IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT + || networkJobs.size() < IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT #endif ; } @@ -1301,7 +1301,7 @@ void QQuickPixmapData::addToCache() pixmapStore()->m_cache.insert(key, this); inCache = true; PIXMAP_PROFILE(pixmapCountChanged<QQuickProfiler::PixmapCacheCountChanged>( - url, pixmapStore()->m_cache.count())); + url, pixmapStore()->m_cache.size())); } } @@ -1315,7 +1315,7 @@ void QQuickPixmapData::removeFromCache(QQuickPixmapStore *store) store->m_cache.remove(key); inCache = false; PIXMAP_PROFILE(pixmapCountChanged<QQuickProfiler::PixmapCacheCountChanged>( - url, store->m_cache.count())); + url, store->m_cache.size())); } } diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index efa6b1dfa0..1c25cc10da 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -333,7 +333,7 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix, void QQuickPropertyChangesParser::verifyBindings(const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &props) { - for (int ii = 0; ii < props.count(); ++ii) + for (int ii = 0; ii < props.size(); ++ii) verifyList(compilationUnit, props.at(ii)); } @@ -358,7 +358,7 @@ QQuickPropertyChanges::QQuickPropertyChanges() QQuickPropertyChanges::~QQuickPropertyChanges() { Q_D(QQuickPropertyChanges); - for(int ii = 0; ii < d->signalReplacements.count(); ++ii) + for(int ii = 0; ii < d->signalReplacements.size(); ++ii) delete d->signalReplacements.at(ii); } @@ -427,7 +427,7 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions() ActionList list; - for (int ii = 0; ii < d->properties.count(); ++ii) { + for (int ii = 0; ii < d->properties.size(); ++ii) { QQmlProperty prop = d->property(d->properties.at(ii).first); QQuickStateAction a(d->object, prop, d->properties.at(ii).first, @@ -439,7 +439,7 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions() } } - for (int ii = 0; ii < d->signalReplacements.count(); ++ii) { + for (int ii = 0; ii < d->signalReplacements.size(); ++ii) { QQuickReplaceSignalHandler *handler = d->signalReplacements.at(ii); if (handler->property.isValid()) { @@ -449,7 +449,7 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions() } } - for (int ii = 0; ii < d->expressions.count(); ++ii) { + for (int ii = 0; ii < d->expressions.size(); ++ii) { QQuickPropertyChangesPrivate::ExpressionChange e = d->expressions.at(ii); const QString &property = e.name; diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp index 7b93936cfe..51de063090 100644 --- a/src/quick/util/qquickshortcut.cpp +++ b/src/quick/util/qquickshortcut.cpp @@ -209,7 +209,7 @@ void QQuickShortcut::setSequences(const QVariantList &values) // if nothing has changed, just return: if (m_shortcuts.size() == requestedShortcuts.size()) { bool changed = false; - for (int i = 0; i < requestedShortcuts.count(); ++i) { + for (int i = 0; i < requestedShortcuts.size(); ++i) { const Shortcut &requestedShortcut = requestedShortcuts[i]; const Shortcut &shortcut = m_shortcuts[i]; if (!(requestedShortcut.userValue == shortcut.userValue @@ -373,7 +373,7 @@ bool QQuickShortcut::event(QEvent *event) QShortcutEvent *se = static_cast<QShortcutEvent *>(event); bool match = m_shortcut.matches(se); int i = 0; - while (!match && i < m_shortcuts.count()) + while (!match && i < m_shortcuts.size()) match |= m_shortcuts.at(i++).matches(se); if (match) { if (se->isAmbiguous()) diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp index 09eaf60819..20f54081c6 100644 --- a/src/quick/util/qquickstate.cpp +++ b/src/quick/util/qquickstate.cpp @@ -243,7 +243,7 @@ QQmlListProperty<QQuickStateOperation> QQuickState::changes() int QQuickState::operationCount() const { Q_D(const QQuickState); - return d->operations.count(); + return d->operations.size(); } QQuickStateOperation *QQuickState::operationAt(int index) const @@ -263,8 +263,8 @@ void QQuickStatePrivate::complete() { Q_Q(QQuickState); - for (int ii = 0; ii < reverting.count(); ++ii) { - for (int jj = 0; jj < revertList.count(); ++jj) { + for (int ii = 0; ii < reverting.size(); ++ii) { + for (int jj = 0; jj < revertList.size(); ++jj) { const QQuickRevertAction &revert = reverting.at(ii); const QQuickSimpleAction &simple = revertList.at(jj); if ((revert.event && simple.event() == revert.event) || @@ -295,7 +295,7 @@ QQuickStatePrivate::generateActionList() const if (!extends.isEmpty()) { QList<QQuickState *> states = group ? group->states() : QList<QQuickState *>(); - for (int ii = 0; ii < states.count(); ++ii) + for (int ii = 0; ii < states.size(); ++ii) if (states.at(ii)->name() == extends) { qmlExecuteDeferred(states.at(ii)); applyList = static_cast<QQuickStatePrivate*>(states.at(ii)->d_func())->generateActionList(); @@ -447,7 +447,7 @@ void QQuickState::addEntriesToRevertList(const QList<QQuickStateAction> &actionL Q_D(QQuickState); if (isStateActive()) { QList<QQuickSimpleAction> simpleActionList; - simpleActionList.reserve(actionList.count()); + simpleActionList.reserve(actionList.size()); for (const QQuickStateAction &action : actionList) { QQuickSimpleAction simpleAction(action); @@ -520,14 +520,14 @@ void QQuickState::apply(QQuickTransition *trans, QQuickState *revert) // List of actions that need to be reverted to roll back (just) this state QQuickStatePrivate::SimpleActionList additionalReverts; // First add the reverse of all the applyList actions - for (int ii = 0; ii < applyList.count(); ++ii) { + for (int ii = 0; ii < applyList.size(); ++ii) { QQuickStateAction &action = applyList[ii]; if (action.event) { if (!action.event->isReversable()) continue; bool found = false; - for (int jj = 0; jj < d->revertList.count(); ++jj) { + for (int jj = 0; jj < d->revertList.size(); ++jj) { QQuickStateActionEvent *event = d->revertList.at(jj).event(); if (event && event->type() == action.event->type()) { if (action.event->mayOverride(event)) { @@ -558,7 +558,7 @@ void QQuickState::apply(QQuickTransition *trans, QQuickState *revert) bool found = false; action.fromBinding = QQmlAnyBinding::ofProperty(action.property); - for (int jj = 0; jj < d->revertList.count(); ++jj) { + for (int jj = 0; jj < d->revertList.size(); ++jj) { if (d->revertList.at(jj).property() == action.property) { found = true; if (d->revertList.at(jj).binding() != action.fromBinding) { @@ -583,13 +583,13 @@ void QQuickState::apply(QQuickTransition *trans, QQuickState *revert) // Any reverts from a previous state that aren't carried forth // into this state need to be translated into apply actions - for (int ii = 0; ii < d->revertList.count(); ++ii) { + for (int ii = 0; ii < d->revertList.size(); ++ii) { bool found = false; if (d->revertList.at(ii).event()) { QQuickStateActionEvent *event = d->revertList.at(ii).event(); if (!event->isReversable()) continue; - for (int jj = 0; !found && jj < applyList.count(); ++jj) { + for (int jj = 0; !found && jj < applyList.size(); ++jj) { const QQuickStateAction &action = applyList.at(jj); if (action.event && action.event->type() == event->type()) { if (action.event->mayOverride(event)) @@ -597,7 +597,7 @@ void QQuickState::apply(QQuickTransition *trans, QQuickState *revert) } } } else { - for (int jj = 0; !found && jj < applyList.count(); ++jj) { + for (int jj = 0; !found && jj < applyList.size(); ++jj) { const QQuickStateAction &action = applyList.at(jj); if (action.property == d->revertList.at(ii).property()) found = true; diff --git a/src/quick/util/qquickstate_p_p.h b/src/quick/util/qquickstate_p_p.h index 528682a5ba..cd7c1be5aa 100644 --- a/src/quick/util/qquickstate_p_p.h +++ b/src/quick/util/qquickstate_p_p.h @@ -206,7 +206,7 @@ public: } static qsizetype operations_count(QQmlListProperty<QQuickStateOperation> *prop) { QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data); - return list->count(); + return list->size(); } static QQuickStateOperation *operations_at(QQmlListProperty<QQuickStateOperation> *prop, qsizetype index) { QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data); diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp index 2812b5824a..694852204c 100644 --- a/src/quick/util/qquickstategroup.cpp +++ b/src/quick/util/qquickstategroup.cpp @@ -96,7 +96,7 @@ QQuickStateGroup::QQuickStateGroup(QObject *parent) QQuickStateGroup::~QQuickStateGroup() { Q_D(const QQuickStateGroup); - for (int i = 0; i < d->states.count(); ++i) + for (int i = 0; i < d->states.size(); ++i) d->states.at(i)->setStateGroup(nullptr); if (d->nullState) d->nullState->setStateGroup(nullptr); @@ -153,7 +153,7 @@ void QQuickStateGroupPrivate::append_state(QQmlListProperty<QQuickState> *list, qsizetype QQuickStateGroupPrivate::count_state(QQmlListProperty<QQuickState> *list) { QQuickStateGroup *_this = static_cast<QQuickStateGroup *>(list->object); - return _this->d_func()->states.count(); + return _this->d_func()->states.size(); } QQuickState *QQuickStateGroupPrivate::at_state(QQmlListProperty<QQuickState> *list, qsizetype index) @@ -166,7 +166,7 @@ void QQuickStateGroupPrivate::clear_states(QQmlListProperty<QQuickState> *list) { QQuickStateGroup *_this = static_cast<QQuickStateGroup *>(list->object); _this->d_func()->setCurrentStateInternal(QString(), true); - for (qsizetype i = 0; i < _this->d_func()->states.count(); ++i) { + for (qsizetype i = 0; i < _this->d_func()->states.size(); ++i) { _this->d_func()->states.at(i)->setStateGroup(nullptr); } _this->d_func()->states.clear(); @@ -190,7 +190,7 @@ void QQuickStateGroupPrivate::removeLast_states(QQmlListProperty<QQuickState> *l { auto *d = qobject_cast<QQuickStateGroup *>(list->object)->d_func(); if (d->currentState == d->states.last()->name()) - d->setCurrentStateInternal(d->states.length() > 1 ? d->states.first()->name() : QString(), true); + d->setCurrentStateInternal(d->states.size() > 1 ? d->states.first()->name() : QString(), true); d->states.last()->setStateGroup(nullptr); d->states.removeLast(); } @@ -234,7 +234,7 @@ void QQuickStateGroupPrivate::append_transition(QQmlListProperty<QQuickTransitio qsizetype QQuickStateGroupPrivate::count_transitions(QQmlListProperty<QQuickTransition> *list) { QQuickStateGroup *_this = static_cast<QQuickStateGroup *>(list->object); - return _this->d_func()->transitions.count(); + return _this->d_func()->transitions.size(); } QQuickTransition *QQuickStateGroupPrivate::at_transition(QQmlListProperty<QQuickTransition> *list, qsizetype index) @@ -299,8 +299,8 @@ void QQuickStateGroup::componentComplete() d->componentComplete = true; QVarLengthArray<QString, 4> names; - names.reserve(d->states.count()); - for (int ii = 0; ii < d->states.count(); ++ii) { + names.reserve(d->states.size()); + for (int ii = 0; ii < d->states.size(); ++ii) { QQuickState *state = d->states.at(ii); if (!state->isNamed()) state->setName(QLatin1String("anonymousState") + QString::number(++d->unnamedCount)); @@ -338,7 +338,7 @@ bool QQuickStateGroupPrivate::updateAutoState() return false; bool revert = false; - for (int ii = 0; ii < states.count(); ++ii) { + for (int ii = 0; ii < states.size(); ++ii) { QQuickState *state = states.at(ii); if (state->isWhenKnown()) { if (state->isNamed()) { @@ -391,7 +391,7 @@ QQuickTransition *QQuickStateGroupPrivate::findTransition(const QString &from, c bool reversed = false; bool done = false; - for (int ii = 0; !done && ii < transitions.count(); ++ii) { + for (int ii = 0; !done && ii < transitions.size(); ++ii) { QQuickTransition *t = transitions.at(ii); if (!t->enabled()) continue; @@ -405,10 +405,10 @@ QQuickTransition *QQuickStateGroupPrivate::findTransition(const QString &from, c const QString toStateStr = t->toState(); auto fromState = QStringView{fromStateStr}.split(QLatin1Char(',')); - for (int jj = 0; jj < fromState.count(); ++jj) + for (int jj = 0; jj < fromState.size(); ++jj) fromState[jj] = fromState.at(jj).trimmed(); auto toState = QStringView{toStateStr}.split(QLatin1Char(',')); - for (int jj = 0; jj < toState.count(); ++jj) + for (int jj = 0; jj < toState.size(); ++jj) toState[jj] = toState.at(jj).trimmed(); if (ii == 1) qSwap(fromState, toState); @@ -476,7 +476,7 @@ void QQuickStateGroupPrivate::setCurrentStateInternal(const QString &state, QQuickState *oldState = nullptr; if (!currentState.isEmpty()) { - for (int ii = 0; ii < states.count(); ++ii) { + for (int ii = 0; ii < states.size(); ++ii) { if (states.at(ii)->name() == currentState) { oldState = states.at(ii); break; @@ -488,7 +488,7 @@ void QQuickStateGroupPrivate::setCurrentStateInternal(const QString &state, emit q->stateChanged(currentState); QQuickState *newState = nullptr; - for (int ii = 0; ii < states.count(); ++ii) { + for (int ii = 0; ii < states.size(); ++ii) { if (states.at(ii)->name() == currentState) { newState = states.at(ii); break; @@ -512,7 +512,7 @@ void QQuickStateGroupPrivate::setCurrentStateInternal(const QString &state, QQuickState *QQuickStateGroup::findState(const QString &name) const { Q_D(const QQuickStateGroup); - for (int i = 0; i < d->states.count(); ++i) { + for (int i = 0; i < d->states.size(); ++i) { QQuickState *state = d->states.at(i); if (state->name() == name) return state; diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp index 319a12e225..1bee09a421 100644 --- a/src/quick/util/qquickstyledtext.cpp +++ b/src/quick/util/qquickstyledtext.cpp @@ -188,31 +188,31 @@ void QQuickStyledTextPrivate::parse() hasSpace = true; } - if (rangeStart != drawText.length() && formatStack.count()) { + if (rangeStart != drawText.size() && formatStack.size()) { if (formatChanged) { QTextLayout::FormatRange formatRange; formatRange.format = formatStack.top(); formatRange.start = rangeStart; - formatRange.length = drawText.length() - rangeStart; + formatRange.length = drawText.size() - rangeStart; ranges.append(formatRange); formatChanged = false; - } else if (ranges.count()) { - ranges.last().length += drawText.length() - rangeStart; + } else if (ranges.size()) { + ranges.last().length += drawText.size() - rangeStart; } } - rangeStart = drawText.length(); + rangeStart = drawText.size(); ++ch; if (*ch == slash) { ++ch; if (parseCloseTag(ch, text, drawText)) { - if (formatStack.count()) { + if (formatStack.size()) { formatChanged = true; formatStack.pop(); } } } else { QTextCharFormat format; - if (formatStack.count()) + if (formatStack.size()) format = formatStack.top(); if (parseTag(ch, text, drawText, format)) { formatChanged = true; @@ -252,15 +252,15 @@ void QQuickStyledTextPrivate::parse() } if (textLength) appendText(text, textStart, textLength, drawText); - if (rangeStart != drawText.length() && formatStack.count()) { + if (rangeStart != drawText.size() && formatStack.size()) { if (formatChanged) { QTextLayout::FormatRange formatRange; formatRange.format = formatStack.top(); formatRange.start = rangeStart; - formatRange.length = drawText.length() - rangeStart; + formatRange.length = drawText.size() - rangeStart; ranges.append(formatRange); - } else if (ranges.count()) { - ranges.last().length += drawText.length() - rangeStart; + } else if (ranges.size()) { + ranges.last().length += drawText.size() - rangeStart; } } @@ -483,7 +483,7 @@ bool QQuickStyledTextPrivate::parseCloseTag(const QChar *&ch, const QString &tex else if (is_equal_ignoring_case(tag, QLatin1String("ul"))) { if (!listStack.isEmpty()) { listStack.pop(); - if (!listStack.count()) + if (!listStack.size()) textOut.append(QChar::LineSeparator); } return false; @@ -506,7 +506,7 @@ bool QQuickStyledTextPrivate::parseCloseTag(const QChar *&ch, const QString &tex } else if (is_equal_ignoring_case(tag, QLatin1String("ol"))) { if (!listStack.isEmpty()) { listStack.pop(); - if (!listStack.count()) + if (!listStack.size()) textOut.append(QChar::LineSeparator); } return false; @@ -649,7 +649,7 @@ void QQuickStyledTextPrivate::parseImageAttributes(const QChar *&ch, const QStri if (!updateImagePositions) { QQuickStyledTextImgTag *image = new QQuickStyledTextImgTag; - image->position = textOut.length() + (trailingSpace ? 0 : 1); + image->position = textOut.size() + (trailingSpace ? 0 : 1); QPair<QStringView,QStringView> attr; do { @@ -693,7 +693,7 @@ void QQuickStyledTextPrivate::parseImageAttributes(const QChar *&ch, const QStri // if we already have a list of img tags for this text // we only want to update the positions of these tags. QQuickStyledTextImgTag *image = imgTags->value(nbImages); - image->position = textOut.length() + (trailingSpace ? 0 : 1); + image->position = textOut.size() + (trailingSpace ? 0 : 1); imgWidth = image->size.width(); image->offset = -std::fmod(imgWidth, spaceWidth) / 2.0; QPair<QStringView,QStringView> attr; diff --git a/src/quick/util/qquicksvgparser.cpp b/src/quick/util/qquicksvgparser.cpp index a4f1ac8e80..5f88805ef7 100644 --- a/src/quick/util/qquicksvgparser.cpp +++ b/src/quick/util/qquicksvgparser.cpp @@ -249,7 +249,7 @@ bool QQuickSvgParser::parsePathDataFast(const QString &dataStr, QPainterPath &pa if (pathElem == QLatin1Char('z') || pathElem == QLatin1Char('Z')) arg.append(0);//dummy const qreal *num = arg.constData(); - int count = arg.count(); + int count = arg.size(); while (count > 0) { qreal offsetX = x; // correction offsets qreal offsetY = y; // for relative commands diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp index ab59969ce5..e53dbe0fd9 100644 --- a/src/quick/util/qquicktimeline.cpp +++ b/src/quick/util/qquicktimeline.cpp @@ -786,7 +786,7 @@ int QQuickTimeLinePrivate::advance(int t) std::sort(updates.begin(), updates.end()); updateQueue = &updates; - for (int ii = 0; ii < updates.count(); ++ii) { + for (int ii = 0; ii < updates.size(); ++ii) { const Update &v = updates.at(ii).second; if (v.g) { v.g->setValue(v.v); @@ -836,7 +836,7 @@ void QQuickTimeLine::remove(QQuickTimeLineObject *v) } if (d->updateQueue) { - for (int ii = 0; ii < d->updateQueue->count(); ++ii) { + for (int ii = 0; ii < d->updateQueue->size(); ++ii) { if (d->updateQueue->at(ii).second.g == v || d->updateQueue->at(ii).second.e.callbackObject() == v) { d->updateQueue->removeAt(ii); diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp index 1d2c9e2f41..062e6e2656 100644 --- a/src/quick/util/qquicktransition.cpp +++ b/src/quick/util/qquicktransition.cpp @@ -115,7 +115,7 @@ void QQuickTransitionPrivate::append_animation(QQmlListProperty<QQuickAbstractAn qsizetype QQuickTransitionPrivate::animation_count(QQmlListProperty<QQuickAbstractAnimation> *list) { QQuickTransition *q = static_cast<QQuickTransition *>(list->object); - return q->d_func()->animations.count(); + return q->d_func()->animations.size(); } QQuickAbstractAnimation* QQuickTransitionPrivate::animation_at(QQmlListProperty<QQuickAbstractAnimation> *list, qsizetype pos) @@ -127,7 +127,7 @@ QQuickAbstractAnimation* QQuickTransitionPrivate::animation_at(QQmlListProperty< void QQuickTransitionPrivate::clear_animations(QQmlListProperty<QQuickAbstractAnimation> *list) { QQuickTransition *q = static_cast<QQuickTransition *>(list->object); - while (q->d_func()->animations.count()) { + while (q->d_func()->animations.size()) { QQuickAbstractAnimation *firstAnim = q->d_func()->animations.at(0); q->d_func()->animations.removeAll(firstAnim); } @@ -232,8 +232,8 @@ QQuickTransitionInstance *QQuickTransition::prepare(QQuickStateOperation::Action group->manager = manager; QQuickAbstractAnimation::TransitionDirection direction = d->reversed ? QQuickAbstractAnimation::Backward : QQuickAbstractAnimation::Forward; - int start = d->reversed ? d->animations.count() - 1 : 0; - int end = d->reversed ? -1 : d->animations.count(); + int start = d->reversed ? d->animations.size() - 1 : 0; + int end = d->reversed ? -1 : d->animations.size(); QAbstractAnimationJob *anim = nullptr; for (int i = start; i != end;) { diff --git a/src/quickcontrols2impl/qquickimageselector.cpp b/src/quickcontrols2impl/qquickimageselector.cpp index a7c431ba7a..eb13fe2c96 100644 --- a/src/quickcontrols2impl/qquickimageselector.cpp +++ b/src/quickcontrols2impl/qquickimageselector.cpp @@ -30,14 +30,14 @@ static inline int cacheSize() static QList<QStringList> permutations(const QStringList &input, int count = -1) { if (count == -1) - count = input.count(); + count = input.size(); QList<QStringList> output; - for (int i = 0; i < input.count(); ++i) { + for (int i = 0; i < input.size(); ++i) { QStringList sub = input.mid(i, count); if (count > 1) { - if (i + count > input.count()) + if (i + count > input.size()) sub += input.mid(0, count - i + 1); std::sort(sub.begin(), sub.end()); @@ -49,7 +49,7 @@ static QList<QStringList> permutations(const QStringList &input, int count = -1) output += sub; } - if (count == input.count()) + if (count == input.size()) break; } @@ -275,8 +275,8 @@ bool QQuickImageSelector::updateActiveStates() int QQuickImageSelector::calculateScore(const QStringList &states) const { int score = 0; - for (int i = 0; i < states.count(); ++i) - score += (m_activeStates.count() - m_activeStates.indexOf(states.at(i))) << 1; + for (int i = 0; i < states.size(); ++i) + score += (m_activeStates.size() - m_activeStates.indexOf(states.at(i))) << 1; return score; } diff --git a/src/quickcontrols2impl/qquickmnemoniclabel.cpp b/src/quickcontrols2impl/qquickmnemoniclabel.cpp index c88f0994c9..982ffeeb66 100644 --- a/src/quickcontrols2impl/qquickmnemoniclabel.cpp +++ b/src/quickcontrols2impl/qquickmnemoniclabel.cpp @@ -58,7 +58,7 @@ void QQuickMnemonicLabel::updateMnemonic() QString text(m_fullText.size(), QChar::Null); int idx = 0; int pos = 0; - int len = m_fullText.length(); + int len = m_fullText.size(); QList<QTextLayout::FormatRange> formats; while (len) { if (m_fullText.at(pos) == QLatin1Char('&') && (len == 1 || m_fullText.at(pos + 1) != QLatin1Char('&'))) { diff --git a/src/quickcontrols2impl/qquickninepatchimage.cpp b/src/quickcontrols2impl/qquickninepatchimage.cpp index 5d029481ad..3f8a9e03e9 100644 --- a/src/quickcontrols2impl/qquickninepatchimage.cpp +++ b/src/quickcontrols2impl/qquickninepatchimage.cpp @@ -266,7 +266,7 @@ void QQuickNinePatchImagePrivate::updatePaddings(const QSizeF &size, const QList qreal oldRightPadding = rightPadding; qreal oldBottomPadding = bottomPadding; - if (horizontal.count() >= 2) { + if (horizontal.size() >= 2) { leftPadding = horizontal.first(); rightPadding = size.width() - horizontal.last() - 2; } else { @@ -274,7 +274,7 @@ void QQuickNinePatchImagePrivate::updatePaddings(const QSizeF &size, const QList rightPadding = 0; } - if (vertical.count() >= 2) { + if (vertical.size() >= 2) { topPadding = vertical.first(); bottomPadding = size.height() - vertical.last() - 2; } else { @@ -300,26 +300,26 @@ void QQuickNinePatchImagePrivate::updateInsets(const QList<qreal> &horizontal, c qreal oldRightInset = rightInset; qreal oldBottomInset = bottomInset; - if (horizontal.count() >= 2 && horizontal.first() == 0) + if (horizontal.size() >= 2 && horizontal.first() == 0) leftInset = horizontal.at(1); else leftInset = 0; - if (horizontal.count() == 2 && horizontal.first() > 0) + if (horizontal.size() == 2 && horizontal.first() > 0) rightInset = horizontal.last() - horizontal.first(); - else if (horizontal.count() == 4) + else if (horizontal.size() == 4) rightInset = horizontal.last() - horizontal.at(2); else rightInset = 0; - if (vertical.count() >= 2 && vertical.first() == 0) + if (vertical.size() >= 2 && vertical.first() == 0) topInset = vertical.at(1); else topInset = 0; - if (vertical.count() == 2 && vertical.first() > 0) + if (vertical.size() == 2 && vertical.first() > 0) bottomInset = vertical.last() - vertical.first(); - else if (vertical.count() == 4) + else if (vertical.size() == 4) bottomInset = vertical.last() - vertical.at(2); else bottomInset = 0; diff --git a/src/quickcontrolstestutils/controlstestutils.cpp b/src/quickcontrolstestutils/controlstestutils.cpp index 662633c7b6..f565751c0d 100644 --- a/src/quickcontrolstestutils/controlstestutils.cpp +++ b/src/quickcontrolstestutils/controlstestutils.cpp @@ -137,7 +137,7 @@ bool QQuickControlsTestUtils::clickButton(QQuickAbstractButton *button) const QPoint buttonCenter = button->mapToScene(QPointF(button->width() / 2, button->height() / 2)).toPoint(); QTest::mouseClick(button->window(), Qt::LeftButton, Qt::NoModifier, buttonCenter); - if (spy.count() != 1) { + if (spy.size() != 1) { qWarning() << "clicked signal of button" << button << "was not emitted after clicking"; return false; } @@ -158,7 +158,7 @@ bool QQuickControlsTestUtils::doubleClickButton(QQuickAbstractButton *button) const QPoint buttonCenter = button->mapToScene(QPointF(button->width() / 2, button->height() / 2)).toPoint(); QTest::mouseDClick(button->window(), Qt::LeftButton, Qt::NoModifier, buttonCenter); - if (spy.count() != 1) { + if (spy.size() != 1) { qWarning() << "doubleClicked signal of button" << button << "was not emitted after double-clicking"; return false; } diff --git a/src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp b/src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp index 32828e9f37..6b1cdb860c 100644 --- a/src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp +++ b/src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp @@ -326,7 +326,7 @@ void QQuickFileDialog::setNameFilters(const QStringList &filters) m_options->setNameFilters(filters); if (m_selectedNameFilter) { int index = m_selectedNameFilter->index(); - if (index < 0 || index >= filters.count()) + if (index < 0 || index >= filters.size()) index = 0; m_selectedNameFilter->update(filters.value(index)); } diff --git a/src/quickdialogs2/quickdialogs2quickimpl/qquickfontdialogimpl.cpp b/src/quickdialogs2/quickdialogs2quickimpl/qquickfontdialogimpl.cpp index 1f5f060620..5dcde5a81e 100644 --- a/src/quickdialogs2/quickdialogs2quickimpl/qquickfontdialogimpl.cpp +++ b/src/quickdialogs2/quickdialogs2quickimpl/qquickfontdialogimpl.cpp @@ -532,7 +532,7 @@ static int findStyleInModel(const QString &selectedStyle, const QStringList &mod auto styleClass = classifyStyleFallback(selectedStyle); if (styleClass != StyleClass::Unknown) - for (int i = 0; i < model.count(); ++i) + for (int i = 0; i < model.size(); ++i) if (classifyStyleFallback(model.at(i)) == styleClass) return i; } @@ -707,7 +707,7 @@ void QQuickFontDialogImplAttached::searchListView(const QString &s, QQuickListVi do { m_search.append(s); - for (int i = 0; i < model.count(); ++i) { + for (int i = 0; i < model.size(); ++i) { if (model.at(i).startsWith(m_search, Qt::CaseInsensitive)) { listView->setCurrentIndex(i); return; @@ -774,7 +774,7 @@ void QQuickFontDialogImplAttached::_q_sizeEdited() auto model = sizeListView()->model().toStringList(); int i; - for (i = 0; i < model.count() - 1; ++i) { + for (i = 0; i < model.size() - 1; ++i) { if (model.at(i).toInt() >= size) break; } diff --git a/src/quicklayouts/qquickgridlayoutengine_p.h b/src/quicklayouts/qquickgridlayoutengine_p.h index 8d7343464e..412e56b29a 100644 --- a/src/quicklayouts/qquickgridlayoutengine_p.h +++ b/src/quicklayouts/qquickgridlayoutengine_p.h @@ -109,7 +109,7 @@ public: QQuickGridLayoutItem *findLayoutItem(QQuickItem *layoutItem) const { - for (int i = q_items.count() - 1; i >= 0; --i) { + for (int i = q_items.size() - 1; i >= 0; --i) { QQuickGridLayoutItem *item = static_cast<QQuickGridLayoutItem*>(q_items.at(i)); if (item->layoutItem() == layoutItem) return item; diff --git a/src/quicklayouts/qquickstacklayout.cpp b/src/quicklayouts/qquickstacklayout.cpp index 823a79f0ca..217e1df406 100644 --- a/src/quicklayouts/qquickstacklayout.cpp +++ b/src/quicklayouts/qquickstacklayout.cpp @@ -320,7 +320,7 @@ void QQuickStackLayout::rearrange(const QSizeF &newSize) qCDebug(lcQuickLayouts) << "QQuickStackLayout::rearrange"; - if (d->currentIndex == -1 || d->currentIndex >= m_cachedItemSizeHints.count()) + if (d->currentIndex == -1 || d->currentIndex >= m_cachedItemSizeHints.size()) return; QQuickStackLayout::SizeHints &hints = cachedItemSizeHints(d->currentIndex); QQuickItem *item = itemAt(d->currentIndex); diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp index 53d1378d89..6ec5c566d0 100644 --- a/src/quickshapes/qquickshape.cpp +++ b/src/quickshapes/qquickshape.cpp @@ -903,7 +903,7 @@ void QQuickShape::itemChange(ItemChange change, const ItemChangeData &data) if (change == ItemVisibleHasChanged && data.boolValue) d->_q_shapePathChanged(); else if (change == QQuickItem::ItemSceneChange) { - for (int i = 0; i < d->sp.count(); ++i) + for (int i = 0; i < d->sp.size(); ++i) QQuickShapePathPrivate::get(d->sp[i])->dirty = QQuickShapePathPrivate::DirtyAll; d->_q_shapePathChanged(); } @@ -1002,7 +1002,7 @@ void QQuickShapePrivate::sync() renderer->setAsyncCallback(asyncShapeReady, this); } - const int count = sp.count(); + const int count = sp.size(); bool countChanged = false; renderer->beginSync(count, &countChanged); diff --git a/src/quickshapes/qquickshape_p_p.h b/src/quickshapes/qquickshape_p_p.h index 593a5d8d73..20bc07da0f 100644 --- a/src/quickshapes/qquickshape_p_p.h +++ b/src/quickshapes/qquickshape_p_p.h @@ -167,7 +167,7 @@ struct QQuickShapeGradientCacheKey inline size_t qHash(const QQuickShapeGradientCacheKey &v, size_t seed = 0) { size_t h = seed + v.spread; - for (int i = 0; i < 3 && i < v.stops.count(); ++i) + for (int i = 0; i < 3 && i < v.stops.size(); ++i) h += v.stops[i].second.rgba(); return h; } diff --git a/src/quickshapes/qquickshapegenericrenderer.cpp b/src/quickshapes/qquickshapegenericrenderer.cpp index 4f32609d44..c7b7eeadb1 100644 --- a/src/quickshapes/qquickshapegenericrenderer.cpp +++ b/src/quickshapes/qquickshapegenericrenderer.cpp @@ -90,7 +90,7 @@ QQuickShapeGenericRenderer::~QQuickShapeGenericRenderer() void QQuickShapeGenericRenderer::beginSync(int totalCount, bool *countChanged) { - if (m_sp.count() != totalCount) { + if (m_sp.size() != totalCount) { m_sp.resize(totalCount); m_accDirty |= DirtyList; *countChanged = true; @@ -236,7 +236,7 @@ void QQuickShapeGenericRenderer::endSync(bool async) bool didKickOffAsync = false; - for (int i = 0; i < m_sp.count(); ++i) { + for (int i = 0; i < m_sp.size(); ++i) { ShapePathData &d(m_sp[i]); if (!d.syncDirty) continue; @@ -291,7 +291,7 @@ void QQuickShapeGenericRenderer::endSync(bool async) QObject::connect(r, &QQuickShapeFillRunnable::done, qApp, [this, i](QQuickShapeFillRunnable *r) { // Bail out when orphaned (meaning either another run was // started after this one, or the renderer got destroyed). - if (!r->orphaned && i < m_sp.count()) { + if (!r->orphaned && i < m_sp.size()) { ShapePathData &d(m_sp[i]); d.fillVertices = r->fillVertices; d.fillIndices = r->fillIndices; @@ -326,7 +326,7 @@ void QQuickShapeGenericRenderer::endSync(bool async) r->strokeColor = d.strokeColor; r->clipSize = QSize(m_item->width(), m_item->height()); QObject::connect(r, &QQuickShapeStrokeRunnable::done, qApp, [this, i](QQuickShapeStrokeRunnable *r) { - if (!r->orphaned && i < m_sp.count()) { + if (!r->orphaned && i < m_sp.size()) { ShapePathData &d(m_sp[i]); d.strokeVertices = r->strokeVertices; d.pendingStroke = nullptr; @@ -377,7 +377,7 @@ void QQuickShapeGenericRenderer::triangulateFill(const QPainterPath &path, const QVectorPath &vp = qtVectorPathForPath(path); QTriangleSet ts = qTriangulate(vp, QTransform::fromScale(TRI_SCALE, TRI_SCALE), 1, supportsElementIndexUint); - const int vertexCount = ts.vertices.count() / 2; // just a qreal vector with x,y hence the / 2 + const int vertexCount = ts.vertices.size() / 2; // just a qreal vector with x,y hence the / 2 fillVertices->resize(vertexCount); ColoredVertex *vdst = reinterpret_cast<ColoredVertex *>(fillVertices->data()); const qreal *vsrc = ts.vertices.constData(); @@ -588,13 +588,13 @@ void QQuickShapeGenericRenderer::updateFillNode(ShapePathData *d, QQuickShapeGen } const int indexCount = d->indexType == QSGGeometry::UnsignedShortType - ? d->fillIndices.count() * 2 : d->fillIndices.count(); + ? d->fillIndices.size() * 2 : d->fillIndices.size(); if (g->indexType() != d->indexType) { g = new QSGGeometry(QSGGeometry::defaultAttributes_ColoredPoint2D(), - d->fillVertices.count(), indexCount, d->indexType); + d->fillVertices.size(), indexCount, d->indexType); n->setGeometry(g); } else { - g->allocate(d->fillVertices.count(), indexCount); + g->allocate(d->fillVertices.size(), indexCount); } g->setDrawingMode(QSGGeometry::DrawTriangles); memcpy(g->vertexData(), d->fillVertices.constData(), g->vertexCount() * g->sizeOfVertex()); @@ -635,7 +635,7 @@ void QQuickShapeGenericRenderer::updateStrokeNode(ShapePathData *d, QQuickShapeG return; } - g->allocate(d->strokeVertices.count(), 0); + g->allocate(d->strokeVertices.size(), 0); g->setDrawingMode(QSGGeometry::DrawTriangleStrip); memcpy(g->vertexData(), d->strokeVertices.constData(), g->vertexCount() * g->sizeOfVertex()); } @@ -778,10 +778,10 @@ int QQuickShapeLinearGradientMaterial::compare(const QSGMaterial *other) const if (int d = ga->b.y() - gb->b.y()) return d; - if (int d = ga->stops.count() - gb->stops.count()) + if (int d = ga->stops.size() - gb->stops.size()) return d; - for (int i = 0; i < ga->stops.count(); ++i) { + for (int i = 0; i < ga->stops.size(); ++i) { if (int d = ga->stops[i].first - gb->stops[i].first) return d; if (int d = ga->stops[i].second.rgba() - gb->stops[i].second.rgba()) @@ -912,10 +912,10 @@ int QQuickShapeRadialGradientMaterial::compare(const QSGMaterial *other) const if (int d = ga->v1 - gb->v1) return d; - if (int d = ga->stops.count() - gb->stops.count()) + if (int d = ga->stops.size() - gb->stops.size()) return d; - for (int i = 0; i < ga->stops.count(); ++i) { + for (int i = 0; i < ga->stops.size(); ++i) { if (int d = ga->stops[i].first - gb->stops[i].first) return d; if (int d = ga->stops[i].second.rgba() - gb->stops[i].second.rgba()) @@ -1021,10 +1021,10 @@ int QQuickShapeConicalGradientMaterial::compare(const QSGMaterial *other) const if (int d = ga->v0 - gb->v0) return d; - if (int d = ga->stops.count() - gb->stops.count()) + if (int d = ga->stops.size() - gb->stops.size()) return d; - for (int i = 0; i < ga->stops.count(); ++i) { + for (int i = 0; i < ga->stops.size(); ++i) { if (int d = ga->stops[i].first - gb->stops[i].first) return d; if (int d = ga->stops[i].second.rgba() - gb->stops[i].second.rgba()) diff --git a/src/quickshapes/qquickshapesoftwarerenderer.cpp b/src/quickshapes/qquickshapesoftwarerenderer.cpp index 21327d12e0..620b964180 100644 --- a/src/quickshapes/qquickshapesoftwarerenderer.cpp +++ b/src/quickshapes/qquickshapesoftwarerenderer.cpp @@ -8,7 +8,7 @@ QT_BEGIN_NAMESPACE void QQuickShapeSoftwareRenderer::beginSync(int totalCount, bool *countChanged) { - if (m_sp.count() != totalCount) { + if (m_sp.size() != totalCount) { m_sp.resize(totalCount); m_accDirty |= DirtyList; *countChanged = true; @@ -155,7 +155,7 @@ void QQuickShapeSoftwareRenderer::updateNode() if (!m_accDirty) return; - const int count = m_sp.count(); + const int count = m_sp.size(); const bool listChanged = m_accDirty & DirtyList; if (listChanged) m_node->m_sp.resize(count); diff --git a/src/quicktemplates2/accessible/qaccessiblequickpage.cpp b/src/quicktemplates2/accessible/qaccessiblequickpage.cpp index d291648bab..6a15f3a3b3 100644 --- a/src/quicktemplates2/accessible/qaccessiblequickpage.cpp +++ b/src/quicktemplates2/accessible/qaccessiblequickpage.cpp @@ -35,7 +35,7 @@ QList<QQuickItem *> QAccessibleQuickPage::orderedChildItems() const kids.move(hidx, 0); const qsizetype fidx = kids.indexOf(p->footer()); if (fidx != -1) - kids.move(fidx, kids.count() - 1); + kids.move(fidx, kids.size() - 1); return kids; } diff --git a/src/quicktemplates2/qquickactiongroup.cpp b/src/quicktemplates2/qquickactiongroup.cpp index 9caf5f67f8..72f4027341 100644 --- a/src/quicktemplates2/qquickactiongroup.cpp +++ b/src/quicktemplates2/qquickactiongroup.cpp @@ -170,7 +170,7 @@ void QQuickActionGroupPrivate::actions_append(QQmlListProperty<QQuickAction> *pr qsizetype QQuickActionGroupPrivate::actions_count(QQmlListProperty<QQuickAction> *prop) { QQuickActionGroupPrivate *p = static_cast<QQuickActionGroupPrivate *>(prop->data); - return p->actions.count(); + return p->actions.size(); } QQuickAction *QQuickActionGroupPrivate::actions_at(QQmlListProperty<QQuickAction> *prop, qsizetype index) diff --git a/src/quicktemplates2/qquickbuttongroup.cpp b/src/quicktemplates2/qquickbuttongroup.cpp index b5a7ea00aa..87f3f1a05c 100644 --- a/src/quicktemplates2/qquickbuttongroup.cpp +++ b/src/quicktemplates2/qquickbuttongroup.cpp @@ -205,7 +205,7 @@ void QQuickButtonGroupPrivate::buttons_append(QQmlListProperty<QQuickAbstractBut qsizetype QQuickButtonGroupPrivate::buttons_count(QQmlListProperty<QQuickAbstractButton> *prop) { QQuickButtonGroupPrivate *p = static_cast<QQuickButtonGroupPrivate *>(prop->data); - return p->buttons.count(); + return p->buttons.size(); } QQuickAbstractButton *QQuickButtonGroupPrivate::buttons_at(QQmlListProperty<QQuickAbstractButton> *prop, qsizetype index) diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index 6311981645..f90cf0254f 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -190,7 +190,7 @@ QVariant QQuickComboBoxDelegateModel::variantValue(int index, const QString &rol const QVariant object = model.toList().value(index); if (object.metaType() == QMetaType::fromType<QVariantMap>()) { const QVariantMap data = object.toMap(); - if (data.count() == 1) + if (data.size() == 1) return data.first(); } } @@ -441,10 +441,10 @@ void QQuickComboBoxPrivate::updateEditText() if (extra.isAllocated() && extra->allowComplete && !text.isEmpty()) { const QString completed = tryComplete(text); - if (completed.length() > text.length()) { + if (completed.size() > text.size()) { input->setText(completed); // This will select the text backwards. - input->select(completed.length(), text.length()); + input->select(completed.size(), text.size()); return; } } @@ -548,14 +548,14 @@ QString QQuickComboBoxPrivate::tryComplete(const QString &input) continue; // either the first or the shortest match - if (match.isEmpty() || text.length() < match.length()) + if (match.isEmpty() || text.size() < match.size()) match = text; } if (match.isEmpty()) return input; - return input + match.mid(input.length()); + return input + match.mid(input.size()); } void QQuickComboBoxPrivate::setCurrentIndex(int index, Activation activate) diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp index 85a1308604..45bdfcc5b3 100644 --- a/src/quicktemplates2/qquickcontainer.cpp +++ b/src/quicktemplates2/qquickcontainer.cpp @@ -296,7 +296,7 @@ void QQuickContainerPrivate::reorderItems() QList<QQuickItem *> siblings = effectiveContentItem(contentItem)->childItems(); int to = 0; - for (int i = 0; i < siblings.count(); ++i) { + for (int i = 0; i < siblings.size(); ++i) { QQuickItem* sibling = siblings.at(i); if (QQuickItemPrivate::get(sibling)->isTransparentForPositioner()) continue; @@ -362,7 +362,7 @@ void QQuickContainerPrivate::contentData_append(QQmlListProperty<QObject> *prop, qsizetype QQuickContainerPrivate::contentData_count(QQmlListProperty<QObject> *prop) { QQuickContainer *q = static_cast<QQuickContainer *>(prop->object); - return QQuickContainerPrivate::get(q)->contentData.count(); + return QQuickContainerPrivate::get(q)->contentData.size(); } QObject *QQuickContainerPrivate::contentData_at(QQmlListProperty<QObject> *prop, qsizetype index) diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp index f06bb147c9..9b39f9e1ab 100644 --- a/src/quicktemplates2/qquickdialogbuttonbox.cpp +++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp @@ -282,7 +282,7 @@ void QQuickDialogButtonBoxPrivate::updateLayout() std::stable_sort(buttons.begin(), buttons.end(), ButtonLayout(static_cast<QPlatformDialogHelper::ButtonLayout>(buttonLayout))); - for (int i = 0; i < buttons.count() - 1; ++i) + for (int i = 0; i < buttons.size() - 1; ++i) q->insertItem(i, buttons.at(i)); } diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index 14fd4d26a0..ccaf3219b6 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -41,7 +41,7 @@ QList<QQuickPopup *> QQuickOverlayPrivate::stackingOrderPopups() const const QList<QQuickItem *> children = paintOrderChildItems(); QList<QQuickPopup *> popups; - popups.reserve(children.count()); + popups.reserve(children.size()); for (auto it = children.crbegin(), end = children.crend(); it != end; ++it) { QQuickPopup *popup = qobject_cast<QQuickPopup *>((*it)->parent()); diff --git a/src/quicktemplates2/qquickpane.cpp b/src/quicktemplates2/qquickpane.cpp index 46d943c2bb..05e5c90883 100644 --- a/src/quicktemplates2/qquickpane.cpp +++ b/src/quicktemplates2/qquickpane.cpp @@ -165,7 +165,7 @@ qreal QQuickPanePrivate::getContentWidth() const return cw; const auto contentChildren = contentChildItems(); - if (contentChildren.count() == 1) + if (contentChildren.size() == 1) return contentChildren.first()->implicitWidth(); return 0; @@ -181,7 +181,7 @@ qreal QQuickPanePrivate::getContentHeight() const return ch; const auto contentChildren = contentChildItems(); - if (contentChildren.count() == 1) + if (contentChildren.size() == 1) return contentChildren.first()->implicitHeight(); return 0; diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp index e65a2f18ad..892f4a3e71 100644 --- a/src/quicktemplates2/qquickstackview.cpp +++ b/src/quicktemplates2/qquickstackview.cpp @@ -387,7 +387,7 @@ bool QQuickStackView::isBusy() const int QQuickStackView::depth() const { Q_D(const QQuickStackView); - return d->elements.count(); + return d->elements.size(); } /*! @@ -448,7 +448,7 @@ QQuickItem *QQuickStackView::find(const QJSValue &callback, LoadBehavior behavio if (!engine || !func.isCallable()) // TODO: warning? return nullptr; - for (int i = d->elements.count() - 1; i >= 0; --i) { + for (int i = d->elements.size() - 1; i >= 0; --i) { QQuickStackElement *element = d->elements.at(i); if (behavior == ForceLoad) element->load(this); @@ -574,9 +574,9 @@ void QQuickStackView::push(QQmlV4Function *args) if (!d->elements.isEmpty()) exit = d->elements.top(); - int oldDepth = d->elements.count(); + int oldDepth = d->elements.size(); if (d->pushElements(elements)) { - d->depthChange(d->elements.count(), oldDepth); + d->depthChange(d->elements.size(), oldDepth); QQuickStackElement *enter = d->elements.top(); d->startTransition(QQuickStackTransition::pushEnter(operation, enter, this), QQuickStackTransition::pushExit(operation, exit, this), @@ -640,14 +640,14 @@ void QQuickStackView::pop(QQmlV4Function *args) QScopedValueRollback<bool> modifyingElements(d->modifyingElements, true); QScopedValueRollback<QString> operationNameRollback(d->operation, operationName); int argc = args->length(); - if (d->elements.count() <= 1 || argc > 2) { + if (d->elements.size() <= 1 || argc > 2) { if (argc > 2) d->warn(QStringLiteral("too many arguments")); args->setReturnValue(QV4::Encode::null()); return; } - int oldDepth = d->elements.count(); + int oldDepth = d->elements.size(); QQuickStackElement *exit = d->elements.pop(); QQuickStackElement *enter = d->elements.top(); @@ -686,7 +686,7 @@ void QQuickStackView::pop(QQmlV4Function *args) d->removing.insert(exit); previousItem = exit->item; } - d->depthChange(d->elements.count(), oldDepth); + d->depthChange(d->elements.size(), oldDepth); d->startTransition(QQuickStackTransition::popExit(operation, exit, this), QQuickStackTransition::popEnter(operation, enter, this), operation == Immediate); @@ -837,13 +837,13 @@ void QQuickStackView::replace(QQmlV4Function *args) return; } - int oldDepth = d->elements.count(); + int oldDepth = d->elements.size(); QQuickStackElement* exit = nullptr; if (!d->elements.isEmpty()) exit = d->elements.pop(); if (exit != target ? d->replaceElements(target, elements) : d->pushElements(elements)) { - d->depthChange(d->elements.count(), oldDepth); + d->depthChange(d->elements.size(), oldDepth); if (exit) { exit->removal = true; d->removing.insert(exit); @@ -914,7 +914,7 @@ void QQuickStackView::clear(Operation operation) QQuickStackTransition::popEnter(operation, nullptr, this), false); } - int oldDepth = d->elements.count(); + int oldDepth = d->elements.size(); d->setCurrentItem(nullptr); qDeleteAll(d->elements); d->elements.clear(); @@ -1115,7 +1115,7 @@ void QQuickStackView::componentComplete() QScopedValueRollback<QString> operationNameRollback(d->operation, QStringLiteral("initialItem")); QQuickStackElement *element = nullptr; QString error; - int oldDepth = d->elements.count(); + int oldDepth = d->elements.size(); if (QObject *o = d->initialItem.toQObject()) element = QQuickStackElement::fromObject(o, this, &error); else if (d->initialItem.isString()) @@ -1124,7 +1124,7 @@ void QQuickStackView::componentComplete() d->warn(error); delete element; } else if (d->pushElement(element)) { - d->depthChange(d->elements.count(), oldDepth); + d->depthChange(d->elements.size(), oldDepth); d->setCurrentItem(element); element->setStatus(QQuickStackView::Active); } diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp index 23cdf0c41e..8b0811195a 100644 --- a/src/quicktemplates2/qquickstackview_p.cpp +++ b/src/quicktemplates2/qquickstackview_p.cpp @@ -165,7 +165,7 @@ bool QQuickStackViewPrivate::pushElements(const QList<QQuickStackElement *> &ele Q_Q(QQuickStackView); if (!elems.isEmpty()) { for (QQuickStackElement *e : elems) { - e->setIndex(elements.count()); + e->setIndex(elements.size()); elements += e; } return elements.top()->load(q); @@ -183,7 +183,7 @@ bool QQuickStackViewPrivate::pushElement(QQuickStackElement *element) bool QQuickStackViewPrivate::popElements(QQuickStackElement *element) { Q_Q(QQuickStackView); - while (elements.count() > 1 && elements.top() != element) { + while (elements.size() > 1 && elements.top() != element) { delete elements.pop(); if (!element) break; diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp index 049856597c..42343d1072 100644 --- a/src/quicktemplates2/qquickswipedelegate.cpp +++ b/src/quicktemplates2/qquickswipedelegate.cpp @@ -941,7 +941,7 @@ bool QQuickSwipeDelegatePrivate::attachedObjectsSetPressed(QQuickItem *item, QPo bool found = false; QVarLengthArray<QQuickItem *, 16> itemAndChildren; itemAndChildren.append(item); - for (int i = 0; i < itemAndChildren.count(); ++i) { + for (int i = 0; i < itemAndChildren.size(); ++i) { auto item = itemAndChildren.at(i); auto posInItem = item->mapFromScene(scenePos); if (item->contains(posInItem)) { diff --git a/src/quicktestutils/qml/testhttpserver.cpp b/src/quicktestutils/qml/testhttpserver.cpp index 5a9cb6a1cd..9873cd1827 100644 --- a/src/quicktestutils/qml/testhttpserver.cpp +++ b/src/quicktestutils/qml/testhttpserver.cpp @@ -165,7 +165,7 @@ bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &bod if (headers_done) { m_waitData.body.append(line); } else if (line.endsWith("{{Ignore}}\n")) { - m_waitData.headerPrefixes.append(line.left(line.length() - strlen("{{Ignore}}\n"))); + m_waitData.headerPrefixes.append(line.left(line.size() - strlen("{{Ignore}}\n"))); } else { line.replace("{{ServerHostUrl}}", serverHostUrl); m_waitData.headerExactMatches.append(line); @@ -177,7 +177,7 @@ bool TestHTTPServer::wait(const QUrl &expect, const QUrl &reply, const QUrl &bod if (!m_replyData.endsWith('\n')) m_replyData.append('\n'); m_replyData.append("Content-length: "); - m_replyData.append(QByteArray::number(m_bodyData.length())); + m_replyData.append(QByteArray::number(m_bodyData.size())); m_replyData.append("\n\n"); for (int ii = 0; ii < m_replyData.size(); ++ii) { @@ -216,7 +216,7 @@ void TestHTTPServer::disconnected() return; m_dataCache.remove(socket); - for (int ii = 0; ii < m_toSend.count(); ++ii) { + for (int ii = 0; ii < m_toSend.size(); ++ii) { if (m_toSend.at(ii).first == socket) { m_toSend.removeAt(ii); --ii; @@ -237,7 +237,7 @@ void TestHTTPServer::readyRead() return; } - if (m_state == Failed || (m_waitData.body.isEmpty() && m_waitData.headerExactMatches.count() == 0)) { + if (m_state == Failed || (m_waitData.body.isEmpty() && m_waitData.headerExactMatches.size() == 0)) { qWarning() << "TestHTTPServer: Unexpected data" << socket->readAll(); return; } @@ -301,7 +301,7 @@ bool TestHTTPServer::reply(QTcpSocket *socket, const QByteArray &fileNameIn) return true; } - for (int ii = 0; ii < m_directories.count(); ++ii) { + for (int ii = 0; ii < m_directories.size(); ++ii) { const QString &dir = m_directories.at(ii).first; const Mode mode = m_directories.at(ii).second; diff --git a/src/quicktestutils/quick/viewtestutils.cpp b/src/quicktestutils/quick/viewtestutils.cpp index c9b92e7c91..19e29928bb 100644 --- a/src/quicktestutils/quick/viewtestutils.cpp +++ b/src/quicktestutils/quick/viewtestutils.cpp @@ -79,7 +79,7 @@ void QQuickViewTestUtils::flick(QQuickView *window, const QPoint &from, const QP QList<int> QQuickViewTestUtils::adjustIndexesForAddDisplaced(const QList<int> &indexes, int index, int count) { QList<int> result; - for (int i=0; i<indexes.count(); i++) { + for (int i=0; i<indexes.size(); i++) { int num = indexes[i]; if (num >= index) { num += count; @@ -92,7 +92,7 @@ QList<int> QQuickViewTestUtils::adjustIndexesForAddDisplaced(const QList<int> &i QList<int> QQuickViewTestUtils::adjustIndexesForMove(const QList<int> &indexes, int from, int to, int count) { QList<int> result; - for (int i=0; i<indexes.count(); i++) { + for (int i=0; i<indexes.size(); i++) { int num = indexes[i]; if (from < to) { if (num >= from && num < from + count) @@ -113,7 +113,7 @@ QList<int> QQuickViewTestUtils::adjustIndexesForMove(const QList<int> &indexes, QList<int> QQuickViewTestUtils::adjustIndexesForRemoveDisplaced(const QList<int> &indexes, int index, int count) { QList<int> result; - for (int i=0; i<indexes.count(); i++) { + for (int i=0; i<indexes.size(); i++) { int num = indexes[i]; if (num >= index) num -= count; @@ -130,7 +130,7 @@ QQuickViewTestUtils::QaimModel::QaimModel(QObject *parent) int QQuickViewTestUtils::QaimModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); - return list.count(); + return list.size(); } int QQuickViewTestUtils::QaimModel::columnCount(const QModelIndex &parent) const @@ -175,15 +175,15 @@ QString QQuickViewTestUtils::QaimModel::number(int index) const void QQuickViewTestUtils::QaimModel::addItem(const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), list.count(), list.count()); + emit beginInsertRows(QModelIndex(), list.size(), list.size()); list.append(QPair<QString,QString>(name, number)); emit endInsertRows(); } void QQuickViewTestUtils::QaimModel::addItems(const QList<QPair<QString, QString> > &items) { - emit beginInsertRows(QModelIndex(), list.count(), list.count()+items.count()-1); - for (int i=0; i<items.count(); i++) + emit beginInsertRows(QModelIndex(), list.size(), list.size()+items.size()-1); + for (int i=0; i<items.size(); i++) list.append(QPair<QString,QString>(items[i].first, items[i].second)); emit endInsertRows(); } @@ -197,8 +197,8 @@ void QQuickViewTestUtils::QaimModel::insertItem(int index, const QString &name, void QQuickViewTestUtils::QaimModel::insertItems(int index, const QList<QPair<QString, QString> > &items) { - emit beginInsertRows(QModelIndex(), index, index+items.count()-1); - for (int i=0; i<items.count(); i++) + emit beginInsertRows(QModelIndex(), index, index+items.size()-1); + for (int i=0; i<items.size(); i++) list.insert(index + i, QPair<QString,QString>(items[i].first, items[i].second)); emit endInsertRows(); } @@ -240,7 +240,7 @@ void QQuickViewTestUtils::QaimModel::modifyItem(int idx, const QString &name, co void QQuickViewTestUtils::QaimModel::clear() { - int count = list.count(); + int count = list.size(); if (count > 0) { beginRemoveRows(QModelIndex(), 0, count-1); list.clear(); @@ -276,11 +276,11 @@ private: }; void QQuickViewTestUtils::QaimModel::matchAgainst(const QList<QPair<QString, QString> > &other, const QString &error1, const QString &error2) { - for (int i=0; i<other.count(); i++) { + for (int i=0; i<other.size(); i++) { QVERIFY2(list.contains(other[i]), ScopedPrintable(other[i].first + QLatin1Char(' ') + other[i].second + QLatin1Char(' ') + error1)); } - for (int i=0; i<list.count(); i++) { + for (int i=0; i<list.size(); i++) { QVERIFY2(other.contains(list[i]), ScopedPrintable(list[i].first + QLatin1Char(' ') + list[i].second + QLatin1Char(' ') + error2)); } @@ -337,7 +337,7 @@ bool QQuickViewTestUtils::ListRange::isValid() const int QQuickViewTestUtils::ListRange::count() const { - return indexes.count(); + return indexes.size(); } QList<QPair<QString,QString> > QQuickViewTestUtils::ListRange::getModelDataValues(const QaimModel &model) @@ -345,7 +345,7 @@ QList<QPair<QString,QString> > QQuickViewTestUtils::ListRange::getModelDataValue QList<QPair<QString,QString> > data; if (!valid) return data; - for (int i=0; i<indexes.count(); i++) + for (int i=0; i<indexes.size(); i++) data.append(qMakePair(model.name(indexes[i]), model.number(indexes[i]))); return data; } @@ -396,7 +396,7 @@ bool QQuickViewTestUtils::testVisibleItems(const QQuickItemViewPrivate *priv, bo QHash<QQuickItem*, int> uniqueItems; int skip = 0; - for (int i = 0; i < priv->visibleItems.count(); ++i) { + for (int i = 0; i < priv->visibleItems.size(); ++i) { FxViewItem *item = priv->visibleItems.at(i); if (!item) { *failItem = nullptr; diff --git a/src/quicktestutils/quick/visualtestutils.cpp b/src/quicktestutils/quick/visualtestutils.cpp index b7bd561028..ddbf8ca9f6 100644 --- a/src/quicktestutils/quick/visualtestutils.cpp +++ b/src/quicktestutils/quick/visualtestutils.cpp @@ -15,7 +15,7 @@ QQuickItem *QQuickVisualTestUtils::findVisibleChild(QQuickItem *parent, const QS { QQuickItem *item = nullptr; QList<QQuickItem*> items = parent->findChildren<QQuickItem*>(objectName); - for (int i = 0; i < items.count(); ++i) { + for (int i = 0; i < items.size(); ++i) { if (items.at(i)->isVisible() && !QQuickItemPrivate::get(items.at(i))->culled) { item = items.at(i); break; @@ -27,7 +27,7 @@ QQuickItem *QQuickVisualTestUtils::findVisibleChild(QQuickItem *parent, const QS void QQuickVisualTestUtils::dumpTree(QQuickItem *parent, int depth) { static QString padding = QStringLiteral(" "); - for (int i = 0; i < parent->childItems().count(); ++i) { + for (int i = 0; i < parent->childItems().size(); ++i) { QQuickItem *item = qobject_cast<QQuickItem*>(parent->childItems().at(i)); if (!item) continue; diff --git a/src/quicktestutils/quick/visualtestutils_p.h b/src/quicktestutils/quick/visualtestutils_p.h index 953d374327..ae618a04e0 100644 --- a/src/quicktestutils/quick/visualtestutils_p.h +++ b/src/quicktestutils/quick/visualtestutils_p.h @@ -46,7 +46,7 @@ namespace QQuickVisualTestUtils using namespace Qt::StringLiterals; const QMetaObject &mo = T::staticMetaObject; - for (int i = 0; i < parent->childItems().count(); ++i) { + for (int i = 0; i < parent->childItems().size(); ++i) { QQuickItem *item = qobject_cast<QQuickItem*>(parent->childItems().at(i)); if (!item) continue; @@ -75,7 +75,7 @@ namespace QQuickVisualTestUtils { QList<T*> items; const QMetaObject &mo = T::staticMetaObject; - for (int i = 0; i < parent->childItems().count(); ++i) { + for (int i = 0; i < parent->childItems().size(); ++i) { QQuickItem *item = qobject_cast<QQuickItem*>(parent->childItems().at(i)); if (!item || (visibleOnly && (!item->isVisible() || QQuickItemPrivate::get(item)->culled))) continue; @@ -91,7 +91,7 @@ namespace QQuickVisualTestUtils QList<T*> findItems(QQuickItem *parent, const QString &objectName, const QList<int> &indexes) { QList<T*> items; - for (int i=0; i<indexes.count(); i++) + for (int i=0; i<indexes.size(); i++) items << qobject_cast<QQuickItem*>(findItem<T>(parent, objectName, indexes[i])); return items; } diff --git a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp index 0a17d75387..cac9581803 100644 --- a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp @@ -81,7 +81,7 @@ public: int count() { - return states.count(); + return states.size(); } QList<QAbstractAnimationJob::State> states; diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp index f8665eac0a..a11ae75033 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp @@ -99,7 +99,7 @@ public: } void clear() { states.clear(); } - int count() { return states.count(); } + int count() { return states.size(); } QList<QAbstractAnimationJob::State> states; }; diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp index 03d207e49b..cc67df420c 100644 --- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp @@ -116,7 +116,7 @@ public: } void clear() { states.clear(); } - int count() const { return states.count(); } + int count() const { return states.size(); } QList<QAbstractAnimationJob::State> states; bool beEvil = false; @@ -562,8 +562,8 @@ typedef QList<QAbstractAnimationJob::State> StateList; static bool compareStates(const StateChangeListener& spy, const StateList &expectedStates) { bool equals = true; - for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) { - if (i >= spy.count() || i >= expectedStates.count()) { + for (int i = 0; i < qMax(expectedStates.size(), spy.count()); ++i) { + if (i >= spy.count() || i >= expectedStates.size()) { equals = false; break; } @@ -577,8 +577,8 @@ static bool compareStates(const StateChangeListener& spy, const StateList &expec if (!equals) { const char *stateStrings[] = {"Stopped", "Paused", "Running"}; QString e,a; - for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) { - if (i < expectedStates.count()) { + for (int i = 0; i < qMax(expectedStates.size(), spy.count()); ++i) { + if (i < expectedStates.size()) { int exp = int(expectedStates.at(i)); if (!e.isEmpty()) e += QLatin1String(", "); @@ -596,7 +596,7 @@ static bool compareStates(const StateChangeListener& spy, const StateList &expec } } - qDebug().noquote() << "\nexpected (count == " << expectedStates.count() << "): " << e + qDebug().noquote() << "\nexpected (count == " << expectedStates.size() << "): " << e << "\nactual (count == " << spy.count() << "): " << a << "\n"; } return equals; diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp index 1efc48e07d..81d8694406 100644 --- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp @@ -45,8 +45,8 @@ void tst_QPacketProtocol::init() m_client->connectToHost(m_server->serverAddress(), m_server->serverPort()); - QVERIFY(clientSpy.count() > 0 || clientSpy.wait()); - QVERIFY(serverSpy.count() > 0 || serverSpy.wait()); + QVERIFY(clientSpy.size() > 0 || clientSpy.wait()); + QVERIFY(serverSpy.size() > 0 || serverSpy.wait()); m_serverConn = m_server->nextPendingConnection(); } diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp index 9f51b65c7f..ac607df0a0 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp @@ -853,15 +853,15 @@ void tst_QQmlDebugJS::evaluateInContext() QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(engineClient.data(), SIGNAL(result()))); - QVERIFY(engineClient->engines().count()); + QVERIFY(engineClient->engines().size()); engineClient->queryRootContexts(engineClient->engines()[0], &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(engineClient.data(), SIGNAL(result()))); auto contexts = engineClient->rootContext().contexts; - QCOMPARE(contexts.count(), 1); + QCOMPARE(contexts.size(), 1); auto objects = contexts[0].objects; - QCOMPARE(objects.count(), 1); + QCOMPARE(objects.size(), 1); engineClient->queryObjectRecursive(objects[0], &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(engineClient.data(), SIGNAL(result()))); @@ -874,7 +874,7 @@ void tst_QQmlDebugJS::evaluateInContext() QTRY_COMPARE(responseBody(m_client).value("value").toInt(), 20); auto childObjects = object.children; - QVERIFY(childObjects.count() > 0); // QQmlComponentAttached is also in there + QVERIFY(childObjects.size() > 0); // QQmlComponentAttached is also in there QCOMPARE(childObjects[0].className, QString::fromLatin1("Item")); // "b" accessible in context of surrounding (child) object @@ -1065,7 +1065,7 @@ void tst_QQmlDebugJS::letConstLocals() for (const auto prop : props) { const auto propObj = prop.toObject(); QString name = propObj.value(QStringLiteral("name")).toString(); - QVERIFY(name.length() == 1); + QVERIFY(name.size() == 1); auto i = expectedMembers.indexOf(name.at(0)); QVERIFY(i != -1); expectedMembers.remove(i, 1); diff --git a/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp b/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp index 48396aefea..0e0340b672 100644 --- a/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp +++ b/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp @@ -63,7 +63,7 @@ private slots: changeLanguage("ru"); auto translationIssues = getTranslationIssues(); - QCOMPARE(translationIssues.length(), getTranslatableTextOccurrences().count()); + QCOMPARE(translationIssues.size(), getTranslatableTextOccurrences().size()); QCOMPARE(translationIssues.at(0).language, "ru-Cyrl-RU ru-RU ru"); } @@ -73,18 +73,18 @@ private slots: auto translationIssues = getTranslationIssues(); - QCOMPARE(translationIssues.length(), 3); + QCOMPARE(translationIssues.size(), 3); QCOMPARE(translationIssues.at(0).language, "fr-Latn-FR fr-FR fr"); } void verifyCorrectNumberOfTranslatableTextOccurrences() { - QCOMPARE(getTranslatableTextOccurrences().length(), 5); + QCOMPARE(getTranslatableTextOccurrences().size(), 5); } void verifyCorrectNumberOfStates() { - QCOMPARE(getStates().length(), 2); + QCOMPARE(getStates().size(), 2); } void getElideWarnings() @@ -128,9 +128,9 @@ private slots: { QVector<QmlState> stateList = getStates(); - QCOMPARE(stateList.length(), 2); + QCOMPARE(stateList.size(), 2); - for (int i = 0; i < stateList.count(); i++) { + for (int i = 0; i < stateList.size(); i++) { auto stateName = stateList.at(i).name; QVersionedPacket<QQmlDebugConnector> packet; sendMessageToService(createChangeStateRequest(packet, stateName)); diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp index 78d80405f4..890f4eeef6 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp @@ -55,7 +55,7 @@ QQmlEngineDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRoot if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()))) return QQmlEngineDebugObjectReference(); - int count = m_engineDebugClient->rootContext().contexts.count(); + int count = m_engineDebugClient->rootContext().contexts.size(); m_engineDebugClient->queryObject( m_engineDebugClient->rootContext().contexts[count - 1].objects[0], &success); if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()))) @@ -156,7 +156,7 @@ void tst_QQmlEngineDebugInspectorIntegration::createObject() QQmlEngineDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 2); + QCOMPARE(rootObject.children.size(), 2); int requestId = m_inspectorClient->createObject( qml, rootObject.debugId, QStringList() << QLatin1String("import QtQuick 2.0"), @@ -166,7 +166,7 @@ void tst_QQmlEngineDebugInspectorIntegration::createObject() rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 3); + QCOMPARE(rootObject.children.size(), 3); QCOMPARE(rootObject.children[2].idString, QLatin1String("xxxyxxx")); } @@ -177,7 +177,7 @@ void tst_QQmlEngineDebugInspectorIntegration::moveObject() QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled); QQmlEngineDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 2); + QCOMPARE(rootObject.children.size(), 2); int childId = rootObject.children[0].debugId; int requestId = m_inspectorClient->moveObject(childId, rootObject.children[1].debugId); @@ -186,12 +186,12 @@ void tst_QQmlEngineDebugInspectorIntegration::moveObject() rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 1); + QCOMPARE(rootObject.children.size(), 1); bool success = false; m_engineDebugClient->queryObject(rootObject.children[0], &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()))); - QCOMPARE(m_engineDebugClient->object().children.length(), 1); + QCOMPARE(m_engineDebugClient->object().children.size(), 1); QCOMPARE(m_engineDebugClient->object().children[0].debugId, childId); } @@ -202,7 +202,7 @@ void tst_QQmlEngineDebugInspectorIntegration::destroyObject() QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled); QQmlEngineDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 2); + QCOMPARE(rootObject.children.size(), 2); int requestId = m_inspectorClient->destroyObject(rootObject.children[0].debugId); QTRY_COMPARE(m_recipient->lastResponseId, requestId); @@ -210,12 +210,12 @@ void tst_QQmlEngineDebugInspectorIntegration::destroyObject() rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 1); + QCOMPARE(rootObject.children.size(), 1); bool success = false; m_engineDebugClient->queryObject(rootObject.children[0], &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()))); - QCOMPARE(m_engineDebugClient->object().children.length(), 0); + QCOMPARE(m_engineDebugClient->object().children.size(), 0); } QTEST_MAIN(tst_QQmlEngineDebugInspectorIntegration) diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp index 49fe5948d5..ffde808bb4 100644 --- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp @@ -171,14 +171,14 @@ QQmlEngineDebugObjectReference tst_QQmlEngineDebugService::findRootObject( QVERIFYOBJECT(success); QVERIFYOBJECT(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); - QVERIFYOBJECT(m_dbg->engines().count()); + QVERIFYOBJECT(m_dbg->engines().size()); m_dbg->queryRootContexts(m_dbg->engines()[0], &success); QVERIFYOBJECT(success); QVERIFYOBJECT(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); - QVERIFYOBJECT(m_dbg->rootContext().contexts.count()); - QVERIFYOBJECT(m_dbg->rootContext().contexts.last().objects.count()); - int count = m_dbg->rootContext().contexts.count(); + QVERIFYOBJECT(m_dbg->rootContext().contexts.size()); + QVERIFYOBJECT(m_dbg->rootContext().contexts.last().objects.size()); + int count = m_dbg->rootContext().contexts.size(); recursive ? m_dbg->queryObjectRecursive(m_dbg->rootContext().contexts[count - context - 1].objects[0], &success) : m_dbg->queryObject(m_dbg->rootContext().contexts[count - context - 1].objects[0], &success); @@ -210,7 +210,7 @@ void tst_QQmlEngineDebugService::recursiveObjectTest( qmlContext(o))); const QObjectList &children = o->children(); - for (int i=0; i<children.count(); i++) { + for (int i=0; i<children.size(); i++) { QObject *child = children[i]; if (!qmlContext(child)) continue; @@ -235,7 +235,7 @@ void tst_QQmlEngineDebugService::recursiveObjectTest( QCOMPARE(p.objectDebugId, QQmlDebugService::idForObject(o)); // signal properties are fake - they are generated from QQmlAbstractBoundSignal children - if (p.name.startsWith("on") && p.name.length() > 2 && p.name[2].isUpper()) { + if (p.name.startsWith("on") && p.name.size() > 2 && p.name[2].isUpper()) { QString signal = p.value.toString(); QQmlBoundSignalExpression *expr = QQmlPropertyPrivate::signalExpression(QQmlProperty(o, p.name)); QVERIFY(expr && expr->expression() == signal); @@ -299,7 +299,7 @@ void tst_QQmlEngineDebugService::getContexts() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); QList<QQmlEngineDebugEngineReference> engines = m_dbg->engines(); - QCOMPARE(engines.count(), 1); + QCOMPARE(engines.size(), 1); m_dbg->queryRootContexts(engines.first(), &success); QVERIFY(success); @@ -438,7 +438,7 @@ void tst_QQmlEngineDebugService::watch_property() m_rootItem->setProperty("width", origWidth*2); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant)))); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); m_dbg->removeWatch(id, &success); QVERIFY(success); @@ -448,7 +448,7 @@ void tst_QQmlEngineDebugService::watch_property() // restore original value and verify spy doesn't get additional signal since watch has been removed m_rootItem->setProperty("width", origWidth); QTest::qWait(100); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).value<QByteArray>(), prop.name.toUtf8()); QCOMPARE(spy.at(0).at(1).value<QVariant>(), QVariant::fromValue(origWidth*2)); @@ -486,11 +486,11 @@ void tst_QQmlEngineDebugService::watch_object() m_rootItem->setProperty("height", origHeight*2); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant)))); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); int newWidth = -1; int newHeight = -1; - for (int i=0; i<spy.count(); i++) { + for (int i=0; i<spy.size(); i++) { const QVariantList &values = spy[i]; if (values[0].value<QByteArray>() == "width") newWidth = values[1].value<QVariant>().toInt(); @@ -509,7 +509,7 @@ void tst_QQmlEngineDebugService::watch_object() m_rootItem->setProperty("width", origWidth); m_rootItem->setProperty("height", origHeight); QTest::qWait(100); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(newWidth, origWidth * 2); QCOMPARE(newHeight, origHeight * 2); @@ -562,10 +562,10 @@ void tst_QQmlEngineDebugService::watch_expression() // restore original value and verify spy doesn't get a signal since watch has been removed m_rootItem->setProperty("width", origWidth); QTest::qWait(100); - QCOMPARE(spy.count(), incrementCount); + QCOMPARE(spy.size(), incrementCount); width = origWidth + increment; - for (int i=0; i<spy.count(); i++) { + for (int i=0; i<spy.size(); i++) { width += increment; QCOMPARE(spy.at(i).at(1).value<QVariant>().toInt(), width); } @@ -614,7 +614,7 @@ void tst_QQmlEngineDebugService::queryAvailableEngines() // TODO test multiple engines QList<QQmlEngineDebugEngineReference> engines = m_dbg->engines(); - QCOMPARE(engines.count(), 1); + QCOMPARE(engines.size(), 1); foreach (const QQmlEngineDebugEngineReference &e, engines) { QCOMPARE(e.debugId, QQmlDebugService::idForObject(m_engine)); @@ -628,7 +628,7 @@ void tst_QQmlEngineDebugService::queryRootContexts() m_dbg->queryAvailableEngines(&success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); - QVERIFY(m_dbg->engines().count()); + QVERIFY(m_dbg->engines().size()); const QQmlEngineDebugEngineReference engine = m_dbg->engines()[0]; QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); @@ -647,8 +647,8 @@ void tst_QQmlEngineDebugService::queryRootContexts() // root context query sends only root object data - it doesn't fill in // the children or property info - QCOMPARE(context.objects.count(), 0); - QCOMPARE(context.contexts.count(), 8); + QCOMPARE(context.objects.size(), 0); + QCOMPARE(context.contexts.size(), 8); QVERIFY(context.contexts[0].debugId >= 0); QCOMPARE(context.contexts[0].name, QString("tst_QQmlDebug_childContext")); } @@ -686,7 +686,7 @@ void tst_QQmlEngineDebugService::queryObject() if (recursive) { foreach (const QQmlEngineDebugObjectReference &child, obj.children) { QVERIFY(!child.className.isEmpty()); - QVERIFY(child.properties.count() > 0); + QVERIFY(child.properties.size() > 0); } QQmlEngineDebugObjectReference rect; @@ -708,7 +708,7 @@ void tst_QQmlEngineDebugService::queryObject() } else { foreach (const QQmlEngineDebugObjectReference &child, obj.children) { QVERIFY(!child.className.isEmpty()); - QCOMPARE(child.properties.count(), 0); + QCOMPARE(child.properties.size(), 0); } } } @@ -749,7 +749,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); - QCOMPARE(m_dbg->objects().count(), 1); + QCOMPARE(m_dbg->objects().size(), 1); QQmlEngineDebugObjectReference obj = m_dbg->objects().first(); QVERIFY(!obj.className.isEmpty()); @@ -765,7 +765,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() if (recursive) { foreach (const QQmlEngineDebugObjectReference &child, obj.children) { QVERIFY(!child.className.isEmpty()); - QVERIFY(child.properties.count() > 0); + QVERIFY(child.properties.size() > 0); } QQmlEngineDebugObjectReference rect; @@ -789,7 +789,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() } else { foreach (const QQmlEngineDebugObjectReference &child, obj.children) { QVERIFY(!child.className.isEmpty()); - QCOMPARE(child.properties.count(), 0); + QCOMPARE(child.properties.size(), 0); } } } @@ -1134,7 +1134,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QQmlEngineDebugObjectReference obj = findRootObject(sourceIndex); QVERIFY(!obj.className.isEmpty()); QVERIFY(obj.debugId != -1); - QVERIFY(obj.children.count() >= 2); + QVERIFY(obj.children.size() >= 2); bool success; // We are going to switch state a couple of times, we need to get rid of the transition before m_dbg->queryExpressionResult(obj.debugId,QString("transitions = []"), &success); @@ -1166,7 +1166,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() // change the binding QQmlEngineDebugObjectReference state = obj.children[1]; QCOMPARE(state.className, QString("State")); - QVERIFY(state.children.count() > 0); + QVERIFY(state.children.size() > 0); QQmlEngineDebugObjectReference propertyChange = state.children[0]; QVERIFY(!propertyChange.className.isEmpty()); @@ -1250,12 +1250,12 @@ void tst_QQmlEngineDebugService::queryObjectTree() QQmlEngineDebugObjectReference obj = findRootObject(sourceIndex, true); QVERIFY(!obj.className.isEmpty()); QVERIFY(obj.debugId != -1); - QVERIFY(obj.children.count() >= 2); + QVERIFY(obj.children.size() >= 2); // check state QQmlEngineDebugObjectReference state = obj.children[1]; QCOMPARE(state.className, QString("State")); - QVERIFY(state.children.count() > 0); + QVERIFY(state.children.size() > 0); QQmlEngineDebugObjectReference propertyChange = state.children[0]; QVERIFY(!propertyChange.className.isEmpty()); @@ -1274,7 +1274,7 @@ void tst_QQmlEngineDebugService::queryObjectTree() QCOMPARE(transition.className, QString("Transition")); QCOMPARE(findProperty(transition.properties,"from").value.toString(), QString("*")); QCOMPARE(findProperty(transition.properties,"to").value, findProperty(state.properties,"name").value); - QVERIFY(transition.children.count() > 0); + QVERIFY(transition.children.size() > 0); QQmlEngineDebugObjectReference animation = transition.children[0]; QVERIFY(!animation.className.isEmpty()); @@ -1321,18 +1321,18 @@ void tst_QQmlEngineDebugService::asynchronousCreate() { void tst_QQmlEngineDebugService::invalidContexts() { getContexts(); - const int base = m_dbg->rootContext().contexts.count(); + const int base = m_dbg->rootContext().contexts.size(); QQmlContext context(m_engine); getContexts(); - QCOMPARE(m_dbg->rootContext().contexts.count(), base + 1); + QCOMPARE(m_dbg->rootContext().contexts.size(), base + 1); QQmlRefPointer<QQmlContextData> contextData = QQmlContextData::get(&context); contextData->invalidate(); getContexts(); - QCOMPARE(m_dbg->rootContext().contexts.count(), base); + QCOMPARE(m_dbg->rootContext().contexts.size(), base); QQmlRefPointer<QQmlContextData> rootData = QQmlContextData::get(m_engine->rootContext()); rootData->invalidate(); getContexts(); - QCOMPARE(m_dbg->rootContext().contexts.count(), 0); + QCOMPARE(m_dbg->rootContext().contexts.size(), 0); } void tst_QQmlEngineDebugService::createObjectOnDestruction() @@ -1351,11 +1351,11 @@ void tst_QQmlEngineDebugService::createObjectOnDestruction() "}", QUrl::fromLocalFile("x.qml")); QVERIFY(component.isReady()); QVERIFY(component.create()); - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE(spy.size(), 2); } // Doesn't crash and doesn't give us another signal for the object created on destruction. QTest::qWait(500); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QQmlEngineDebugService::debuggerCrashOnAttach() { diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp index f389fb8f9f..897d8c8688 100644 --- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp +++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp @@ -64,7 +64,7 @@ void tst_QQmlInspector::checkAnimationSpeed(int targetMillisPerDegree) for (int i = 0; i < 10; ++i) { QString output = m_process->output(); - int position = output.length(); + int position = output.size(); do { QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); output = m_process->output(); diff --git a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp index 90ababb67e..0c4fd568a9 100644 --- a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp +++ b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp @@ -266,14 +266,14 @@ void tst_QQmlPreview::error() QCOMPARE(startQmlProcess("window.qml"), ConnectSuccess); QVERIFY(m_client); m_client->triggerLoad(testFileUrl("broken.qml")); - QTRY_COMPARE_WITH_TIMEOUT(m_serviceErrors.count(), 1, 10000); + QTRY_COMPARE_WITH_TIMEOUT(m_serviceErrors.size(), 1, 10000); QVERIFY(m_serviceErrors.first().contains("broken.qml:7 Expected token `}'")); } static float parseZoomFactor(const QString &output) { const QString prefix("zoom "); - const int start = output.lastIndexOf(prefix) + prefix.length(); + const int start = output.lastIndexOf(prefix) + prefix.size(); if (start < 0) return -1; const int end = output.indexOf('\n', start); diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index ce92728ee4..67ff637004 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -52,20 +52,20 @@ private: void QQmlProfilerTestClient::startTrace(qint64 timestamp, const QList<int> &engineIds) { types.append(QQmlProfilerEventType(Event, MaximumRangeType, StartTrace)); - asynchronousMessages.append(QQmlProfilerEvent(timestamp, types.length() - 1, + asynchronousMessages.append(QQmlProfilerEvent(timestamp, types.size() - 1, engineIds.toVector())); } void QQmlProfilerTestClient::endTrace(qint64 timestamp, const QList<int> &engineIds) { types.append(QQmlProfilerEventType(Event, MaximumRangeType, EndTrace)); - asynchronousMessages.append(QQmlProfilerEvent(timestamp, types.length() - 1, + asynchronousMessages.append(QQmlProfilerEvent(timestamp, types.size() - 1, engineIds.toVector())); } int QQmlProfilerTestClient::numLoadedEventTypes() const { - return types.length(); + return types.size(); } void QQmlProfilerTestClient::addEventType(const QQmlProfilerEventType &type) @@ -76,7 +76,7 @@ void QQmlProfilerTestClient::addEventType(const QQmlProfilerEventType &type) void QQmlProfilerTestClient::addEvent(const QQmlProfilerEvent &event) { const int typeIndex = event.typeIndex(); - QVERIFY(typeIndex < types.length()); + QVERIFY(typeIndex < types.size()); const QQmlProfilerEventType &type = types[typeIndex]; @@ -272,14 +272,14 @@ void tst_QQmlProfilerService::checkTraceReceived() // must end with "EndTrace" expected = QQmlProfilerEventType(Event, MaximumRangeType, EndTrace); - VERIFY(MessageListAsynchronous, m_client->asynchronousMessages.length() - 1, expected, + VERIFY(MessageListAsynchronous, m_client->asynchronousMessages.size() - 1, expected, CheckMessageType | CheckDetailType, numbers); } void tst_QQmlProfilerService::checkJsHeap() { QVERIFY(m_client); - QVERIFY2(m_client->jsHeapMessages.count() > 0, "no JavaScript heap messages received"); + QVERIFY2(m_client->jsHeapMessages.size() > 0, "no JavaScript heap messages received"); bool seen_alloc = false; bool seen_small = false; @@ -357,9 +357,9 @@ bool tst_QQmlProfilerService::verify(tst_QQmlProfilerService::MessageListType ty return false; } - if (target->length() <= expectedPosition) { + if (target->size() <= expectedPosition) { qWarning() << "Not enough events. expected position:" << expectedPosition - << "length:" << target->length(); + << "length:" << target->size(); return false; } @@ -438,7 +438,7 @@ bool tst_QQmlProfilerService::verify(tst_QQmlProfilerService::MessageListType ty } return true; - } while (++position < target->length() && target->at(position).timestamp() == timestamp); + } while (++position < target->size() && target->at(position).timestamp() == timestamp); foreach (const QString &message, warnings) qWarning() << message.toLocal8Bit().constData(); @@ -467,32 +467,32 @@ void tst_QQmlProfilerService::cleanup() }; if (m_client && QTest::currentTestFailed()) { - qDebug() << "QML Messages:" << m_client->qmlMessages.count(); + qDebug() << "QML Messages:" << m_client->qmlMessages.size(); int i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->qmlMessages)) log(data, i++); qDebug() << " "; - qDebug() << "JavaScript Messages:" << m_client->javascriptMessages.count(); + qDebug() << "JavaScript Messages:" << m_client->javascriptMessages.size(); i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->javascriptMessages)) log(data, i++); qDebug() << " "; - qDebug() << "Asynchronous Messages:" << m_client->asynchronousMessages.count(); + qDebug() << "Asynchronous Messages:" << m_client->asynchronousMessages.size(); i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->asynchronousMessages)) log(data, i++); qDebug() << " "; - qDebug() << "Pixmap Cache Messages:" << m_client->pixmapMessages.count(); + qDebug() << "Pixmap Cache Messages:" << m_client->pixmapMessages.size(); i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->pixmapMessages)) log(data, i++); qDebug() << " "; - qDebug() << "Javascript Heap Messages:" << m_client->jsHeapMessages.count(); + qDebug() << "Javascript Heap Messages:" << m_client->jsHeapMessages.size(); i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->jsHeapMessages)) log(data, i++); @@ -677,9 +677,9 @@ void tst_QQmlProfilerService::flushInterval() QCOMPARE(connectTo(true, "timer.qml", true, 1), ConnectSuccess); // Make sure we get multiple messages - QTRY_VERIFY(m_client->qmlMessages.length() > 0); - QVERIFY(m_client->qmlMessages.length() < 100); - QTRY_VERIFY(m_client->qmlMessages.length() > 100); + QTRY_VERIFY(m_client->qmlMessages.size() > 0); + QVERIFY(m_client->qmlMessages.size() < 100); + QTRY_VERIFY(m_client->qmlMessages.size() > 100); m_client->client->setRecording(false); checkTraceReceived(); @@ -783,7 +783,7 @@ void tst_QQmlProfilerService::multiEngine() QTRY_COMPARE(m_process->state(), QProcess::NotRunning); QCOMPARE(m_process->exitStatus(), QProcess::NormalExit); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQmlProfilerService::batchOverflow() diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp index d7a79f446b..cdb7b1dee0 100644 --- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp @@ -370,7 +370,7 @@ void tst_qv4debugger::pendingBreakpoint() debugger()->addBreakPoint("testfile", 2); evaluateJavaScript(script, "testfile"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 1); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("testfile")); QCOMPARE(state.lineNumber, 2); @@ -386,7 +386,7 @@ void tst_qv4debugger::liveBreakPoint() debugger()->pause(); evaluateJavaScript(script, "liveBreakPoint"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 2); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 2); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(1); QCOMPARE(state.fileName, QString("liveBreakPoint")); QCOMPARE(state.lineNumber, 3); @@ -414,7 +414,7 @@ void tst_qv4debugger::addBreakPointWhilePaused() m_debuggerAgent->m_breakPointsToAddWhenPaused << TestAgent::TestBreakPoint("addBreakPointWhilePaused", 2); evaluateJavaScript(script, "addBreakPointWhilePaused"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 2); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 2); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(0); QCOMPARE(state.fileName, QString("addBreakPointWhilePaused")); @@ -461,7 +461,7 @@ void tst_qv4debugger::conditionalBreakPoint() debugger()->addBreakPoint("conditionalBreakPoint", 3, QStringLiteral("i > 10")); evaluateJavaScript(script, "conditionalBreakPoint"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 4); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 4); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("conditionalBreakPoint")); QCOMPARE(state.lineNumber, 3); @@ -495,7 +495,7 @@ void tst_qv4debugger::conditionalBreakPointInQml() QScopedPointer<QObject> obj(component.create()); QCOMPARE(obj->property("success").toBool(), true); - QCOMPARE(debuggerAgent->m_statesWhenPaused.count(), 1); + QCOMPARE(debuggerAgent->m_statesWhenPaused.size(), 1); QCOMPARE(debuggerAgent->m_statesWhenPaused.at(0).fileName, qmlFileName); QCOMPARE(debuggerAgent->m_statesWhenPaused.at(0).lineNumber, 7); @@ -699,7 +699,7 @@ void tst_qv4debugger::breakInCatch() evaluateJavaScript(script, "breakInCatch"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::BreakPointHit); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 1); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("breakInCatch")); QCOMPARE(state.lineNumber, 4); @@ -716,7 +716,7 @@ void tst_qv4debugger::breakInWith() evaluateJavaScript(script, "breakInWith"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::BreakPointHit); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 1); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("breakInWith")); QCOMPARE(state.lineNumber, 2); @@ -752,7 +752,7 @@ void tst_qv4debugger::evaluateExpression() evaluateJavaScript(script, "evaluateExpression"); - QCOMPARE(m_debuggerAgent->m_expressionResults.count(), 4); + QCOMPARE(m_debuggerAgent->m_expressionResults.size(), 4); QJsonObject result0 = m_debuggerAgent->m_expressionResults[0]; QCOMPARE(result0.value("type").toString(), QStringLiteral("number")); QCOMPARE(result0.value("value").toInt(), 10); @@ -776,7 +776,7 @@ void tst_qv4debugger::stepToEndOfScript() evaluateJavaScript(script, "toEnd"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::Step); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 5); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 5); for (int i = 0; i < 4; ++i) { QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(i); QCOMPARE(state.fileName, QString("toEnd")); @@ -846,7 +846,7 @@ void tst_qv4debugger::lastLineOfConditional() evaluateJavaScript(script, "trueBranch"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::Step); - QVERIFY(m_debuggerAgent->m_statesWhenPaused.count() > 1); + QVERIFY(m_debuggerAgent->m_statesWhenPaused.size() > 1); QV4Debugger::ExecutionState firstState = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(firstState.fileName, QString("trueBranch")); QCOMPARE(firstState.lineNumber, breakPoint); @@ -873,7 +873,7 @@ void tst_qv4debugger::readThis() evaluateJavaScript(script, "applyThis"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_expressionResults.count(), 1); + QCOMPARE(m_debuggerAgent->m_expressionResults.size(), 1); QJsonObject result0 = m_debuggerAgent->m_expressionResults[0]; QCOMPARE(result0.value("type").toString(), QStringLiteral("object")); QCOMPARE(result0.value("value").toInt(), 1); diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp index bc15af706d..bce2c28378 100644 --- a/tests/auto/qml/debugger/shared/debugutil.cpp +++ b/tests/auto/qml/debugger/shared/debugutil.cpp @@ -20,7 +20,7 @@ bool QQmlDebugTest::waitForSignal(QObject *sender, const char *member, int timeo QSignalSpy spy(sender, member); // Do not use spy.wait(). We want to avoid nested event loops. - if (QTest::qWaitFor([&]() { return spy.count() > 0; }, timeout)) + if (QTest::qWaitFor([&]() { return spy.size() > 0; }, timeout)) return true; qWarning("waitForSignal %s timed out after %d ms", member, timeout); @@ -132,7 +132,7 @@ QQmlDebugTest::ConnectResult QQmlDebugTest::connectTo( QSignalSpy okSpy(&stateHandler, &ClientStateHandler::allOk); QSignalSpy disconnectSpy(m_connection, &QQmlDebugConnection::disconnected); m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort()); - if (!QTest::qWaitFor([&](){ return okSpy.count() > 0 || disconnectSpy.count() > 0; }, 5000)) + if (!QTest::qWaitFor([&](){ return okSpy.size() > 0 || disconnectSpy.size() > 0; }, 5000)) return ConnectionTimeout; if (!stateHandler.allEnabled()) @@ -231,7 +231,7 @@ QString debugJsServerPath(const QString &selfPath) static const char *debugserver = "qqmldebugjsserver"; QString appPath = QCoreApplication::applicationDirPath(); const int position = appPath.lastIndexOf(selfPath); - return (position == -1 ? appPath : appPath.replace(position, selfPath.length(), debugserver)) + return (position == -1 ? appPath : appPath.replace(position, selfPath.size(), debugserver)) + "/" + debugserver; } diff --git a/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp b/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp index 3963e9aa48..aeeadff16a 100644 --- a/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp +++ b/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp @@ -207,7 +207,7 @@ bool Test262Runner::loadTests() QString harness = "harness"; QString intl402 = "intl402"; - int pathlen = dir.path().length() + 1; + int pathlen = dir.path().size() + 1; QDirIterator it(dir, QDirIterator::Subdirectories); while (it.hasNext()) { QString file = it.next().mid(pathlen); @@ -494,7 +494,7 @@ static bool executeTest(const QByteArray &data, bool runAsModule = false, const QFile f(url.toLocalFile()); if (f.open(QIODevice::ReadOnly)) { QByteArray content = harnessForModules + f.readAll(); - module = vm.compileModule(url.toString(), QString::fromUtf8(content.constData(), content.length()), QFileInfo(f).lastModified()); + module = vm.compileModule(url.toString(), QString::fromUtf8(content.constData(), content.size()), QFileInfo(f).lastModified()); if (vm.hasException) break; vm.injectModule(module); @@ -726,7 +726,7 @@ YamlSection::YamlSection(const QByteArray &yaml, const char *sectionName) start += static_cast<int>(strlen(sectionName)); int end = yaml.indexOf('\n', start + 1); if (end < 0) - end = yaml.length(); + end = yaml.size(); int s = yaml.indexOf('[', start); if (s > 0 && s < end) { diff --git a/tests/auto/qml/parserstress/tst_parserstress.cpp b/tests/auto/qml/parserstress/tst_parserstress.cpp index 7fb2787d31..99af0247a8 100644 --- a/tests/auto/qml/parserstress/tst_parserstress.cpp +++ b/tests/auto/qml/parserstress/tst_parserstress.cpp @@ -126,7 +126,7 @@ void tst_parserstress::ecmascript() if (fileInfo.fileName() == QLatin1String("regress-352044-02-n.js")) { QVERIFY(component.isError()); - QCOMPARE(component.errors().length(), 2); + QCOMPARE(component.errors().size(), 2); QCOMPARE(component.errors().at(0).description(), QString("Expected token `;'")); QCOMPARE(component.errors().at(0).line(), 66); diff --git a/tests/auto/qml/qjsmanagedvalue/tst_qjsmanagedvalue.cpp b/tests/auto/qml/qjsmanagedvalue/tst_qjsmanagedvalue.cpp index 568b14b5ac..6723926585 100644 --- a/tests/auto/qml/qjsmanagedvalue/tst_qjsmanagedvalue.cpp +++ b/tests/auto/qml/qjsmanagedvalue/tst_qjsmanagedvalue.cpp @@ -1742,7 +1742,7 @@ void tst_QJSManagedValue::stringByIndex() const QString testString = QStringLiteral("foobar"); QJSManagedValue str(testString, &engine); - for (uint i = 0; i < testString.length(); ++i) { + for (uint i = 0; i < testString.size(); ++i) { QVERIFY(str.hasOwnProperty(i)); QVERIFY(str.hasProperty(i)); diff --git a/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp b/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp index 339a524604..e329cf948f 100644 --- a/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp +++ b/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp @@ -95,7 +95,7 @@ void tst_QJSValueIterator::iterateForward() QCOMPARE(it.hasNext(), false); it = object; - for (int i = 0; i < lst.count(); ++i) { + for (int i = 0; i < lst.size(); ++i) { QCOMPARE(it.hasNext(), true); it.next(); QCOMPARE(it.name(), lst.at(i)); diff --git a/tests/auto/qml/qmlcppcodegen/data/birthdayparty.cpp b/tests/auto/qml/qmlcppcodegen/data/birthdayparty.cpp index 4ba76d882d..048459f03a 100644 --- a/tests/auto/qml/qmlcppcodegen/data/birthdayparty.cpp +++ b/tests/auto/qml/qmlcppcodegen/data/birthdayparty.cpp @@ -28,7 +28,7 @@ QQmlListProperty<Person> BirthdayParty::guests() int BirthdayParty::guestCount() const { - return m_guests.count(); + return m_guests.size(); } Person *BirthdayParty::guest(int index) const diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp index dc4b66e8f9..19a6731ff7 100644 --- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp +++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp @@ -697,7 +697,7 @@ void tst_qmldiskcache::cacheResources() } const QSet<QString> entries = entrySet(m_qmlCacheDirectory).subtract(existingFiles); - QCOMPARE(entries.count(), 1); + QCOMPARE(entries.size(), 1); QDateTime cacheFileTimeStamp; @@ -726,7 +726,7 @@ void tst_qmldiskcache::cacheResources() { const QSet<QString> entries = entrySet(m_qmlCacheDirectory).subtract(existingFiles); - QCOMPARE(entries.count(), 1); + QCOMPARE(entries.size(), 1); QCOMPARE(QFileInfo(m_qmlCacheDirectory.absoluteFilePath(*entries.cbegin())).lastModified().toMSecsSinceEpoch(), cacheFileTimeStamp.toMSecsSinceEpoch()); @@ -972,7 +972,7 @@ void tst_qmldiskcache::cacheModuleScripts() const QSet<QString> entries = entrySet(m_qmlCacheDirectory, QStringList("*.mjsc")); - QCOMPARE(entries.count(), 1); + QCOMPARE(entries.size(), 1); QDateTime cacheFileTimeStamp; diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp index 9d7beb23a7..e95673221a 100644 --- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp +++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp @@ -147,7 +147,7 @@ void TestQmlformat::initTestCase() QStringList TestQmlformat::findFiles(const QDir &d) { - for (int ii = 0; ii < m_excludedDirs.count(); ++ii) { + for (int ii = 0; ii < m_excludedDirs.size(); ++ii) { QString s = m_excludedDirs.at(ii); if (d.absolutePath().endsWith(s)) return QStringList(); diff --git a/tests/auto/qml/qmltc/tst_qmltc.cpp b/tests/auto/qml/qmltc/tst_qmltc.cpp index 97486bc418..f958b1880b 100644 --- a/tests/auto/qml/qmltc/tst_qmltc.cpp +++ b/tests/auto/qml/qmltc/tst_qmltc.cpp @@ -1053,8 +1053,8 @@ void tst_qmltc::propertyAlias_external() QSignalSpy heightAliasChangedSpy(&created, &PREPEND_NAMESPACE(propertyAlias_external)::heightAliasChanged); created.setHeight(10); QCOMPARE(created.heightAlias(), 10); - QCOMPARE(heightChangedSpy.count(), 1); - QCOMPARE(heightAliasChangedSpy.count(), 1); + QCOMPARE(heightChangedSpy.size(), 1); + QCOMPARE(heightAliasChangedSpy.size(), 1); } // TODO: we need to support RESET in aliases as well? (does it make sense?) @@ -1139,15 +1139,15 @@ void tst_qmltc::complexAliases() created.setAFont(newFont); QCOMPARE(created.aFont(), newFont); QCOMPARE(created.aFont(), theText->property("font").value<QFont>()); - QCOMPARE(aFontSpy.count(), 1); + QCOMPARE(aFontSpy.size(), 1); newFont.setStyle(QFont::StyleOblique); theText->setProperty("font", newFont); QCOMPARE(theText->property("font").value<QFont>(), newFont); QCOMPARE(created.aFont(), theText->property("font").value<QFont>()); - QCOMPARE(aFontSpy.count(), 2); + QCOMPARE(aFontSpy.size(), 2); created.setAWordSpacing(1); - QCOMPARE(aFontSpy.count(), 3); + QCOMPARE(aFontSpy.size(), 3); // aliasToObjectAlias: QCOMPARE(created.aliasToObjectAlias(), created.aRectObject()); @@ -1182,12 +1182,12 @@ void tst_qmltc::complexAliases() QCOMPARE(created.aliasToValueTypeAlias(), newFont); QCOMPARE(created.aliasToValueTypeAlias(), created.aFont()); QCOMPARE(created.aliasToValueTypeAlias(), theText->property("font").value<QFont>()); - QCOMPARE(aFontSpy.count(), 4); - QCOMPARE(aliasToValueTypeAliasSpy.count(), 1); + QCOMPARE(aFontSpy.size(), 4); + QCOMPARE(aliasToValueTypeAliasSpy.size(), 1); newFont.setPixelSize(12); created.setAFont(newFont); - QCOMPARE(aFontSpy.count(), 5); - QCOMPARE(aliasToValueTypeAliasSpy.count(), 2); + QCOMPARE(aFontSpy.size(), 5); + QCOMPARE(aliasToValueTypeAliasSpy.size(), 2); QCOMPARE(created.aliasToValueTypeAlias(), created.aFont()); QCOMPARE(created.aliasToValueTypeAlias(), theText->property("font").value<QFont>()); @@ -1196,8 +1196,8 @@ void tst_qmltc::complexAliases() created.setAliasToPropertyOfValueTypeAlias(3); QCOMPARE(created.aliasToPropertyOfValueTypeAlias(), created.aFont().pixelSize()); QCOMPARE(created.aFont(), theText->property("font").value<QFont>()); - QCOMPARE(aFontSpy.count(), 6); - QCOMPARE(aliasToValueTypeAliasSpy.count(), 3); + QCOMPARE(aFontSpy.size(), 6); + QCOMPARE(aliasToValueTypeAliasSpy.size(), 3); // aliasToImportedMessage: QCOMPARE(created.aliasToImportedMessage(), localImport->property("message").toString()); @@ -1235,7 +1235,7 @@ void tst_qmltc::complexAliases() newPalette->fromQPalette(QPalette(QColor(u"cyan"_s))); QCOMPARE(newPalette->button(), QColor(u"cyan"_s)); created.setAliasToPrivatePalette(newPalette); - QCOMPARE(paletteChangedSpy.count(), 1); + QCOMPARE(paletteChangedSpy.size(), 1); QCOMPARE(QQuickItemPrivate::get(theRect)->palette()->button(), QColor(u"cyan"_s)); QCOMPARE(created.aliasToPrivatePalette(), QQuickItemPrivate::get(theRect)->palette()); @@ -1317,9 +1317,9 @@ void tst_qmltc::componentHelloWorld() QCOMPARE(created->hello(), QStringLiteral("Hello, World!")); QSignalSpy onDestroySpy(created.get(), &PREPEND_NAMESPACE(ComponentHelloWorld)::sDestroying); - QCOMPARE(onDestroySpy.count(), 0); + QCOMPARE(onDestroySpy.size(), 0); created.reset(); - QCOMPARE(onDestroySpy.count(), 1); + QCOMPARE(onDestroySpy.size(), 1); } void tst_qmltc::propertyReturningFunction() @@ -2092,7 +2092,7 @@ void tst_qmltc::calqlatrBits() QSignalSpy scaleChangedSpy(textItem, &QQuickItem::scaleChanged); controller->completeToBeginning(); - QTRY_VERIFY(scaleChangedSpy.count() > 0); + QTRY_VERIFY(scaleChangedSpy.size() > 0); } void tst_qmltc::trickyPropertyChangeAndSignalHandlers() diff --git a/tests/auto/qml/qqmlapplicationengine/androidassets/tst_androidassets.cpp b/tests/auto/qml/qqmlapplicationengine/androidassets/tst_androidassets.cpp index 4ba7deb98e..7a6774c268 100644 --- a/tests/auto/qml/qqmlapplicationengine/androidassets/tst_androidassets.cpp +++ b/tests/auto/qml/qqmlapplicationengine/androidassets/tst_androidassets.cpp @@ -41,7 +41,7 @@ void tst_AndroidAssets::loadsFromAssetsPath() // load QML file from assets, by path: engine.load(pathPrefix() + QStringLiteral("/qml/main.qml")); - QTRY_VERIFY(engine.rootObjects().length() == 1); + QTRY_VERIFY(engine.rootObjects().size() == 1); QVERIFY(failureSpy.isEmpty()); } @@ -52,7 +52,7 @@ void tst_AndroidAssets::loadsFromAssetsUrl() // load QML file from assets, by URL: engine.load(QUrl(urlPrefix() + QStringLiteral("/qml/main.qml"))); - QTRY_VERIFY(engine.rootObjects().length() == 1); + QTRY_VERIFY(engine.rootObjects().size() == 1); QVERIFY(failureSpy.isEmpty()); } diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp index 43f7296d4f..d0f580cf5f 100644 --- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp @@ -57,14 +57,14 @@ void tst_qqmlapplicationengine::basicLoading() QSignalSpy objectCreated(test, SIGNAL(objectCreated(QObject*,QUrl))); test->load(testFileUrl("basicTest.qml")); - QCOMPARE(objectCreated.count(), size);//one less than rootObjects().size() because we missed the first one + QCOMPARE(objectCreated.size(), size);//one less than rootObjects().size() because we missed the first one QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); QByteArray testQml("import QtQml 2.0; QtObject{property bool success: true; property TestItem t: TestItem{}}"); test->loadData(testQml, testFileUrl("dynamicTest.qml")); - QCOMPARE(objectCreated.count(), size); + QCOMPARE(objectCreated.size(), size); QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); @@ -215,10 +215,10 @@ void tst_qqmlapplicationengine::applicationProperties() QCoreApplication::setOrganizationName(originalOrganization); QCoreApplication::setOrganizationDomain(originalDomain); - QCOMPARE(nameChanged.count(), 1); - QCOMPARE(versionChanged.count(), 1); - QCOMPARE(organizationChanged.count(), 1); - QCOMPARE(domainChanged.count(), 1); + QCOMPARE(nameChanged.size(), 1); + QCOMPARE(versionChanged.size(), 1); + QCOMPARE(organizationChanged.size(), 1); + QCOMPARE(domainChanged.size(), 1); delete test; } @@ -230,12 +230,12 @@ void tst_qqmlapplicationengine::removeObjectsWhenDestroyed() QSignalSpy objectCreated(test.data(), SIGNAL(objectCreated(QObject*,QUrl))); test->load(testFileUrl("basicTest.qml")); - QCOMPARE(objectCreated.count(), 1); + QCOMPARE(objectCreated.size(), 1); QSignalSpy objectDestroyed(test->rootObjects().first(), SIGNAL(destroyed())); test->rootObjects().first()->deleteLater(); objectDestroyed.wait(); - QCOMPARE(objectDestroyed.count(), 1); + QCOMPARE(objectDestroyed.size(), 1); QCOMPARE(test->rootObjects().size(), 0); } @@ -315,7 +315,7 @@ void tst_qqmlapplicationengine::failureToLoadTriggersWarningSignal() QQmlApplicationEngine test; QSignalSpy warningObserver(&test, &QQmlApplicationEngine::warnings); test.load(url); - QTRY_COMPARE(warningObserver.count(), 1); + QTRY_COMPARE(warningObserver.size(), 1); } void tst_qqmlapplicationengine::errorWhileCreating() @@ -330,8 +330,8 @@ void tst_qqmlapplicationengine::errorWhileCreating() test.load(url); - QTRY_COMPARE(observer.count(), 1); - QCOMPARE(failureObserver.count(), 1); + QTRY_COMPARE(observer.size(), 1); + QCOMPARE(failureObserver.size(), 1); QCOMPARE(failureObserver.first().first(), url); QList<QVariant> args = observer.takeFirst(); QVERIFY(args.at(0).isNull()); diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp index 53a8c49e94..faa64ddac5 100644 --- a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp +++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp @@ -309,7 +309,7 @@ void tst_qqmlbinding::warningOnUnknownProperty() QScopedPointer<QQuickItem> item { qobject_cast<QQuickItem *>(c.create()) }; QVERIFY(item); - QCOMPARE(messageHandler.messages().count(), 1); + QCOMPARE(messageHandler.messages().size(), 1); const QString expectedMessage = c.url().toString() + QLatin1String(":6:5: QML Binding: Property 'unknown' does not exist on Item."); QCOMPARE(messageHandler.messages().first(), expectedMessage); @@ -324,7 +324,7 @@ void tst_qqmlbinding::warningOnReadOnlyProperty() QScopedPointer<QQuickItem> item { qobject_cast<QQuickItem *>(c.create()) }; QVERIFY(item); - QCOMPARE(messageHandler.messages().count(), 1); + QCOMPARE(messageHandler.messages().size(), 1); const QString expectedMessage = c.url().toString() + QLatin1String(":8:5: QML Binding: Property 'name' on Item is read-only."); QCOMPARE(messageHandler.messages().first(), expectedMessage); @@ -339,7 +339,7 @@ void tst_qqmlbinding::disabledOnUnknownProperty() QScopedPointer<QQuickItem> item { qobject_cast<QQuickItem *>(c.create()) }; QVERIFY(item); - QCOMPARE(messageHandler.messages().count(), 0); + QCOMPARE(messageHandler.messages().size(), 0); } void tst_qqmlbinding::disabledOnReadonlyProperty() @@ -350,7 +350,7 @@ void tst_qqmlbinding::disabledOnReadonlyProperty() QQmlComponent c(&engine, testFileUrl("disabledReadonly.qml")); QScopedPointer<QQuickItem> item { qobject_cast<QQuickItem *>(c.create()) }; QVERIFY(item); - QCOMPARE(messageHandler.messages().count(), 0); + QCOMPARE(messageHandler.messages().size(), 0); } void tst_qqmlbinding::delayed() @@ -447,7 +447,7 @@ void tst_qqmlbinding::bindingOverwriting() QVERIFY(item); QLoggingCategory::setFilterRules(QString()); - QCOMPARE(messageHandler.messages().count(), 2); + QCOMPARE(messageHandler.messages().size(), 2); } void tst_qqmlbinding::bindToQmlComponent() diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index c15fdf0323..cf3894ccbb 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -162,7 +162,7 @@ void tst_qqmlcomponent::loadEmptyUrl() c.loadUrl(QUrl()); QVERIFY(c.isError()); - QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().size(), 1); QQmlError error = c.errors().first(); QCOMPARE(error.url(), QUrl()); QCOMPARE(error.line(), -1); @@ -338,7 +338,7 @@ void tst_qqmlcomponent::qmlCreateObjectDirty() QQmlEngine engine; engine.setOutputWarningsToStandardError(false); QObject::connect(&engine, &QQmlEngine::warnings, [](const QList<QQmlError> &warnings) { - QCOMPARE(warnings.count(), 1); + QCOMPARE(warnings.size(), 1); QCOMPARE(warnings[0].description(), "QML Component: Unsuitable arguments passed to createObject(). The first argument " "should be a QObject* or null, and the second argument should be a JavaScript " @@ -556,7 +556,7 @@ void tst_qqmlcomponent::onDestructionCount() engine.setOutputWarningsToStandardError(false); QCOMPARE(engine.outputWarningsToStandardError(), false); - QCOMPARE(warnings.count(), 0); + QCOMPARE(warnings.size(), 0); } void tst_qqmlcomponent::recursion() @@ -1095,7 +1095,7 @@ void tst_qqmlcomponent::qmlPropertySignalExists() QSignalSpy changeSignalSpy(o.get(), SIGNAL(pChanged())); QVERIFY(QMetaObject::invokeMethod(o.get(), "doStuff")); - QCOMPARE(changeSignalSpy.count(), 1); + QCOMPARE(changeSignalSpy.size(), 1); QCOMPARE(o->property("p").toInt(), 42); } diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index f203bd1800..dfc01df241 100644 --- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -227,7 +227,7 @@ void tst_qqmlconnections::errors() QQmlComponent c(&engine, url); QVERIFY(c.isError()); QList<QQmlError> errors = c.errors(); - QCOMPARE(errors.count(), 1); + QCOMPARE(errors.size(), 1); QCOMPARE(errors.at(0).description(), error); } diff --git a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp index 1737d1eaeb..11d79707d0 100644 --- a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp +++ b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp @@ -58,7 +58,7 @@ void tst_qqmlcpputils::fastConnect() qmlobject_connect(obj, MyObject, SIGNAL(signal1()), obj, MyObject, SIGNAL(signal2())); obj->signal1(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); delete obj; } diff --git a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp index 491324fa57..ca66ddb618 100644 --- a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp +++ b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp @@ -56,7 +56,7 @@ public: if (parent.isValid()) return 0; - return mValues.count(); + return mValues.size(); } int columnCount(const QModelIndex &parent) const override @@ -187,15 +187,15 @@ void tst_QQmlDelegateModel::nestedDelegates() QScopedPointer<QObject> o(c.create()); QQuickItem *item = qobject_cast<QQuickItem *>(o.data()); - QCOMPARE(item->childItems().length(), 2); + QCOMPARE(item->childItems().size(), 2); for (QQuickItem *child : item->childItems()) { if (child->objectName() != QLatin1String("loader")) continue; - QCOMPARE(child->childItems().length(), 1); + QCOMPARE(child->childItems().size(), 1); QQuickItem *timeMarks = child->childItems().at(0); const QList<QQuickItem *> children = timeMarks->childItems(); - QCOMPARE(children.length(), 2); + QCOMPARE(children.size(), 2); // One of them is the repeater, the other one is the rectangle QVERIFY(children.at(0)->objectName() == QLatin1String("zap") diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index cb2dd9373a..0b26979c4d 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -401,7 +401,7 @@ void QObjectContainer::children_append(QQmlListProperty<QObject> *prop, QObject qsizetype QObjectContainer::children_count(QQmlListProperty<QObject> *prop) { - return static_cast<QObjectContainer*>(prop->object)->dataChildren.count(); + return static_cast<QObjectContainer*>(prop->object)->dataChildren.size(); } QObject *QObjectContainer::children_at(QQmlListProperty<QObject> *prop, qsizetype index) diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 53c521e167..0a7ef4add0 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -2290,9 +2290,9 @@ void tst_qqmlecmascript::scriptErrors() QQmlComponent component(&engine, testFileUrl("scriptErrors.qml")); QString url = component.url().toString(); - QString warning1 = url.left(url.length() - 3) + "js:2: Error: Invalid write to global property \"a\""; + QString warning1 = url.left(url.size() - 3) + "js:2: Error: Invalid write to global property \"a\""; QString warning2 = url + ":5: ReferenceError: a is not defined"; - QString warning3 = url.left(url.length() - 3) + "js:4: Error: Invalid write to global property \"a\""; + QString warning3 = url.left(url.size() - 3) + "js:4: Error: Invalid write to global property \"a\""; QString warning4 = url + ":13: ReferenceError: a is not defined"; QString warning5 = url + ":11: ReferenceError: a is not defined"; QString warning6 = url + ":10:5: Unable to assign [undefined] to int"; @@ -2854,26 +2854,26 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_ERROR("object.method_nonexistent()")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_nonexistent(10, 11)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); // Insufficient arguments o->reset(); QVERIFY(EVALUATE_ERROR("object.method_int()")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_intint(10)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); // Excessive arguments QTest::ignoreMessage(QtWarningMsg, qPrintable("Too many arguments, ignoring 1")); @@ -2882,7 +2882,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_int(10, 11)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(10)); QTest::ignoreMessage(QtWarningMsg, qPrintable("Too many arguments, ignoring 1")); @@ -2891,7 +2891,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_intint(10, 11, 12)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 9); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(10)); QCOMPARE(o->actuals().at(1), QVariant(11)); @@ -2900,19 +2900,19 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_NoArgs()", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 0); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_NoArgs_int()", QV4::Primitive::fromInt32(6))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_NoArgs_real()", QV4::Primitive::fromDouble(19.75))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 2); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); { @@ -2921,7 +2921,7 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(scope.engine->toVariant(ret, QMetaType {}), QVariant(QPointF(123, 4.5))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 3); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); } o->reset(); @@ -2931,14 +2931,14 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(qobjectWrapper->object(), (QObject *)o); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 4); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); } o->reset(); QVERIFY(EVALUATE_ERROR("object.method_NoArgs_unknown()")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); { @@ -2947,63 +2947,63 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(ret->toQStringNoThrow(), QString("Hello world")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 6); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); } o->reset(); QVERIFY(EVALUATE_VALUE("object.method_NoArgs_QVariant()", QV4::ScopedValue(scope, scope.engine->newString("QML rocks")))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 7); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); // Test arg types o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(94)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(94)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(\"94\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(94)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(\"not a number\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_intint(122, 9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 9); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(122)); QCOMPARE(o->actuals().at(1), QVariant(9)); @@ -3011,56 +3011,56 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_real(94.3)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(94.3)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(\"94.3\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(94.3)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(\"not a number\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qIsNaN(o->actuals().at(0).toDouble())); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qIsNaN(o->actuals().at(0).toDouble())); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qIsNaN(o->actuals().at(0).toDouble())); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QString(\"Hello world\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant("Hello world")); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QString(19)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant("19")); o->reset(); @@ -3069,7 +3069,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QString(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(expected)); } @@ -3077,71 +3077,71 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QString(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QString())); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QString(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QString())); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QPointF(0)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QPointF(null)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QPointF(undefined)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QPointF(object)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPointF())", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF(99.3, -10.2))); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPoint())", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF(9, 12))); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QObject(0)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QObject(\"Hello world\")")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant::fromValue((QObject *)nullptr)); { @@ -3151,7 +3151,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(root); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0).value<QObject *>()->metaObject()->className(), "QQmlComponentAttached"); } @@ -3168,49 +3168,49 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QObject(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant::fromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant::fromValue((QObject *)o)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).isNull()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).isUndefined()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(19)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).strictlyEquals(QJSValue(19))); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QScriptValue([19, 20])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).isArray()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(4, null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(4)); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).isNull()); @@ -3218,7 +3218,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(8, undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(8)); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).isUndefined()); @@ -3226,7 +3226,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(3, 19)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(3)); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).strictlyEquals(QJSValue(19))); @@ -3234,7 +3234,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(44, [19, 20])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(44)); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).isArray()); @@ -3242,20 +3242,20 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_ERROR("object.method_overload()")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload(10)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 16); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(10)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload(10, 11)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 17); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(10)); QCOMPARE(o->actuals().at(1), QVariant(11)); @@ -3263,21 +3263,21 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_overload(\"Hello\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 18); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QString("Hello"))); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_with_enum(9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 19); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(9)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_default(10)", QV4::Primitive::fromInt32(19))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 20); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(10)); QCOMPARE(o->actuals().at(1), QVariant(19)); @@ -3285,7 +3285,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_default(10, 13)", QV4::Primitive::fromInt32(13))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 20); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(10)); QCOMPARE(o->actuals().at(1), QVariant(13)); @@ -3293,14 +3293,14 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_inherited(9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -3); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(9)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QVariant(9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 21); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(9)); QCOMPARE(o->actuals().at(1), QVariant()); @@ -3308,7 +3308,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QVariant(\"Hello\", \"World\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 21); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(QString("Hello"))); QCOMPARE(o->actuals().at(1), QVariant(QString("World"))); @@ -3316,104 +3316,104 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QJsonObject({foo:123})", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 22); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonObject>(o->actuals().at(0)), QJsonDocument::fromJson("{\"foo\":123}").object()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonArray([123])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 23); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonArray>(o->actuals().at(0)), QJsonDocument::fromJson("[123]").array()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(123)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(123)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(42.35)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(42.35)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue('ciao')", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QStringLiteral("ciao"))); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(true)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(true)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(false)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(false)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Null)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Undefined)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload({foo:123})", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 25); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonObject>(o->actuals().at(0)), QJsonDocument::fromJson("{\"foo\":123}").object()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload([123])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 26); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonArray>(o->actuals().at(0)), QJsonDocument::fromJson("[123]").array()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 27); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Null)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 27); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Undefined)); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_unknown(null)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QByteArray(\"Hello\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 29); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QByteArray>(o->actuals().at(0)), QByteArray("Hello")); o->reset(); @@ -3422,7 +3422,7 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->invoked(), 30); QVERIFY(ret->isString()); QCOMPARE(ret->toQStringNoThrow(), QString("Hello world!")); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(123)); QJSValue callback = qvariant_cast<QJSValue>(o->actuals().at(1)); QVERIFY(!callback.isNull()); @@ -3432,7 +3432,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_overload2('foo', 12, [1, 2, 3])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 31); - QCOMPARE(o->actuals().count(), 3); + QCOMPARE(o->actuals().size(), 3); QCOMPARE(qvariant_cast<QString>(o->actuals().at(0)), QStringLiteral("foo")); QCOMPARE(qvariant_cast<int>(o->actuals().at(1)), 12); QCOMPARE(qvariant_cast<QVariantList>(o->actuals().at(2)), (QVariantList {1.0, 2.0, 3.0})); @@ -3441,7 +3441,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_overload2(11, 12, {a: 1, b: 2})", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 31); - QCOMPARE(o->actuals().count(), 3); + QCOMPARE(o->actuals().size(), 3); QCOMPARE(qvariant_cast<int>(o->actuals().at(0)), 11); QCOMPARE(qvariant_cast<int>(o->actuals().at(1)), 12); QCOMPARE(qvariant_cast<QVariantMap>(o->actuals().at(2)), @@ -3452,7 +3452,7 @@ void tst_qqmlecmascript::callQtInvokables() QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 32); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QVariantList>(o->actuals().at(0)), (QVariantList {1.0, QStringLiteral("bar"), 0.2})); @@ -3461,7 +3461,7 @@ void tst_qqmlecmascript::callQtInvokables() QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 33); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QVariantMap>(o->actuals().at(0)), (QVariantMap { {QStringLiteral("one"), 1.0}, @@ -4835,7 +4835,7 @@ void tst_qqmlecmascript::importScripts() else { QVERIFY(component.isError()); QCOMPARE(warningMessages.size(), 1); - QCOMPARE(component.errors().count(), 2); + QCOMPARE(component.errors().size(), 2); QCOMPARE(component.errors().at(1).toString(), warningMessages.first()); return; } @@ -5850,22 +5850,22 @@ void tst_qqmlecmascript::sequenceConversionRead() QMetaObject::invokeMethod(object.data(), "readSequences"); QList<int> intList; intList << 1 << 2 << 3 << 4; - QCOMPARE(object->property("intListLength").toInt(), intList.length()); + QCOMPARE(object->property("intListLength").toInt(), intList.size()); QCOMPARE(object->property("intList").value<QList<int> >(), intList); QList<qreal> qrealList; qrealList << 1.1 << 2.2 << 3.3 << 4.4; - QCOMPARE(object->property("qrealListLength").toInt(), qrealList.length()); + QCOMPARE(object->property("qrealListLength").toInt(), qrealList.size()); QCOMPARE(object->property("qrealList").value<QList<qreal> >(), qrealList); QList<bool> boolList; boolList << true << false << true << false; - QCOMPARE(object->property("boolListLength").toInt(), boolList.length()); + QCOMPARE(object->property("boolListLength").toInt(), boolList.size()); QCOMPARE(object->property("boolList").value<QList<bool> >(), boolList); QList<QString> stringList; stringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth"); - QCOMPARE(object->property("stringListLength").toInt(), stringList.length()); + QCOMPARE(object->property("stringListLength").toInt(), stringList.size()); QCOMPARE(object->property("stringList").value<QList<QString> >(), stringList); QList<QUrl> urlList; urlList << QUrl("http://www.example1.com") << QUrl("http://www.example2.com") << QUrl("http://www.example3.com"); - QCOMPARE(object->property("urlListLength").toInt(), urlList.length()); + QCOMPARE(object->property("urlListLength").toInt(), urlList.size()); QCOMPARE(object->property("urlList").value<QList<QUrl> >(), urlList); QStringList qstringList; qstringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth"); - QCOMPARE(object->property("qstringListLength").toInt(), qstringList.length()); + QCOMPARE(object->property("qstringListLength").toInt(), qstringList.size()); QCOMPARE(object->property("qstringList").value<QStringList>(), qstringList); QMetaObject::invokeMethod(object.data(), "readSequenceElements"); @@ -7341,7 +7341,7 @@ void tst_qqmlecmascript::nonNotifyable() QLatin1String(object->metaObject()->className()) + QLatin1String("::value"); - QCOMPARE(messageHandler.messages().length(), 2); + QCOMPARE(messageHandler.messages().size(), 2); QCOMPARE(messageHandler.messages().at(0), expected1); QCOMPARE(messageHandler.messages().at(1), expected2); } @@ -7399,7 +7399,7 @@ void tst_qqmlecmascript::qtbug_22679() QScopedPointer<QObject> o(component.create()); QVERIFY2(o, qPrintable(component.errorString())); - QCOMPARE(warningsSpy.count(), 0); + QCOMPARE(warningsSpy.size(), 0); } void tst_qqmlecmascript::qtbug_22843_data() @@ -7423,7 +7423,7 @@ void tst_qqmlecmascript::qtbug_22843() QQmlComponent component(&engine, testFileUrl(fileName)); QString url = component.url().toString(); - QString expectedError = url.left(url.length()-3) + QLatin1String("js:4:16: Expected token `;'"); + QString expectedError = url.left(url.size()-3) + QLatin1String("js:4:16: Expected token `;'"); QVERIFY(component.isError()); QCOMPARE(component.errors().value(1).toString(), expectedError); @@ -8253,8 +8253,8 @@ void tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroy() QSignalSpy spy1(object1, SIGNAL(destroyed())); QSignalSpy spy2(object2, SIGNAL(destroyed())); myEngine.reset(); - QCOMPARE(spy1.count(), 1); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy1.size(), 1); + QCOMPARE(spy2.size(), 1); deleteObject.deleteNestedObject(); } @@ -8569,14 +8569,14 @@ void tst_qqmlecmascript::garbageCollectionDuringCreation() QVERIFY2(object, qPrintable(component.errorString())); QObjectContainer *container = qobject_cast<QObjectContainer*>(object.data()); - QCOMPARE(container->dataChildren.count(), 1); + QCOMPARE(container->dataChildren.size(), 1); QObject *child = container->dataChildren.first(); QQmlData *ddata = QQmlData::get(child); QVERIFY(!ddata->jsWrapper.isNullOrUndefined()); gc(engine); - QCOMPARE(container->dataChildren.count(), 0); + QCOMPARE(container->dataChildren.size(), 0); } void tst_qqmlecmascript::qtbug_39520() diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index 4460dd7de5..fdf3fffeb6 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -170,26 +170,26 @@ void tst_QQmlImport::uiFormatLoading() QSignalSpy objectCreated(test, SIGNAL(objectCreated(QObject*,QUrl))); test->load(testFileUrl("TestForm.ui.qml")); - QCOMPARE(objectCreated.count(), size);//one less than rootObjects().size() because we missed the first one + QCOMPARE(objectCreated.size(), size);//one less than rootObjects().size() because we missed the first one QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); QByteArray testQml("import QtQml 2.0; QtObject{property bool success: true; property TestForm t: TestForm{}}"); test->loadData(testQml, testFileUrl("dynamicTestForm.ui.qml")); - QCOMPARE(objectCreated.count(), size); + QCOMPARE(objectCreated.size(), size); QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); test->load(testFileUrl("openTestFormFromDir.qml")); - QCOMPARE(objectCreated.count(), size); + QCOMPARE(objectCreated.size(), size); QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); test->load(testFileUrl("openTestFormFromQmlDir.qml")); - QCOMPARE(objectCreated.count(), size); + QCOMPARE(objectCreated.size(), size); QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); diff --git a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp index e6c8ad721e..1baf61574e 100644 --- a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp +++ b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp @@ -517,7 +517,7 @@ void tst_qqmlincubator::statusChanged() MyIncubator incubator(QQmlIncubator::Synchronous); component.create(incubator); QVERIFY(incubator.isReady()); - QCOMPARE(incubator.statuses.count(), 3); + QCOMPARE(incubator.statuses.size(), 3); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); QCOMPARE(incubator.statuses.at(1), -1); QCOMPARE(incubator.statuses.at(2), int(QQmlIncubator::Ready)); @@ -531,7 +531,7 @@ void tst_qqmlincubator::statusChanged() MyIncubator incubator(QQmlIncubator::Asynchronous); component.create(incubator); QVERIFY(incubator.isLoading()); - QCOMPARE(incubator.statuses.count(), 1); + QCOMPARE(incubator.statuses.size(), 1); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); { @@ -539,7 +539,7 @@ void tst_qqmlincubator::statusChanged() controller.incubateWhile(&b); } - QCOMPARE(incubator.statuses.count(), 3); + QCOMPARE(incubator.statuses.size(), 3); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); QCOMPARE(incubator.statuses.at(1), -1); QCOMPARE(incubator.statuses.at(2), int(QQmlIncubator::Ready)); @@ -553,7 +553,7 @@ void tst_qqmlincubator::statusChanged() MyIncubator incubator(QQmlIncubator::Asynchronous); component2.create(incubator); QVERIFY(incubator.isLoading()); - QCOMPARE(incubator.statuses.count(), 1); + QCOMPARE(incubator.statuses.size(), 1); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); { @@ -562,7 +562,7 @@ void tst_qqmlincubator::statusChanged() } QVERIFY(incubator.isReady()); - QCOMPARE(incubator.statuses.count(), 3); + QCOMPARE(incubator.statuses.size(), 3); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); QCOMPARE(incubator.statuses.at(1), -1); QCOMPARE(incubator.statuses.at(2), int(QQmlIncubator::Ready)); diff --git a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp index 03add4b309..4908ca210b 100644 --- a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp +++ b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp @@ -226,7 +226,7 @@ void tst_qqmlinfo::attachedObject() QScopedPointer<QObject> object(component.create()); QVERIFY2(object != nullptr, qPrintable(component.errorString())); - QCOMPARE(warningSpy.count(), 2); + QCOMPARE(warningSpy.size(), 2); // The Attached C++ type has no QML engine since it was created in C++, so we should see its parent instead. const auto cppWarnings = warningSpy.at(0).first().value<QList<QQmlError>>(); diff --git a/tests/auto/qml/qqmlinstantiator/stringmodel.h b/tests/auto/qml/qqmlinstantiator/stringmodel.h index 69d617a07f..d9676b9460 100644 --- a/tests/auto/qml/qqmlinstantiator/stringmodel.h +++ b/tests/auto/qml/qqmlinstantiator/stringmodel.h @@ -37,7 +37,7 @@ public: int rowCount(const QModelIndex &) const override { - return items.count(); + return items.size(); } QHash<int, QByteArray> roleNames() const override @@ -72,7 +72,7 @@ public: QVariant data (const QModelIndex & index, int role) const override { int row = index.row(); - if ((row<0) || (row>=items.count())) + if ((row<0) || (row>=items.size())) return QVariant(QMetaType(QMetaType::UnknownType)); switch (role) { diff --git a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp index aeca3f4046..1097c65f02 100644 --- a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp +++ b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp @@ -124,19 +124,19 @@ void tst_qqmlinstantiator::activeProperty() QCOMPARE(instantiator->count(), 0); QVERIFY(instantiator->delegate()->isReady()); - QCOMPARE(activeSpy.count(), 0); - QCOMPARE(countSpy.count(), 0); - QCOMPARE(objectSpy.count(), 0); - QCOMPARE(modelSpy.count(), 0); + QCOMPARE(activeSpy.size(), 0); + QCOMPARE(countSpy.size(), 0); + QCOMPARE(objectSpy.size(), 0); + QCOMPARE(modelSpy.size(), 0); instantiator->setActive(true); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 1); - QCOMPARE(activeSpy.count(), 1); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(objectSpy.count(), 1); - QCOMPARE(modelSpy.count(), 0); + QCOMPARE(activeSpy.size(), 1); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(objectSpy.size(), 1); + QCOMPARE(modelSpy.size(), 0); QObject *object = instantiator->object(); QVERIFY(object); @@ -178,18 +178,18 @@ void tst_qqmlinstantiator::intModelChange() QSignalSpy modelSpy(instantiator, SIGNAL(modelChanged())); QCOMPARE(instantiator->count(), 10); - QCOMPARE(activeSpy.count(), 0); - QCOMPARE(countSpy.count(), 0); - QCOMPARE(objectSpy.count(), 0); - QCOMPARE(modelSpy.count(), 0); + QCOMPARE(activeSpy.size(), 0); + QCOMPARE(countSpy.size(), 0); + QCOMPARE(objectSpy.size(), 0); + QCOMPARE(modelSpy.size(), 0); instantiator->setModel(QVariant(2)); QCOMPARE(instantiator->count(), 2); - QCOMPARE(activeSpy.count(), 0); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(objectSpy.count(), 2); - QCOMPARE(modelSpy.count(), 1); + QCOMPARE(activeSpy.size(), 0); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(objectSpy.size(), 2); + QCOMPARE(modelSpy.size(), 1); for (int i=0; i<2; i++) { QObject *object = instantiator->objectAt(i); @@ -267,7 +267,7 @@ void tst_qqmlinstantiator::handlerWithParent() QScopedPointer<QObject> rootObject(component.create()); QVERIFY(rootObject != nullptr); const auto handlers = rootObject->findChildren<QObject *>("pointHandler"); - QCOMPARE(handlers.count(), 2); + QCOMPARE(handlers.size(), 2); for (const auto *h : handlers) { QCOMPARE(h->parent(), rootObject.data()); } diff --git a/tests/auto/qml/qqmlitemmodels/qtestmodel.h b/tests/auto/qml/qqmlitemmodels/qtestmodel.h index 9839e4c7f9..6cbec533b1 100644 --- a/tests/auto/qml/qqmlitemmodels/qtestmodel.h +++ b/tests/auto/qml/qqmlitemmodels/qtestmodel.h @@ -74,7 +74,7 @@ public: Node *n = (Node*)parent.internalPointer(); if (!n) n = tree; - return n->children.count(); + return n->children.size(); } int columnCount(const QModelIndex& parent = QModelIndex()) const override { @@ -97,7 +97,7 @@ public: Node *pn = (Node*)parent.internalPointer(); if (!pn) pn = tree; - if (row >= pn->children.count()) + if (row >= pn->children.size()) return QModelIndex(); Node *n = pn->children.at(row); @@ -130,7 +130,7 @@ public: if (pn != tree) pn = pn->parent; if (idx.row() < 0 || idx.column() < 0 || idx.column() >= cols - || idx.row() >= pn->children.count()) { + || idx.row() >= pn->children.size()) { wrongIndex = true; qWarning("Invalid modelIndex [%d,%d,%p]", idx.row(), idx.column(), idx.internalPointer()); @@ -268,15 +268,15 @@ public: void addRows(int row, int count) { if (count > 0) { - children.reserve(children.count() + count); + children.reserve(children.size() + count); children.insert(row, count, (Node *)0); } } void removeRows(int row, int count, bool keepAlive = false) { - int newCount = qMax(children.count() - count, 0); - int effectiveCountDiff = children.count() - newCount; + int newCount = qMax(children.size() - count, 0); + int effectiveCountDiff = children.size() - newCount; if (effectiveCountDiff > 0) { if (!keepAlive) for (int i = 0; i < effectiveCountDiff; i++) diff --git a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp index f046fcd35d..339a61f996 100644 --- a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp +++ b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp @@ -163,7 +163,7 @@ void tst_qqmlitemmodels::itemSelection() QCOMPARE(isVariant.userType(), qMetaTypeId<QItemSelection>()); const QItemSelection &sel = isVariant.value<QItemSelection>(); - QCOMPARE(sel.count(), object->itemSelection().count()); + QCOMPARE(sel.size(), object->itemSelection().size()); QCOMPARE(sel, object->itemSelection()); } } @@ -181,7 +181,7 @@ void tst_qqmlitemmodels::modelIndexList() QCOMPARE(object->property("count").toInt(), 10); const QModelIndexList &mil = object->modelIndexList(); - QCOMPARE(mil.count(), 4); + QCOMPARE(mil.size(), 4); for (int i = 0; i < 3; i++) QCOMPARE(mil.at(i), model.index(2 + i, 2 + i)); QCOMPARE(mil.at(3), QModelIndex()); // The string inserted at the end should result in an invalid index @@ -198,7 +198,7 @@ void tst_qqmlitemmodels::modelIndexList() QCOMPARE(milVariant.userType(), qMetaTypeId<QModelIndexList>()); const QModelIndexList &milProp = milVariant.value<QModelIndexList>(); - QCOMPARE(milProp.count(), mil.count()); + QCOMPARE(milProp.size(), mil.size()); QCOMPARE(milProp, mil); } } diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp index 2b6f8e867e..f4b6acc848 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.cpp +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -189,7 +189,7 @@ void CustomBinding::componentComplete() void EnumSupportingCustomParser::verifyBindings(const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) { - if (bindings.count() != 1) { + if (bindings.size() != 1) { error(bindings.first(), QStringLiteral("Custom parser invoked incorrectly for unit test")); return; } @@ -221,7 +221,7 @@ void SimpleObjectCustomParser::applyBindings(QObject *object, const QQmlRefPoint { SimpleObjectWithCustomParser *o = qobject_cast<SimpleObjectWithCustomParser*>(object); Q_ASSERT(o); - o->setCustomBindingsCount(bindings.count()); + o->setCustomBindingsCount(bindings.size()); } diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp index dd9df84867..2d02cac9f8 100644 --- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp +++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp @@ -1022,7 +1022,7 @@ void tst_qqmllistcompositor::moveFromEnd() QVector<C::Insert> inserts; compositor.listItemsInserted(a, 0, 1, &inserts); - QCOMPARE(inserts.count(), 1); + QCOMPARE(inserts.size(), 1); QCOMPARE(inserts.at(0).index[1], 1); QCOMPARE(inserts.at(0).count, 1); diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp index 7f31e43b1e..8b07398832 100644 --- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp +++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp @@ -128,10 +128,10 @@ bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVarian if (model == nullptr) return false; - if (model->count() != testList.count()) + if (model->count() != testList.size()) return false; - for (int i=0 ; i < testList.count() ; ++i) { + for (int i=0 ; i < testList.size() ; ++i) { const QVariant &testVariant = testList.at(i); if (testVariant.typeId() != QMetaType::QVariantMap) return false; @@ -597,7 +597,7 @@ void tst_qqmllistmodel::dynamic() QCOMPARE(actual,result); if (model.count() > 0) - QVERIFY(spyCount.count() > 0); + QVERIFY(spyCount.size() > 0); } void tst_qqmllistmodel::enumerate() @@ -705,7 +705,7 @@ void tst_qqmllistmodel::error() } else { QVERIFY(component.isError()); QList<QQmlError> errors = component.errors(); - QCOMPARE(errors.count(),1); + QCOMPARE(errors.size(),1); QCOMPARE(errors.at(0).description(),error); } } @@ -803,7 +803,7 @@ void tst_qqmllistmodel::get() QCOMPARE(model->data(index, role), roleValue); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> spyResult = spy.takeFirst(); QCOMPARE(spyResult.at(0).value<QModelIndex>(), model->index(index, 0, QModelIndex())); @@ -904,7 +904,7 @@ void tst_qqmllistmodel::get_nested() testData << qMakePair(1, QString("listRoleB")); testData << qMakePair(1, QString("listRoleC")); - for (int i=0; i<testData.count(); i++) { + for (int i=0; i<testData.size(); i++) { int outerListIndex = testData[i].first; QString outerListRoleName = testData[i].second; int outerListRole = roleFromName(model, outerListRoleName); @@ -927,7 +927,7 @@ void tst_qqmllistmodel::get_nested() } else { QCOMPARE(childModel->data(index, role), roleValue); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> spyResult = spy.takeFirst(); QCOMPARE(spyResult.at(0).value<QModelIndex>(), childModel->index(index, 0, QModelIndex())); @@ -1097,7 +1097,7 @@ void tst_qqmllistmodel::property_changes() expr.evaluate(); QVERIFY2(!expr.hasError(), qPrintable(expr.error().toString())); - QString signalHandler = "on" + QString(roleName[0].toUpper()) + roleName.mid(1, roleName.length()) + "Changed:"; + QString signalHandler = "on" + QString(roleName[0].toUpper()) + roleName.mid(1, roleName.size()) + "Changed:"; QString qml = "import QtQuick 2.0\n" "Connections {\n" "property bool gotSignal: false\n" @@ -1122,11 +1122,11 @@ void tst_qqmllistmodel::property_changes() // test itemsChanged() is emitted correctly if (itemsChanged) { - QCOMPARE(spyItemsChanged.count(), 1); + QCOMPARE(spyItemsChanged.size(), 1); QCOMPARE(spyItemsChanged.at(0).at(0).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex())); QCOMPARE(spyItemsChanged.at(0).at(1).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex())); } else { - QCOMPARE(spyItemsChanged.count(), 0); + QCOMPARE(spyItemsChanged.size(), 0); } expr.setExpression(testExpression); @@ -1643,7 +1643,7 @@ void tst_qqmllistmodel::crash_append_empty_array() QQmlExpression expr(engine.rootContext(), model, "append(new Array())"); expr.evaluate(); QVERIFY2(!expr.hasError(), qPrintable(expr.error().toString())); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_qqmllistmodel::dynamic_roles_crash_QTBUG_38907() diff --git a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp index 6a9cc93abd..4875602314 100644 --- a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp +++ b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp @@ -91,10 +91,10 @@ bool tst_qqmllistmodelworkerscript::compareVariantList(const QVariantList &testL if (model == nullptr) return false; - if (model->count() != testList.count()) + if (model->count() != testList.size()) return false; - for (int i=0 ; i < testList.count() ; ++i) { + for (int i=0 ; i < testList.size() ; ++i) { const QVariant &testVariant = testList.at(i); if (testVariant.typeId() != QMetaType::QVariantMap) return false; @@ -331,8 +331,8 @@ void tst_qqmllistmodelworkerscript::dynamic_worker() QSignalSpy spyCount(&model, SIGNAL(countChanged())); - if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}')) - script = script.mid(1, script.length() - 2); + if (script[0] == QLatin1Char('{') && script[script.size()-1] == QLatin1Char('}')) + script = script.mid(1, script.size() - 2); QVariantList operations; foreach (const QString &s, script.split(';')) { if (!s.isEmpty()) @@ -348,7 +348,7 @@ void tst_qqmllistmodelworkerscript::dynamic_worker() QCOMPARE(QQmlProperty(item, "result").read().toInt(), result); if (model.count() > 0) - QVERIFY(spyCount.count() > 0); + QVERIFY(spyCount.size() > 0); delete item; qApp->processEvents(); @@ -380,8 +380,8 @@ void tst_qqmllistmodelworkerscript::dynamic_worker_sync() QQuickItem *item = createWorkerTest(&eng, &component, &model); QVERIFY(item != nullptr); - if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}')) - script = script.mid(1, script.length() - 2); + if (script[0] == QLatin1Char('{') && script[script.size()-1] == QLatin1Char('}')) + script = script.mid(1, script.size() - 2); QVariantList operations; foreach (const QString &s, script.split(';')) { if (!s.isEmpty()) @@ -394,7 +394,7 @@ void tst_qqmllistmodelworkerscript::dynamic_worker_sync() // execute a set of commands on the worker list model, then check the // changes are reflected in the list model in the main thread QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", - Q_ARG(QVariant, operations.mid(0, operations.length()-1)))); + Q_ARG(QVariant, operations.mid(0, operations.size()-1)))); waitForWorker(item); QQmlExpression e(eng.rootContext(), &model, operations.last().toString()); @@ -468,7 +468,7 @@ void tst_qqmllistmodelworkerscript::get_worker() QCOMPARE(model.data(index, role), roleValue); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> spyResult = spy.takeFirst(); QCOMPARE(spyResult.at(0).value<QModelIndex>(), model.index(index, 0, QModelIndex())); @@ -585,11 +585,11 @@ void tst_qqmllistmodelworkerscript::property_changes_worker() // test itemsChanged() is emitted correctly if (itemsChanged) { - QCOMPARE(spyItemsChanged.count(), 1); + QCOMPARE(spyItemsChanged.size(), 1); QCOMPARE(spyItemsChanged.at(0).at(0).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex())); QCOMPARE(spyItemsChanged.at(0).at(1).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex())); } else { - QCOMPARE(spyItemsChanged.count(), 0); + QCOMPARE(spyItemsChanged.size(), 0); } delete item; @@ -638,32 +638,32 @@ void tst_qqmllistmodelworkerscript::worker_sync() QCOMPARE(model.count(), 2); QCOMPARE(childModel->count(), 1); - QCOMPARE(spyModelInserted.count(), 0); - QCOMPARE(spyChildInserted.count(), 0); + QCOMPARE(spyModelInserted.size(), 0); + QCOMPARE(spyChildInserted.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "doSync")); waitForWorker(item); QCOMPARE(model.count(), 2); QCOMPARE(childModel->count(), 2); - QCOMPARE(spyModelInserted.count(), 0); - QCOMPARE(spyChildInserted.count(), 1); + QCOMPARE(spyModelInserted.size(), 0); + QCOMPARE(spyChildInserted.size(), 1); QVERIFY(QMetaObject::invokeMethod(item, "addItemViaWorker")); waitForWorker(item); QCOMPARE(model.count(), 2); QCOMPARE(childModel->count(), 2); - QCOMPARE(spyModelInserted.count(), 0); - QCOMPARE(spyChildInserted.count(), 1); + QCOMPARE(spyModelInserted.size(), 0); + QCOMPARE(spyChildInserted.size(), 1); QVERIFY(QMetaObject::invokeMethod(item, "doSync")); waitForWorker(item); QCOMPARE(model.count(), 2); QCOMPARE(childModel->count(), 3); - QCOMPARE(spyModelInserted.count(), 0); - QCOMPARE(spyChildInserted.count(), 2); + QCOMPARE(spyModelInserted.size(), 0); + QCOMPARE(spyChildInserted.size(), 2); delete item; qApp->processEvents(); @@ -688,7 +688,7 @@ void tst_qqmllistmodelworkerscript::worker_remove_element() QSignalSpy spyModelRemoved(&model, SIGNAL(rowsRemoved(QModelIndex,int,int))); QCOMPARE(model.count(), 0); - QCOMPARE(spyModelRemoved.count(), 0); + QCOMPARE(spyModelRemoved.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "addItem")); @@ -698,13 +698,13 @@ void tst_qqmllistmodelworkerscript::worker_remove_element() waitForWorker(item); QCOMPARE(model.count(), 1); - QCOMPARE(spyModelRemoved.count(), 0); + QCOMPARE(spyModelRemoved.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "doSync")); waitForWorker(item); QCOMPARE(model.count(), 0); - QCOMPARE(spyModelRemoved.count(), 1); + QCOMPARE(spyModelRemoved.size(), 1); delete item; qApp->processEvents(); @@ -751,7 +751,7 @@ void tst_qqmllistmodelworkerscript::worker_remove_list() QSignalSpy spyModelRemoved(&model, SIGNAL(rowsRemoved(QModelIndex,int,int))); QCOMPARE(model.count(), 0); - QCOMPARE(spyModelRemoved.count(), 0); + QCOMPARE(spyModelRemoved.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "addList")); @@ -761,13 +761,13 @@ void tst_qqmllistmodelworkerscript::worker_remove_list() waitForWorker(item); QCOMPARE(model.count(), 1); - QCOMPARE(spyModelRemoved.count(), 0); + QCOMPARE(spyModelRemoved.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "doSync")); waitForWorker(item); QCOMPARE(model.count(), 0); - QCOMPARE(spyModelRemoved.count(), 1); + QCOMPARE(spyModelRemoved.size(), 1); delete item; qApp->processEvents(); @@ -798,8 +798,8 @@ void tst_qqmllistmodelworkerscript::dynamic_role() QQmlExpression preExp(engine.rootContext(), &model, preamble); QCOMPARE(preExp.evaluate().toInt(), 0); - if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}')) - script = script.mid(1, script.length() - 2); + if (script[0] == QLatin1Char('{') && script[script.size()-1] == QLatin1Char('}')) + script = script.mid(1, script.size() - 2); QVariantList operations; foreach (const QString &s, script.split(';')) { if (!s.isEmpty()) @@ -809,7 +809,7 @@ void tst_qqmllistmodelworkerscript::dynamic_role() // execute a set of commands on the worker list model, then check the // changes are reflected in the list model in the main thread QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", - Q_ARG(QVariant, operations.mid(0, operations.length()-1)))); + Q_ARG(QVariant, operations.mid(0, operations.size()-1)))); waitForWorker(item); QQmlExpression e(engine.rootContext(), &model, operations.last().toString()); diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp index d058b6ec89..b678fbd1e2 100644 --- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp +++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp @@ -498,9 +498,9 @@ void tst_qqmllocale::weekDays() QList<QVariant> qmlDays = val.toList(); QList<Qt::DayOfWeek> days = QLocale(locale).weekdays(); - QCOMPARE(days.count(), qmlDays.count()); + QCOMPARE(days.size(), qmlDays.size()); - for (int i = 0; i < days.count(); ++i) { + for (int i = 0; i < days.size(); ++i) { int day = int(days.at(i)); if (day == 7) // JS Date days in range 0(Sunday) to 6(Saturday) day = 0; @@ -540,9 +540,9 @@ void tst_qqmllocale::uiLanguages() QList<QVariant> qmlLangs = val.toList(); QStringList langs = QLocale(locale).uiLanguages(); - QCOMPARE(langs.count(), qmlLangs.count()); + QCOMPARE(langs.size(), qmlLangs.size()); - for (int i = 0; i < langs.count(); ++i) { + for (int i = 0; i < langs.size(); ++i) { QCOMPARE(langs.at(i), qmlLangs.at(i).toString()); } diff --git a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp index ed6f24aaf3..d945f460eb 100644 --- a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp +++ b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp @@ -227,18 +227,18 @@ void tst_QQmlMetaObject::property() QCOMPARE(value, expectedValue); else QVERIFY(value.isValid()); - QCOMPARE(changedSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); if (isWritable) { QVERIFY(prop.write(object, newValue)); - QCOMPARE(changedSpy.count(), 1); + QCOMPARE(changedSpy.size(), 1); QVariant value = prop.read(object); if (value.userType() == qMetaTypeId<QJSValue>()) value = value.value<QJSValue>().toVariant(); QCOMPARE(value, newValue); } else { QVERIFY(!prop.write(object, prop.read(object))); - QCOMPARE(changedSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); } } diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index b36a43243d..a4901aebad 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -133,7 +133,7 @@ void registerStaticPlugin(const char *uri) PluginType::metaData.append(QCborValue(QCborMap::fromJsonObject(md)).toCbor()); auto rawMetaDataFunctor = []() -> QPluginMetaData { - return {reinterpret_cast<const uchar *>(PluginType::metaData.constData()), size_t(PluginType::metaData.length())}; + return {reinterpret_cast<const uchar *>(PluginType::metaData.constData()), size_t(PluginType::metaData.size())}; }; QStaticPlugin plugin(instanceFunctor, rawMetaDataFunctor); qRegisterStaticPluginFunction(plugin); @@ -235,7 +235,7 @@ void tst_qqmlmoduleplugin::incorrectPluginCase() QQmlComponent component(&engine, testFileUrl(QStringLiteral("incorrectCase.qml"))); QList<QQmlError> errors = component.errors(); - QCOMPARE(errors.count(), 1); + QCOMPARE(errors.size(), 1); QString expectedError = QLatin1String("module \"org.qtproject.WrongCase\" plugin \"PluGin\" not found"); @@ -566,7 +566,7 @@ void tst_qqmlmoduleplugin::importStrictModule() QVERIFY(object != nullptr); } else { QVERIFY(!component.isReady()); - QCOMPARE(component.errors().count(), 1); + QCOMPARE(component.errors().size(), 1); QCOMPARE(component.errors().first().toString(), url.toString() + error); } } diff --git a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp index 438dc3d3c2..d007f4d024 100644 --- a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp +++ b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp @@ -15,7 +15,7 @@ private slots: static bool compareItems(QQmlObjectModel *model, const QObjectList &items) { - for (int i = 0; i < items.count(); ++i) { + for (int i = 0; i < items.size(); ++i) { if (model->get(i) != items.at(i)) return false; } @@ -65,81 +65,81 @@ void tst_QQmlObjectModel::changes() model.append(&item0); items.append(&item0); QCOMPARE(model.count(), ++count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // insert(0, item1) -> [item1, item0] model.insert(0, &item1); items.insert(0, &item1); QCOMPARE(model.count(), ++count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // append(item2) -> [item1, item0, item2] model.append(&item2); items.append(&item2); QCOMPARE(model.count(), ++count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // insert(2, item3) -> [item1, item0, item3, item2] model.insert(2, &item3); items.insert(2, &item3); QCOMPARE(model.count(), ++count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // move(0, 1) -> [item0, item1, item3, item2] model.move(0, 1); items.move(0, 1); QCOMPARE(model.count(), count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true, 1)); // move(3, 2) -> [item0, item1, item2, item3] model.move(3, 2); items.move(3, 2); QCOMPARE(model.count(), count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true, 2)); // remove(0) -> [item1, item2, item3] model.remove(0); items.removeAt(0); QCOMPARE(model.count(), --count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 0, 1, false)); // remove(2) -> [item1, item2] model.remove(2); items.removeAt(2); QCOMPARE(model.count(), --count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 0, 1, false)); // clear() -> [] model.clear(); items.clear(); QCOMPARE(model.count(), 0); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 0, 2, false)); } diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 7d2dc302ea..723faaa909 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -2103,7 +2103,7 @@ void tst_qqmlproperty::assignEmptyVariantMap() QVariantMap map; map.insert("key", "value"); o.setVariantMap(map); - QCOMPARE(o.variantMap().count(), 1); + QCOMPARE(o.variantMap().size(), 1); QCOMPARE(o.variantMap().isEmpty(), false); @@ -2111,7 +2111,7 @@ void tst_qqmlproperty::assignEmptyVariantMap() QObject *obj = component.createWithInitialProperties({{"o", QVariant::fromValue(&o)}}); QVERIFY(obj); - QCOMPARE(o.variantMap().count(), 0); + QCOMPARE(o.variantMap().size(), 0); QCOMPARE(o.variantMap().isEmpty(), true); delete obj; diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index aac9c5229f..3c3e0ba1e9 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -90,7 +90,7 @@ void tst_QQmlPropertyMap::insert() QQmlPropertyMap map; map.insert(QLatin1String("key1"),100); map.insert(QLatin1String("key2"),200); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); @@ -103,33 +103,33 @@ void tst_QQmlPropertyMap::insert() //QQmlPropertyMap has an invokable keys() method QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols."); map.insert(QLatin1String("keys"), 1); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(!map.contains(QLatin1String("keys"))); QVERIFY(map.value(QLatin1String("keys")).isNull()); //QQmlPropertyMap has a deleteLater() slot QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols."); map.insert(QLatin1String("deleteLater"), 1); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(!map.contains(QLatin1String("deleteLater"))); QVERIFY(map.value(QLatin1String("deleteLater")).isNull()); //QQmlPropertyMap has an valueChanged() signal QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols."); map.insert(QLatin1String("valueChanged"), 1); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(!map.contains(QLatin1String("valueChanged"))); QVERIFY(map.value(QLatin1String("valueChanged")).isNull()); //but 'valueChange' should be ok map.insert(QLatin1String("valueChange"), 1); - QCOMPARE(map.keys().count(), 3); + QCOMPARE(map.keys().size(), 3); QVERIFY(map.contains(QLatin1String("valueChange"))); QCOMPARE(map.value(QLatin1String("valueChange")), QVariant(1)); //'valueCHANGED' should be ok, too map.insert(QLatin1String("valueCHANGED"), 1); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(map.contains(QLatin1String("valueCHANGED"))); QCOMPARE(map.value(QLatin1String("valueCHANGED")), QVariant(1)); } @@ -144,7 +144,7 @@ void tst_QQmlPropertyMap::insertMany() QQmlPropertyMap map; map.insert(values); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); @@ -162,7 +162,7 @@ void tst_QQmlPropertyMap::insertMany() //QQmlPropertyMap has an invokable keys() method QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols."); map.insert(values); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(!map.contains(QLatin1String("keys"))); QVERIFY(map.value(QLatin1String("keys")).isNull()); @@ -171,7 +171,7 @@ void tst_QQmlPropertyMap::insertMany() //QQmlPropertyMap has a deleteLater() slot QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols."); map.insert(values); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(!map.contains(QLatin1String("deleteLater"))); QVERIFY(map.value(QLatin1String("deleteLater")).isNull()); @@ -180,13 +180,13 @@ void tst_QQmlPropertyMap::insertMany() //QQmlPropertyMap has an valueChanged() signal QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols."); map.insert(values); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(!map.contains(QLatin1String("valueChanged"))); QVERIFY(map.value(QLatin1String("valueChanged")).isNull()); values.remove(QStringLiteral("valueChanged")); map.insert(values); // Adds "foobar" and changes "key1" - QCOMPARE(map.keys().count(), 5); + QCOMPARE(map.keys().size(), 5); QCOMPARE(map.value(QStringLiteral("foobar")).toInt(), 12); QCOMPARE(map.value(QStringLiteral("key1")).toInt(), 100); } @@ -196,7 +196,7 @@ void tst_QQmlPropertyMap::operatorInsert() QQmlPropertyMap map; map[QLatin1String("key1")] = 100; map[QLatin1String("key2")] = 200; - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); @@ -225,12 +225,12 @@ void tst_QQmlPropertyMap::clear() { QQmlPropertyMap map; map.insert(QLatin1String("key1"),100); - QCOMPARE(map.keys().count(), 1); + QCOMPARE(map.keys().size(), 1); QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); map.clear(QLatin1String("key1")); - QCOMPARE(map.keys().count(), 1); + QCOMPARE(map.keys().size(), 1); QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key1")), QVariant()); } @@ -241,10 +241,10 @@ void tst_QQmlPropertyMap::changed() QSignalSpy spy(&map, SIGNAL(valueChanged(QString,QVariant))); map.insert(QLatin1String("key1"),100); map.insert(QLatin1String("key2"),200); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); map.clear(QLatin1String("key1")); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); //make changes in QML QQmlEngine engine; @@ -257,9 +257,9 @@ void tst_QQmlPropertyMap::changed() QScopedPointer<QQuickText> txt(qobject_cast<QQuickText*>(component.create())); QVERIFY(txt); QCOMPARE(txt->text(), QString('X')); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> arguments = spy.takeFirst(); - QCOMPARE(arguments.count(), 2); + QCOMPARE(arguments.size(), 2); QCOMPARE(arguments.at(0).toString(),QLatin1String("key1")); QCOMPARE(arguments.at(1).value<QVariant>(),QVariant("Hello World")); QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); @@ -485,7 +485,7 @@ void tst_QQmlPropertyMap::disallowExtending() "}\n", QUrl()); obj.reset(component.create()); QVERIFY(obj.isNull()); - QCOMPARE(component.errors().count(), 1); + QCOMPARE(component.errors().size(), 1); QCOMPARE(component.errors().at(0).toString(), QStringLiteral("<Unknown File>:3:1: Fully dynamic types cannot declare new properties.")); } @@ -524,24 +524,24 @@ void tst_QQmlPropertyMap::QTBUG_48136() QSignalSpy notifySpy(&map, QByteArray::number(QSIGNAL_CODE) + prop.notifySignal().methodSignature()); map.insert(key, 42); - QCOMPARE(notifySpy.count(), 1); + QCOMPARE(notifySpy.size(), 1); map.insert(key, 43); - QCOMPARE(notifySpy.count(), 2); + QCOMPARE(notifySpy.size(), 2); map.insert(key, 43); - QCOMPARE(notifySpy.count(), 2); + QCOMPARE(notifySpy.size(), 2); map.insert(key, 44); - QCOMPARE(notifySpy.count(), 3); + QCOMPARE(notifySpy.size(), 3); // // Test that the valueChanged signal is emitted correctly // QSignalSpy valueChangedSpy(&map, &QQmlPropertyMap::valueChanged); map.setProperty(key, 44); - QCOMPARE(valueChangedSpy.count(), 0); + QCOMPARE(valueChangedSpy.size(), 0); map.setProperty(key, 45); - QCOMPARE(valueChangedSpy.count(), 1); + QCOMPARE(valueChangedSpy.size(), 1); map.setProperty(key, 45); - QCOMPARE(valueChangedSpy.count(), 1); + QCOMPARE(valueChangedSpy.size(), 1); } void tst_QQmlPropertyMap::lookupsInSubTypes() @@ -560,14 +560,14 @@ void tst_QQmlPropertyMap::freeze() map.insert(QLatin1String("key1"),100); map.insert(QLatin1String("key2"),200); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); map.freeze(); map.insert(QLatin1String("key3"), 32); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(!map.contains("key3")); map.insert(QLatin1String("key1"), QStringLiteral("Hello World")); @@ -652,7 +652,7 @@ void tst_QQmlPropertyMap::signalIndices() QSignalSpy spy(&map, method); map.insert(QLatin1String("key1"), 200); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } QTEST_MAIN(tst_QQmlPropertyMap) diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index 595adf5f67..c3bf3b6181 100644 --- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp +++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp @@ -733,7 +733,7 @@ void tst_qqmlqt::createQmlObject() QQuickItem *item = qobject_cast<QQuickItem *>(object.data()); QVERIFY(item != nullptr); - QCOMPARE(item->childItems().count(), 1); + QCOMPARE(item->childItems().size(), 1); } @@ -825,7 +825,7 @@ void tst_qqmlqt::dateTimeFormatting() QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); QVERIFY(object != nullptr); - QVERIFY(inputProperties.count() > 0); + QVERIFY(inputProperties.size() > 0); QVariant result; foreach(const QString &prop, inputProperties) { QVERIFY(QMetaObject::invokeMethod(object.data(), method.toUtf8().constData(), @@ -833,7 +833,7 @@ void tst_qqmlqt::dateTimeFormatting() Q_ARG(QVariant, prop))); QStringList output = result.toStringList(); QCOMPARE(output.size(), expectedResults.size()); - for (int i=0; i<output.count(); i++) + for (int i=0; i<output.size(); i++) QCOMPARE(output[i], expectedResults[i]); } } @@ -1136,7 +1136,7 @@ void tst_qqmlqt::quit() QSignalSpy spy(&engine, SIGNAL(quit())); QScopedPointer<QObject> object(component.create()); QVERIFY(object != nullptr); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_qqmlqt::exit() @@ -1146,7 +1146,7 @@ void tst_qqmlqt::exit() QSignalSpy spy(&engine, &QQmlEngine::exit); QScopedPointer<QObject> object(component.create()); QVERIFY(object != nullptr); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> arguments = spy.takeFirst(); QVERIFY(arguments.at(0).toInt() == object->property("returnCode").toInt()); } diff --git a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp index 296b5ef0ff..67c44684a4 100644 --- a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp +++ b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp @@ -52,7 +52,7 @@ void removeRecursive(const QString& dirname) { QDir dir(dirname); QFileInfoList entries(dir.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot)); - for (int i = 0; i < entries.count(); ++i) + for (int i = 0; i < entries.size(); ++i) if (entries[i].isDir()) removeRecursive(entries[i].filePath()); else @@ -174,7 +174,7 @@ void tst_qqmlsqldatabase::totalDatabases() if (engine->offlineStoragePath().isEmpty()) QSKIP("offlineStoragePath is empty, skip this test."); - QCOMPARE(QDir(dbDir()+"/Databases").entryInfoList(QDir::Files|QDir::NoDotAndDotDot).count(), total_databases_created_by_tests*2); + QCOMPARE(QDir(dbDir()+"/Databases").entryInfoList(QDir::Files|QDir::NoDotAndDotDot).size(), total_databases_created_by_tests*2); } void tst_qqmlsqldatabase::upgradeDatabase() diff --git a/tests/auto/qml/qqmltablemodel/tst_qqmltablemodel.cpp b/tests/auto/qml/qqmltablemodel/tst_qqmltablemodel.cpp index a8be2d0f99..a01a72c167 100644 --- a/tests/auto/qml/qqmltablemodel/tst_qqmltablemodel.cpp +++ b/tests/auto/qml/qqmltablemodel/tst_qqmltablemodel.cpp @@ -69,8 +69,8 @@ void tst_QQmlTableModel::appendRemoveRow() QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, -1))); QCOMPARE(model->rowCount(), 2); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call remove() with an rowIndex that is too large. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -78,16 +78,16 @@ void tst_QQmlTableModel::appendRemoveRow() QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 2))); QCOMPARE(model->rowCount(), 2); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call remove() with a valid rowIndex but negative rows. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*removeRow\\(\\): \"rows\" is less than or equal to zero")); QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 0), Q_ARG(int, -1))); QCOMPARE(model->rowCount(), 2); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call remove() with a valid rowIndex but excessive rows. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -95,8 +95,8 @@ void tst_QQmlTableModel::appendRemoveRow() QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 0), Q_ARG(int, 3))); QCOMPARE(model->rowCount(), 2); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call remove() without specifying the number of rows to remove; it should remove one row. QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 0))); @@ -104,8 +104,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->columnCount(), 2); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); // Call append() with a row that has an unexpected role; the row should be added and the extra data ignored. QVERIFY(QMetaObject::invokeMethod(view.rootObject(), "appendRowExtraData")); @@ -116,8 +116,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Foo")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); // Call append() with a row that is an int. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -130,8 +130,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Foo")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call append() with a row with a role of the wrong type. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -144,8 +144,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Foo")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call append() with a row that is an array instead of a simple object. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -156,8 +156,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->columnCount(), 2); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call append() to insert one row. QVERIFY(QMetaObject::invokeMethod(view.rootObject(), "appendRow", Q_ARG(QVariant, QLatin1String("Max")), Q_ARG(QVariant, 40))); @@ -169,8 +169,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Max")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); // Call remove() and specify rowIndex and rows, removing all remaining rows. QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 0), Q_ARG(int, 3))); @@ -178,8 +178,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->columnCount(), 2); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")), QVariant()); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")), QVariant()); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); } void tst_QQmlTableModel::appendRowToEmptyModel() @@ -211,8 +211,8 @@ void tst_QQmlTableModel::appendRowToEmptyModel() const QHash<int, QByteArray> roleNames = model->roleNames(); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("John")); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 1); QCOMPARE(tableView->columns(), 2); } @@ -249,8 +249,8 @@ void tst_QQmlTableModel::clear() QCOMPARE(model->columnCount(), 2); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")), QVariant()); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")), QVariant()); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); // Wait until updatePolish() gets called, which is where the size is recalculated. QTRY_COMPARE(tableView->rows(), 0); QCOMPARE(tableView->columns(), 2); @@ -323,8 +323,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -339,8 +339,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -354,8 +354,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -369,8 +369,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -384,8 +384,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -399,8 +399,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); QTRY_COMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); @@ -417,8 +417,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(3, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Max")); QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); QTRY_COMPARE(tableView->rows(), 4); QCOMPARE(tableView->columns(), 2); @@ -437,8 +437,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Max")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); QTRY_COMPARE(tableView->rows(), 5); QCOMPARE(tableView->columns(), 2); } @@ -481,8 +481,8 @@ void tst_QQmlTableModel::moveRow() QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); rowCountSignalEmissions = 3; - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Try to move with a fromRowIndex that is negative. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*moveRow\\(\\): \"fromRowIndex\" cannot be negative")); @@ -490,16 +490,16 @@ void tst_QQmlTableModel::moveRow() // Shouldn't have changed. QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Try to move with a fromRowIndex that is too large. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*moveRow\\(\\): \"fromRowIndex\" 5 is greater than or equal to rowCount\\(\\)")); QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 5), Q_ARG(int, 1))); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Try to move with a toRowIndex that is negative. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*moveRow\\(\\): \"toRowIndex\" cannot be negative")); @@ -507,16 +507,16 @@ void tst_QQmlTableModel::moveRow() // Shouldn't have changed. QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Try to move with a toRowIndex that is too large. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*moveRow\\(\\): \"toRowIndex\" 5 is greater than or equal to rowCount\\(\\)")); QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 0), Q_ARG(int, 5))); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Move the first row to the end. QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 0), Q_ARG(int, 4))); @@ -533,8 +533,8 @@ void tst_QQmlTableModel::moveRow() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("John")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Move it back again. QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 4), Q_ARG(int, 0))); @@ -550,8 +550,8 @@ void tst_QQmlTableModel::moveRow() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 30); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Move the first row down one by one row. QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 0), Q_ARG(int, 1))); @@ -567,8 +567,8 @@ void tst_QQmlTableModel::moveRow() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 30); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); } void tst_QQmlTableModel::setRow() @@ -607,8 +607,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -623,8 +623,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -636,8 +636,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -651,8 +651,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -666,8 +666,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -681,8 +681,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -695,8 +695,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -709,8 +709,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Daisy")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 30); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -725,8 +725,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 30); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Wot")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); QTRY_COMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); } @@ -756,16 +756,16 @@ void tst_QQmlTableModel::setDataThroughDelegate() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); QVERIFY(QMetaObject::invokeMethod(view.rootObject(), "modify")); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("John")); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); // Test setting a role that doesn't exist for a certain column. QVERIFY(QMetaObject::invokeMethod(view.rootObject(), "modifyInvalidRole")); @@ -774,8 +774,8 @@ void tst_QQmlTableModel::setDataThroughDelegate() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); // Test setting a role with a value of the wrong type. // There are two rows, so two delegates respond to the signal, which means we need to ignore two warnings. @@ -789,8 +789,8 @@ void tst_QQmlTableModel::setDataThroughDelegate() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); } // Start off with empty rows and then set them to test rowCountChanged(). @@ -825,8 +825,8 @@ void tst_QQmlTableModel::setRowsImperatively() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); } @@ -865,8 +865,8 @@ void tst_QQmlTableModel::setRowsMultipleTimes() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 41); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Power")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 89); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); @@ -882,8 +882,8 @@ void tst_QQmlTableModel::setRowsMultipleTimes() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 41); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Power")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 89); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QCOMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); } @@ -986,8 +986,8 @@ void tst_QQmlTableModel::appendRowWithDouble() QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleKey).toDouble(), 3.5); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleKey).toString(), QLatin1String("3.5")); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); @@ -1001,8 +1001,8 @@ void tst_QQmlTableModel::appendRowWithDouble() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleKey).toDouble(), 5); QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleKey).toString(), QLatin1String("5")); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 4); QCOMPARE(tableView->columns(), 2); @@ -1015,8 +1015,8 @@ void tst_QQmlTableModel::appendRowWithDouble() // Nothing should change QCOMPARE(model->rowCount(), 4); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); QCOMPARE(tableView->rows(), 4); QCOMPARE(tableView->columns(), 2); } diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp index f572016142..736907d5f0 100644 --- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp +++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp @@ -142,13 +142,13 @@ void tst_qqmltimer::repeat() timer->setRepeating(false); QVERIFY(!timer->isRepeating()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setRepeating(false); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setRepeating(true); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete timer; } @@ -176,13 +176,13 @@ void tst_qqmltimer::triggeredOnStart() timer->setTriggeredOnStart(false); QVERIFY(!timer->triggeredOnStart()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setTriggeredOnStart(false); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setTriggeredOnStart(true); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete timer; } @@ -254,13 +254,13 @@ void tst_qqmltimer::changeDuration() timer->setInterval(200); QCOMPARE(timer->interval(), 200); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setInterval(200); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setInterval(300); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete timer; } diff --git a/tests/auto/qml/qqmltreemodeltotablemodel/testmodel.cpp b/tests/auto/qml/qqmltreemodeltotablemodel/testmodel.cpp index 8bf9561316..58587da79c 100644 --- a/tests/auto/qml/qqmltreemodeltotablemodel/testmodel.cpp +++ b/tests/auto/qml/qqmltreemodeltotablemodel/testmodel.cpp @@ -52,7 +52,7 @@ int TestModel::rowCount(const QModelIndex &parent) const if (!parent.isValid()) return 1; // root of the tree if (parent.column() == 0) - return treeItem(parent)->m_childItems.count(); + return treeItem(parent)->m_childItems.size(); return 0; } diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index d28035b266..43b86144f6 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -275,8 +275,8 @@ public: qint64 readData(char *data, qint64 maxlen) override { - if (m_buffer.length() < maxlen) - maxlen = m_buffer.length(); + if (m_buffer.size() < maxlen) + maxlen = m_buffer.size(); std::memcpy(data, m_buffer.data(), maxlen); m_buffer.remove(0, maxlen); return maxlen; @@ -351,9 +351,9 @@ public: segments.removeFirst(); } if (segments.startsWith("plugin")) { - if (segments.length() == 2) { + if (segments.size() == 2) { segments.append(path); - } else if (segments.length() == 3) { + } else if (segments.size() == 3) { if (!segments[2].startsWith('/')) segments[2] = path + segments[2]; } else { @@ -446,7 +446,7 @@ void tst_QQMLTypeLoader::intercept() QTRY_COMPARE(o->property("created").toInt(), 2); QTRY_COMPARE(o->property("loaded").toInt(), 2); - QVERIFY(factory.loadedFiles.length() >= 6); + QVERIFY(factory.loadedFiles.size() >= 6); QVERIFY(factory.loadedFiles.contains(dataDirectory() + "/test_intercept.qml")); QVERIFY(factory.loadedFiles.contains(dataDirectory() + "/Intercept.qml")); QVERIFY(factory.loadedFiles.contains(dataDirectory() + "/Fast/qmldir")); diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index f3f9d29b5c..8701fe5696 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -1160,7 +1160,7 @@ static void checkNoErrors(QQmlComponent& component) QList<QQmlError> errors = component.errors(); if (errors.isEmpty()) return; - for (int ii = 0; ii < errors.count(); ++ii) { + for (int ii = 0; ii < errors.size(); ++ii) { const QQmlError &error = errors.at(ii); qWarning("%d:%d:%s",error.line(),error.column(),error.description().toUtf8().constData()); } @@ -1690,8 +1690,8 @@ void tst_qqmlvaluetypes::sequences() { QList<BaseGadget> gadgetList{1, 4, 7, 8, 15}; QJSValue value = engine.toScriptValue(gadgetList); - QCOMPARE(value.property("length").toInt(), gadgetList.length()); - for (int i = 0; i < gadgetList.length(); ++i) + QCOMPARE(value.property("length").toInt(), gadgetList.size()); + for (int i = 0; i < gadgetList.size(); ++i) QCOMPARE(value.property(i).property("baseProperty").toInt(), gadgetList.at(i).baseProperty()); } { @@ -1704,8 +1704,8 @@ void tst_qqmlvaluetypes::sequences() { QVector<QChar> qcharVector{QChar(1), QChar(4), QChar(42), QChar(8), QChar(15)}; QJSValue value = engine.toScriptValue(qcharVector); - QCOMPARE(value.property("length").toInt(), qcharVector.length()); - for (int i = 0; i < qcharVector.length(); ++i) + QCOMPARE(value.property("length").toInt(), qcharVector.size()); + for (int i = 0; i < qcharVector.size(); ++i) QCOMPARE(value.property(i).toString(), qcharVector.at(i)); } { @@ -1767,7 +1767,7 @@ void tst_qqmlvaluetypes::enumerableProperties() names.insert(name); } - QCOMPARE(names.count(), 2); + QCOMPARE(names.size(), 2); QVERIFY(names.contains(QStringLiteral("baseProperty"))); QVERIFY(names.contains(QStringLiteral("derivedProperty"))); } diff --git a/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp b/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp index ae4dcbef02..05b8ce605d 100644 --- a/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp +++ b/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp @@ -79,7 +79,7 @@ private: const QStringList fields = item.split(QLatin1Char(',')); for (const QString &field : fields) { QStringList values = field.split(QLatin1Char('=')); - if (values.count() != 2) { + if (values.size() != 2) { qWarning() << "makeItemXmlAndData: invalid field:" << field; continue; } @@ -235,7 +235,7 @@ void tst_QQmlXmlListModel::roles() QTRY_COMPARE(model->rowCount(), 9); QHash<int, QByteArray> roleNames = model->roleNames(); - QCOMPARE(roleNames.count(), 4); + QCOMPARE(roleNames.size(), 4); QVERIFY(roleNames.key("name", -1) >= 0); QVERIFY(roleNames.key("type", -1) >= 0); QVERIFY(roleNames.key("age", -1) >= 0); @@ -246,7 +246,7 @@ void tst_QQmlXmlListModel::roles() roles.insert(roleNames.key("type")); roles.insert(roleNames.key("age")); roles.insert(roleNames.key("size")); - QCOMPARE(roles.count(), 4); + QCOMPARE(roles.size(), 4); } void tst_QQmlXmlListModel::elementErrors() @@ -294,7 +294,7 @@ void tst_QQmlXmlListModel::uniqueRoleNames() QTRY_COMPARE(model->rowCount(), 9); QHash<int, QByteArray> roleNames = model->roleNames(); - QCOMPARE(roleNames.count(), 1); + QCOMPARE(roleNames.size(), 1); } void tst_QQmlXmlListModel::headers() @@ -313,7 +313,7 @@ void tst_QQmlXmlListModel::headers() QQmlXmlListModel::Ready); // It doesn't do a network request for a local file - QCOMPARE(factory.lastSentHeaders.count(), 0); + QCOMPARE(factory.lastSentHeaders.size(), 0); model->setProperty("source", QUrl("http://localhost/filethatdoesnotexist.xml")); QTRY_COMPARE_WITH_TIMEOUT(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")), @@ -322,7 +322,7 @@ void tst_QQmlXmlListModel::headers() QVariantMap expectedHeaders; expectedHeaders["Accept"] = "application/xml,*/*"; - QCOMPARE(factory.lastSentHeaders.count(), expectedHeaders.count()); + QCOMPARE(factory.lastSentHeaders.size(), expectedHeaders.size()); for (auto it = expectedHeaders.cbegin(), end = expectedHeaders.cend(); it != end; ++it) { QVERIFY(factory.lastSentHeaders.contains(it.key())); QCOMPARE(factory.lastSentHeaders[it.key()].toString(), it.value().toString()); @@ -345,7 +345,7 @@ void tst_QQmlXmlListModel::source() QCOMPARE(model->property("progress").toDouble(), qreal(1.0)); QCOMPARE(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")), QQmlXmlListModel::Loading); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); spy.clear(); QCOMPARE(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")), QQmlXmlListModel::Ready); @@ -359,7 +359,7 @@ void tst_QQmlXmlListModel::source() QQmlXmlListModel::Null); qreal expectedProgress = (source.isLocalFile() || (source.scheme() == "qrc"_L1)) ? 1.0 : 0.0; QCOMPARE(model->property("progress").toDouble(), expectedProgress); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); spy.clear(); QCOMPARE(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")), QQmlXmlListModel::Loading); @@ -373,10 +373,10 @@ void tst_QQmlXmlListModel::source() timer.start(20000); loop.exec(); - if (spy.count() == 0 && status != QQmlXmlListModel::Ready) { + if (spy.size() == 0 && status != QQmlXmlListModel::Ready) { qWarning("QQmlXmlListModel invalid source test timed out"); } else { - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); } @@ -415,7 +415,7 @@ void tst_QQmlXmlListModel::data() for (int i = 0; i < 9; i++) { QModelIndex index = model->index(i, 0); - for (int j = 0; j < model->roleNames().count(); j++) { + for (int j = 0; j < model->roleNames().size(); j++) { QCOMPARE(model->data(index, j), QVariant()); } } @@ -442,9 +442,9 @@ void tst_QQmlXmlListModel::reload() QCoreApplication::processEvents(); QMetaObject::invokeMethod(model.get(), "reload"); QMetaObject::invokeMethod(model.get(), "reload"); - QTRY_COMPARE(spyCount.count(), 0); - QTRY_COMPARE(spyInsert.count(), 1); - QTRY_COMPARE(spyRemove.count(), 1); + QTRY_COMPARE(spyCount.size(), 0); + QTRY_COMPARE(spyInsert.size(), 1); + QTRY_COMPARE(spyRemove.size(), 1); QCOMPARE(spyInsert[0][1].toInt(), 0); QCOMPARE(spyInsert[0][2].toInt(), 8); @@ -557,14 +557,14 @@ void tst_QQmlXmlListModel::propertyChanges() QCOMPARE(role->property("name").toString(), QString("size")); QCOMPARE(role->property("elementName").toString(), QString("size")); - QCOMPARE(nameSpy.count(), 1); - QCOMPARE(elementSpy.count(), 1); + QCOMPARE(nameSpy.size(), 1); + QCOMPARE(elementSpy.size(), 1); role->setProperty("name", "size"); role->setProperty("elementName", "size"); - QCOMPARE(nameSpy.count(), 1); - QCOMPARE(elementSpy.count(), 1); + QCOMPARE(nameSpy.size(), 1); + QCOMPARE(elementSpy.size(), 1); QSignalSpy sourceSpy(model.get(), SIGNAL(sourceChanged())); QSignalSpy modelQuerySpy(model.get(), SIGNAL(queryChanged())); @@ -577,14 +577,14 @@ void tst_QQmlXmlListModel::propertyChanges() QTRY_COMPARE(model->rowCount(), 1); - QCOMPARE(sourceSpy.count(), 1); - QCOMPARE(modelQuerySpy.count(), 1); + QCOMPARE(sourceSpy.size(), 1); + QCOMPARE(modelQuerySpy.size(), 1); model->setProperty("source", QUrl("model2.xml")); model->setProperty("query", "/Pets"); - QCOMPARE(sourceSpy.count(), 1); - QCOMPARE(modelQuerySpy.count(), 1); + QCOMPARE(sourceSpy.size(), 1); + QCOMPARE(modelQuerySpy.size(), 1); QTRY_COMPARE(model->rowCount(), 1); } diff --git a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp index b98e1e9da3..7e9e070fa6 100644 --- a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp +++ b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp @@ -76,7 +76,7 @@ void tst_QV4Assembler::perfMapFile() const QByteArray contents = file.readLine(); QVERIFY(contents.endsWith('\n')); QList<QByteArray> fields = contents.split(' '); - QCOMPARE(fields.length(), 3); + QCOMPARE(fields.size(), 3); bool ok = false; const qulonglong address = fields[0].toULongLong(&ok, 16); QVERIFY(ok); diff --git a/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp b/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp index d994783e1f..a3f5c4bb70 100644 --- a/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp +++ b/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp @@ -341,7 +341,7 @@ void tst_qv4identifiertable::insertNumericStringPopulatesIdentifier() QV4::ExecutionEngine engine; const QString numeric = QStringLiteral("1"); uint subtype; - const uint hash = QV4::String::createHashValue(numeric.constData(), numeric.length(), &subtype); + const uint hash = QV4::String::createHashValue(numeric.constData(), numeric.size(), &subtype); QCOMPARE(subtype, QV4::Heap::String::StringType_ArrayIndex); QCOMPARE(engine.identifierTable->insertString(numeric)->identifier, QV4::PropertyKey::fromArrayIndex(hash)); diff --git a/tests/auto/qmldom/domitem/tst_qmldomitem.h b/tests/auto/qmldom/domitem/tst_qmldomitem.h index 0286672f54..433a92a2b2 100644 --- a/tests/auto/qmldom/domitem/tst_qmldomitem.h +++ b/tests/auto/qmldom/domitem/tst_qmldomitem.h @@ -292,7 +292,7 @@ private slots: QVERIFY(didAdd2); RefCacheEntry e2 = RefCacheEntry::forPath(env, refPath); QCOMPARE(e2.cached, RefCacheEntry::Cached::First); - QCOMPARE(e2.canonicalPaths.length(), 1); + QCOMPARE(e2.canonicalPaths.size(), 1); QCOMPARE(e2.canonicalPaths.first().toString(), env.canonicalPath().toString()); bool didAdd3 = RefCacheEntry::addForPath( env, refPath, @@ -302,7 +302,7 @@ private slots: QVERIFY(didAdd3); RefCacheEntry e3 = RefCacheEntry::forPath(env, refPath); QCOMPARE(e3.cached, RefCacheEntry::Cached::All); - QCOMPARE(e3.canonicalPaths.length(), 2); + QCOMPARE(e3.canonicalPaths.size(), 2); QCOMPARE(e3.canonicalPaths.first().toString(), env.canonicalPath().toString()); QCOMPARE(e3.canonicalPaths.last().toString(), tOwner.canonicalPath().toString()); } @@ -457,18 +457,18 @@ private slots: const PropertyInfo *p1 = reinterpret_cast<const PropertyInfo *>(wrappedPInfoPtr->m_value.data()); PropertyInfo p2 = wrappedPInfoPtr->m_value.value<PropertyInfo>(); - QCOMPARE(mPInfo.bindings.length(), 1); - QCOMPARE(mPInfo.propertyDefs.length(), 1); + QCOMPARE(mPInfo.bindings.size(), 1); + QCOMPARE(mPInfo.propertyDefs.size(), 1); QCOMPARE(mPInfo.bindings.first().toString(), mPInfo.bindings.first().toString()); QCOMPARE(mPInfo.propertyDefs.first().toString(), mPInfo.propertyDefs.first().toString()); - QCOMPARE(p2.bindings.length(), 1); - QCOMPARE(p2.propertyDefs.length(), 1); + QCOMPARE(p2.bindings.size(), 1); + QCOMPARE(p2.propertyDefs.size(), 1); QCOMPARE(p2.bindings.first().toString(), mPInfo.bindings.first().toString()); QCOMPARE(p2.propertyDefs.first().toString(), mPInfo.propertyDefs.first().toString()); - QCOMPARE(p1->bindings.length(), 1); - QCOMPARE(p1->propertyDefs.length(), 1); + QCOMPARE(p1->bindings.size(), 1); + QCOMPARE(p1->propertyDefs.size(), 1); QCOMPARE(p1->bindings.first().toString(), mPInfo.bindings.first().toString()); QCOMPARE(p1->propertyDefs.first().toString(), mPInfo.propertyDefs.first().toString()); } @@ -520,9 +520,9 @@ private slots: QList<DomItem> rectAs = obj1.lookup(u"QQ.Rectangle"_s, LookupType::Symbol, LookupOption::Normal); - QVERIFY(rect.length() == 1); - QVERIFY(rect2.length() == 1); - QVERIFY(rectAs.length() == 1); + QVERIFY(rect.size() == 1); + QVERIFY(rect2.size() == 1); + QVERIFY(rectAs.size() == 1); QCOMPARE(rect.first().internalKind(), DomType::Export); QCOMPARE(rect.first(), rect2.first()); QCOMPARE(rect.first(), rectAs.first()); @@ -536,7 +536,7 @@ private slots: return true; }, {}); - QVERIFY(rects.length() == 1); + QVERIFY(rects.size() == 1); for (DomItem &el : rects) { QCOMPARE(rect.first(), el); } diff --git a/tests/auto/qmldom/path/tst_qmldompath.h b/tests/auto/qmldom/path/tst_qmldompath.h index 565bab713e..24d8c30bcf 100644 --- a/tests/auto/qmldom/path/tst_qmldompath.h +++ b/tests/auto/qmldom/path/tst_qmldompath.h @@ -28,9 +28,9 @@ public: QCOMPARE(p11, p2); QCOMPARE(p11, p3); QVERIFY(p11.m_data->strData.isEmpty()); - QCOMPARE(p2.m_data->strData.length(), 1); + QCOMPARE(p2.m_data->strData.size(), 1); QCOMPARE(p2.m_data->strData.first(), s); - QCOMPARE(p3.m_data->strData.length(), 1); + QCOMPARE(p3.m_data->strData.size(), 1); QCOMPARE(p3.m_data->strData.first(), s); } diff --git a/tests/auto/qmlls/lifecycle/qiopipe.cpp b/tests/auto/qmlls/lifecycle/qiopipe.cpp index a3ca36ae24..416fe8257d 100644 --- a/tests/auto/qmlls/lifecycle/qiopipe.cpp +++ b/tests/auto/qmlls/lifecycle/qiopipe.cpp @@ -87,7 +87,7 @@ bool QPipeEndPoint::isSequential() const qint64 QPipeEndPoint::bytesAvailable() const { - return m_buffer.length() + QIODevice::bytesAvailable(); + return m_buffer.size() + QIODevice::bytesAvailable(); } void QPipeEndPoint::setRemoteEndPoint(QPipeEndPoint *other) @@ -97,7 +97,7 @@ void QPipeEndPoint::setRemoteEndPoint(QPipeEndPoint *other) qint64 QPipeEndPoint::readData(char *data, qint64 maxlen) { - maxlen = qMin(maxlen, static_cast<qint64>(m_buffer.length())); + maxlen = qMin(maxlen, static_cast<qint64>(m_buffer.size())); if (maxlen <= 0) return 0; @@ -116,7 +116,7 @@ qint64 QPipeEndPoint::writeData(const char *data, qint64 len) return 0; QByteArray &buffer = m_remoteEndPoint->m_buffer; - const qint64 prevLen = buffer.length(); + const qint64 prevLen = buffer.size(); Q_ASSERT(prevLen >= 0); len = qMin(len, std::numeric_limits<int>::max() - prevLen); diff --git a/tests/auto/qmlls/qmlls/tst_qmlls.cpp b/tests/auto/qmlls/qmlls/tst_qmlls.cpp index 1cfa734018..2c7a76626d 100644 --- a/tests/auto/qmlls/qmlls/tst_qmlls.cpp +++ b/tests/auto/qmlls/qmlls/tst_qmlls.cpp @@ -43,7 +43,7 @@ public: int num = 0; for (const auto ¶ms : m_received) { if (params.uri == uri) - num += params.diagnostics.length(); + num += params.diagnostics.size(); } return num; } diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index fd58dab328..d1c31a080d 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -103,7 +103,7 @@ to have them tested by the examples() test. */ void tst_examples::namingConvention(const QDir &d) { - for (int ii = 0; ii < excludedDirs.count(); ++ii) { + for (int ii = 0; ii < excludedDirs.size(); ++ii) { QString s = excludedDirs.at(ii); if (d.absolutePath().endsWith(s)) return; @@ -157,7 +157,7 @@ void tst_examples::namingConvention() QStringList tst_examples::findQmlFiles(const QDir &d) { - for (int ii = 0; ii < excludedDirs.count(); ++ii) { + for (int ii = 0; ii < excludedDirs.size(); ++ii) { QString s = excludedDirs.at(ii); if (d.absolutePath().endsWith(s)) return QStringList(); @@ -172,7 +172,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d) foreach (const QString &file, files) { if (file.at(0).isLower()) { bool superContinue = false; - for (int ii = 0; ii < excludedFiles.count(); ++ii) { + for (int ii = 0; ii < excludedFiles.size(); ++ii) { QString e = excludedFiles.at(ii); if (d.absoluteFilePath(file).endsWith(e)) { superContinue = true; diff --git a/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp b/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp index 84cfe0e7fd..7a0206c04f 100644 --- a/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp +++ b/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp @@ -103,7 +103,7 @@ void tst_FlickableInterop::touchTapButton() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 1); + QCOMPARE(tappedSpy.size(), 1); // We can drag <= dragThreshold and the button still acts normal, Flickable doesn't grab p1 = button->mapToScene(QPointF(20, 20)).toPoint(); @@ -117,7 +117,7 @@ void tst_FlickableInterop::touchTapButton() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 2); + QCOMPARE(tappedSpy.size(), 2); } void tst_FlickableInterop::touchDragFlickableBehindButton_data() @@ -167,7 +167,7 @@ void tst_FlickableInterop::touchDragFlickableBehindButton() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QVERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); } void tst_FlickableInterop::mouseClickButton_data() @@ -197,7 +197,7 @@ void tst_FlickableInterop::mouseClickButton() QTRY_VERIFY(button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 1); + QCOMPARE(tappedSpy.size(), 1); // We can drag <= dragThreshold and the button still acts normal, Flickable doesn't grab p1 = button->mapToScene(QPointF(20, 20)).toPoint(); @@ -208,7 +208,7 @@ void tst_FlickableInterop::mouseClickButton() QVERIFY(button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 2); + QCOMPARE(tappedSpy.size(), 2); } void tst_FlickableInterop::mouseDragFlickableBehindButton_data() @@ -254,7 +254,7 @@ void tst_FlickableInterop::mouseDragFlickableBehindButton() QVERIFY(!button->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QVERIFY(!button->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); } void tst_FlickableInterop::touchDragSlider() @@ -306,8 +306,8 @@ void tst_FlickableInterop::touchDragSlider() // Release, and do not expect the tapped signal QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); - QCOMPARE(tappedSpy.count(), 0); - QCOMPARE(translationChangedSpy.count(), 1); + QCOMPARE(tappedSpy.size(), 0); + QCOMPARE(translationChangedSpy.size(), 1); } void tst_FlickableInterop::mouseDragSlider_data() @@ -391,8 +391,8 @@ void tst_FlickableInterop::mouseDragSlider() // Release, and do not expect the tapped signal QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); - QCOMPARE(tappedSpy.count(), 0); - QCOMPARE(translationChangedSpy.count(), expectedDragHandlerActive ? 1 : 0); + QCOMPARE(tappedSpy.size(), 0); + QCOMPARE(translationChangedSpy.size(), expectedDragHandlerActive ? 1 : 0); } void tst_FlickableInterop::touchDragFlickableBehindSlider() @@ -437,8 +437,8 @@ void tst_FlickableInterop::touchDragFlickableBehindSlider() QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QVERIFY(!slider->property("pressed").toBool()); - QCOMPARE(tappedSpy.count(), 0); - QCOMPARE(translationChangedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); + QCOMPARE(translationChangedSpy.size(), 0); } void tst_FlickableInterop::mouseDragFlickableBehindSlider() @@ -479,8 +479,8 @@ void tst_FlickableInterop::mouseDragFlickableBehindSlider() QCOMPARE(i, 2); QVERIFY(!slider->property("pressed").toBool()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); - QCOMPARE(tappedSpy.count(), 0); - QCOMPARE(translationChangedSpy.count(), 0); + QCOMPARE(tappedSpy.size(), 0); + QCOMPARE(translationChangedSpy.size(), 0); } void tst_FlickableInterop::touchDragFlickableBehindItemWithHandlers_data() diff --git a/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp b/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp index c4059a1fbd..723ad0b63e 100644 --- a/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp @@ -178,11 +178,11 @@ void tst_MouseAreaInterop::hoverHandlerDoesntHoverOnPress() // QTBUG-72843 QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_COMPARE(ma->pressed(), true); QCOMPARE(handler->isHovered(), true); - QCOMPARE(hoveredChangedSpy.count(), 0); + QCOMPARE(hoveredChangedSpy.size(), 0); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_COMPARE(ma->pressed(), false); QCOMPARE(handler->isHovered(), true); - QCOMPARE(hoveredChangedSpy.count(), 0); + QCOMPARE(hoveredChangedSpy.size(), 0); } void tst_MouseAreaInterop::doubleClickInMouseAreaWithDragHandlerInGrandparent() @@ -199,8 +199,8 @@ void tst_MouseAreaInterop::doubleClickInMouseAreaWithDragHandlerInGrandparent() QPoint p = ma->mapToScene(ma->boundingRect().center()).toPoint(); QTest::mouseDClick(&window, Qt::LeftButton, Qt::NoModifier, p); - QCOMPARE(dClickSpy.count(), 1); - QCOMPARE(dragActiveSpy.count(), 0); + QCOMPARE(dClickSpy.size(), 1); + QCOMPARE(dragActiveSpy.size(), 0); } QTEST_MAIN(tst_MouseAreaInterop) diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp index f2c6ce5ee6..0aa96b6c59 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp @@ -145,7 +145,7 @@ void tst_MptaInterop::touchesThenPinch() QQuickTouchUtils::flush(window); QVERIFY(tp.at(0)->property("pressed").toBool()); QTRY_VERIFY(tp.at(1)->property("pressed").toBool()); - QCOMPARE(mptaPressedSpy.count(), 2); + QCOMPARE(mptaPressedSpy.size(), 2); // Press a third touchpoint: MPTA grabs it too QPoint p3 = mpta->mapToScene(QPointF(110, 200)).toPoint(); @@ -154,8 +154,8 @@ void tst_MptaInterop::touchesThenPinch() QCOMPARE(tp.at(0)->property("pressed").toBool(), true); QCOMPARE(tp.at(1)->property("pressed").toBool(), true); QCOMPARE(tp.at(2)->property("pressed").toBool(), true); - QCOMPARE(mptaPressedSpy.count(), 3); - QCOMPARE(mptaCanceledSpy.count(), 0); + QCOMPARE(mptaPressedSpy.size(), 3); + QCOMPARE(mptaCanceledSpy.size(), 0); QCOMPARE(devPriv->pointById(1)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(2)->exclusiveGrabber, mpta); QCOMPARE(devPriv->pointById(3)->exclusiveGrabber, mpta); @@ -254,7 +254,7 @@ void tst_MptaInterop::touchesThenPinch() touch.release(2, p2).commit(); QQuickTouchUtils::flush(window); - QTRY_COMPARE(mptaReleasedSpy.count(), 1); + QTRY_COMPARE(mptaReleasedSpy.size(), 1); } void tst_MptaInterop::unloadHandlerWithPassiveGrab() diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp index 1f8b73a919..0cb82bacc7 100644 --- a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp @@ -153,21 +153,21 @@ void tst_DragHandler::touchDrag() QCOMPARE(dragHandler->centroid().scenePosition(), scenePressPos); QCOMPARE(dragHandler->centroid().scenePressPosition(), scenePressPos); QCOMPARE(dragHandler->centroid().velocity(), QVector2D()); - QCOMPARE(centroidChangedSpy.count(), 1); + QCOMPARE(centroidChangedSpy.size(), 1); p1 += QPoint(dragThreshold, 0); QTest::touchEvent(window, touchDevice).move(1, p1, window); QQuickTouchUtils::flush(window); qCDebug(lcPointerTests) << "velocity after drag" << dragHandler->centroid().velocity(); if (dragThreshold > 0) QTRY_VERIFY(!qFuzzyIsNull(dragHandler->centroid().velocity().x())); - QCOMPARE(centroidChangedSpy.count(), 2); + QCOMPARE(centroidChangedSpy.size(), 2); QVERIFY(!dragHandler->active()); p1 += QPoint(1, 0); QTest::touchEvent(window, touchDevice).move(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(dragHandler->active()); - QCOMPARE(translationChangedSpy.count(), 0); - QCOMPARE(centroidChangedSpy.count(), 3); + QCOMPARE(translationChangedSpy.size(), 0); + QCOMPARE(centroidChangedSpy.size(), 3); QCOMPARE(dragHandler->persistentTranslation().x(), 0); QCOMPARE(dragHandler->activeTranslation().x(), 0); QPointF sceneGrabPos = p1; @@ -186,15 +186,15 @@ void tst_DragHandler::touchDrag() QCOMPARE(dragHandler->persistentTranslation().y(), 0); QCOMPARE(dragHandler->activeTranslation().y(), 0); QVERIFY(dragHandler->centroid().velocity().x() > 0); - QCOMPARE(centroidChangedSpy.count(), 4); + QCOMPARE(centroidChangedSpy.size(), 4); QTest::touchEvent(window, touchDevice).release(1, p1, window); QQuickTouchUtils::flush(window); QTRY_VERIFY(!dragHandler->active()); QCOMPARE(dragHandler->centroid().pressedButtons(), Qt::NoButton); QCOMPARE(dragHandler->centroid().velocity(), QVector2D()); QCOMPARE(ball->mapToScene(ballCenter).toPoint(), p1); - QCOMPARE(translationChangedSpy.count(), 1); - QCOMPARE(centroidChangedSpy.count(), 5); + QCOMPARE(translationChangedSpy.size(), 1); + QCOMPARE(centroidChangedSpy.size(), 5); QCOMPARE(dragHandler->persistentTranslation().x(), dragThreshold + 20); // Drag again: activeTranslation starts over, while persistentTranslation accumulates @@ -290,13 +290,13 @@ void tst_DragHandler::mouseDrag() QCOMPARE(dragHandler->centroid().scenePosition(), scenePressPos); QCOMPARE(dragHandler->centroid().scenePressPosition(), scenePressPos); QCOMPARE(dragHandler->centroid().velocity(), QVector2D()); - QCOMPARE(centroidChangedSpy.count(), 1); + QCOMPARE(centroidChangedSpy.size(), 1); } p1 += QPoint(dragThreshold, 0); QTest::mouseMove(window, p1); if (shouldDrag) { // QTRY_VERIFY(dragHandler->centroid().velocity().x() > 0); // TODO QTBUG-33891 - QCOMPARE(centroidChangedSpy.count(), 2); + QCOMPARE(centroidChangedSpy.size(), 2); QVERIFY(!dragHandler->active()); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); @@ -308,9 +308,9 @@ void tst_DragHandler::mouseDrag() QTRY_VERIFY(dragHandler->active()); else QVERIFY(!dragHandler->active()); - QCOMPARE(translationChangedSpy.count(), 0); + QCOMPARE(translationChangedSpy.size(), 0); if (shouldDrag) - QCOMPARE(centroidChangedSpy.count(), 3); + QCOMPARE(centroidChangedSpy.size(), 3); QCOMPARE(dragHandler->persistentTranslation().x(), 0.0); QCOMPARE(dragHandler->activeTranslation().x(), 0.0); QPointF sceneGrabPos = p1; @@ -330,7 +330,7 @@ void tst_DragHandler::mouseDrag() QCOMPARE(dragHandler->persistentTranslation().y(), 0.0); QCOMPARE(dragHandler->activeTranslation().y(), 0.0); // QVERIFY(dragHandler->centroid().velocity().x() > 0); // TODO QTBUG-33891 - QCOMPARE(centroidChangedSpy.count(), 4); + QCOMPARE(centroidChangedSpy.size(), 4); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ClosedHandCursor); #endif @@ -340,8 +340,8 @@ void tst_DragHandler::mouseDrag() QCOMPARE(dragHandler->centroid().pressedButtons(), Qt::NoButton); if (shouldDrag) QCOMPARE(ball->mapToScene(ballCenter).toPoint(), p1); - QCOMPARE(translationChangedSpy.count(), shouldDrag ? 1 : 0); - QCOMPARE(centroidChangedSpy.count(), shouldDrag ? 5 : 0); + QCOMPARE(translationChangedSpy.size(), shouldDrag ? 1 : 0); + QCOMPARE(centroidChangedSpy.size(), shouldDrag ? 5 : 0); #if QT_CONFIG(cursor) QTest::mouseMove(window, p1 + QPoint(1, 0)); // TODO after fixing QTBUG-53987, don't send mouseMove QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); @@ -388,19 +388,19 @@ void tst_DragHandler::mouseDragThreshold() QCOMPARE(dragHandler->centroid().scenePosition(), scenePressPos); QCOMPARE(dragHandler->centroid().scenePressPosition(), scenePressPos); QCOMPARE(dragHandler->centroid().velocity(), QVector2D()); - QCOMPARE(centroidChangedSpy.count(), 1); + QCOMPARE(centroidChangedSpy.size(), 1); p1 += QPoint(qMax(1, dragThreshold), 0); // QTBUG-85431: zero-distance mouse moves are not delivered QTest::mouseMove(window, p1); if (dragThreshold > 0) QTRY_VERIFY(dragHandler->centroid().velocity().x() > 0); - QCOMPARE(centroidChangedSpy.count(), 2); + QCOMPARE(centroidChangedSpy.size(), 2); // the handler is not yet active, unless the drag threshold was already exceeded QCOMPARE(dragHandler->active(), dragThreshold == 0); p1 += QPoint(1, 0); QTest::mouseMove(window, p1); QTRY_VERIFY(dragHandler->active()); - QCOMPARE(translationChangedSpy.count(), dragThreshold ? 0 : 1); - QCOMPARE(centroidChangedSpy.count(), 3); + QCOMPARE(translationChangedSpy.size(), dragThreshold ? 0 : 1); + QCOMPARE(centroidChangedSpy.size(), 3); QCOMPARE(dragHandler->translation().x(), dragThreshold ? 0 : 2); QPointF sceneGrabPos = dragThreshold ? p1 : p1 - QPoint(1, 0); QCOMPARE(dragHandler->centroid().sceneGrabPosition(), sceneGrabPos); @@ -415,13 +415,13 @@ void tst_DragHandler::mouseDragThreshold() QCOMPARE(dragHandler->translation().x(), dragThreshold + (dragThreshold ? 20 : 21)); QCOMPARE(dragHandler->translation().y(), 0.0); QVERIFY(dragHandler->centroid().velocity().x() > 0); - QCOMPARE(centroidChangedSpy.count(), 4); + QCOMPARE(centroidChangedSpy.size(), 4); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_VERIFY(!dragHandler->active()); QCOMPARE(dragHandler->centroid().pressedButtons(), Qt::NoButton); QCOMPARE(ball->mapToScene(ballCenter).toPoint(), p1); - QCOMPARE(translationChangedSpy.count(), dragThreshold ? 1 : 2); - QCOMPARE(centroidChangedSpy.count(), 5); + QCOMPARE(translationChangedSpy.size(), dragThreshold ? 1 : 2); + QCOMPARE(centroidChangedSpy.size(), 5); } void tst_DragHandler::dragFromMargin() // QTBUG-74966 @@ -574,13 +574,13 @@ void tst_DragHandler::touchDragMulti() touchSeq.stationary(1).press(2, p2, window).commit(); QQuickTouchUtils::flush(window); QVERIFY(!dragHandler1->active()); - QCOMPARE(centroidChangedSpy1.count(), 2); + QCOMPARE(centroidChangedSpy1.size(), 2); QCOMPARE(dragHandler1->centroid().position(), ball1Center); QCOMPARE(dragHandler1->centroid().pressPosition(), ball1Center); QCOMPARE(dragHandler1->centroid().scenePosition(), scenePressPos1); QCOMPARE(dragHandler1->centroid().scenePressPosition(), scenePressPos1); QVERIFY(!dragHandler2->active()); - QCOMPARE(centroidChangedSpy2.count(), 2); + QCOMPARE(centroidChangedSpy2.size(), 2); QCOMPARE(dragHandler2->centroid().position(), ball2Center); QCOMPARE(dragHandler2->centroid().pressPosition(), ball2Center); QCOMPARE(dragHandler2->centroid().scenePosition(), scenePressPos2); @@ -590,13 +590,13 @@ void tst_DragHandler::touchDragMulti() touchSeq.move(1, p1, window).move(2, p2, window).commit(); QQuickTouchUtils::flush(window); QVERIFY(!dragHandler1->active()); - QCOMPARE(centroidChangedSpy1.count(), 3); + QCOMPARE(centroidChangedSpy1.size(), 3); QCOMPARE(dragHandler1->centroid().position(), ball1Center + QPointF(dragThreshold, 0)); QCOMPARE(dragHandler1->centroid().pressPosition(), ball1Center); QCOMPARE(dragHandler1->centroid().scenePosition().toPoint(), p1); QCOMPARE(dragHandler1->centroid().scenePressPosition(), scenePressPos1); QVERIFY(!dragHandler2->active()); - QCOMPARE(centroidChangedSpy2.count(), 3); + QCOMPARE(centroidChangedSpy2.size(), 3); QCOMPARE(dragHandler2->centroid().position(), ball2Center + QPointF(0, dragThreshold)); QCOMPARE(dragHandler2->centroid().pressPosition(), ball2Center); QCOMPARE(dragHandler2->centroid().scenePosition().toPoint(), p2); @@ -607,7 +607,7 @@ void tst_DragHandler::touchDragMulti() QQuickTouchUtils::flush(window); QTRY_VERIFY(dragHandler1->active()); QVERIFY(dragHandler2->active()); - QCOMPARE(translationChangedSpy1.count(), 0); + QCOMPARE(translationChangedSpy1.size(), 0); QCOMPARE(dragHandler1->translation().x(), 0.0); QPointF sceneGrabPos1 = p1; QPointF sceneGrabPos2 = p2; @@ -616,7 +616,7 @@ void tst_DragHandler::touchDragMulti() p1 += QPoint(19, 0); p2 += QPoint(0, 19); QVERIFY(dragHandler2->active()); - QCOMPARE(translationChangedSpy2.count(), 0); + QCOMPARE(translationChangedSpy2.size(), 0); QCOMPARE(dragHandler2->translation().x(), 0.0); QCOMPARE(dragHandler2->centroid().sceneGrabPosition(), sceneGrabPos2); touchSeq.move(1, p1, window).move(2, p2, window).commit(); @@ -643,12 +643,12 @@ void tst_DragHandler::touchDragMulti() QVERIFY(dragHandler2->active()); QCOMPARE(dragHandler1->centroid().pressedButtons(), Qt::NoButton); QCOMPARE(ball1->mapToScene(ball1Center).toPoint(), p1); - QCOMPARE(translationChangedSpy1.count(), 1); + QCOMPARE(translationChangedSpy1.size(), 1); touchSeq.release(2, p2, window).commit(); QQuickTouchUtils::flush(window); QTRY_VERIFY(!dragHandler2->active()); QCOMPARE(ball2->mapToScene(ball2Center).toPoint(), p2); - QCOMPARE(translationChangedSpy2.count(), 1); + QCOMPARE(translationChangedSpy2.size(), 1); } void tst_DragHandler::touchDragMultiSliders_data() @@ -854,7 +854,7 @@ void tst_DragHandler::touchPinchAndMouseMove() for (int i = 0; i < 10; ++i) { p1 += delta; QTest::mouseMove(window, p1); - QCOMPARE(rectMovedSpy.count(), 0); + QCOMPARE(rectMovedSpy.size(), 0); } } diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp index ae1cd3a7fc..e488c0486f 100644 --- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp @@ -101,45 +101,45 @@ void tst_HoverHandler::hoverHandlerAndUnderlyingHoverHandler() QTest::mouseMove(window, outOfSidebar); QCOMPARE(topSidebarHH->isHovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 0); + QCOMPARE(sidebarHoveredSpy.size(), 0); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, buttonCenter); QCOMPARE(topSidebarHH->isHovered(), !blocking); - QCOMPARE(sidebarHoveredSpy.count(), blocking ? 2 : 1); + QCOMPARE(sidebarHoveredSpy.size(), blocking ? 2 : 1); QCOMPARE(buttonHH->isHovered(), true); - QCOMPARE(buttonHoveredSpy.count(), 1); + QCOMPARE(buttonHoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::PointingHandCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), blocking ? 3 : 1); + QCOMPARE(sidebarHoveredSpy.size(), blocking ? 3 : 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, outOfSidebar); QCOMPARE(topSidebarHH->isHovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), blocking ? 4 : 2); + QCOMPARE(sidebarHoveredSpy.size(), blocking ? 4 : 2); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif @@ -172,45 +172,45 @@ void tst_HoverHandler::mouseAreaAndUnderlyingHoverHandler() QTest::mouseMove(window, outOfSidebar); QCOMPARE(topSidebarHH->isHovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 0); + QCOMPARE(sidebarHoveredSpy.size(), 0); QCOMPARE(buttonMA->hovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonMA->hovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, buttonCenter); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonMA->hovered(), true); - QCOMPARE(buttonHoveredSpy.count(), 1); + QCOMPARE(buttonHoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::UpArrowCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(topSidebarHH->isHovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonMA->hovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, outOfSidebar); QCOMPARE(topSidebarHH->isHovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 2); + QCOMPARE(sidebarHoveredSpy.size(), 2); QCOMPARE(buttonMA->hovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif @@ -238,45 +238,45 @@ void tst_HoverHandler::hoverHandlerAndUnderlyingMouseArea() QTest::mouseMove(window, outOfSidebar); QCOMPARE(bottomSidebarMA->hovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 0); + QCOMPARE(sidebarHoveredSpy.size(), 0); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(bottomSidebarMA->hovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ClosedHandCursor); #endif QTest::mouseMove(window, buttonCenter); QCOMPARE(bottomSidebarMA->hovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 2); + QCOMPARE(sidebarHoveredSpy.size(), 2); QCOMPARE(buttonHH->isHovered(), true); - QCOMPARE(buttonHoveredSpy.count(), 1); + QCOMPARE(buttonHoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::PointingHandCursor); #endif QTest::mouseMove(window, rightOfButton); QCOMPARE(bottomSidebarMA->hovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 3); + QCOMPARE(sidebarHoveredSpy.size(), 3); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ClosedHandCursor); #endif QTest::mouseMove(window, outOfSidebar); QCOMPARE(bottomSidebarMA->hovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 4); + QCOMPARE(sidebarHoveredSpy.size(), 4); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif @@ -311,21 +311,21 @@ void tst_HoverHandler::disabledHoverHandlerAndUnderlyingMouseArea() QTest::mouseMove(window, outOfSidebar); QCOMPARE(bottomSidebarMA->hovered(), false); - QCOMPARE(sidebarHoveredSpy.count(), 0); + QCOMPARE(sidebarHoveredSpy.size(), 0); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); QTest::mouseMove(window, buttonCenter); QCOMPARE(bottomSidebarMA->hovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); QTest::mouseMove(window, rightOfButton); QCOMPARE(bottomSidebarMA->hovered(), true); - QCOMPARE(sidebarHoveredSpy.count(), 1); + QCOMPARE(sidebarHoveredSpy.size(), 1); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); } void tst_HoverHandler::hoverHandlerOnDisabledItem() @@ -352,15 +352,15 @@ void tst_HoverHandler::hoverHandlerOnDisabledItem() QTest::mouseMove(window, rightOfButton); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 0); + QCOMPARE(buttonHoveredSpy.size(), 0); QTest::mouseMove(window, buttonCenter); QCOMPARE(buttonHH->isHovered(), true); - QCOMPARE(buttonHoveredSpy.count(), 1); + QCOMPARE(buttonHoveredSpy.size(), 1); QTest::mouseMove(window, rightOfButton); QCOMPARE(buttonHH->isHovered(), false); - QCOMPARE(buttonHoveredSpy.count(), 2); + QCOMPARE(buttonHoveredSpy.size(), 2); } void tst_HoverHandler::movingItemWithHoverHandler() @@ -416,21 +416,21 @@ void tst_HoverHandler::margin() // QTBUG-85303 QTest::mouseMove(window, {10, 10}); QCOMPARE(hh->isHovered(), false); - QCOMPARE(hoveredSpy.count(), 0); + QCOMPARE(hoveredSpy.size(), 0); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::ArrowCursor); #endif QTest::mouseMove(window, leftMargin); QCOMPARE(hh->isHovered(), true); - QCOMPARE(hoveredSpy.count(), 1); + QCOMPARE(hoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif QTest::mouseMove(window, itemCenter); QCOMPARE(hh->isHovered(), true); - QCOMPARE(hoveredSpy.count(), 1); + QCOMPARE(hoveredSpy.size(), 1); #if QT_CONFIG(cursor) QCOMPARE(window->cursor().shape(), Qt::OpenHandCursor); #endif @@ -596,12 +596,12 @@ void tst_HoverHandler::addHandlerFromCpp() // Move mouse inside child QTest::mouseMove(window.data(), inside); QVERIFY(handler->isHovered()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // Move mouse outside child QTest::mouseMove(window.data(), outside); QVERIFY(!handler->isHovered()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // Remove the parent item from the handler spy.clear(); @@ -610,12 +610,12 @@ void tst_HoverHandler::addHandlerFromCpp() // Move mouse inside child QTest::mouseMove(window.data(), inside); QVERIFY(!handler->isHovered()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // Move mouse outside child QTest::mouseMove(window.data(), outside); QVERIFY(!handler->isHovered()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // Reparent back the item to the handler spy.clear(); @@ -624,12 +624,12 @@ void tst_HoverHandler::addHandlerFromCpp() // Move mouse inside child QTest::mouseMove(window.data(), inside); QVERIFY(handler->isHovered()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // Move mouse outside child QTest::mouseMove(window.data(), outside); QVERIFY(!handler->isHovered()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_HoverHandler::ensureHoverHandlerWorksWhenItemHasHoverDisabled() @@ -663,12 +663,12 @@ void tst_HoverHandler::ensureHoverHandlerWorksWhenItemHasHoverDisabled() // Move mouse inside child QTest::mouseMove(window.data(), inside); QVERIFY(handler->isHovered()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // Move mouse outside child QTest::mouseMove(window.data(), outside); QVERIFY(!handler->isHovered()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } QTEST_MAIN(tst_HoverHandler) diff --git a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp index 4104fea7e2..ea97d576cf 100644 --- a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp @@ -75,9 +75,9 @@ void tst_QQuickPinchHandler::pinchProperties() QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(pinchHandler, SIGNAL(targetChanged())); pinchHandler->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); pinchHandler->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); // axis /* @@ -139,14 +139,14 @@ void tst_QQuickPinchHandler::pinchProperties() QCOMPARE(pinchHandler->minimumScale(), 0.25); QCOMPARE(pinchHandler->maximumScale(), 1.5); - QCOMPARE(scaleMinSpy.count(),1); - QCOMPARE(scaleMaxSpy.count(),1); + QCOMPARE(scaleMinSpy.size(),1); + QCOMPARE(scaleMaxSpy.size(),1); pinchHandler->setMinimumScale(0.25); pinchHandler->setMaximumScale(1.5); - QCOMPARE(scaleMinSpy.count(),1); - QCOMPARE(scaleMaxSpy.count(),1); + QCOMPARE(scaleMinSpy.size(),1); + QCOMPARE(scaleMaxSpy.size(),1); // minimum and maximum rotation properties QSignalSpy rotMinSpy(pinchHandler, SIGNAL(minimumRotationChanged())); @@ -161,14 +161,14 @@ void tst_QQuickPinchHandler::pinchProperties() QCOMPARE(pinchHandler->minimumRotation(), -90.0); QCOMPARE(pinchHandler->maximumRotation(), 45.0); - QCOMPARE(rotMinSpy.count(),1); - QCOMPARE(rotMaxSpy.count(),1); + QCOMPARE(rotMinSpy.size(),1); + QCOMPARE(rotMaxSpy.size(),1); pinchHandler->setMinimumRotation(-90.0); pinchHandler->setMaximumRotation(45.0); - QCOMPARE(rotMinSpy.count(),1); - QCOMPARE(rotMaxSpy.count(),1); + QCOMPARE(rotMinSpy.size(),1); + QCOMPARE(rotMaxSpy.size(),1); } QEventPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) diff --git a/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp index d8116efb35..1a32a25bd8 100644 --- a/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp @@ -83,20 +83,20 @@ void tst_PointHandler::singleTouch() QTest::touchEvent(window, touchDevice).press(1, point, window); QQuickTouchUtils::flush(window); QTRY_COMPARE(handler->active(), true); - QCOMPARE(activeSpy.count(), 1); - QCOMPARE(pointSpy.count(), 1); + QCOMPARE(activeSpy.size(), 1); + QCOMPARE(pointSpy.size(), 1); QCOMPARE(handler->point().position().toPoint(), point); QCOMPARE(handler->point().scenePosition().toPoint(), point); QCOMPARE(handler->point().pressedButtons(), Qt::NoButton); QCOMPARE(handler->translation(), QVector2D()); - QCOMPARE(translationSpy.count(), 1); + QCOMPARE(translationSpy.size(), 1); point += QPoint(10, 10); QTest::touchEvent(window, touchDevice).move(1, point, window); QQuickTouchUtils::flush(window); QCOMPARE(handler->active(), true); - QCOMPARE(activeSpy.count(), 1); - QCOMPARE(pointSpy.count(), 2); + QCOMPARE(activeSpy.size(), 1); + QCOMPARE(pointSpy.size(), 2); QCOMPARE(handler->point().position().toPoint(), point); QCOMPARE(handler->point().scenePosition().toPoint(), point); QCOMPARE(handler->point().pressPosition().toPoint(), QPoint(100, 100)); @@ -105,15 +105,15 @@ void tst_PointHandler::singleTouch() QVERIFY(handler->point().velocity().x() > 0); QVERIFY(handler->point().velocity().y() > 0); QCOMPARE(handler->translation(), QVector2D(10, 10)); - QCOMPARE(translationSpy.count(), 2); + QCOMPARE(translationSpy.size(), 2); QTest::touchEvent(window, touchDevice).release(1, point, window); QQuickTouchUtils::flush(window); QTRY_COMPARE(handler->active(), false); - QCOMPARE(activeSpy.count(), 2); - QCOMPARE(pointSpy.count(), 3); + QCOMPARE(activeSpy.size(), 2); + QCOMPARE(pointSpy.size(), 3); QCOMPARE(handler->translation(), QVector2D()); - QCOMPARE(translationSpy.count(), 3); + QCOMPARE(translationSpy.size(), 3); } void tst_PointHandler::tabletStylus() @@ -139,8 +139,8 @@ void tst_PointHandler::tabletStylus() QWindowSystemInterface::handleTabletEvent(window, point, window->mapToGlobal(point), int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::LeftButton, 0.5, 25, 35, 0.6, 12.3, 3, stylusId, Qt::NoModifier); QTRY_COMPARE(handler->active(), true); - QCOMPARE(activeSpy.count(), 1); - QCOMPARE(pointSpy.count(), 1); + QCOMPARE(activeSpy.size(), 1); + QCOMPARE(pointSpy.size(), 1); QCOMPARE(handler->point().position().toPoint(), pointLocalDPI); QCOMPARE(handler->point().scenePosition().toPoint(), pointLocalDPI); QCOMPARE(handler->point().pressedButtons(), Qt::LeftButton); @@ -148,16 +148,16 @@ void tst_PointHandler::tabletStylus() QCOMPARE(handler->point().rotation(), 12.3); QCOMPARE(handler->point().uniqueId().numericId(), stylusId); QCOMPARE(handler->translation(), QVector2D()); - QCOMPARE(translationSpy.count(), 1); + QCOMPARE(translationSpy.size(), 1); QPoint delta(10, 10); QPoint deltaLocalDPI = QHighDpi::fromNativeLocalPosition(delta, window); point += delta; QWindowSystemInterface::handleTabletEvent(window, point, window->mapToGlobal(point), int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::LeftButton, 0.45, 23, 33, 0.57, 15.6, 3, stylusId, Qt::NoModifier); - QTRY_COMPARE(pointSpy.count(), 2); + QTRY_COMPARE(pointSpy.size(), 2); QCOMPARE(handler->active(), true); - QCOMPARE(activeSpy.count(), 1); + QCOMPARE(activeSpy.size(), 1); QCOMPARE(handler->point().position().toPoint(), pointLocalDPI + deltaLocalDPI); QCOMPARE(handler->point().scenePosition().toPoint(), pointLocalDPI + deltaLocalDPI); QCOMPARE(handler->point().pressPosition().toPoint(), pointLocalDPI); @@ -169,15 +169,15 @@ void tst_PointHandler::tabletStylus() QVERIFY(handler->point().velocity().x() > 0); QVERIFY(handler->point().velocity().y() > 0); QCOMPARE(handler->translation(), QVector2D(deltaLocalDPI)); - QCOMPARE(translationSpy.count(), 2); + QCOMPARE(translationSpy.size(), 2); QWindowSystemInterface::handleTabletEvent(window, point, window->mapToGlobal(point), int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::NoButton, 0, 0, 0, 0, 0, 0, stylusId, Qt::NoModifier); QTRY_COMPARE(handler->active(), false); - QCOMPARE(activeSpy.count(), 2); - QCOMPARE(pointSpy.count(), 3); + QCOMPARE(activeSpy.size(), 2); + QCOMPARE(pointSpy.size(), 3); QCOMPARE(handler->translation(), QVector2D()); - QCOMPARE(translationSpy.count(), 3); + QCOMPARE(translationSpy.size(), 3); } void tst_PointHandler::simultaneousMultiTouch() @@ -186,7 +186,7 @@ void tst_PointHandler::simultaneousMultiTouch() createView(windowPtr, "multiPointTracker.qml"); QQuickView * window = windowPtr.data(); QList<QQuickPointHandler *> handlers = window->rootObject()->findChildren<QQuickPointHandler *>(); - QCOMPARE(handlers.count(), 3); + QCOMPARE(handlers.size(), 3); QVector<QSignalSpy*> activeSpies; QVector<QSignalSpy*> pointSpies; @@ -205,8 +205,8 @@ void tst_PointHandler::simultaneousMultiTouch() int i = 0; for (auto h : handlers) { QTRY_COMPARE(h->active(), true); - QCOMPARE(activeSpies[i]->count(), 1); - QCOMPARE(pointSpies[i]->count(), 1); + QCOMPARE(activeSpies[i]->size(), 1); + QCOMPARE(pointSpies[i]->size(), 1); int chosenPointIndex = points.indexOf(h->point().position().toPoint()); QVERIFY(chosenPointIndex != -1); // Verify that each handler chose a unique point @@ -216,7 +216,7 @@ void tst_PointHandler::simultaneousMultiTouch() QCOMPARE(h->point().scenePosition().toPoint(), point); QCOMPARE(h->point().pressedButtons(), Qt::NoButton); QCOMPARE(h->translation(), QVector2D()); - QCOMPARE(translationSpies[i]->count(), 1); + QCOMPARE(translationSpies[i]->size(), 1); ++i; } @@ -227,8 +227,8 @@ void tst_PointHandler::simultaneousMultiTouch() i = 0; for (auto h : handlers) { QCOMPARE(h->active(), true); - QCOMPARE(activeSpies[i]->count(), 1); - QCOMPARE(pointSpies[i]->count(), 2); + QCOMPARE(activeSpies[i]->size(), 1); + QCOMPARE(pointSpies[i]->size(), 2); QCOMPARE(h->point().position().toPoint(), points[pointIndexPerHandler[i]]); QCOMPARE(h->point().scenePosition().toPoint(), points[pointIndexPerHandler[i]]); QCOMPARE(h->point().pressPosition().toPoint(), pressPoints[pointIndexPerHandler[i]]); @@ -237,7 +237,7 @@ void tst_PointHandler::simultaneousMultiTouch() QVERIFY(h->point().velocity().x() > 0); QVERIFY(h->point().velocity().y() > 0); QCOMPARE(h->translation(), QVector2D(10 + 10 * pointIndexPerHandler[i], 10 + 10 * pointIndexPerHandler[i] % 2)); - QCOMPARE(translationSpies[i]->count(), 2); + QCOMPARE(translationSpies[i]->size(), 2); ++i; } @@ -246,10 +246,10 @@ void tst_PointHandler::simultaneousMultiTouch() i = 0; for (auto h : handlers) { QTRY_COMPARE(h->active(), false); - QCOMPARE(activeSpies[i]->count(), 2); - QCOMPARE(pointSpies[i]->count(), 3); + QCOMPARE(activeSpies[i]->size(), 2); + QCOMPARE(pointSpies[i]->size(), 3); QCOMPARE(h->translation(), QVector2D()); - QCOMPARE(translationSpies[i]->count(), 3); + QCOMPARE(translationSpies[i]->size(), 3); ++i; } @@ -363,7 +363,7 @@ void tst_PointHandler::pressedMultipleButtons() QPoint point(100,100); - for (int i = 0; i < buttons.count(); ++i) { + for (int i = 0; i < buttons.size(); ++i) { int btns = int(buttons.at(i)); int release = 0; if (i > 0) { @@ -383,8 +383,8 @@ void tst_PointHandler::pressedMultipleButtons() QTest::mousePress(windowPtr.data(), Qt::NoButton, Qt::NoModifier, point); QCOMPARE(handler->active(), false); - QCOMPARE(activeSpy.count(), activeChangeCount); - QCOMPARE(pointSpy.count(), changeCount); + QCOMPARE(activeSpy.size(), activeChangeCount); + QCOMPARE(pointSpy.size(), changeCount); } void tst_PointHandler::ignoreSystemSynthMouse() // QTBUG-104890 diff --git a/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp b/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp index 3b9599e435..d87acc3200 100644 --- a/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp @@ -165,13 +165,13 @@ void tst_QQuickWheelHandler::singleHandler() sendWheelEvent(window, eventPos, eventAngleDelta, eventPixelDelta, eventModifiers, Qt::NoScrollPhase, eventInverted); } QCOMPARE(rect->position().toPoint(), expectedPosition); - QCOMPARE(activeChangedSpy.count(), 1); + QCOMPARE(activeChangedSpy.size(), 1); QCOMPARE(handler->active(), true); QCOMPARE(rect->scale(), expectedScale); QCOMPARE(rect->rotation(), expectedRotation); if (!eventPhases) { QTRY_COMPARE(handler->active(), false); - QCOMPARE(activeChangedSpy.count(), 2); + QCOMPARE(activeChangedSpy.size(), 2); } // restore by rotating backwards @@ -181,7 +181,7 @@ void tst_QQuickWheelHandler::singleHandler() } else { sendWheelEvent(window, eventPos, eventAngleDelta * -1, eventPixelDelta * -1, eventModifiers, Qt::NoScrollPhase, eventInverted); } - QCOMPARE(activeChangedSpy.count(), eventPhases ? 2 : 3); + QCOMPARE(activeChangedSpy.size(), eventPhases ? 2 : 3); QCOMPARE(handler->active(), !eventPhases); QCOMPARE(rect->position().toPoint(), QPoint(0, 0)); QCOMPARE(rect->scale(), 1); @@ -306,13 +306,13 @@ void tst_QQuickWheelHandler::nestedHandler() QCOMPARE(innerRect->scale(), innerScale); QCOMPARE(innerRect->rotation(), innerRotation); QCOMPARE(outerRect->position().toPoint(), outerPosition); - QCOMPARE(outerActiveChangedSpy.count(), 1); + QCOMPARE(outerActiveChangedSpy.size(), 1); QCOMPARE(outerHandler->active(), true); QCOMPARE(outerRect->scale(), outerScale); QCOMPARE(outerRect->rotation(), outerRotation); if (!eventPhases) { QTRY_COMPARE(outerHandler->active(), false); - QCOMPARE(outerActiveChangedSpy.count(), 2); + QCOMPARE(outerActiveChangedSpy.size(), 2); } } @@ -355,9 +355,9 @@ void tst_QQuickWheelHandler::blocking() qreal outerPosWas = outerRect->position().x(); sendWheelEvent(window, eventPos, {0, 120}, {0, 0}, Qt::NoModifier, Qt::NoScrollPhase, false); - QTRY_COMPARE(innerActiveChangedSpy.count(), 2); + QTRY_COMPARE(innerActiveChangedSpy.size(), 2); QCOMPARE(innerRect->position().x(), innerPosWas + 15); - QCOMPARE(outerActiveChangedSpy.count(), blocking ? 0 : 2); + QCOMPARE(outerActiveChangedSpy.size(), blocking ? 0 : 2); QCOMPARE(outerRect->position().x(), outerPosWas + (blocking ? 0 : 15)); } diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp index fa41dfd3d6..e7da38a5ce 100644 --- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp +++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp @@ -98,10 +98,10 @@ void tst_QQuickAccessible::cleanup() { const EventList list = QTestAccessibility::events(); if (!list.isEmpty()) { - qWarning().noquote() << list.count() + qWarning().noquote() << list.size() << "accessibility event(s) were not handled in testfunction '" << QTest::currentTestFunction() << "':"; - for (int i = 0; i < list.count(); ++i) { + for (int i = 0; i < list.size(); ++i) { auto object = list.at(i)->object(); QString objectInfo = object ? QDebug::toString(object) : u"[deleted object]"_s; diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp index 8be86cdec4..1a01a8aca5 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -132,10 +132,10 @@ void tst_qquickanimatedimage::frameCount() const QUrl origSource = anim->source(); anim->setSource(QUrl()); QCOMPARE(anim->frameCount(), 0); - QCOMPARE(frameCountChangedSpy.count(), 1); + QCOMPARE(frameCountChangedSpy.size(), 1); anim->setSource(origSource); QCOMPARE(anim->frameCount(), 3); - QCOMPARE(frameCountChangedSpy.count(), 2); + QCOMPARE(frameCountChangedSpy.size(), 2); delete anim; } @@ -169,13 +169,13 @@ void tst_qquickanimatedimage::mirror_running() QVERIFY(spy.isValid()); anim->setPlaying(true); - QTRY_VERIFY(spy.count() == 1); spy.clear(); + QTRY_VERIFY(spy.size() == 1); spy.clear(); anim->setMirror(true); QCOMPARE(anim->currentFrame(), 1); QImage frame1_flipped = window.grabWindow(); - QTRY_VERIFY(spy.count() == 1); spy.clear(); + QTRY_VERIFY(spy.size() == 1); spy.clear(); QCOMPARE(anim->currentFrame(), 0); // animation only has 2 frames, should cycle back to first QImage frame0_flipped = window.grabWindow(); @@ -336,48 +336,48 @@ void tst_qquickanimatedimage::sourceSizeChanges() // Local ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 0); + QTRY_COMPARE(sourceSizeSpy.size(), 0); ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("hearts_copy.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("colors.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 2); + QTRY_COMPARE(sourceSizeSpy.size(), 2); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 3); + QTRY_COMPARE(sourceSizeSpy.size(), 3); // Remote ctxt->setContextProperty("srcImage", server.url("/hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/hearts_copy.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/colors.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 5); + QTRY_COMPARE(sourceSizeSpy.size(), 5); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 6); + QTRY_COMPARE(sourceSizeSpy.size(), 6); delete anim; } @@ -453,17 +453,17 @@ void tst_qquickanimatedimage::progressAndStatusChanges() ctxt->setContextProperty("srcImage", testFileUrl("stickman.gif")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 0); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 0); + QTRY_COMPARE(sourceSpy.size(), 0); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 0); // Loading local file ctxt->setContextProperty("srcImage", testFileUrl("colors.gif")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 1); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 1); + QTRY_COMPARE(sourceSpy.size(), 1); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 1); // Loading remote file ctxt->setContextProperty("srcImage", server.url("/stickman.gif")); @@ -471,16 +471,16 @@ void tst_qquickanimatedimage::progressAndStatusChanges() QTRY_COMPARE(obj->progress(), 0.0); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 2); - QTRY_VERIFY(progressSpy.count() > 1); - QTRY_COMPARE(statusSpy.count(), 3); + QTRY_COMPARE(sourceSpy.size(), 2); + QTRY_VERIFY(progressSpy.size() > 1); + QTRY_COMPARE(statusSpy.size(), 3); ctxt->setContextProperty("srcImage", ""); QTRY_COMPARE(obj->status(), QQuickImage::Null); QTRY_COMPARE(obj->progress(), 0.0); - QTRY_COMPARE(sourceSpy.count(), 3); - QTRY_VERIFY(progressSpy.count() > 2); - QTRY_COMPARE(statusSpy.count(), 4); + QTRY_COMPARE(sourceSpy.size(), 3); + QTRY_VERIFY(progressSpy.size() > 2); + QTRY_COMPARE(statusSpy.size(), 4); delete obj; } @@ -506,40 +506,40 @@ void tst_qquickanimatedimage::playingAndPausedChanges() obj->setProperty("paused", false); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 0); - QTRY_COMPARE(pausedSpy.count(), 0); + QTRY_COMPARE(playingSpy.size(), 0); + QTRY_COMPARE(pausedSpy.size(), 0); obj->setProperty("playing", false); obj->setProperty("paused", true); QTRY_VERIFY(!obj->isPlaying()); QTRY_VERIFY(obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 1); - QTRY_COMPARE(pausedSpy.count(), 1); + QTRY_COMPARE(playingSpy.size(), 1); + QTRY_COMPARE(pausedSpy.size(), 1); obj->setProperty("playing", true); obj->setProperty("paused", false); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 2); - QTRY_COMPARE(pausedSpy.count(), 2); + QTRY_COMPARE(playingSpy.size(), 2); + QTRY_COMPARE(pausedSpy.size(), 2); ctxt->setContextProperty("srcImage", testFileUrl("stickman.gif")); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 2); - QTRY_COMPARE(pausedSpy.count(), 2); + QTRY_COMPARE(playingSpy.size(), 2); + QTRY_COMPARE(pausedSpy.size(), 2); obj->setProperty("paused", true); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 2); - QTRY_COMPARE(pausedSpy.count(), 3); + QTRY_COMPARE(playingSpy.size(), 2); + QTRY_COMPARE(pausedSpy.size(), 3); obj->setProperty("playing", false); QTRY_VERIFY(!obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 3); - QTRY_COMPARE(pausedSpy.count(), 4); + QTRY_COMPARE(playingSpy.size(), 3); + QTRY_COMPARE(pausedSpy.size(), 4); obj->setProperty("playing", true); @@ -547,8 +547,8 @@ void tst_qquickanimatedimage::playingAndPausedChanges() ctxt->setContextProperty("srcImage", testFileUrl("green.png")); QTRY_VERIFY(!obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); - QTRY_COMPARE(playingSpy.count(), 5); - QTRY_COMPARE(pausedSpy.count(), 4); + QTRY_COMPARE(playingSpy.size(), 5); + QTRY_COMPARE(pausedSpy.size(), 4); delete obj; } @@ -626,15 +626,15 @@ void tst_qquickanimatedimage::currentFrame() anim->setCurrentFrame(1); QCOMPARE(anim->currentFrame(), 1); - QCOMPARE(frameChangedSpy.count(), 1); - QCOMPARE(currentFrameChangedSpy.count(), 1); + QCOMPARE(frameChangedSpy.size(), 1); + QCOMPARE(currentFrameChangedSpy.size(), 1); QCOMPARE(anim->property("currentFrameChangeCount"), 1); QCOMPARE(anim->property("frameChangeCount"), 1); evaluate<void>(anim, "scriptedSetCurrentFrame(2)"); QCOMPARE(anim->currentFrame(), 2); - QCOMPARE(frameChangedSpy.count(), 2); - QCOMPARE(currentFrameChangedSpy.count(), 2); + QCOMPARE(frameChangedSpy.size(), 2); + QCOMPARE(currentFrameChangedSpy.size(), 2); QCOMPARE(anim->property("currentFrameChangeCount"), 2); QCOMPARE(anim->property("frameChangeCount"), 2); } diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp index c9f16af86a..72c807bdf8 100644 --- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp +++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp @@ -63,7 +63,7 @@ void tst_qquickanimatedsprite::test_properties() sprite->setRunning(false); QVERIFY(!sprite->running()); // The finished() signal shouldn't be emitted when running is manually set to false. - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); sprite->setInterpolate(false); QVERIFY(!sprite->interpolate()); } @@ -87,11 +87,11 @@ void tst_qquickanimatedsprite::test_runningChangedSignal() QVERIFY(finishedSpy.isValid()); sprite->setRunning(true); - QTRY_COMPARE(runningChangedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QTRY_COMPARE(runningChangedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); QTRY_VERIFY(!sprite->running()); - QTRY_COMPARE(runningChangedSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 1); + QTRY_COMPARE(runningChangedSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 1); } void tst_qquickanimatedsprite::test_startStop() @@ -114,12 +114,12 @@ void tst_qquickanimatedsprite::test_startStop() sprite->start(); QVERIFY(sprite->running()); - QTRY_COMPARE(runningChangedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QTRY_COMPARE(runningChangedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); sprite->stop(); QVERIFY(!sprite->running()); - QTRY_COMPARE(runningChangedSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 0); + QTRY_COMPARE(runningChangedSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 0); sprite->setCurrentFrame(2); sprite->start(); @@ -154,12 +154,12 @@ void tst_qquickanimatedsprite::test_frameChangedSignal() QVERIFY(!sprite->paused()); QCOMPARE(sprite->loops(), 3); QCOMPARE(sprite->frameCount(), 6); - QCOMPARE(frameChangedSpy.count(), 0); + QCOMPARE(frameChangedSpy.size(), 0); frameChangedSpy.clear(); sprite->setRunning(true); QTRY_VERIFY(!sprite->running()); - QCOMPARE(frameChangedSpy.count(), 3*6 + 1); + QCOMPARE(frameChangedSpy.size(), 3*6 + 1); int prevFrame = -1; int loopCounter = 0; @@ -257,7 +257,7 @@ void tst_qquickanimatedsprite::test_largeAnimation() sprite->setRunning(true); QTRY_VERIFY_WITH_TIMEOUT(!sprite->running(), 100000 /* make sure we wait until its done*/ ); if (frameSync) - QVERIFY(isWithinRange(3*40, int(frameChangedSpy.count()), 3*40 + 1)); + QVERIFY(isWithinRange(3*40, int(frameChangedSpy.size()), 3*40 + 1)); int prevFrame = -1; int loopCounter = 0; int maxFrame = 0; @@ -375,8 +375,8 @@ void tst_qquickanimatedsprite::test_implicitSize() QVERIFY(frameImplicitWidthChangedSpy.isValid()); sprite->setFrameWidth(20); - QCOMPARE(frameWidthChangedSpy.count(), 1); - QCOMPARE(frameImplicitWidthChangedSpy.count(), 1); + QCOMPARE(frameWidthChangedSpy.size(), 1); + QCOMPARE(frameImplicitWidthChangedSpy.size(), 1); // Ensure that implicitHeight matches frameHeight. QSignalSpy frameHeightChangedSpy(sprite, SIGNAL(frameHeightChanged(int))); @@ -386,8 +386,8 @@ void tst_qquickanimatedsprite::test_implicitSize() QVERIFY(frameImplicitHeightChangedSpy.isValid()); sprite->setFrameHeight(20); - QCOMPARE(frameHeightChangedSpy.count(), 1); - QCOMPARE(frameImplicitHeightChangedSpy.count(), 1); + QCOMPARE(frameHeightChangedSpy.size(), 1); + QCOMPARE(frameImplicitHeightChangedSpy.size(), 1); } void tst_qquickanimatedsprite::test_infiniteLoops() @@ -409,7 +409,7 @@ void tst_qquickanimatedsprite::test_infiniteLoops() // The finished() signal shouldn't be emitted for infinite animations. const int previousFrame = sprite->currentFrame(); QTRY_VERIFY(sprite->currentFrame() != previousFrame); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); } void tst_qquickanimatedsprite::test_finishBehavior() diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index 4b0e38ba65..f7a84ca979 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -121,8 +121,8 @@ void tst_qquickanimations::simpleProperty() QCOMPARE(animation.target(), &rect); QCOMPARE(animation.property(), QLatin1String("x")); QCOMPARE(animation.to().toReal(), 200.0); - QCOMPARE(fromChangedSpy.count(), 0); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 0); + QCOMPARE(toChangedSpy.size(), 1); animation.start(); QVERIFY(animation.isRunning()); QTest::qWait(animation.duration()); @@ -137,8 +137,8 @@ void tst_qquickanimations::simpleProperty() QCOMPARE(animation.currentTime(), 125); QCOMPARE(rect.x(),100.0); animation.setFrom(100); - QCOMPARE(fromChangedSpy.count(), 1); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 1); + QCOMPARE(toChangedSpy.size(), 1); } void tst_qquickanimations::simpleNumber() @@ -153,8 +153,8 @@ void tst_qquickanimations::simpleNumber() QCOMPARE(animation.target(), &rect); QCOMPARE(animation.property(), QLatin1String("x")); QCOMPARE(animation.to(), qreal(200)); - QCOMPARE(fromChangedSpy.count(), 0); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 0); + QCOMPARE(toChangedSpy.size(), 1); animation.start(); QVERIFY(animation.isRunning()); QTest::qWait(animation.duration()); @@ -169,8 +169,8 @@ void tst_qquickanimations::simpleNumber() QCOMPARE(animation.currentTime(), 125); QCOMPARE(rect.x(), qreal(100)); animation.setFrom(100); - QCOMPARE(fromChangedSpy.count(), 1); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 1); + QCOMPARE(toChangedSpy.size(), 1); } void tst_qquickanimations::simpleColor() @@ -185,8 +185,8 @@ void tst_qquickanimations::simpleColor() QCOMPARE(animation.target(), &rect); QCOMPARE(animation.property(), QLatin1String("color")); QCOMPARE(animation.to(), QColor("red")); - QCOMPARE(fromChangedSpy.count(), 0); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 0); + QCOMPARE(toChangedSpy.size(), 1); animation.start(); QVERIFY(animation.isRunning()); QTest::qWait(animation.duration()); @@ -204,8 +204,8 @@ void tst_qquickanimations::simpleColor() rect.setColor(QColor("green")); animation.setFrom(QColor("blue")); QCOMPARE(animation.from(), QColor("blue")); - QCOMPARE(fromChangedSpy.count(), 1); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 1); + QCOMPARE(toChangedSpy.size(), 1); animation.restart(); QCOMPARE(rect.color(), QColor("blue")); QVERIFY(animation.isRunning()); @@ -226,8 +226,8 @@ void tst_qquickanimations::simpleRotation() QCOMPARE(animation.property(), QLatin1String("rotation")); QCOMPARE(animation.to(), qreal(270)); QCOMPARE(animation.direction(), QQuickRotationAnimation::Numerical); - QCOMPARE(fromChangedSpy.count(), 0); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 0); + QCOMPARE(toChangedSpy.size(), 1); animation.start(); QVERIFY(animation.isRunning()); QTest::qWait(animation.duration()); @@ -242,8 +242,8 @@ void tst_qquickanimations::simpleRotation() QCOMPARE(animation.currentTime(), 125); QCOMPARE(rect.rotation(), qreal(135)); animation.setFrom(90); - QCOMPARE(fromChangedSpy.count(), 1); - QCOMPARE(toChangedSpy.count(), 1); + QCOMPARE(fromChangedSpy.size(), 1); + QCOMPARE(toChangedSpy.size(), 1); } void tst_qquickanimations::simplePath() @@ -667,11 +667,11 @@ void tst_qquickanimations::resume() QSignalSpy spy(&animation, SIGNAL(pausedChanged(bool))); animation.pause(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(animation.isPaused()); animation.stop(); QVERIFY(!animation.isPaused()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // Load QtQuick to ensure that QQuickPropertyAnimation is registered as PropertyAnimation { @@ -683,12 +683,12 @@ void tst_qquickanimations::resume() QByteArray message = "<Unknown File>: QML PropertyAnimation: setPaused() cannot be used when animation isn't running."; QTest::ignoreMessage(QtWarningMsg, message); animation.pause(); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(!animation.isPaused()); animation.resume(); QVERIFY(!animation.isPaused()); QVERIFY(!animation.isRunning()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquickanimations::dotProperty() @@ -727,7 +727,7 @@ void tst_qquickanimations::badTypes() QScopedPointer<QObject> obj(c.create()); QVERIFY(obj.isNull()); - QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().size(), 1); QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: number expected")); } @@ -739,7 +739,7 @@ void tst_qquickanimations::badTypes() QScopedPointer<QObject> obj(c.create()); QVERIFY(obj.isNull()); - QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().size(), 1); QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: color expected")); } @@ -1047,12 +1047,12 @@ void tst_qquickanimations::disabledTransition() QSignalSpy runningSpy(trans, SIGNAL(runningChanged())); QQuickItemPrivate::get(rect)->setState(""); QCOMPARE(myRect->x(),qreal(200)); - QCOMPARE(runningSpy.count(), 1); //stopped -> running + QCOMPARE(runningSpy.size(), 1); //stopped -> running QVERIFY(trans->running()); QTest::qWait(300); QTIMED_COMPARE(myRect->x(),qreal(100)); QVERIFY(!trans->running()); - QCOMPARE(runningSpy.count(), 2); //running -> stopped + QCOMPARE(runningSpy.size(), 2); //running -> stopped } void tst_qquickanimations::invalidDuration() @@ -1226,7 +1226,7 @@ void tst_qquickanimations::easingProperties() QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::BezierSpline); QVector<QPointF> points = animObject->easing().toCubicSpline(); - QCOMPARE(points.count(), 3); + QCOMPARE(points.size(), 3); QCOMPARE(points.at(0), QPointF(0.5, 0.2)); QCOMPARE(points.at(1), QPointF(0.13, 0.65)); QCOMPARE(points.at(2), QPointF(1.0, 1.0)); @@ -1355,7 +1355,7 @@ void tst_qquickanimations::signalOrder() colorAnimation->setDuration(duration); animation->start(); - QTRY_VERIFY(finishedSpy.count()); + QTRY_VERIFY(finishedSpy.size()); QCOMPARE(actualSignalOrder, expectedSignalOrder); } @@ -1678,7 +1678,7 @@ void tst_qquickanimations::unsetAnimatorProxyJobWindow() item.setParentItem(&dummy); QSignalSpy spy(&window, SIGNAL(sceneGraphInitialized())); window.show(); - if (spy.count() < 1) + if (spy.size() < 1) spy.wait(); QCOMPARE(proxy.job().data(), job); } @@ -1705,8 +1705,8 @@ void tst_qquickanimations::finished() QVERIFY(finishedSpy.isValid()); QVERIFY(simpleTopLevelAnimation->setProperty("running", QVariant(true))); - QTRY_COMPARE(stoppedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 1); + QTRY_COMPARE(stoppedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 1); // Test that the signal is properly revisioned and hence accessible from QML. QCOMPARE(root->property("finishedUsableInQml").toBool(), true); @@ -1733,9 +1733,9 @@ void tst_qquickanimations::finished() QObject *transitionRect = root->property("transitionRect").value<QObject*>(); QVERIFY(transitionRect); QVERIFY(transitionRect->setProperty("state", QVariant(QLatin1String("go")))); - QTRY_COMPARE(runningChangedSpy.count(), 1); - QCOMPARE(stoppedSpy.count(), 0); - QCOMPARE(finishedSpy.count(), 0); + QTRY_COMPARE(runningChangedSpy.size(), 1); + QCOMPARE(stoppedSpy.size(), 0); + QCOMPARE(finishedSpy.size(), 0); } // Test that finished() is not emitted for animations within a Behavior. @@ -1752,8 +1752,8 @@ void tst_qquickanimations::finished() QVERIFY(root->setProperty("bar", QVariant(1.0))); QTRY_COMPARE(root->property("bar").toReal(), 1.0); - QCOMPARE(stoppedSpy.count(), 0); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(stoppedSpy.size(), 0); + QCOMPARE(finishedSpy.size(), 0); } } @@ -2095,8 +2095,8 @@ void tst_qquickanimations::changePropertiesDuringAnimation() // mid-animation. if (loops != QQuickAbstractAnimation::Infinite) QVERIFY(numberAnimation->qtAnimation()->currentLoop() < numberAnimation->loops()); - QCOMPARE(startedSpy.count(), 0); - QCOMPARE(stoppedSpy.count(), 0); + QCOMPARE(startedSpy.size(), 0); + QCOMPARE(stoppedSpy.size(), 0); } void tst_qquickanimations::infiniteLoopsWithoutFrom() diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp index e65a67c045..5ea11729d8 100644 --- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp +++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp @@ -341,7 +341,7 @@ void tst_qquickbehaviors::runningTrue() QSignalSpy runningSpy(animation, SIGNAL(runningChanged(bool))); rect->setProperty("myValue", 180); - QTRY_VERIFY(runningSpy.count() > 0); + QTRY_VERIFY(runningSpy.size() > 0); } //QTBUG-12295 @@ -579,7 +579,7 @@ void tst_qquickbehaviors::aliasedProperty() QSignalSpy targetValueSpy(behavior, SIGNAL(targetValueChanged())); QQuickItemPrivate::get(rect.data())->setState("moved"); QCOMPARE(behavior->targetValue(), 400); - QCOMPARE(targetValueSpy.count(), 1); + QCOMPARE(targetValueSpy.size(), 1); QScopedPointer<QQuickRectangle> acc(qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("acc"))); QScopedPointer<QQuickRectangle> range(qobject_cast<QQuickRectangle*>(acc->findChild<QQuickRectangle*>("range"))); QTRY_VERIFY(acc->property("value").toDouble() > 0); @@ -615,7 +615,7 @@ void tst_qquickbehaviors::oneWay() QQuickRectangle *myRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRectOneWay")); myRect->setProperty("x", 100); QCOMPARE(behavior->targetValue(), 100); - QCOMPARE(targetValueSpy.count(), 1); + QCOMPARE(targetValueSpy.size(), 1); QCOMPARE(behavior->enabled(), false); qreal x = myRect->x(); QCOMPARE(x, qreal(100)); //should change immediately @@ -625,7 +625,7 @@ void tst_qquickbehaviors::oneWay() myRect->setProperty("x", 0); QCOMPARE(behavior->targetValue(), 0); - QCOMPARE(targetValueSpy.count(), 2); + QCOMPARE(targetValueSpy.size(), 2); QCOMPARE(behavior->enabled(), true); QCOMPARE(myAnimation->isRunning(), true); QVERIFY(myRect->x() > 0.0); diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp index 793ab8d8c9..a217c4ea1b 100644 --- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp @@ -435,7 +435,7 @@ void tst_qquickborderimage::statusChanges() if (remote) server.sendDelayedItem(); QTRY_COMPARE(obj->status(), finalStatus); - QCOMPARE(spy.count(), emissions); + QCOMPARE(spy.size(), emissions); delete obj; } @@ -460,48 +460,48 @@ void tst_qquickborderimage::sourceSizeChanges() // Local ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 0); + QTRY_COMPARE(sourceSizeSpy.size(), 0); ctxt->setContextProperty("srcImage", testFileUrl("heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart200_copy.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 2); + QTRY_COMPARE(sourceSizeSpy.size(), 2); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 3); + QTRY_COMPARE(sourceSizeSpy.size(), 3); // Remote ctxt->setContextProperty("srcImage", server.url("/heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/heart200_copy.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/colors.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 5); + QTRY_COMPARE(sourceSizeSpy.size(), 5); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 6); + QTRY_COMPARE(sourceSizeSpy.size(), 6); delete obj; } @@ -532,17 +532,17 @@ void tst_qquickborderimage::progressAndStatusChanges() ctxt->setContextProperty("srcImage", testFileUrl("heart200.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 0); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 0); + QTRY_COMPARE(sourceSpy.size(), 0); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 0); // Loading local file ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 1); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 1); + QTRY_COMPARE(sourceSpy.size(), 1); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 1); // Loading remote file ctxt->setContextProperty("srcImage", server.url("/heart200.png")); @@ -550,16 +550,16 @@ void tst_qquickborderimage::progressAndStatusChanges() QTRY_COMPARE(obj->progress(), 0.0); QTRY_COMPARE(obj->status(), QQuickBorderImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 2); - QTRY_VERIFY(progressSpy.count() > 1); - QTRY_COMPARE(statusSpy.count(), 3); + QTRY_COMPARE(sourceSpy.size(), 2); + QTRY_VERIFY(progressSpy.size() > 1); + QTRY_COMPARE(statusSpy.size(), 3); ctxt->setContextProperty("srcImage", ""); QTRY_COMPARE(obj->status(), QQuickBorderImage::Null); QTRY_COMPARE(obj->progress(), 0.0); - QTRY_COMPARE(sourceSpy.count(), 3); - QTRY_VERIFY(progressSpy.count() > 2); - QTRY_COMPARE(statusSpy.count(), 4); + QTRY_COMPARE(sourceSpy.size(), 3); + QTRY_VERIFY(progressSpy.size() > 2); + QTRY_COMPARE(statusSpy.size(), 4); delete obj; } @@ -614,7 +614,7 @@ void tst_qquickborderimage::multiFrame() if (asynchronous) { QCOMPARE(image->frameCount(), 0); QTRY_COMPARE(image->frameCount(), 4); - QCOMPARE(countSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); } else { QCOMPARE(image->frameCount(), 4); } @@ -636,7 +636,7 @@ void tst_qquickborderimage::multiFrame() image->setCurrentFrame(1); QTRY_COMPARE(image->status(), QQuickImageBase::Ready); - QCOMPARE(currentSpy.count(), 1); + QCOMPARE(currentSpy.size(), 1); QCOMPARE(image->currentFrame(), 1); contents = view.grabWindow(); // The middle of the second frame looks green, approximately qRgba(0x3a, 0xd2, 0x31, 0xff) diff --git a/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp b/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp index dab29e21cc..1aa926ab19 100644 --- a/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp +++ b/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp @@ -54,25 +54,25 @@ void tst_qquickboundaryrule::dragHandler() QVERIFY(ok); QCOMPARE(boundaryRule->property("peakOvershoot").toReal(&ok), 0); QVERIFY(ok); - QCOMPARE(overshootChangedSpy.count(), 0); + QCOMPARE(overshootChangedSpy.size(), 0); // restricted drag: halfway into overshoot p1 += QPoint(20, 0); QTest::mouseMove(&window, p1); QCOMPARE(target->position().x(), 117.5); QCOMPARE(boundaryRule->property("currentOvershoot").toReal(), 20); QCOMPARE(boundaryRule->property("peakOvershoot").toReal(), 20); - QCOMPARE(overshootChangedSpy.count(), 1); + QCOMPARE(overshootChangedSpy.size(), 1); // restricted drag: maximum overshoot p1 += QPoint(80, 0); QTest::mouseMove(&window, p1); QCOMPARE(target->position().x(), 140); QCOMPARE(boundaryRule->property("currentOvershoot").toReal(), 100); QCOMPARE(boundaryRule->property("peakOvershoot").toReal(), 100); - QCOMPARE(overshootChangedSpy.count(), 2); + QCOMPARE(overshootChangedSpy.size(), 2); // release and let it return to bounds QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_COMPARE(dragHandler->active(), false); - QTRY_COMPARE(overshootChangedSpy.count(), 3); + QTRY_COMPARE(overshootChangedSpy.size(), 3); QCOMPARE(boundaryRule->property("currentOvershoot").toReal(&ok), 0); QVERIFY(ok); QCOMPARE(boundaryRule->property("peakOvershoot").toReal(&ok), 0); diff --git a/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp b/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp index f1bc591bd3..046cd5a14c 100644 --- a/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp +++ b/tests/auto/quick/qquickcolorgroup/tst_qquickcolorgroup.cpp @@ -46,7 +46,7 @@ void tst_QQuickColorGroup::checkColorProperty() qvariant_cast<QColor>(property.read(&defaultGroup))); constexpr int expectedNotificationsCount = 2; // One from write + one from reset - QCOMPARE(sp.count(), expectedNotificationsCount); + QCOMPARE(sp.size(), expectedNotificationsCount); } void tst_QQuickColorGroup::checkColorProperty_data() @@ -73,7 +73,7 @@ void tst_QQuickColorGroup::colorGroupChangedWhenColorChanged() group.setMid(Qt::blue); - QCOMPARE(sp.count(), 1); + QCOMPARE(sp.size(), 1); } QTEST_MAIN(tst_QQuickColorGroup) diff --git a/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp b/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp index aaa7fd8545..7e6416b8e2 100644 --- a/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp +++ b/tests/auto/quick/qquickdeliveryagent/tst_qquickdeliveryagent.cpp @@ -179,7 +179,7 @@ void tst_qquickdeliveryagent::passiveGrabberOrder() auto devPriv = QPointingDevicePrivate::get(QPointingDevice::primaryPointingDevice()); const auto &persistentPoint = devPriv->activePoints.values().first(); qCDebug(lcTests) << "passive grabbers" << persistentPoint.passiveGrabbers << "contexts" << persistentPoint.passiveGrabbersContext; - QCOMPARE(persistentPoint.passiveGrabbers.count(), 2); + QCOMPARE(persistentPoint.passiveGrabbers.size(), 2); QCOMPARE(persistentPoint.passiveGrabbers.first(), subsceneTap); QCOMPARE(persistentPoint.passiveGrabbersContext.first(), subscene.deliveryAgent); QCOMPARE(persistentPoint.passiveGrabbers.last(), rootTap); @@ -187,10 +187,10 @@ void tst_qquickdeliveryagent::passiveGrabberOrder() QTest::mouseRelease(&view, Qt::LeftButton); QTest::qWait(100); // QQuickWindow::event() has failsafe: clear all grabbers after release - QCOMPARE(persistentPoint.passiveGrabbers.count(), 0); + QCOMPARE(persistentPoint.passiveGrabbers.size(), 0); qCDebug(lcTests) << "TapHandlers emitted tapped in this order:" << spy.senders; - QCOMPARE(spy.senders.count(), 2); + QCOMPARE(spy.senders.size(), 2); // passive grabbers are visited in order, and emit tapped() at that time QCOMPARE(spy.senders.first(), subsceneTap); QCOMPARE(spy.senders.last(), rootTap); @@ -279,7 +279,7 @@ void tst_qquickdeliveryagent::passiveGrabberItems() QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, QPoint(exclusiveGrabber->x() + 1, exclusiveGrabber->y() + 1)); auto devPriv = QPointingDevicePrivate::get(QPointingDevice::primaryPointingDevice()); const auto &persistentPoint = devPriv->activePoints.values().first(); - QTRY_COMPARE(persistentPoint.passiveGrabbers.count(), 1); + QTRY_COMPARE(persistentPoint.passiveGrabbers.size(), 1); QCOMPARE(persistentPoint.passiveGrabbers.first(), passiveGrabber); QCOMPARE(persistentPoint.exclusiveGrabber, exclusiveGrabber); QVERIFY(exclusiveGrabber->lastPressed); @@ -295,7 +295,7 @@ void tst_qquickdeliveryagent::passiveGrabberItems() // since it became the exclusive grabber on mouseMove QTRY_VERIFY(!passiveGrabber->lastPressed); QVERIFY(exclusiveGrabber->lastPressed); - QCOMPARE(persistentPoint.passiveGrabbers.count(), 0); + QCOMPARE(persistentPoint.passiveGrabbers.size(), 0); QCOMPARE(persistentPoint.exclusiveGrabber, nullptr); exclusiveGrabber->lastPressed = false; @@ -304,7 +304,7 @@ void tst_qquickdeliveryagent::passiveGrabberItems() QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, QPoint(exclusiveGrabber->x() + 1, exclusiveGrabber->y() + 1)); const auto &pressedPoint = devPriv->activePoints.values().first(); - QTRY_COMPARE(pressedPoint.passiveGrabbers.count(), 1); + QTRY_COMPARE(pressedPoint.passiveGrabbers.size(), 1); QCOMPARE(pressedPoint.passiveGrabbers.first(), passiveGrabber); QCOMPARE(pressedPoint.exclusiveGrabber, exclusiveGrabber); QVERIFY(exclusiveGrabber->lastPressed); @@ -319,7 +319,7 @@ void tst_qquickdeliveryagent::passiveGrabberItems() // Both the passive and the exclusive grabber get the mouseRelease event QTRY_VERIFY(!passiveGrabber->lastPressed); QVERIFY(!exclusiveGrabber->lastPressed); - QCOMPARE(pressedPoint.passiveGrabbers.count(), 0); + QCOMPARE(pressedPoint.passiveGrabbers.size(), 0); QCOMPARE(pressedPoint.exclusiveGrabber, nullptr); } @@ -372,8 +372,8 @@ void tst_qquickdeliveryagent::tapHandlerDoesntOverrideSubsceneGrabber() // QTBUG QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, clickPos); qCDebug(lcTests) << "clicking subscene TextEdit set cursorPos to" << cursorPos; QVERIFY(textEdit->property("cursorPosition").toInt() > cursorPos); // TextEdit reacts regardless - QCOMPARE(clickSpy.count(), expectedTaps); - QCOMPARE(cancelSpy.count(), expectedCancels); + QCOMPARE(clickSpy.size(), expectedTaps); + QCOMPARE(cancelSpy.size(), expectedCancels); } void tst_qquickdeliveryagent::undoDelegationWhenSubsceneFocusCleared() // QTBUG-105192 diff --git a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp index 04d2784f20..c35f31b8f2 100644 --- a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp +++ b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp @@ -344,7 +344,7 @@ void tst_qquickdesignersupport::basicStates() QVERIFY(stateGroup); - QCOMPARE(stateGroup->states().count(), 2 ); + QCOMPARE(stateGroup->states().size(), 2 ); QQuickState *state01 = stateGroup->states().first(); QQuickState *state02 = stateGroup->states().last(); @@ -390,7 +390,7 @@ void tst_qquickdesignersupport::statesPropertyChanges() QVERIFY(stateGroup); - QCOMPARE(stateGroup->states().count(), 2 ); + QCOMPARE(stateGroup->states().size(), 2 ); QQuickState *state01 = stateGroup->states().first(); QQuickState *state02 = stateGroup->states().last(); @@ -409,7 +409,7 @@ void tst_qquickdesignersupport::statesPropertyChanges() QCOMPARE(state01->operationCount(), 1); - QCOMPARE(statePrivate01->operations.count(), 1); + QCOMPARE(statePrivate01->operations.size(), 1); QQuickStateOperation *propertyChange = statePrivate01->operations.at(0).data(); @@ -444,7 +444,7 @@ void tst_qquickdesignersupport::statesPropertyChanges() QCOMPARE(rootItem, QQuickDesignerSupportPropertyChanges::targetObject(newPropertyChange)); QCOMPARE(state01->operationCount(), 2); - QCOMPARE(statePrivate01->operations.count(), 2); + QCOMPARE(statePrivate01->operations.size(), 2); QCOMPARE(QQuickDesignerSupportPropertyChanges::stateObject(newPropertyChange), state01); diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index af591dd5ce..bce1da4bf0 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -73,7 +73,7 @@ public: protected: void touchEvent(QTouchEvent *ev) override { - QCOMPARE(ev->points().count(), 1); + QCOMPARE(ev->points().size(), 1); auto touchpoint = ev->points().first(); switch (touchpoint.state()) { case QEventPoint::State::Pressed: @@ -351,27 +351,27 @@ void tst_qquickflickable::boundsBehavior() flickable->setBoundsBehavior(QQuickFlickable::DragAndOvershootBounds); QCOMPARE(flickable->boundsBehavior(), QQuickFlickable::DragAndOvershootBounds); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setBoundsBehavior(QQuickFlickable::DragAndOvershootBounds); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setBoundsBehavior(QQuickFlickable::DragOverBounds); QCOMPARE(flickable->boundsBehavior(), QQuickFlickable::DragOverBounds); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); flickable->setBoundsBehavior(QQuickFlickable::DragOverBounds); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); flickable->setBoundsBehavior(QQuickFlickable::StopAtBounds); QCOMPARE(flickable->boundsBehavior(), QQuickFlickable::StopAtBounds); - QCOMPARE(spy.count(),3); + QCOMPARE(spy.size(),3); flickable->setBoundsBehavior(QQuickFlickable::StopAtBounds); - QCOMPARE(spy.count(),3); + QCOMPARE(spy.size(),3); flickable->setBoundsBehavior(QQuickFlickable::OvershootBounds); QCOMPARE(flickable->boundsBehavior(), QQuickFlickable::OvershootBounds); - QCOMPARE(spy.count(),4); + QCOMPARE(spy.size(),4); flickable->setBoundsBehavior(QQuickFlickable::OvershootBounds); - QCOMPARE(spy.count(),4); + QCOMPARE(spy.size(),4); delete flickable; } @@ -404,23 +404,23 @@ void tst_qquickflickable::rebound() flick(window.data(), QPoint(20,20), QPoint(120,120), 200); QTRY_COMPARE(window->rootObject()->property("transitionsStarted").toInt(), 2); - QCOMPARE(hMoveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), 1); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 0); + QCOMPARE(hMoveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), 1); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 0); QVERIFY(rebound->running()); QTRY_VERIFY(!flickable->isMoving()); QCOMPARE(flickable->contentX(), 0.0); QCOMPARE(flickable->contentY(), 0.0); - QCOMPARE(hMoveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), 2); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 1); + QCOMPARE(hMoveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), 2); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 1); QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 2); QVERIFY(!rebound->running()); - QCOMPARE(reboundSpy.count(), 2); + QCOMPARE(reboundSpy.size(), 2); hMoveSpy.clear(); vMoveSpy.clear(); @@ -436,19 +436,19 @@ void tst_qquickflickable::rebound() QVERIFY(flickable->isMoving()); QTRY_VERIFY(window->rootObject()->property("transitionsStarted").toInt() >= 1); - QCOMPARE(hMoveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), 1); - QCOMPARE(movementStartedSpy.count(), 1); + QCOMPARE(hMoveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), 1); + QCOMPARE(movementStartedSpy.size(), 1); QTRY_VERIFY(!flickable->isMoving()); QCOMPARE(flickable->contentX(), 0.0); // moving started/stopped signals should only have been emitted once, // and when they are, all transitions should have finished - QCOMPARE(hMoveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), 2); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 1); + QCOMPARE(hMoveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), 2); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 1); hMoveSpy.clear(); vMoveSpy.clear(); @@ -463,16 +463,16 @@ void tst_qquickflickable::rebound() flick(window.data(), QPoint(20,20), QPoint(120,120), 200); QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 0); - QCOMPARE(hMoveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), 1); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 0); + QCOMPARE(hMoveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), 1); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 0); QTRY_VERIFY(!flickable->isMoving()); - QCOMPARE(hMoveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), 2); - QCOMPARE(movementStartedSpy.count(), 1); - QCOMPARE(movementEndedSpy.count(), 1); + QCOMPARE(hMoveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), 2); + QCOMPARE(movementStartedSpy.size(), 1); + QCOMPARE(movementEndedSpy.size(), 1); QCOMPARE(window->rootObject()->property("transitionsStarted").toInt(), 0); } @@ -489,9 +489,9 @@ void tst_qquickflickable::maximumFlickVelocity() flickable->setMaximumFlickVelocity(2.0); QCOMPARE(flickable->maximumFlickVelocity(), 2.0); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setMaximumFlickVelocity(2.0); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); delete flickable; } @@ -509,9 +509,9 @@ void tst_qquickflickable::flickDeceleration() flickable->setFlickDeceleration(2.0); QCOMPARE(flickable->flickDeceleration(), 2.0); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setFlickDeceleration(2.0); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); delete flickable; } @@ -535,9 +535,9 @@ void tst_qquickflickable::pressDelay() flickable->setPressDelay(200); QCOMPARE(flickable->pressDelay(), 200); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setPressDelay(200); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); QQuickItem *mouseArea = window->rootObject()->findChild<QQuickItem*>("mouseArea"); QSignalSpy clickedSpy(mouseArea, SIGNAL(clicked(QQuickMouseEvent*))); @@ -550,11 +550,11 @@ void tst_qquickflickable::pressDelay() // But, it should occur eventually QTRY_VERIFY(mouseArea->property("pressed").toBool()); - QCOMPARE(clickedSpy.count(),0); + QCOMPARE(clickedSpy.size(),0); // On release the clicked signal should be emitted QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); - QCOMPARE(clickedSpy.count(),1); + QCOMPARE(clickedSpy.size(),1); // Press and release position should match QCOMPARE(flickable->property("pressX").toReal(), flickable->property("releaseX").toReal()); @@ -568,11 +568,11 @@ void tst_qquickflickable::pressDelay() // The press should not occur immediately QVERIFY(!mouseArea->property("pressed").toBool()); - QCOMPARE(clickedSpy.count(),0); + QCOMPARE(clickedSpy.size(),0); // On release the press, release and clicked signal should be emitted QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(180, 180)); - QCOMPARE(clickedSpy.count(),1); + QCOMPARE(clickedSpy.size(),1); // Press and release position should match QCOMPARE(flickable->property("pressX").toReal(), flickable->property("releaseX").toReal()); @@ -593,7 +593,7 @@ void tst_qquickflickable::pressDelay() // On release the clicked signal should *not* be emitted QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 190)); - QCOMPARE(clickedSpy.count(),1); + QCOMPARE(clickedSpy.size(),1); } // QTBUG-17361 @@ -777,19 +777,19 @@ void tst_qquickflickable::flickableDirection() flickable->setFlickableDirection(QQuickFlickable::HorizontalAndVerticalFlick); QCOMPARE(flickable->flickableDirection(), QQuickFlickable::HorizontalAndVerticalFlick); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); flickable->setFlickableDirection(QQuickFlickable::AutoFlickDirection); QCOMPARE(flickable->flickableDirection(), QQuickFlickable::AutoFlickDirection); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); flickable->setFlickableDirection(QQuickFlickable::HorizontalFlick); QCOMPARE(flickable->flickableDirection(), QQuickFlickable::HorizontalFlick); - QCOMPARE(spy.count(),3); + QCOMPARE(spy.size(),3); flickable->setFlickableDirection(QQuickFlickable::HorizontalFlick); QCOMPARE(flickable->flickableDirection(), QQuickFlickable::HorizontalFlick); - QCOMPARE(spy.count(),3); + QCOMPARE(spy.size(),3); delete flickable; } @@ -862,7 +862,7 @@ void tst_qquickflickable::returnToBounds() QTRY_COMPARE(obj->contentY(), 0.); QVERIFY(!rebound->running()); - QCOMPARE(reboundSpy.count(), setRebound ? 2 : 0); + QCOMPARE(reboundSpy.size(), setRebound ? 2 : 0); } void tst_qquickflickable::returnToBounds_data() @@ -900,7 +900,7 @@ void tst_qquickflickable::wheel() QTRY_VERIFY(flick->contentY() > 0); QCOMPARE(flick->contentX(), qreal(0)); - QTRY_COMPARE(moveEndSpy.count(), 1); + QTRY_COMPARE(moveEndSpy.size(), 1); QCOMPARE(fp->velocityTimeline.isActive(), false); QCOMPARE(fp->timeline.isActive(), false); QTest::qWait(50); // make sure that onContentYChanged won't sneak in again @@ -925,7 +925,7 @@ void tst_qquickflickable::wheel() QTRY_VERIFY(flick->contentX() > 0); QCOMPARE(flick->contentY(), qreal(0)); - QTRY_COMPARE(moveEndSpy.count(), 2); + QTRY_COMPARE(moveEndSpy.size(), 2); QCOMPARE(fp->velocityTimeline.isActive(), false); QCOMPARE(fp->timeline.isActive(), false); QTest::qWait(50); // make sure that onContentXChanged won't sneak in again @@ -979,7 +979,7 @@ void tst_qquickflickable::trackpad() QGuiApplication::sendEvent(window.data(), &event); } - QTRY_COMPARE(moveEndSpy.count(), 1); // QTBUG-55871 + QTRY_COMPARE(moveEndSpy.size(), 1); // QTBUG-55871 QCOMPARE(flick->property("movementsAfterEnd").value<int>(), 0); // QTBUG-55886 } @@ -1016,7 +1016,7 @@ void tst_qquickflickable::nestedTrackpad() event.setTimestamp(timestamp++); QGuiApplication::sendEvent(&window, &event); } - QTRY_COMPARE(innerMoveEndSpy.count(), 1); + QTRY_COMPARE(innerMoveEndSpy.size(), 1); innerFlickable->setContentX(0); QCOMPARE(innerFlickable->contentX(), qreal(0)); @@ -1040,7 +1040,7 @@ void tst_qquickflickable::nestedTrackpad() event.setTimestamp(timestamp++); QGuiApplication::sendEvent(&window, &event); } - QTRY_COMPARE(outerMoveEndSpy.count(), 1); + QTRY_COMPARE(outerMoveEndSpy.size(), 1); } void tst_qquickflickable::movingAndFlicking_data() @@ -1112,15 +1112,15 @@ void tst_qquickflickable::movingAndFlicking() QCOMPARE(flickable->property("movingInContentX").value<bool>(), true); QCOMPARE(flickable->property("movingInContentY").value<bool>(), true); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(flickSpy.count(), 1); - QCOMPARE(vFlickSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 1 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(flickSpy.size(), 1); + QCOMPARE(vFlickSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hFlickSpy.size(), horizontalEnabled ? 1 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(flickStartSpy.count(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(flickStartSpy.size(), 1); // wait for any motion to end QTRY_VERIFY(!flickable->isMoving()); @@ -1131,17 +1131,17 @@ void tst_qquickflickable::movingAndFlicking() QVERIFY(!flickable->isFlickingHorizontally()); QVERIFY(!flickable->isFlickingVertically()); - QCOMPARE(moveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(flickSpy.count(), 2); - QCOMPARE(vFlickSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 2 : 0); - - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 1); - QCOMPARE(flickStartSpy.count(), 1); - QCOMPARE(flickEndSpy.count(), 1); + QCOMPARE(moveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(flickSpy.size(), 2); + QCOMPARE(vFlickSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hFlickSpy.size(), horizontalEnabled ? 2 : 0); + + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 1); + QCOMPARE(flickStartSpy.size(), 1); + QCOMPARE(flickEndSpy.size(), 1); // Stop on a full pixel after user interaction if (verticalEnabled) @@ -1168,17 +1168,17 @@ void tst_qquickflickable::movingAndFlicking() QCOMPARE(flickable->isFlickingHorizontally(), horizontalEnabled); QCOMPARE(flickable->isFlickingVertically(), verticalEnabled); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(flickSpy.count(), 1); - QCOMPARE(vFlickSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 1 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(flickSpy.size(), 1); + QCOMPARE(vFlickSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hFlickSpy.size(), horizontalEnabled ? 1 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 0); - QCOMPARE(flickStartSpy.count(), 1); - QCOMPARE(flickEndSpy.count(), 0); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 0); + QCOMPARE(flickStartSpy.size(), 1); + QCOMPARE(flickEndSpy.size(), 0); // wait for any motion to end QTRY_VERIFY(!flickable->isMoving()); @@ -1189,17 +1189,17 @@ void tst_qquickflickable::movingAndFlicking() QVERIFY(!flickable->isFlickingHorizontally()); QVERIFY(!flickable->isFlickingVertically()); - QCOMPARE(moveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(flickSpy.count(), 2); - QCOMPARE(vFlickSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hFlickSpy.count(), horizontalEnabled ? 2 : 0); - - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 1); - QCOMPARE(flickStartSpy.count(), 1); - QCOMPARE(flickEndSpy.count(), 1); + QCOMPARE(moveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(flickSpy.size(), 2); + QCOMPARE(vFlickSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hFlickSpy.size(), horizontalEnabled ? 2 : 0); + + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 1); + QCOMPARE(flickStartSpy.size(), 1); + QCOMPARE(flickEndSpy.size(), 1); QCOMPARE(flickable->contentX(), 0.0); QCOMPARE(flickable->contentY(), 0.0); @@ -1280,26 +1280,26 @@ void tst_qquickflickable::movingAndDragging() QCOMPARE(flickable->property("draggingInContentX").value<bool>(), true); QCOMPARE(flickable->property("draggingInContentY").value<bool>(), true); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(dragSpy.count(), 1); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 1 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(dragSpy.size(), 1); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 1 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(dragStartSpy.count(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(dragStartSpy.size(), 1); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, moveFrom + moveByWithoutSnapBack*3); QVERIFY(!flickable->isDragging()); QVERIFY(!flickable->isDraggingHorizontally()); QVERIFY(!flickable->isDraggingVertically()); - QCOMPARE(dragSpy.count(), 2); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(dragStartSpy.count(), 1); - QCOMPARE(dragEndSpy.count(), 1); + QCOMPARE(dragSpy.size(), 2); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(dragStartSpy.size(), 1); + QCOMPARE(dragEndSpy.size(), 1); // Don't test whether moving finished because a flick could occur // wait for any motion to end @@ -1311,17 +1311,17 @@ void tst_qquickflickable::movingAndDragging() QVERIFY(!flickable->isDraggingHorizontally()); QVERIFY(!flickable->isDraggingVertically()); - QCOMPARE(dragSpy.count(), 2); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(moveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0); + QCOMPARE(dragSpy.size(), 2); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(moveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 2 : 0); - QCOMPARE(dragStartSpy.count(), 1); - QCOMPARE(dragEndSpy.count(), 1); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 1); + QCOMPARE(dragStartSpy.size(), 1); + QCOMPARE(dragEndSpy.size(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 1); // Stop on a full pixel after user interaction if (verticalEnabled) @@ -1351,17 +1351,17 @@ void tst_qquickflickable::movingAndDragging() QCOMPARE(flickable->isDraggingHorizontally(), horizontalEnabled); QCOMPARE(flickable->isDraggingVertically(), verticalEnabled); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(dragSpy.count(), 1); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 1 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(dragSpy.size(), 1); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 1 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 0); - QCOMPARE(dragStartSpy.count(), 1); - QCOMPARE(dragEndSpy.count(), 0); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 0); + QCOMPARE(dragStartSpy.size(), 1); + QCOMPARE(dragEndSpy.size(), 0); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, moveFrom + moveByWithSnapBack*3); @@ -1373,15 +1373,15 @@ void tst_qquickflickable::movingAndDragging() QVERIFY(!flickable->isDraggingHorizontally()); QVERIFY(!flickable->isDraggingVertically()); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 1 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 1 : 0); - QCOMPARE(dragSpy.count(), 2); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 1 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 1 : 0); + QCOMPARE(dragSpy.size(), 2); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 2 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 0); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 0); // wait for any motion to end QTRY_VERIFY(!flickable->isMoving()); @@ -1392,17 +1392,17 @@ void tst_qquickflickable::movingAndDragging() QVERIFY(!flickable->isDraggingHorizontally()); QVERIFY(!flickable->isDraggingVertically()); - QCOMPARE(moveSpy.count(), 2); - QCOMPARE(vMoveSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hMoveSpy.count(), horizontalEnabled ? 2 : 0); - QCOMPARE(dragSpy.count(), 2); - QCOMPARE(vDragSpy.count(), verticalEnabled ? 2 : 0); - QCOMPARE(hDragSpy.count(), horizontalEnabled ? 2 : 0); + QCOMPARE(moveSpy.size(), 2); + QCOMPARE(vMoveSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hMoveSpy.size(), horizontalEnabled ? 2 : 0); + QCOMPARE(dragSpy.size(), 2); + QCOMPARE(vDragSpy.size(), verticalEnabled ? 2 : 0); + QCOMPARE(hDragSpy.size(), horizontalEnabled ? 2 : 0); - QCOMPARE(moveStartSpy.count(), 1); - QCOMPARE(moveEndSpy.count(), 1); - QCOMPARE(dragStartSpy.count(), 1); - QCOMPARE(dragEndSpy.count(), 1); + QCOMPARE(moveStartSpy.size(), 1); + QCOMPARE(moveEndSpy.size(), 1); + QCOMPARE(dragStartSpy.size(), 1); + QCOMPARE(dragEndSpy.size(), 1); QCOMPARE(flickable->contentX(), 0.0); QCOMPARE(flickable->contentY(), 0.0); @@ -1430,7 +1430,7 @@ void tst_qquickflickable::flickOnRelease() QTest::mouseMove(window.data(), QPoint(50, 10), 10); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 10), 10); - QCOMPARE(vFlickSpy.count(), 1); + QCOMPARE(vFlickSpy.size(), 1); // wait for any motion to end QTRY_VERIFY(!flickable->isMoving()); @@ -1472,14 +1472,14 @@ void tst_qquickflickable::pressWhileFlicking() QVERIFY(flickable->isMoving()); QVERIFY(flickable->isMovingVertically()); QVERIFY(!flickable->isMovingHorizontally()); - QCOMPARE(vMoveSpy.count(), 1); - QCOMPARE(hMoveSpy.count(), 0); - QCOMPARE(moveSpy.count(), 1); - QCOMPARE(vFlickSpy.count(), 1); - QCOMPARE(hFlickSpy.count(), 0); - QCOMPARE(flickSpy.count(), 1); - QCOMPARE(flickStartSpy.count(), 1); - QCOMPARE(flickEndSpy.count(), 0); + QCOMPARE(vMoveSpy.size(), 1); + QCOMPARE(hMoveSpy.size(), 0); + QCOMPARE(moveSpy.size(), 1); + QCOMPARE(vFlickSpy.size(), 1); + QCOMPARE(hFlickSpy.size(), 0); + QCOMPARE(flickSpy.size(), 1); + QCOMPARE(flickStartSpy.size(), 1); + QCOMPARE(flickEndSpy.size(), 0); QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(20, 50)); QTRY_VERIFY(!flickable->isFlicking()); @@ -2105,10 +2105,10 @@ void tst_qquickflickable::stopAtBounds() else QCOMPARE(transpose ? flickable->isAtYBeginning() : flickable->isAtXBeginning(), false); - QCOMPARE(atXBeginningChangedSpy.count(), (!transpose && !invert) ? 1 : 0); - QCOMPARE(atYBeginningChangedSpy.count(), ( transpose && !invert) ? 1 : 0); - QCOMPARE(atXEndChangedSpy.count(), (!transpose && invert) ? 1 : 0); - QCOMPARE(atYEndChangedSpy.count(), ( transpose && invert) ? 1 : 0); + QCOMPARE(atXBeginningChangedSpy.size(), (!transpose && !invert) ? 1 : 0); + QCOMPARE(atYBeginningChangedSpy.size(), ( transpose && !invert) ? 1 : 0); + QCOMPARE(atXEndChangedSpy.size(), (!transpose && invert) ? 1 : 0); + QCOMPARE(atYEndChangedSpy.size(), ( transpose && invert) ? 1 : 0); // Drag away from the aligned boundary again. // None of the mouse movements will position the view at the boundary exactly, @@ -2142,7 +2142,7 @@ void tst_qquickflickable::stopAtBounds() else flick(&view, QPoint(120,120), QPoint(20,20), 100); - QVERIFY(flickSignal.count() > 0); + QVERIFY(flickSignal.size() > 0); if (transpose) { if (invert) QTRY_COMPARE(flickable->isAtYBeginning(), true); @@ -2313,22 +2313,22 @@ void tst_qquickflickable::contentSize() flickable.setWidth(100); QCOMPARE(flickable.width(), qreal(100)); QCOMPARE(flickable.contentWidth(), qreal(-1.0)); - QCOMPARE(cwspy.count(), 0); + QCOMPARE(cwspy.size(), 0); flickable.setContentWidth(10); QCOMPARE(flickable.width(), qreal(100)); QCOMPARE(flickable.contentWidth(), qreal(10)); - QCOMPARE(cwspy.count(), 1); + QCOMPARE(cwspy.size(), 1); flickable.setHeight(100); QCOMPARE(flickable.height(), qreal(100)); QCOMPARE(flickable.contentHeight(), qreal(-1.0)); - QCOMPARE(chspy.count(), 0); + QCOMPARE(chspy.size(), 0); flickable.setContentHeight(10); QCOMPARE(flickable.height(), qreal(100)); QCOMPARE(flickable.contentHeight(), qreal(10)); - QCOMPARE(chspy.count(), 1); + QCOMPARE(chspy.size(), 1); } // QTBUG-53726 @@ -2822,13 +2822,13 @@ void tst_qquickflickable::ignoreNonLeftMouseButtons() // QTBUG-96909 QTest::mouseMove(&view, p1, 50); } QVERIFY(flickable->isDragging()); - QCOMPARE(dragSpy.count(), 1); + QCOMPARE(dragSpy.size(), 1); // Press other button too, then release left button: dragging changes to false QTest::mousePress(&view, otherButton); QTest::mouseRelease(&view, Qt::LeftButton); QTRY_COMPARE(flickable->isDragging(), false); - QCOMPARE(dragSpy.count(), 2); + QCOMPARE(dragSpy.size(), 2); // Drag further with the other button held: Flickable ignores it for (int i = 0; i < 8; ++i) { @@ -2836,11 +2836,11 @@ void tst_qquickflickable::ignoreNonLeftMouseButtons() // QTBUG-96909 QTest::mouseMove(&view, p1, 50); } QCOMPARE(flickable->isDragging(), false); - QCOMPARE(dragSpy.count(), 2); + QCOMPARE(dragSpy.size(), 2); // Release other button: nothing happens QTest::mouseRelease(&view, otherButton); - QCOMPARE(dragSpy.count(), 2); + QCOMPARE(dragSpy.size(), 2); } void tst_qquickflickable::ignoreNonLeftMouseButtons_data() @@ -2873,12 +2873,12 @@ void tst_qquickflickable::receiveTapOutsideContentItem() // Tap outside the content item in the top-left corner QTest::mouseClick(&window, Qt::LeftButton, {}, QPoint(5, 5)); - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); // Tap outside the content item in the bottom-right corner const QPoint bottomRight(flickable.contentItem()->width() + 5, flickable.contentItem()->height() + 5); QTest::mouseClick(&window, Qt::LeftButton, {}, bottomRight); - QCOMPARE(clickedSpy.count(), 2); + QCOMPARE(clickedSpy.size(), 2); } void tst_qquickflickable::flickWhenRotated_data() diff --git a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp index 3c9417fb1d..4dcbcc4884 100644 --- a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp +++ b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp @@ -379,78 +379,78 @@ void tst_qquickfocusscope::forceActiveFocus() itemA1->forceActiveFocus(); QVERIFY(itemA1->hasActiveFocus()); QVERIFY(!rootObject->hasActiveFocus()); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); scopeA->forceActiveFocus(); QVERIFY(!itemA1->hasActiveFocus()); QVERIFY(scopeA->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 1); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); itemA2->forceActiveFocus(); QVERIFY(!itemA1->hasActiveFocus()); QVERIFY(itemA2->hasActiveFocus()); QVERIFY(scopeA->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 1); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); scopeA->forceActiveFocus(); QVERIFY(!itemA1->hasActiveFocus()); QVERIFY(itemA2->hasActiveFocus()); QVERIFY(scopeA->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 1); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); itemA1->forceActiveFocus(); QVERIFY(itemA1->hasActiveFocus()); QVERIFY(!scopeA->hasActiveFocus()); QVERIFY(!itemA2->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 2); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 2); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); // Then jump back and forth between branch 'a' and 'b' itemB1->forceActiveFocus(); QVERIFY(itemB1->hasActiveFocus()); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); scopeA->forceActiveFocus(); QVERIFY(!itemA1->hasActiveFocus()); QVERIFY(!itemB1->hasActiveFocus()); QVERIFY(scopeA->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 3); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 3); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); scopeB->forceActiveFocus(); QVERIFY(!scopeA->hasActiveFocus()); QVERIFY(!itemB1->hasActiveFocus()); QVERIFY(scopeB->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 4); - QCOMPARE(scopeBSpy.count(), 1); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 4); + QCOMPARE(scopeBSpy.size(), 1); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); itemA2->forceActiveFocus(); QVERIFY(!scopeB->hasActiveFocus()); QVERIFY(itemA2->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 5); - QCOMPARE(scopeBSpy.count(), 2); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 5); + QCOMPARE(scopeBSpy.size(), 2); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); itemB2->forceActiveFocus(); QVERIFY(!itemA2->hasActiveFocus()); QVERIFY(itemB2->hasActiveFocus()); - QCOMPARE(scopeASpy.count(), 6); - QCOMPARE(scopeBSpy.count(), 3); - QCOMPARE(rootSpy.count(), 0); - QCOMPARE(scopeSpy.count(), 1); + QCOMPARE(scopeASpy.size(), 6); + QCOMPARE(scopeBSpy.size(), 3); + QCOMPARE(rootSpy.size(), 0); + QCOMPARE(scopeSpy.size(), 1); delete view; } @@ -516,12 +516,12 @@ void tst_qquickfocusscope::canvasFocus() QCOMPARE(item2->hasFocus(), false); QCOMPARE(item2->hasActiveFocus(), false); - QCOMPARE(rootFocusSpy.count(), 1); - QCOMPARE(rootActiveFocusSpy.count(), 1); - QCOMPARE(scope1FocusSpy.count(), 0); - QCOMPARE(scope1ActiveFocusSpy.count(), 1); - QCOMPARE(item1FocusSpy.count(), 0); - QCOMPARE(item1ActiveFocusSpy.count(), 1); + QCOMPARE(rootFocusSpy.size(), 1); + QCOMPARE(rootActiveFocusSpy.size(), 1); + QCOMPARE(scope1FocusSpy.size(), 0); + QCOMPARE(scope1ActiveFocusSpy.size(), 1); + QCOMPARE(item1FocusSpy.size(), 0); + QCOMPARE(item1ActiveFocusSpy.size(), 1); // view->hide(); // seemingly doesn't remove focus, so have an another view steal it. @@ -537,12 +537,12 @@ void tst_qquickfocusscope::canvasFocus() QCOMPARE(item1->hasFocus(), true); QCOMPARE(item1->hasActiveFocus(), false); - QCOMPARE(rootFocusSpy.count(), 2); - QCOMPARE(rootActiveFocusSpy.count(), 2); - QCOMPARE(scope1FocusSpy.count(), 0); - QCOMPARE(scope1ActiveFocusSpy.count(), 2); - QCOMPARE(item1FocusSpy.count(), 0); - QCOMPARE(item1ActiveFocusSpy.count(), 2); + QCOMPARE(rootFocusSpy.size(), 2); + QCOMPARE(rootActiveFocusSpy.size(), 2); + QCOMPARE(scope1FocusSpy.size(), 0); + QCOMPARE(scope1ActiveFocusSpy.size(), 2); + QCOMPARE(item1FocusSpy.size(), 0); + QCOMPARE(item1ActiveFocusSpy.size(), 2); // window does not have focus, so item2 will not get active focus @@ -559,16 +559,16 @@ void tst_qquickfocusscope::canvasFocus() QCOMPARE(item2->hasFocus(), true); QCOMPARE(item2->hasActiveFocus(), false); - QCOMPARE(rootFocusSpy.count(), 2); - QCOMPARE(rootActiveFocusSpy.count(), 2); - QCOMPARE(scope1FocusSpy.count(), 1); - QCOMPARE(scope1ActiveFocusSpy.count(), 2); - QCOMPARE(item1FocusSpy.count(), 0); - QCOMPARE(item1ActiveFocusSpy.count(), 2); - QCOMPARE(scope2FocusSpy.count(), 1); - QCOMPARE(scope2ActiveFocusSpy.count(), 0); - QCOMPARE(item2FocusSpy.count(), 1); - QCOMPARE(item2ActiveFocusSpy.count(), 0); + QCOMPARE(rootFocusSpy.size(), 2); + QCOMPARE(rootActiveFocusSpy.size(), 2); + QCOMPARE(scope1FocusSpy.size(), 1); + QCOMPARE(scope1ActiveFocusSpy.size(), 2); + QCOMPARE(item1FocusSpy.size(), 0); + QCOMPARE(item1ActiveFocusSpy.size(), 2); + QCOMPARE(scope2FocusSpy.size(), 1); + QCOMPARE(scope2ActiveFocusSpy.size(), 0); + QCOMPARE(item2FocusSpy.size(), 1); + QCOMPARE(item2ActiveFocusSpy.size(), 0); // give the window focus, and item2 will get active focus view->show(); @@ -582,12 +582,12 @@ void tst_qquickfocusscope::canvasFocus() QCOMPARE(scope2->hasActiveFocus(), true); QCOMPARE(item2->hasFocus(), true); QCOMPARE(item2->hasActiveFocus(), true); - QCOMPARE(rootFocusSpy.count(), 3); - QCOMPARE(rootActiveFocusSpy.count(), 3); - QCOMPARE(scope2FocusSpy.count(), 1); - QCOMPARE(scope2ActiveFocusSpy.count(), 1); - QCOMPARE(item2FocusSpy.count(), 1); - QCOMPARE(item2ActiveFocusSpy.count(), 1); + QCOMPARE(rootFocusSpy.size(), 3); + QCOMPARE(rootActiveFocusSpy.size(), 3); + QCOMPARE(scope2FocusSpy.size(), 1); + QCOMPARE(scope2ActiveFocusSpy.size(), 1); + QCOMPARE(item2FocusSpy.size(), 1); + QCOMPARE(item2ActiveFocusSpy.size(), 1); delete view; } diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp index 0efe3a2c24..c34edbcdde 100644 --- a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp +++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp @@ -147,27 +147,27 @@ void tst_qquickfontloader::changeFont() QSignalSpy statusSpy(fontObject, SIGNAL(statusChanged())); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(nameSpy.count(), 0); - QCOMPARE(statusSpy.count(), 0); + QCOMPARE(nameSpy.size(), 0); + QCOMPARE(statusSpy.size(), 0); QTRY_COMPARE(fontObject->name(), QString("OCRA")); ctxt->setContextProperty("fnt", server.urlString("/daniel.ttf")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Loading); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(nameSpy.count(), 1); - QCOMPARE(statusSpy.count(), 2); + QCOMPARE(nameSpy.size(), 1); + QCOMPARE(statusSpy.size(), 2); QTRY_COMPARE(fontObject->name(), QString("Daniel")); ctxt->setContextProperty("fnt", testFileUrl("tarzeau_ocr_a.ttf")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(nameSpy.count(), 2); - QCOMPARE(statusSpy.count(), 2); + QCOMPARE(nameSpy.size(), 2); + QCOMPARE(statusSpy.size(), 2); QTRY_COMPARE(fontObject->name(), QString("OCRA")); ctxt->setContextProperty("fnt", server.urlString("/daniel.ttf")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(nameSpy.count(), 3); - QCOMPARE(statusSpy.count(), 2); + QCOMPARE(nameSpy.size(), 3); + QCOMPARE(statusSpy.size(), 2); QTRY_COMPARE(fontObject->name(), QString("Daniel")); } diff --git a/tests/auto/quick/qquickfontmetrics/tst_quickfontmetrics.cpp b/tests/auto/quick/qquickfontmetrics/tst_quickfontmetrics.cpp index 6d98b62696..f34bdc2059 100644 --- a/tests/auto/quick/qquickfontmetrics/tst_quickfontmetrics.cpp +++ b/tests/auto/quick/qquickfontmetrics/tst_quickfontmetrics.cpp @@ -39,7 +39,7 @@ void tst_QuickFontMetrics::properties() QSignalSpy spy(&metrics, SIGNAL(fontChanged(QFont))); metrics.setFont(font); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(metrics.ascent(), expected.ascent()); QCOMPARE(metrics.descent(), expected.descent()); diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 182458bb10..1a2d409473 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -350,7 +350,7 @@ void tst_QQuickGridView::items() QTRY_COMPARE(gridview->count(), model.count()); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); @@ -365,7 +365,7 @@ void tst_QQuickGridView::items() QaimModel model2; ctxt->setContextProperty("testModel", &model2); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QTRY_COMPARE(itemCount, 0); delete window; @@ -430,7 +430,7 @@ void tst_QQuickGridView::inserted_basic() model.insertItem(1, "Will", "9876"); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); QTRY_VERIFY(name != nullptr); @@ -452,7 +452,7 @@ void tst_QQuickGridView::inserted_basic() model.insertItem(0, "Foo", "1111"); // zero index, and current item - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QQuickText>(contentItem, "textName", 0); QTRY_VERIFY(name != nullptr); @@ -539,7 +539,7 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && delegateVisible(item)) { firstVisibleIndex = i; @@ -549,7 +549,7 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); // Confirm items positioned correctly and indexes correct - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); @@ -732,7 +732,7 @@ void tst_QQuickGridView::insertBeforeVisible() QTRY_COMPARE(gridview->contentY(), 0.0 + itemsOffsetAfterMove); // Confirm items positioned correctly and indexes correct - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -804,7 +804,7 @@ void tst_QQuickGridView::removed_basic() QTRY_COMPARE(removed, QString("Item1")); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -825,7 +825,7 @@ void tst_QQuickGridView::removed_basic() // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -838,7 +838,7 @@ void tst_QQuickGridView::removed_basic() QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -876,7 +876,7 @@ void tst_QQuickGridView::removed_basic() QVERIFY(QQuickTest::qWaitForPolish(gridview)); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QTRY_COMPARE(item->x(), qreal((i%3)*80)); @@ -959,7 +959,7 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow, int firstVisibleIndex = -1; QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); QRectF viewRect(gridview->contentX(), gridview->contentY(), gridview->width(), gridview->height()); - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item) { QRectF itemRect(item->x(), item->y(), item->width(), item->height()); @@ -975,7 +975,7 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow, QCOMPARE(firstName, firstVisible); // Confirm items positioned correctly and indexes correct - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); @@ -1200,7 +1200,7 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible() QCOMPARE(name->text(), QString("Item1")); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QTRY_VERIFY(findItem<QQuickItem>(contentItem, "wrapper", i)); QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -1309,7 +1309,7 @@ void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow, // Confirm items positioned correctly and indexes correct QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && delegateVisible(item)) { firstVisibleIndex = i; @@ -1318,7 +1318,7 @@ void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow, } QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item && ( (flow == QQuickGridView::FlowLeftToRight && i >= firstVisibleIndex + (3*6)) @@ -1545,7 +1545,7 @@ void tst_QQuickGridView::multipleChanges(bool condensed) QTRY_VERIFY(gridview != nullptr); QVERIFY(QQuickTest::qWaitForPolish(gridview)); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -1584,7 +1584,7 @@ void tst_QQuickGridView::multipleChanges(bool condensed) QQuickText *number; QQuickItem *contentItem = gridview->contentItem(); QTRY_VERIFY(contentItem != nullptr); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -2172,7 +2172,7 @@ void tst_QQuickGridView::changeFlow() QTRY_VERIFY(contentItem != nullptr); // Confirm items positioned correctly and indexes correct - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2190,7 +2190,7 @@ void tst_QQuickGridView::changeFlow() ctxt->setContextProperty("testTopToBottom", QVariant(true)); // Confirm items positioned correctly and indexes correct - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2208,7 +2208,7 @@ void tst_QQuickGridView::changeFlow() ctxt->setContextProperty("testRightToLeft", QVariant(true)); // Confirm items positioned correctly and indexes correct - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2228,7 +2228,7 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(gridview->contentX(), 0.); // Confirm items positioned correctly and indexes correct - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2322,17 +2322,17 @@ void tst_QQuickGridView::propertyChanges() QTRY_COMPARE(gridView->cacheBuffer(), 3); QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowTopToBottom); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); - QTRY_COMPARE(cacheBufferSpy.count(),1); - QTRY_COMPARE(flowSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),1); + QTRY_COMPARE(cacheBufferSpy.size(),1); + QTRY_COMPARE(flowSpy.size(),1); gridView->setWrapEnabled(false); gridView->setCacheBuffer(3); gridView->setFlow(QQuickGridView::FlowTopToBottom); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); - QTRY_COMPARE(cacheBufferSpy.count(),1); - QTRY_COMPARE(flowSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),1); + QTRY_COMPARE(cacheBufferSpy.size(),1); + QTRY_COMPARE(flowSpy.size(),1); gridView->setFlow(QQuickGridView::FlowLeftToRight); QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowLeftToRight); @@ -2345,26 +2345,26 @@ void tst_QQuickGridView::propertyChanges() QTRY_COMPARE(gridView->cacheBuffer(), 5); QTRY_COMPARE(gridView->layoutDirection(), Qt::RightToLeft); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),2); - QTRY_COMPARE(cacheBufferSpy.count(),2); - QTRY_COMPARE(layoutSpy.count(),1); - QTRY_COMPARE(flowSpy.count(),2); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),2); + QTRY_COMPARE(cacheBufferSpy.size(),2); + QTRY_COMPARE(layoutSpy.size(),1); + QTRY_COMPARE(flowSpy.size(),2); gridView->setWrapEnabled(true); gridView->setCacheBuffer(5); gridView->setLayoutDirection(Qt::RightToLeft); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),2); - QTRY_COMPARE(cacheBufferSpy.count(),2); - QTRY_COMPARE(layoutSpy.count(),1); - QTRY_COMPARE(flowSpy.count(),2); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),2); + QTRY_COMPARE(cacheBufferSpy.size(),2); + QTRY_COMPARE(layoutSpy.size(),1); + QTRY_COMPARE(flowSpy.size(),2); gridView->setFlow(QQuickGridView::FlowTopToBottom); QTRY_COMPARE(gridView->flow(), QQuickGridView::FlowTopToBottom); - QTRY_COMPARE(flowSpy.count(),3); + QTRY_COMPARE(flowSpy.size(),3); gridView->setFlow(QQuickGridView::FlowTopToBottom); - QTRY_COMPARE(flowSpy.count(),3); + QTRY_COMPARE(flowSpy.size(),3); delete window; } @@ -2404,24 +2404,24 @@ void tst_QQuickGridView::componentChanges() QVERIFY(gridView->headerItem()); QVERIFY(gridView->footerItem()); - QTRY_COMPARE(highlightSpy.count(),1); - QTRY_COMPARE(delegateSpy.count(),1); - QTRY_COMPARE(headerSpy.count(),1); - QTRY_COMPARE(footerSpy.count(),1); - QTRY_COMPARE(headerItemSpy.count(),1); - QTRY_COMPARE(footerItemSpy.count(),1); + QTRY_COMPARE(highlightSpy.size(),1); + QTRY_COMPARE(delegateSpy.size(),1); + QTRY_COMPARE(headerSpy.size(),1); + QTRY_COMPARE(footerSpy.size(),1); + QTRY_COMPARE(headerItemSpy.size(),1); + QTRY_COMPARE(footerItemSpy.size(),1); gridView->setHighlight(&component); gridView->setDelegate(&delegateComponent); gridView->setHeader(&component); gridView->setFooter(&component); - QTRY_COMPARE(highlightSpy.count(),1); - QTRY_COMPARE(delegateSpy.count(),1); - QTRY_COMPARE(headerSpy.count(),1); - QTRY_COMPARE(footerSpy.count(),1); - QTRY_COMPARE(headerItemSpy.count(),1); - QTRY_COMPARE(footerItemSpy.count(),1); + QTRY_COMPARE(highlightSpy.size(),1); + QTRY_COMPARE(delegateSpy.size(),1); + QTRY_COMPARE(headerSpy.size(),1); + QTRY_COMPARE(footerSpy.size(),1); + QTRY_COMPARE(headerItemSpy.size(),1); + QTRY_COMPARE(footerItemSpy.size(),1); delete window; } @@ -2442,13 +2442,13 @@ void tst_QQuickGridView::modelChanges() gridView->setModel(modelVariant); QTRY_COMPARE(gridView->model(), modelVariant); - QTRY_COMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.size(),1); gridView->setModel(modelVariant); - QTRY_COMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.size(),1); gridView->setModel(QVariant()); - QTRY_COMPARE(modelSpy.count(),2); + QTRY_COMPARE(modelSpy.size(),2); delete window; } @@ -2578,7 +2578,7 @@ void tst_QQuickGridView::positionViewAtIndex() QTRY_COMPARE(gridview->contentY(), contentPos); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = index; i < model.count() && i < itemCount-index-1; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3073,7 +3073,7 @@ void tst_QQuickGridView::footer() QSignalSpy footerItemSpy(gridview, SIGNAL(footerItemChanged())); QMetaObject::invokeMethod(window->rootObject(), "changeFooter"); - QCOMPARE(footerItemSpy.count(), 1); + QCOMPARE(footerItemSpy.size(), 1); footer = findItem<QQuickText>(contentItem, "footer"); QVERIFY(!footer); @@ -3292,7 +3292,7 @@ void tst_QQuickGridView::header() QSignalSpy headerItemSpy(gridview, SIGNAL(headerItemChanged())); QMetaObject::invokeMethod(window->rootObject(), "changeHeader"); - QCOMPARE(headerItemSpy.count(), 1); + QCOMPARE(headerItemSpy.size(), 1); header = findItem<QQuickText>(contentItem, "header"); QVERIFY(!header); @@ -3651,16 +3651,16 @@ void tst_QQuickGridView::resizeViewAndRepaint() // Ensure we handle -ve sizes gridview->setHeight(-100); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 3); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 3); gridview->setCacheBuffer(120); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 9); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 9); // ensure items in cache become visible gridview->setHeight(120); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 15); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 15); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3672,9 +3672,9 @@ void tst_QQuickGridView::resizeViewAndRepaint() // ensure items outside view become invisible gridview->setHeight(60); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 12); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 12); - itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3730,8 +3730,8 @@ void tst_QQuickGridView::resizeGrid() // Confirm items positioned correctly and indexes correct QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - QVERIFY(items.count() >= 18 && items.count() <= 21); - for (int i = 0; i < model.count() && i < items.count(); ++i) { + QVERIFY(items.size() >= 18 && items.size() <= 21); + for (int i = 0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); @@ -3762,8 +3762,8 @@ void tst_QQuickGridView::resizeGrid() // Confirm items positioned correctly and indexes correct items = findItems<QQuickItem>(contentItem, "wrapper"); - QVERIFY(items.count() >= 28); - for (int i = 0; i < model.count() && i < items.count(); ++i) { + QVERIFY(items.size() >= 28); + for (int i = 0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); @@ -3851,7 +3851,7 @@ void tst_QQuickGridView::changeColumnCount() QVERIFY(QQuickTest::qWaitForPolish(gridview)); // a single column of 6 items are visible - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QCOMPARE(itemCount, 6); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -3863,7 +3863,7 @@ void tst_QQuickGridView::changeColumnCount() // now 6x3 grid is visible, plus 1 extra below for refill gridview->setWidth(240); QVERIFY(QQuickTest::qWaitForPolish(gridview)); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QCOMPARE(itemCount, 6*3 + 1); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -3875,7 +3875,7 @@ void tst_QQuickGridView::changeColumnCount() // back to single column gridview->setWidth(100); QVERIFY(QQuickTest::qWaitForPolish(gridview)); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QCOMPARE(itemCount, 6); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -3976,8 +3976,8 @@ void tst_QQuickGridView::onAdd() qApp->processEvents(); QVariantList result = gridview->property("addedDelegates").toList(); - QTRY_COMPARE(result.count(), items.count()); - for (int i=0; i<items.count(); i++) + QTRY_COMPARE(result.size(), items.size()); + for (int i=0; i<items.size(); i++) QCOMPARE(result[i].toString(), items[i].first); releaseView(window); @@ -4461,7 +4461,7 @@ void tst_QQuickGridView::snapOneRow() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(gridview->currentIndex(), 2); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); } // flick to end @@ -4474,7 +4474,7 @@ void tst_QQuickGridView::snapOneRow() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(gridview->currentIndex(), 6); - QCOMPARE(currentIndexSpy.count(), 3); + QCOMPARE(currentIndexSpy.size(), 3); } if (flow == QQuickGridView::FlowLeftToRight) @@ -4497,7 +4497,7 @@ void tst_QQuickGridView::snapOneRow() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(gridview->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 6); + QCOMPARE(currentIndexSpy.size(), 6); } releaseView(window); @@ -4611,7 +4611,7 @@ void tst_QQuickGridView::populateTransitions() QCOMPARE(gridview->property("countAddTransitions").toInt(), 0); } - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -4633,7 +4633,7 @@ void tst_QQuickGridView::populateTransitions() // clear the model window->rootContext()->setContextProperty("testModel", QVariant()); QTRY_COMPARE(gridview->count(), 0); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").size(), 0); gridview->setProperty("countPopulateTransitions", 0); gridview->setProperty("countAddTransitions", 0); @@ -4647,7 +4647,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(gridview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 18 : 0); QTRY_COMPARE(gridview->property("countAddTransitions").toInt(), 0); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -4665,7 +4665,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(gridview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 18 : 0); QTRY_COMPARE(gridview->property("countAddTransitions").toInt(), 0); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -4753,7 +4753,7 @@ void tst_QQuickGridView::addTransitions() targetIndexes << i; } } - QVERIFY(expectedTargetData.count() > 0); + QVERIFY(expectedTargetData.size() > 0); } // start animation @@ -4766,7 +4766,7 @@ void tst_QQuickGridView::addTransitions() QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes); if (shouldAnimateTargets) { - QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -4792,7 +4792,7 @@ void tst_QQuickGridView::addTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= gridview->contentY()) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -4802,7 +4802,7 @@ void tst_QQuickGridView::addTransitions() QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); // verify all items moved to the correct final positions - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->x(), (i%3)*80.0); @@ -4965,7 +4965,7 @@ void tst_QQuickGridView::moveTransitions() model.moveItems(moveFrom, moveTo, moveCount); gridview->forceLayout(); - QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -4989,7 +4989,7 @@ void tst_QQuickGridView::moveTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= gridview->contentY()) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -5000,7 +5000,7 @@ void tst_QQuickGridView::moveTransitions() // verify all items moved to the correct final positions qreal pixelOffset = 60 * rowOffsetAfterMove; - for (int i=firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i=firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->x(), (i%3)*80.0); @@ -5201,13 +5201,13 @@ void tst_QQuickGridView::removeTransitions() targetIndexes << i; } } - QVERIFY(expectedTargetData.count() > 0); + QVERIFY(expectedTargetData.size() > 0); } // calculate targetItems and expectedTargets before model changes QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes); QVariantMap expectedTargets; - for (int i=0; i<targetIndexes.count(); i++) + for (int i=0; i<targetIndexes.size(); i++) expectedTargets[model.name(targetIndexes[i])] = targetIndexes[i]; // start animation @@ -5216,7 +5216,7 @@ void tst_QQuickGridView::removeTransitions() QTRY_COMPARE(model.count(), gridview->count()); if (shouldAnimateTargets || expectedDisplacedIndexes.isValid()) { - QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(gridview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(gridview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -5241,9 +5241,9 @@ void tst_QQuickGridView::removeTransitions() } QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - int itemCount = items.count(); + int itemCount = items.size(); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); int index = e.evaluate().toInt(); if (firstVisibleIndex < 0 && items[i]->y() >= gridview->contentY()) @@ -5438,15 +5438,15 @@ void tst_QQuickGridView::displacedTransitions() QTRY_VERIFY(gridview->property("displaceTransitionsDone").toBool()); // check the correct number of target items and indexes were received - QCOMPARE(resultTargetIndexes.count(), expectedDisplacedIndexes.count()); - for (int i=0; i<resultTargetIndexes.count(); i++) - QCOMPARE(resultTargetIndexes[i].value<QList<int> >().count(), change.count); - QCOMPARE(resultTargetItems.count(), expectedDisplacedIndexes.count()); - for (int i=0; i<resultTargetItems.count(); i++) - QCOMPARE(resultTargetItems[i].toList().count(), change.count); + QCOMPARE(resultTargetIndexes.size(), expectedDisplacedIndexes.count()); + for (int i=0; i<resultTargetIndexes.size(); i++) + QCOMPARE(resultTargetIndexes[i].value<QList<int> >().size(), change.count); + QCOMPARE(resultTargetItems.size(), expectedDisplacedIndexes.count()); + for (int i=0; i<resultTargetItems.size(); i++) + QCOMPARE(resultTargetItems[i].toList().size(), change.count); } else { - QCOMPARE(resultTargetIndexes.count(), 0); - QCOMPARE(resultTargetItems.count(), 0); + QCOMPARE(resultTargetIndexes.size(), 0); + QCOMPARE(resultTargetItems.size(), 0); } if (change.type == ListChange::Inserted && useAddDisplaced && addDisplacedEnabled) @@ -5473,7 +5473,7 @@ void tst_QQuickGridView::displacedTransitions() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->x(), (i%3)*80.0); @@ -5626,7 +5626,7 @@ void tst_QQuickGridView::multipleTransitions() int timeBetweenActions = window->rootObject()->property("timeBetweenActions").toInt(); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -5636,7 +5636,7 @@ void tst_QQuickGridView::multipleTransitions() model.insertItems(changes[i].index, targetItems); gridview->forceLayout(); QTRY_COMPARE(model.count(), gridview->count()); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!gridview->property("runningAddTargets").toBool()); QTRY_VERIFY(!gridview->property("runningAddDisplaced").toBool()); } else { @@ -5648,7 +5648,7 @@ void tst_QQuickGridView::multipleTransitions() model.removeItems(changes[i].index, changes[i].count); gridview->forceLayout(); QTRY_COMPARE(model.count(), gridview->count()); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!gridview->property("runningRemoveTargets").toBool()); QTRY_VERIFY(!gridview->property("runningRemoveDisplaced").toBool()); } else { @@ -5659,7 +5659,7 @@ void tst_QQuickGridView::multipleTransitions() model.moveItems(changes[i].index, changes[i].to, changes[i].count); gridview->forceLayout(); QVERIFY(QQuickTest::qWaitForPolish(gridview)); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!gridview->property("runningMoveTargets").toBool()); QTRY_VERIFY(!gridview->property("runningMoveDisplaced").toBool()); } else { @@ -5683,7 +5683,7 @@ void tst_QQuickGridView::multipleTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= contentY) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -5694,7 +5694,7 @@ void tst_QQuickGridView::multipleTransitions() QVERIFY2(firstVisibleIndex >= 0, QTest::toString(firstVisibleIndex)); // verify all items moved to the correct final positions - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); @@ -5802,7 +5802,7 @@ void tst_QQuickGridView::multipleDisplaced() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->x(), (i%3)*80.0); @@ -5896,7 +5896,7 @@ void tst_QQuickGridView::cacheBuffer() QVERIFY(gridview->model() != 0); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QTRY_COMPARE(item->x(), (i%3)*80.0); @@ -5926,7 +5926,7 @@ void tst_QQuickGridView::cacheBuffer() } int newItemCount = 0; - newItemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + newItemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); // Confirm items positioned correctly for (int i = 0; i < model.count() && i < newItemCount; ++i) { @@ -6404,7 +6404,7 @@ QList<int> tst_QQuickGridView::toIntList(const QVariantList &list) { QList<int> ret; bool ok = true; - for (int i=0; i<list.count(); i++) { + for (int i=0; i<list.size(); i++) { ret << list[i].toInt(&ok); if (!ok) qWarning() << "tst_QQuickGridView::toIntList(): not a number:" << list[i]; @@ -6416,7 +6416,7 @@ QList<int> tst_QQuickGridView::toIntList(const QVariantList &list) void tst_QQuickGridView::matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes) { const QSet<int> expectedIndexSet(expectedIndexes.cbegin(), expectedIndexes.cend()); - for (int i=0; i<indexLists.count(); i++) { + for (int i=0; i<indexLists.size(); i++) { const auto ¤tList = indexLists[i].value<QList<int> >(); const QSet<int> current(currentList.cbegin(), currentList.cend()); if (current != expectedIndexSet) @@ -6436,19 +6436,19 @@ void tst_QQuickGridView::matchItemsAndIndexes(const QVariantMap &items, const Qa qDebug() << itemIndex; QCOMPARE(model.name(itemIndex), name); } - QCOMPARE(items.count(), expectedIndexes.count()); + QCOMPARE(items.size(), expectedIndexes.size()); } void tst_QQuickGridView::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems) { - for (int i=0; i<itemLists.count(); i++) { + for (int i=0; i<itemLists.size(); i++) { QVariantList current = itemLists[i].toList(); - for (int j=0; j<current.count(); j++) { + for (int j=0; j<current.size(); j++) { QQuickItem *o = qobject_cast<QQuickItem*>(current[j].value<QObject*>()); QVERIFY2(o, QTest::toString(QString("Invalid actual item at %1").arg(j))); QVERIFY2(expectedItems.contains(o), QTest::toString(QString("Cannot match item %1").arg(j))); } - QCOMPARE(current.count(), expectedItems.count()); + QCOMPARE(current.size(), expectedItems.size()); } } @@ -6552,11 +6552,11 @@ void tst_QQuickGridView::jsArrayChange() } view->setModel(QVariant::fromValue(array1)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // no change view->setModel(QVariant::fromValue(array2)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQuickGridView::contentHeightWithDelayRemove_data() @@ -6725,7 +6725,7 @@ void tst_QQuickGridView::keyNavigationEnabled() // of disabling both mouse and keyboard interaction. QSignalSpy enabledSpy(gridView, SIGNAL(keyNavigationEnabledChanged())); gridView->setInteractive(false); - QCOMPARE(enabledSpy.count(), 1); + QCOMPARE(enabledSpy.size(), 1); QCOMPARE(gridView->isKeyNavigationEnabled(), false); flick(window.data(), QPoint(200, 175), QPoint(200, 50), 100); @@ -6738,17 +6738,17 @@ void tst_QQuickGridView::keyNavigationEnabled() // Check that isKeyNavigationEnabled implicitly follows the value of interactive. gridView->setInteractive(true); - QCOMPARE(enabledSpy.count(), 2); + QCOMPARE(enabledSpy.size(), 2); QCOMPARE(gridView->isKeyNavigationEnabled(), true); // Change it back again for the next check. gridView->setInteractive(false); - QCOMPARE(enabledSpy.count(), 3); + QCOMPARE(enabledSpy.size(), 3); QCOMPARE(gridView->isKeyNavigationEnabled(), false); // Setting keyNavigationEnabled to true shouldn't enable mouse interaction. gridView->setKeyNavigationEnabled(true); - QCOMPARE(enabledSpy.count(), 4); + QCOMPARE(enabledSpy.size(), 4); flick(window.data(), QPoint(200, 175), QPoint(200, 50), 100); QVERIFY(!gridView->isMoving()); QCOMPARE(gridView->contentY(), 0.0); @@ -6761,7 +6761,7 @@ void tst_QQuickGridView::keyNavigationEnabled() // Changing interactive now shouldn't result in keyNavigationEnabled changing, // since we broke the "binding". gridView->setInteractive(true); - QCOMPARE(enabledSpy.count(), 4); + QCOMPARE(enabledSpy.size(), 4); // Keyboard interaction shouldn't work now. gridView->setKeyNavigationEnabled(false); diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index 73b575f818..560fad64eb 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -582,9 +582,9 @@ void tst_qquickimage::noLoading() ctxt->setContextProperty("srcImage", testFileUrl("green.png")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 1); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 1); + QTRY_COMPARE(sourceSpy.size(), 1); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 1); // Loading remote file ctxt->setContextProperty("srcImage", server.url("/rect.png")); @@ -592,9 +592,9 @@ void tst_qquickimage::noLoading() QTRY_COMPARE(obj->progress(), 0.0); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 2); - QTRY_VERIFY(progressSpy.count() >= 2); - QTRY_COMPARE(statusSpy.count(), 3); + QTRY_COMPARE(sourceSpy.size(), 2); + QTRY_VERIFY(progressSpy.size() >= 2); + QTRY_COMPARE(statusSpy.size(), 3); // Loading remote file again - should not go through 'Loading' state. progressSpy.clear(); @@ -602,9 +602,9 @@ void tst_qquickimage::noLoading() ctxt->setContextProperty("srcImage", server.url("/rect.png")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 4); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 5); + QTRY_COMPARE(sourceSpy.size(), 4); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 5); delete obj; } @@ -659,17 +659,17 @@ void tst_qquickimage::sourceSize_QTBUG_14303() QTRY_COMPARE(obj->sourceSize().width(), 200); QTRY_COMPARE(obj->sourceSize().height(), 200); - QTRY_COMPARE(sourceSizeSpy.count(), 0); + QTRY_COMPARE(sourceSizeSpy.size(), 0); ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(obj->sourceSize().width(), 120); QTRY_COMPARE(obj->sourceSize().height(), 120); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart200.png")); QTRY_COMPARE(obj->sourceSize().width(), 200); QTRY_COMPARE(obj->sourceSize().height(), 200); - QTRY_COMPARE(sourceSizeSpy.count(), 2); + QTRY_COMPARE(sourceSizeSpy.size(), 2); delete obj; } @@ -811,48 +811,48 @@ void tst_qquickimage::sourceSizeChanges() // Local ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(img->status(), QQuickImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 0); + QTRY_COMPARE(sourceSizeSpy.size(), 0); ctxt->setContextProperty("srcImage", testFileUrl("heart.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("heart_copy.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 1); + QTRY_COMPARE(sourceSizeSpy.size(), 1); ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 2); + QTRY_COMPARE(sourceSizeSpy.size(), 2); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(img->status(), QQuickImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 3); + QTRY_COMPARE(sourceSizeSpy.size(), 3); // Remote ctxt->setContextProperty("srcImage", server.url("/heart.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/heart.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/heart_copy.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 4); + QTRY_COMPARE(sourceSizeSpy.size(), 4); ctxt->setContextProperty("srcImage", server.url("/colors.png")); QTRY_COMPARE(img->status(), QQuickImage::Ready); - QTRY_COMPARE(sourceSizeSpy.count(), 5); + QTRY_COMPARE(sourceSizeSpy.size(), 5); ctxt->setContextProperty("srcImage", QUrl("")); QTRY_COMPARE(img->status(), QQuickImage::Null); - QTRY_COMPARE(sourceSizeSpy.count(), 6); + QTRY_COMPARE(sourceSizeSpy.size(), 6); delete img; } @@ -954,17 +954,17 @@ void tst_qquickimage::progressAndStatusChanges() ctxt->setContextProperty("srcImage", testFileUrl("heart.png")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 0); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 0); + QTRY_COMPARE(sourceSpy.size(), 0); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 0); // Loading local file ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 1); - QTRY_COMPARE(progressSpy.count(), 0); - QTRY_COMPARE(statusSpy.count(), 1); + QTRY_COMPARE(sourceSpy.size(), 1); + QTRY_COMPARE(progressSpy.size(), 0); + QTRY_COMPARE(statusSpy.size(), 1); // Loading remote file ctxt->setContextProperty("srcImage", server.url("/heart.png")); @@ -972,16 +972,16 @@ void tst_qquickimage::progressAndStatusChanges() QTRY_COMPARE(obj->progress(), 0.0); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); - QTRY_COMPARE(sourceSpy.count(), 2); - QTRY_VERIFY(progressSpy.count() > 1); - QTRY_COMPARE(statusSpy.count(), 3); + QTRY_COMPARE(sourceSpy.size(), 2); + QTRY_VERIFY(progressSpy.size() > 1); + QTRY_COMPARE(statusSpy.size(), 3); ctxt->setContextProperty("srcImage", ""); QTRY_COMPARE(obj->status(), QQuickImage::Null); QTRY_COMPARE(obj->progress(), 0.0); - QTRY_COMPARE(sourceSpy.count(), 3); - QTRY_VERIFY(progressSpy.count() > 2); - QTRY_COMPARE(statusSpy.count(), 4); + QTRY_COMPARE(sourceSpy.size(), 3); + QTRY_VERIFY(progressSpy.size() > 2); + QTRY_COMPARE(statusSpy.size(), 4); delete obj; } @@ -1209,7 +1209,7 @@ void tst_qquickimage::multiFrame() if (asynchronous) { QCOMPARE(image->frameCount(), 0); QTRY_COMPARE(image->frameCount(), 4); - QCOMPARE(countSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); } else { QCOMPARE(image->frameCount(), 4); } @@ -1228,7 +1228,7 @@ void tst_qquickimage::multiFrame() image->setCurrentFrame(1); QTRY_COMPARE(image->status(), QQuickImageBase::Ready); - QCOMPARE(currentSpy.count(), 1); + QCOMPARE(currentSpy.size(), 1); QCOMPARE(image->currentFrame(), 1); contents = toUnscaledImage(view.grabWindow()); // The second frame is a green ball, approximately qRgba(0x27, 0xc8, 0x22, 0xff) diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp index aa44e9ad61..78727d32a0 100644 --- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp +++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp @@ -423,7 +423,7 @@ void tst_qquickimageprovider::threadTest() //MUST not deadlock QVERIFY(obj != nullptr); QList<QQuickImage *> images = obj->findChildren<QQuickImage *>(); - QCOMPARE(images.count(), 4); + QCOMPARE(images.size(), 4); QTest::qWait(100); foreach (QQuickImage *img, images) { QCOMPARE(img->status(), QQuickImage::Loading); @@ -542,7 +542,7 @@ void tst_qquickimageprovider::asyncTextureTest() //MUST not deadlock QVERIFY(obj != nullptr); QList<QQuickImage *> images = obj->findChildren<QQuickImage *>(); - QCOMPARE(images.count(), 4); + QCOMPARE(images.size(), 4); QTRY_COMPARE(provider->pool.activeThreadCount(), 4); foreach (QQuickImage *img, images) { @@ -615,7 +615,7 @@ void tst_qquickimageprovider::instantAsyncTextureTest() QVERIFY(!obj.isNull()); const QList<QQuickImage *> images = obj->findChildren<QQuickImage *>(); - QCOMPARE(images.count(), 4); + QCOMPARE(images.size(), 4); for (QQuickImage *img: images) { QTRY_COMPARE(img->status(), QQuickImage::Ready); diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index c74134c113..2736d6d9bb 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -1035,13 +1035,13 @@ void tst_qquickitem::constructor() QQuickItem *child1 = new QQuickItem(root.data()); QCOMPARE(child1->parent(), root.data()); QCOMPARE(child1->parentItem(), root.data()); - QCOMPARE(root->childItems().count(), 1); + QCOMPARE(root->childItems().size(), 1); QCOMPARE(root->childItems().at(0), child1); QQuickItem *child2 = new QQuickItem(root.data()); QCOMPARE(child2->parent(), root.data()); QCOMPARE(child2->parentItem(), root.data()); - QCOMPARE(root->childItems().count(), 2); + QCOMPARE(root->childItems().size(), 2); QCOMPARE(root->childItems().at(0), child1); QCOMPARE(root->childItems().at(1), child2); } @@ -1059,7 +1059,7 @@ void tst_qquickitem::setParentItem() child1->setParentItem(root); QVERIFY(!child1->parent()); QCOMPARE(child1->parentItem(), root); - QCOMPARE(root->childItems().count(), 1); + QCOMPARE(root->childItems().size(), 1); QCOMPARE(root->childItems().at(0), child1); QQuickItem *child2 = new QQuickItem; @@ -1068,14 +1068,14 @@ void tst_qquickitem::setParentItem() child2->setParentItem(root); QVERIFY(!child2->parent()); QCOMPARE(child2->parentItem(), root); - QCOMPARE(root->childItems().count(), 2); + QCOMPARE(root->childItems().size(), 2); QCOMPARE(root->childItems().at(0), child1); QCOMPARE(root->childItems().at(1), child2); child1->setParentItem(nullptr); QVERIFY(!child1->parent()); QVERIFY(!child1->parentItem()); - QCOMPARE(root->childItems().count(), 1); + QCOMPARE(root->childItems().size(), 1); QCOMPARE(root->childItems().at(0), child2); delete root; @@ -1565,7 +1565,7 @@ void tst_qquickitem::polishLoopDetection() } QList<QQuickItem*> items = window.contentItem()->childItems(); - for (int i = 0; i < items.count(); ++i) { + for (int i = 0; i < items.size(); ++i) { static_cast<TestPolishItem*>(items.at(i))->doPolish(); } item = static_cast<TestPolishItem*>(items.first()); @@ -1921,7 +1921,7 @@ void tst_qquickitem::paintOrder() QList<QQuickItem*> list = QQuickItemPrivate::get(root)->paintOrderChildItems(); QStringList items; - for (int i = 0; i < list.count(); ++i) + for (int i = 0; i < list.size(); ++i) items << list.at(i)->objectName(); QCOMPARE(items, expected); diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 161397640e..2c4b2dd6ec 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -2548,19 +2548,19 @@ void tst_QQuickItem::smooth() item->setSmooth(true); QVERIFY(item->smooth()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); QList<QVariant> arguments = spy.first(); - QCOMPARE(arguments.count(), 1); + QCOMPARE(arguments.size(), 1); QVERIFY(arguments.at(0).toBool()); item->setSmooth(true); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); item->setSmooth(false); QVERIFY(!item->smooth()); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); item->setSmooth(false); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete item; } @@ -2577,19 +2577,19 @@ void tst_QQuickItem::antialiasing() item->setAntialiasing(true); QVERIFY(item->antialiasing()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); QList<QVariant> arguments = spy.first(); - QCOMPARE(arguments.count(), 1); + QCOMPARE(arguments.size(), 1); QVERIFY(arguments.at(0).toBool()); item->setAntialiasing(true); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); item->setAntialiasing(false); QVERIFY(!item->antialiasing()); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); item->setAntialiasing(false); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete item; } @@ -2608,18 +2608,18 @@ void tst_QQuickItem::clip() QVERIFY(item->clip()); QList<QVariant> arguments = spy.first(); - QCOMPARE(arguments.count(), 1); + QCOMPARE(arguments.size(), 1); QVERIFY(arguments.at(0).toBool()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); item->setClip(true); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); item->setClip(false); QVERIFY(!item->clip()); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); item->setClip(false); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete item; } @@ -2927,50 +2927,50 @@ void tst_QQuickItem::propertyChanges() item->setBaselineOffset(10.0); QCOMPARE(item->parentItem(), parentItem); - QCOMPARE(parentSpy.count(),1); + QCOMPARE(parentSpy.size(),1); QList<QVariant> parentArguments = parentSpy.first(); - QCOMPARE(parentArguments.count(), 1); + QCOMPARE(parentArguments.size(), 1); QCOMPARE(item->parentItem(), qvariant_cast<QQuickItem *>(parentArguments.at(0))); - QCOMPARE(childrenChangedSpy.count(),1); + QCOMPARE(childrenChangedSpy.size(),1); item->setParentItem(parentItem); - QCOMPARE(childrenChangedSpy.count(),1); + QCOMPARE(childrenChangedSpy.size(),1); QCOMPARE(item->width(), 100.0); - QCOMPARE(widthSpy.count(),1); + QCOMPARE(widthSpy.size(),1); QCOMPARE(item->height(), 200.0); - QCOMPARE(heightSpy.count(),1); + QCOMPARE(heightSpy.size(),1); QCOMPARE(item->baselineOffset(), 10.0); - QCOMPARE(baselineOffsetSpy.count(),1); + QCOMPARE(baselineOffsetSpy.size(),1); QList<QVariant> baselineOffsetArguments = baselineOffsetSpy.first(); - QCOMPARE(baselineOffsetArguments.count(), 1); + QCOMPARE(baselineOffsetArguments.size(), 1); QCOMPARE(item->baselineOffset(), baselineOffsetArguments.at(0).toReal()); QCOMPARE(parentItem->childrenRect(), QRectF(0.0,0.0,100.0,200.0)); - QCOMPARE(childrenRectSpy.count(),1); + QCOMPARE(childrenRectSpy.size(),1); QList<QVariant> childrenRectArguments = childrenRectSpy.at(0); - QCOMPARE(childrenRectArguments.count(), 1); + QCOMPARE(childrenRectArguments.size(), 1); QCOMPARE(parentItem->childrenRect(), childrenRectArguments.at(0).toRectF()); QCOMPARE(item->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(),1); + QCOMPARE(focusSpy.size(),1); QList<QVariant> focusArguments = focusSpy.first(); - QCOMPARE(focusArguments.count(), 1); + QCOMPARE(focusArguments.size(), 1); QCOMPARE(focusArguments.at(0).toBool(), true); QCOMPARE(parentItem->hasActiveFocus(), false); QCOMPARE(parentItem->hasFocus(), false); - QCOMPARE(wantsFocusSpy.count(),0); + QCOMPARE(wantsFocusSpy.size(),0); item->setX(10.0); QCOMPARE(item->x(), 10.0); - QCOMPARE(xSpy.count(), 1); + QCOMPARE(xSpy.size(), 1); item->setY(10.0); QCOMPARE(item->y(), 10.0); - QCOMPARE(ySpy.count(), 1); + QCOMPARE(ySpy.size(), 1); delete window; } @@ -3255,7 +3255,7 @@ void tst_QQuickItem::changeListener() QCOMPARE(child2Listener.count(QQuickItemPrivate::Destroyed), 1); QQuickItemPrivate::get(parent)->removeItemChangeListener(&parentListener, QQuickItemPrivate::Children); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // QTBUG-54732: all listeners should get invoked even if they remove themselves while iterating the listeners QList<TestListener *> listeners; @@ -3265,89 +3265,89 @@ void tst_QQuickItem::changeListener() // itemVisibilityChanged x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Visibility); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setVisible(false); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Visibility), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemRotationChanged x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Rotation); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setRotation(90); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Rotation), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemOpacityChanged x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Opacity); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setOpacity(0.5); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Opacity), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemChildAdded() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Children); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); child1 = new QQuickItem(parent); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Children), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemParentChanged() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(child1)->addItemChangeListener(listener, QQuickItemPrivate::Parent); - QCOMPARE(QQuickItemPrivate::get(child1)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(child1)->changeListeners.size(), listeners.size()); child1->setParentItem(nullptr); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Parent), 1); - QCOMPARE(QQuickItemPrivate::get(child1)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(child1)->changeListeners.size(), 0); // itemImplicitWidthChanged() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::ImplicitWidth); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setImplicitWidth(parent->implicitWidth() + 1); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::ImplicitWidth), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemImplicitHeightChanged() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::ImplicitHeight); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setImplicitHeight(parent->implicitHeight() + 1); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::ImplicitHeight), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemGeometryChanged() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Geometry); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); parent->setWidth(parent->width() + 1); foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Geometry), 1); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemChildRemoved() x 5 child1->setParentItem(parent); foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Children); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); delete child1; foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Children), 2); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), 0); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), 0); // itemDestroyed() x 5 foreach (TestListener *listener, listeners) QQuickItemPrivate::get(parent)->addItemChangeListener(listener, QQuickItemPrivate::Destroyed); - QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.count(), listeners.count()); + QCOMPARE(QQuickItemPrivate::get(parent)->changeListeners.size(), listeners.size()); delete parent; foreach (TestListener *listener, listeners) QCOMPARE(listener->count(QQuickItemPrivate::Destroyed), 1); diff --git a/tests/auto/quick/qquicklistview/proxytestinnermodel.cpp b/tests/auto/quick/qquicklistview/proxytestinnermodel.cpp index c0dbb641fb..d00b417429 100644 --- a/tests/auto/quick/qquicklistview/proxytestinnermodel.cpp +++ b/tests/auto/quick/qquicklistview/proxytestinnermodel.cpp @@ -28,7 +28,7 @@ int ProxyTestInnerModel::rowCount(const QModelIndex &parent) const if (parent.isValid()) return 0; - return m_values.count(); + return m_values.size(); } int ProxyTestInnerModel::columnCount(const QModelIndex &parent) const @@ -49,7 +49,7 @@ QVariant ProxyTestInnerModel::data(const QModelIndex &index, int role) const void ProxyTestInnerModel::append(const QString &s) { - beginInsertRows(QModelIndex(), m_values.count(), m_values.count()); + beginInsertRows(QModelIndex(), m_values.size(), m_values.size()); m_values << s; endInsertRows(); } diff --git a/tests/auto/quick/qquicklistview/randomsortmodel.cpp b/tests/auto/quick/qquicklistview/randomsortmodel.cpp index 764dc81fb7..3e0c45bb1a 100644 --- a/tests/auto/quick/qquicklistview/randomsortmodel.cpp +++ b/tests/auto/quick/qquicklistview/randomsortmodel.cpp @@ -23,7 +23,7 @@ QHash<int, QByteArray> RandomSortModel::roleNames() const int RandomSortModel::rowCount(const QModelIndex& parent) const { if (!parent.isValid()) - return mData.count(); + return mData.size(); return 0; } @@ -34,7 +34,7 @@ QVariant RandomSortModel::data(const QModelIndex& index, int role) const return QVariant(); } - if (index.row() >= mData.count()) { + if (index.row() >= mData.size()) { return QVariant(); } @@ -49,14 +49,14 @@ QVariant RandomSortModel::data(const QModelIndex& index, int role) const void RandomSortModel::randomize() { - const int row = QRandomGenerator::global()->bounded(mData.count()); + const int row = QRandomGenerator::global()->bounded(mData.size()); int random; bool exists = false; // Make sure we won't end up with two items with the same weight, as that // would make unit-testing much harder do { exists = false; - random = QRandomGenerator::global()->bounded(mData.count() * 10); + random = QRandomGenerator::global()->bounded(mData.size() * 10); QList<QPair<QString, int> >::ConstIterator iter, end; for (iter = mData.constBegin(), end = mData.constEnd(); iter != end; ++iter) { if ((*iter).second == random) { diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 828eaeacb4..3245ead111 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -445,7 +445,7 @@ void tst_QQuickListView::items(const QUrl &source) QTRY_COMPARE(listview->count(), model.count()); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); listview->forceLayout(); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item // current item should be first item QTRY_COMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0)); @@ -563,7 +563,7 @@ void tst_QQuickListView::inserted(const QUrl &source) model.insertItem(1, "Will", "9876"); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); QTRY_VERIFY(name != nullptr); @@ -581,7 +581,7 @@ void tst_QQuickListView::inserted(const QUrl &source) model.insertItem(0, "Foo", "1111"); // zero index, and current item QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); - QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(contentItem->childItems().size(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QQuickText>(contentItem, "textName", 0); QTRY_VERIFY(name != nullptr); @@ -697,7 +697,7 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && !QQuickItemPrivate::get(item)->culled) { firstVisibleIndex = i; @@ -711,7 +711,7 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v QQuickText *number; const qreal visibleFromPos = listview->contentY() - listview->displayMarginBeginning() - listview->cacheBuffer(); const qreal visibleToPos = listview->contentY() + listview->height() + listview->displayMarginEnd() + listview->cacheBuffer(); - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); qreal pos = i*20.0 + itemsOffsetAfterMove; @@ -885,7 +885,7 @@ void tst_QQuickListView::insertBeforeVisible() QTRY_COMPARE(listview->contentY(), 0.0 + itemsOffsetAfterMove); // Confirm items positioned correctly and indexes correct - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -976,7 +976,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -996,7 +996,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(number->text(), model.number(0)); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -1009,7 +1009,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -1045,7 +1045,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -1079,7 +1079,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(listview->count() , model.count()); // Confirm items positioned correctly - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount-1; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i+1); if (!item) qWarning() << "Item" << i+1 << "not found"; @@ -1114,7 +1114,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) listview->positionViewAtEnd(); for (int i = 0; i < 18; ++i) model.removeItems(model.count() - 1, 1); - QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() > 16); + QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").size() > 16); } template <class T> @@ -1170,7 +1170,7 @@ void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::Vertic QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && delegateVisible(item)) { firstVisibleIndex = i; @@ -1182,7 +1182,7 @@ void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::Vertic // Confirm items positioned correctly and indexes correct QQuickText *name; QQuickText *number; - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); qreal pos = i*20.0 + itemsOffsetAfterMove; @@ -1333,7 +1333,7 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou model.clear(); - QTRY_COMPARE(findItems<QQuickListView>(contentItem, "wrapper").count(), 0); + QTRY_COMPARE(findItems<QQuickListView>(contentItem, "wrapper").size(), 0); QTRY_COMPARE(listview->count(), 0); QTRY_VERIFY(!listview->currentItem()); if (verticalLayoutDirection == QQuickItemView::TopToBottom) @@ -1402,7 +1402,7 @@ void tst_QQuickListView::moved(const QUrl &source, QQuickItemView::VerticalLayou QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (item && delegateVisible(item)) { firstVisibleIndex = i; @@ -1412,7 +1412,7 @@ void tst_QQuickListView::moved(const QUrl &source, QQuickItemView::VerticalLayou QVERIFY2(firstVisibleIndex >= 0, QByteArray::number(firstVisibleIndex)); // Confirm items positioned correctly and indexes correct - for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { + for (int i = firstVisibleIndex; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); qreal pos = i*20.0 + itemsOffsetAfterMove; @@ -1612,7 +1612,7 @@ void tst_QQuickListView::multipleChanges(bool condensed) QTRY_VERIFY(listview != nullptr); QVERIFY(QQuickTest::qWaitForPolish(listview)); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -1651,7 +1651,7 @@ void tst_QQuickListView::multipleChanges(bool condensed) QQuickText *number; QQuickItem *contentItem = listview->contentItem(); QTRY_VERIFY(contentItem != nullptr); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -2048,7 +2048,7 @@ void tst_QQuickListView::spacing() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2060,7 +2060,7 @@ void tst_QQuickListView::spacing() QTRY_COMPARE(listview->spacing(), qreal(10)); // Confirm items positioned correctly - QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() == 11); + QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").size() == 11); for (int i = 0; i < 11; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2071,7 +2071,7 @@ void tst_QQuickListView::spacing() listview->setSpacing(0); // Confirm items positioned correctly - QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() >= 16); + QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").size() >= 16); for (int i = 0; i < 16; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -2105,7 +2105,7 @@ void tst_QQuickListView::sections(const QUrl &source) QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY(item); @@ -2159,12 +2159,12 @@ void tst_QQuickListView::sections(const QUrl &source) listview->setContentY(140); QTRY_COMPARE(listview->currentSection(), QString("1")); - QTRY_COMPARE(currentSectionChangedSpy.count(), 1); + QTRY_COMPARE(currentSectionChangedSpy.size(), 1); listview->setContentY(20); QTRY_COMPARE(listview->currentSection(), QString("0")); - QTRY_COMPARE(currentSectionChangedSpy.count(), 2); + QTRY_COMPARE(currentSectionChangedSpy.size(), 2); item = findItem<QQuickItem>(contentItem, "wrapper", 1); QTRY_VERIFY(item); @@ -2214,7 +2214,7 @@ void tst_QQuickListView::sectionsDelegate() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QTRY_VERIFY(item); @@ -2256,7 +2256,7 @@ void tst_QQuickListView::sectionsDelegate() // QTBUG-17606 QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "sect_1"); - QCOMPARE(items.count(), 1); + QCOMPARE(items.size(), 1); // QTBUG-17759 model.modifyItem(0, "One", "aaa"); @@ -2272,10 +2272,10 @@ void tst_QQuickListView::sectionsDelegate() model.modifyItem(10, "Two", "aaa"); model.modifyItem(11, "Two", "aaa"); QVERIFY(QQuickTest::qWaitForPolish(listview)); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_aaa").count(), 1); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_aaa").size(), 1); window->rootObject()->setProperty("sectionProperty", "name"); // ensure view has settled. - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_Four").count(), 1); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "sect_Four").size(), 1); for (int i = 0; i < 4; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "sect_" + model.name(i*3)); @@ -2631,8 +2631,8 @@ void tst_QQuickListView::sectionDelegateChange() QQuickTest::qWaitForPolish(listview); - QVERIFY(findItems<QQuickItem>(contentItem, "section1").count() > 0); - QCOMPARE(findItems<QQuickItem>(contentItem, "section2").count(), 0); + QVERIFY(findItems<QQuickItem>(contentItem, "section1").size() > 0); + QCOMPARE(findItems<QQuickItem>(contentItem, "section2").size(), 0); for (int i = 0; i < 3; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "item", i); @@ -2643,8 +2643,8 @@ void tst_QQuickListView::sectionDelegateChange() QMetaObject::invokeMethod(window->rootObject(), "switchDelegates"); QQuickTest::qWaitForPolish(listview); - QCOMPARE(findItems<QQuickItem>(contentItem, "section1").count(), 0); - QVERIFY(findItems<QQuickItem>(contentItem, "section2").count() > 0); + QCOMPARE(findItems<QQuickItem>(contentItem, "section1").size(), 0); + QVERIFY(findItems<QQuickItem>(contentItem, "section2").size() > 0); for (int i = 0; i < 3; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "item", i); @@ -2691,7 +2691,7 @@ void tst_QQuickListView::sectionsItemInsertion() QVERIFY(QQuickTest::qWaitForPolish(listview)); - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QVERIFY(itemCount > 10); // Verify that the new items are postioned correctly, and have the correct attached section properties @@ -2791,7 +2791,7 @@ void tst_QQuickListView::currentIndex_delayedItemCreation() QSignalSpy spy(listview, SIGNAL(currentItemChanged())); //QCOMPARE(listview->currentIndex(), 0); listview->forceLayout(); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); releaseView(window); } @@ -3193,7 +3193,7 @@ void tst_QQuickListView::cacheBuffer() QTRY_VERIFY(listview->highlight() != nullptr); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3224,7 +3224,7 @@ void tst_QQuickListView::cacheBuffer() } int newItemCount = 0; - newItemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + newItemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); // Confirm items positioned correctly for (int i = 0; i < model.count() && i < newItemCount; ++i) { @@ -3360,7 +3360,7 @@ void tst_QQuickListView::positionViewAtIndex() QTRY_COMPARE(listview->contentY(), contentY); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = index; i < model.count() && i < itemCount-index-1; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3493,13 +3493,13 @@ void tst_QQuickListView::propertyChanges() QTRY_COMPARE(listView->cacheBuffer(), 3); QTRY_COMPARE(listView->snapMode(), QQuickListView::SnapOneItem); - QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1); - QTRY_COMPARE(preferredHighlightBeginSpy.count(),1); - QTRY_COMPARE(preferredHighlightEndSpy.count(),1); - QTRY_COMPARE(highlightRangeModeSpy.count(),1); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); - QTRY_COMPARE(cacheBufferSpy.count(),1); - QTRY_COMPARE(snapModeSpy.count(),1); + QTRY_COMPARE(highlightFollowsCurrentItemSpy.size(),1); + QTRY_COMPARE(preferredHighlightBeginSpy.size(),1); + QTRY_COMPARE(preferredHighlightEndSpy.size(),1); + QTRY_COMPARE(highlightRangeModeSpy.size(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),1); + QTRY_COMPARE(cacheBufferSpy.size(),1); + QTRY_COMPARE(snapModeSpy.size(),1); listView->setHighlightFollowsCurrentItem(false); listView->setPreferredHighlightBegin(1.0); @@ -3509,13 +3509,13 @@ void tst_QQuickListView::propertyChanges() listView->setCacheBuffer(3); listView->setSnapMode(QQuickListView::SnapOneItem); - QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1); - QTRY_COMPARE(preferredHighlightBeginSpy.count(),1); - QTRY_COMPARE(preferredHighlightEndSpy.count(),1); - QTRY_COMPARE(highlightRangeModeSpy.count(),1); - QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); - QTRY_COMPARE(cacheBufferSpy.count(),1); - QTRY_COMPARE(snapModeSpy.count(),1); + QTRY_COMPARE(highlightFollowsCurrentItemSpy.size(),1); + QTRY_COMPARE(preferredHighlightBeginSpy.size(),1); + QTRY_COMPARE(preferredHighlightEndSpy.size(),1); + QTRY_COMPARE(highlightRangeModeSpy.size(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.size(),1); + QTRY_COMPARE(cacheBufferSpy.size(),1); + QTRY_COMPARE(snapModeSpy.size(),1); } void tst_QQuickListView::componentChanges() @@ -3547,20 +3547,20 @@ void tst_QQuickListView::componentChanges() QTRY_COMPARE(listView->footer(), &component); QTRY_COMPARE(listView->delegate(), &delegateComponent); - QTRY_COMPARE(highlightSpy.count(),1); - QTRY_COMPARE(delegateSpy.count(),1); - QTRY_COMPARE(headerSpy.count(),1); - QTRY_COMPARE(footerSpy.count(),1); + QTRY_COMPARE(highlightSpy.size(),1); + QTRY_COMPARE(delegateSpy.size(),1); + QTRY_COMPARE(headerSpy.size(),1); + QTRY_COMPARE(footerSpy.size(),1); listView->setHighlight(&component); listView->setHeader(&component); listView->setFooter(&component); listView->setDelegate(&delegateComponent); - QTRY_COMPARE(highlightSpy.count(),1); - QTRY_COMPARE(delegateSpy.count(),1); - QTRY_COMPARE(headerSpy.count(),1); - QTRY_COMPARE(footerSpy.count(),1); + QTRY_COMPARE(highlightSpy.size(),1); + QTRY_COMPARE(delegateSpy.size(),1); + QTRY_COMPARE(headerSpy.size(),1); + QTRY_COMPARE(footerSpy.size(),1); } void tst_QQuickListView::modelChanges() @@ -3578,13 +3578,13 @@ void tst_QQuickListView::modelChanges() listView->setModel(modelVariant); QTRY_COMPARE(listView->model(), modelVariant); - QTRY_COMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.size(),1); listView->setModel(modelVariant); - QTRY_COMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.size(),1); listView->setModel(QVariant()); - QTRY_COMPARE(modelSpy.count(),2); + QTRY_COMPARE(modelSpy.size(),2); } void tst_QQuickListView::QTBUG_9791() @@ -3606,7 +3606,7 @@ void tst_QQuickListView::QTBUG_9791() qApp->processEvents(); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); QCOMPARE(itemCount, 3); for (int i = 0; i < itemCount; ++i) { @@ -3635,12 +3635,12 @@ void tst_QQuickListView::QTBUG_33568() listview->incrementCurrentIndex(); QTRY_COMPARE(listview->contentY(), -100.0); - QVERIFY(spy.count() > 1); + QVERIFY(spy.size() > 1); spy.clear(); listview->incrementCurrentIndex(); QTRY_COMPARE(listview->contentY(), -50.0); - QVERIFY(spy.count() > 1); + QVERIFY(spy.size() > 1); } void tst_QQuickListView::manualHighlight() @@ -3702,7 +3702,7 @@ void tst_QQuickListView::QTBUG_11105() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -3719,7 +3719,7 @@ void tst_QQuickListView::QTBUG_11105() ctxt->setContextProperty("testModel", &model2); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); QCOMPARE(itemCount, 5); } @@ -3827,7 +3827,7 @@ void tst_QQuickListView::header() QSignalSpy headerItemSpy(listview, SIGNAL(headerItemChanged())); QMetaObject::invokeMethod(window->rootObject(), "changeHeader"); - QCOMPARE(headerItemSpy.count(), 1); + QCOMPARE(headerItemSpy.size(), 1); header = findItem<QQuickText>(contentItem, "header"); QVERIFY(!header); @@ -4086,7 +4086,7 @@ void tst_QQuickListView::footer() QSignalSpy footerItemSpy(listview, SIGNAL(footerItemChanged())); QMetaObject::invokeMethod(window->rootObject(), "changeFooter"); - QCOMPARE(footerItemSpy.count(), 1); + QCOMPARE(footerItemSpy.size(), 1); footer = findItem<QQuickText>(contentItem, "footer"); QVERIFY(!footer); @@ -4373,7 +4373,7 @@ void tst_QQuickListView::resizeView() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -4393,16 +4393,16 @@ void tst_QQuickListView::resizeView() // Ensure we handle -ve sizes listview->setHeight(-100); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 1); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 1); listview->setCacheBuffer(200); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 11); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 11); // ensure items in cache become visible listview->setHeight(200); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 21); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 21); - itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -4413,9 +4413,9 @@ void tst_QQuickListView::resizeView() // ensure items outside view become invisible listview->setHeight(100); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).count(), 16); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper", false).size(), 16); - itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper", false).size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -4484,7 +4484,7 @@ void tst_QQuickListView::sizeLessThan1() QVERIFY(QQuickTest::qWaitForPolish(listview)); // Confirm items positioned correctly - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -4629,7 +4629,7 @@ void tst_QQuickListView::resizeFirstDelegate() QCOMPARE(listview->contentY(), 0.0); QSignalSpy spy(listview, SIGNAL(contentYChanged())); QTest::qWait(100); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); for (int i = 1; i < model.count(); ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -4697,13 +4697,13 @@ void tst_QQuickListView::repositionResizedDelegate() listview->setContentX(contentPos_itemFirstHalfVisible.x()); listview->setContentY(contentPos_itemFirstHalfVisible.y()); QVERIFY(QQuickTest::qWaitForPolish(listview)); - prevSpyCount = spy.count(); + prevSpyCount = spy.size(); QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "incrementRepeater")); QTRY_COMPARE(positioner->boundingRect().size(), resizedPositionerRect.size()); QTRY_COMPARE(positioner->position(), resizedPositionerRect.topLeft()); QCOMPARE(listview->contentX(), contentPos_itemFirstHalfVisible.x()); QCOMPARE(listview->contentY(), contentPos_itemFirstHalfVisible.y()); - QCOMPARE(spy.count(), prevSpyCount); + QCOMPARE(spy.size(), prevSpyCount); QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "decrementRepeater")); QTRY_COMPARE(positioner->boundingRect().size(), origPositionerRect.size()); @@ -4714,7 +4714,7 @@ void tst_QQuickListView::repositionResizedDelegate() listview->setContentX(contentPos_itemSecondHalfVisible.x()); listview->setContentY(contentPos_itemSecondHalfVisible.y()); QVERIFY(QQuickTest::qWaitForPolish(listview)); - prevSpyCount = spy.count(); + prevSpyCount = spy.size(); QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "incrementRepeater")); positioner = findItem<QQuickItem>(window->rootObject(), "positioner"); @@ -4723,7 +4723,7 @@ void tst_QQuickListView::repositionResizedDelegate() QCOMPARE(listview->contentX(), contentPos_itemSecondHalfVisible.x()); QCOMPARE(listview->contentY(), contentPos_itemSecondHalfVisible.y()); qApp->processEvents(); - QCOMPARE(spy.count(), prevSpyCount); + QCOMPARE(spy.size(), prevSpyCount); releaseView(window); } @@ -4913,8 +4913,8 @@ void tst_QQuickListView::onAdd() QTRY_COMPARE(listview->property("count").toInt(), model.count()); QVariantList result = listview->property("addedDelegates").toList(); - QCOMPARE(result.count(), items.count()); - for (int i=0; i<items.count(); i++) + QCOMPARE(result.size(), items.size()); + for (int i=0; i<items.size(); i++) QCOMPARE(result[i].toString(), items[i].first); } @@ -6021,7 +6021,7 @@ void tst_QQuickListView::snapOneItemResize_QTBUG_43555() QVERIFY(QQuickTest::qWaitForPolish(listview)); QTRY_COMPARE(listview->currentIndex(), 5); - QCOMPARE(currentIndexSpy.count(), 0); + QCOMPARE(currentIndexSpy.size(), 0); } void tst_QQuickListView::qAbstractItemModel_package_items() @@ -6345,7 +6345,7 @@ void tst_QQuickListView::snapOneItem() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(listview->currentIndex(), 1); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); } // flick to end @@ -6363,7 +6363,7 @@ void tst_QQuickListView::snapOneItem() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(listview->currentIndex(), 3); - QCOMPARE(currentIndexSpy.count(), 3); + QCOMPARE(currentIndexSpy.size(), 3); } // flick to start @@ -6381,7 +6381,7 @@ void tst_QQuickListView::snapOneItem() if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(listview->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 6); + QCOMPARE(currentIndexSpy.size(), 6); } releaseView(window); @@ -6407,7 +6407,7 @@ void tst_QQuickListView::snapOneItemCurrentIndexRemoveAnimation() QVERIFY(QQuickTest::qWaitForPolish(listview)); QCOMPARE(listview->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 0); + QCOMPARE(currentIndexSpy.size(), 0); } void tst_QQuickListView::snapOneItemWrongDirection() @@ -6711,7 +6711,7 @@ void tst_QQuickListView::populateTransitions() QCOMPARE(listview->property("countAddTransitions").toInt(), 0); } - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -6734,7 +6734,7 @@ void tst_QQuickListView::populateTransitions() window->rootContext()->setContextProperty("testModel", QVariant()); listview->forceLayout(); QTRY_COMPARE(listview->count(), 0); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").size(), 0); listview->setProperty("countPopulateTransitions", 0); listview->setProperty("countAddTransitions", 0); @@ -6746,7 +6746,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(listview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 16 : 0); QTRY_COMPARE(listview->property("countAddTransitions").toInt(), 0); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -6764,7 +6764,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(listview->property("countPopulateTransitions").toInt(), usePopulateTransition ? 16 : 0); QTRY_COMPARE(listview->property("countAddTransitions").toInt(), 0); - itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -6903,7 +6903,7 @@ void tst_QQuickListView::addTransitions() targetIndexes << i; } } - QVERIFY(expectedTargetData.count() > 0); + QVERIFY(expectedTargetData.size() > 0); } // start animation @@ -6916,7 +6916,7 @@ void tst_QQuickListView::addTransitions() QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes); if (shouldAnimateTargets) { - QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(listview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -6943,8 +6943,8 @@ void tst_QQuickListView::addTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - int itemCount = items.count(); - for (int i=0; i<items.count(); i++) { + int itemCount = items.size(); + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= contentY) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -7103,7 +7103,7 @@ void tst_QQuickListView::moveTransitions() // start animation model.moveItems(moveFrom, moveTo, moveCount); - QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(listview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -7127,7 +7127,7 @@ void tst_QQuickListView::moveTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { if (items[i]->y() >= contentY) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); firstVisibleIndex = e.evaluate().toInt(); @@ -7137,7 +7137,7 @@ void tst_QQuickListView::moveTransitions() QVERIFY2(firstVisibleIndex >= 0, QByteArray::number(firstVisibleIndex)); // verify all items moved to the correct final positions - int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); + int itemCount = findItems<QQuickItem>(contentItem, "wrapper").size(); for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); @@ -7297,13 +7297,13 @@ void tst_QQuickListView::removeTransitions() targetIndexes << i; } } - QVERIFY(expectedTargetData.count() > 0); + QVERIFY(expectedTargetData.size() > 0); } // calculate targetItems and expectedTargets before model changes QList<QQuickItem *> targetItems = findItems<QQuickItem>(contentItem, "wrapper", targetIndexes); QVariantMap expectedTargets; - for (int i=0; i<targetIndexes.count(); i++) + for (int i=0; i<targetIndexes.size(); i++) expectedTargets[model.name(targetIndexes[i])] = targetIndexes[i]; // start animation @@ -7311,7 +7311,7 @@ void tst_QQuickListView::removeTransitions() QTRY_COMPARE(model.count(), listview->count()); if (shouldAnimateTargets) { - QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.count()); + QTRY_COMPARE(listview->property("targetTransitionsDone").toInt(), expectedTargetData.size()); QTRY_COMPARE(listview->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.isValid() ? expectedDisplacedIndexes.count() : 0); @@ -7337,9 +7337,9 @@ void tst_QQuickListView::removeTransitions() QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); int firstVisibleIndex = -1; - int itemCount = items.count(); + int itemCount = items.size(); - for (int i=0; i<items.count(); i++) { + for (int i=0; i<items.size(); i++) { QQmlExpression e(qmlContext(items[i]), items[i], "index"); int index = e.evaluate().toInt(); if (firstVisibleIndex < 0 && items[i]->y() >= contentY) @@ -7528,15 +7528,15 @@ void tst_QQuickListView::displacedTransitions() QTRY_VERIFY(listview->property("displaceTransitionsDone").toBool()); // check the correct number of target items and indexes were received - QCOMPARE(resultTargetIndexes.count(), expectedDisplacedIndexes.count()); - for (int i=0; i<resultTargetIndexes.count(); i++) - QCOMPARE(resultTargetIndexes[i].value<QList<int> >().count(), change.count); - QCOMPARE(resultTargetItems.count(), expectedDisplacedIndexes.count()); - for (int i=0; i<resultTargetItems.count(); i++) - QCOMPARE(resultTargetItems[i].toList().count(), change.count); + QCOMPARE(resultTargetIndexes.size(), expectedDisplacedIndexes.count()); + for (int i=0; i<resultTargetIndexes.size(); i++) + QCOMPARE(resultTargetIndexes[i].value<QList<int> >().size(), change.count); + QCOMPARE(resultTargetItems.size(), expectedDisplacedIndexes.count()); + for (int i=0; i<resultTargetItems.size(); i++) + QCOMPARE(resultTargetItems[i].toList().size(), change.count); } else { - QCOMPARE(resultTargetIndexes.count(), 0); - QCOMPARE(resultTargetItems.count(), 0); + QCOMPARE(resultTargetIndexes.size(), 0); + QCOMPARE(resultTargetItems.size(), 0); } if (change.type == ListChange::Inserted && useAddDisplaced && addDisplacedEnabled) @@ -7563,7 +7563,7 @@ void tst_QQuickListView::displacedTransitions() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); QCOMPARE(item->x(), 0.0); @@ -7717,7 +7717,7 @@ void tst_QQuickListView::multipleTransitions() int timeBetweenActions = window->rootObject()->property("timeBetweenActions").toInt(); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -7726,7 +7726,7 @@ void tst_QQuickListView::multipleTransitions() targetItems << qMakePair(QString("new item %1").arg(j), QString::number(j)); model.insertItems(changes[i].index, targetItems); QTRY_COMPARE(model.count(), listview->count()); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!listview->property("runningAddTargets").toBool()); QTRY_VERIFY(!listview->property("runningAddDisplaced").toBool()); } else { @@ -7737,7 +7737,7 @@ void tst_QQuickListView::multipleTransitions() case ListChange::Removed: model.removeItems(changes[i].index, changes[i].count); QTRY_COMPARE(model.count(), listview->count()); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!listview->property("runningRemoveTargets").toBool()); QTRY_VERIFY(!listview->property("runningRemoveDisplaced").toBool()); } else { @@ -7747,7 +7747,7 @@ void tst_QQuickListView::multipleTransitions() case ListChange::Moved: model.moveItems(changes[i].index, changes[i].to, changes[i].count); QVERIFY(QQuickTest::qWaitForPolish(listview)); - if (i == changes.count() - 1) { + if (i == changes.size() - 1) { QTRY_VERIFY(!listview->property("runningMoveTargets").toBool()); QTRY_VERIFY(!listview->property("runningMoveDisplaced").toBool()); } else { @@ -7771,7 +7771,7 @@ void tst_QQuickListView::multipleTransitions() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->x(), 0.0); @@ -7880,7 +7880,7 @@ void tst_QQuickListView::multipleDisplaced() // verify all items moved to the correct final positions QList<QQuickItem*> items = findItems<QQuickItem>(contentItem, "wrapper"); - for (int i=0; i < model.count() && i < items.count(); ++i) { + for (int i=0; i < model.count() && i < items.size(); ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, qPrintable(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->x(), 0.0); @@ -7897,7 +7897,7 @@ QList<int> tst_QQuickListView::toIntList(const QVariantList &list) { QList<int> ret; bool ok = true; - for (int i=0; i<list.count(); i++) { + for (int i=0; i<list.size(); i++) { ret << list[i].toInt(&ok); if (!ok) qWarning() << "tst_QQuickListView::toIntList(): not a number:" << list[i]; @@ -7909,7 +7909,7 @@ QList<int> tst_QQuickListView::toIntList(const QVariantList &list) void tst_QQuickListView::matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes) { const QSet<int> expectedIndexSet(expectedIndexes.cbegin(), expectedIndexes.cend()); - for (int i=0; i<indexLists.count(); i++) { + for (int i=0; i<indexLists.size(); i++) { const auto ¤tList = indexLists[i].value<QList<int> >(); const QSet<int> current(currentList.cbegin(), currentList.cend()); if (current != expectedIndexSet) @@ -7929,20 +7929,20 @@ void tst_QQuickListView::matchItemsAndIndexes(const QVariantMap &items, const Qa qDebug() << itemIndex; QCOMPARE(model.name(itemIndex), name); } - QCOMPARE(items.count(), expectedIndexes.count()); + QCOMPARE(items.size(), expectedIndexes.size()); } void tst_QQuickListView::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems) { - for (int i=0; i<itemLists.count(); i++) { + for (int i=0; i<itemLists.size(); i++) { QCOMPARE(itemLists[i].typeId(), QMetaType::QVariantList); QVariantList current = itemLists[i].toList(); - for (int j=0; j<current.count(); j++) { + for (int j=0; j<current.size(); j++) { QQuickItem *o = qobject_cast<QQuickItem*>(current[j].value<QObject*>()); QVERIFY2(o, qPrintable(QString("Invalid actual item at %1").arg(j))); QVERIFY2(expectedItems.contains(o), qPrintable(QString("Cannot match item %1").arg(j))); } - QCOMPARE(current.count(), expectedItems.count()); + QCOMPARE(current.size(), expectedItems.size()); } } @@ -7972,7 +7972,7 @@ void tst_QQuickListView::flickBeyondBounds() // We're really testing that we don't get stuck in a loop, // but also confirm items positioned correctly. - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 2); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").size(), 2); for (int i = 0; i < 2; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; @@ -8079,7 +8079,7 @@ void tst_QQuickListView::destroyItemOnCreation() model.addItem("new item", ""); QTRY_COMPARE(window->rootObject()->property("createdIndex").toInt(), 0); - QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0); + QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").size(), 0); QCOMPARE(model.count(), 0); } @@ -9070,11 +9070,11 @@ void tst_QQuickListView::jsArrayChange() } view->setModel(QVariant::fromValue(array1)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // no change view->setModel(QVariant::fromValue(array2)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } static bool compareObjectModel(QQuickListView *listview, QQmlObjectModel *model) @@ -9259,7 +9259,7 @@ void tst_QQuickListView::keyNavigationEnabled() // of disabling both mouse and keyboard interaction. QSignalSpy enabledSpy(listView, SIGNAL(keyNavigationEnabledChanged())); listView->setInteractive(false); - QCOMPARE(enabledSpy.count(), 1); + QCOMPARE(enabledSpy.size(), 1); QCOMPARE(listView->isKeyNavigationEnabled(), false); flick(window.data(), QPoint(200, 200), QPoint(200, 50), 100); @@ -9272,17 +9272,17 @@ void tst_QQuickListView::keyNavigationEnabled() // Check that isKeyNavigationEnabled implicitly follows the value of interactive. listView->setInteractive(true); - QCOMPARE(enabledSpy.count(), 2); + QCOMPARE(enabledSpy.size(), 2); QCOMPARE(listView->isKeyNavigationEnabled(), true); // Change it back again for the next check. listView->setInteractive(false); - QCOMPARE(enabledSpy.count(), 3); + QCOMPARE(enabledSpy.size(), 3); QCOMPARE(listView->isKeyNavigationEnabled(), false); // Setting keyNavigationEnabled to true shouldn't enable mouse interaction. listView->setKeyNavigationEnabled(true); - QCOMPARE(enabledSpy.count(), 4); + QCOMPARE(enabledSpy.size(), 4); flick(window.data(), QPoint(200, 200), QPoint(200, 50), 100); QVERIFY(!listView->isMoving()); QCOMPARE(listView->contentY(), 0.0); @@ -9296,7 +9296,7 @@ void tst_QQuickListView::keyNavigationEnabled() // Changing interactive now shouldn't result in keyNavigationEnabled changing, // since we broke the "binding". listView->setInteractive(true); - QCOMPARE(enabledSpy.count(), 4); + QCOMPARE(enabledSpy.size(), 4); // Keyboard interaction shouldn't work now. listView->setKeyNavigationEnabled(false); @@ -9504,7 +9504,7 @@ void tst_QQuickListView::QTBUG_66163_setModelViewPortSizeChange() QTest::qWait(1100); // animation takes 1000ms, + 10% extra delay /* the viewport should not have changed, thus there should not have been any contentYChanged signal*/ - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QQuickListView::itemFiltered() @@ -9575,7 +9575,7 @@ void tst_QQuickListView::QTBUG_34576_velocityZero() window->rootObject()->setProperty("horizontalVelocityZeroCount", QVariant(0)); listview->setCurrentIndex(2); QTRY_COMPARE(window->rootObject()->property("current").toInt(), 2); - QCOMPARE(horizontalVelocitySpy.count(), 0); + QCOMPARE(horizontalVelocitySpy.size(), 0); QCOMPARE(window->rootObject()->property("horizontalVelocityZeroCount").toInt(), 0); QSignalSpy currentIndexChangedSpy(listview, SIGNAL(currentIndexChanged())); @@ -9585,11 +9585,11 @@ void tst_QQuickListView::QTBUG_34576_velocityZero() QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(295,215)); // verify that currentIndexChanged is triggered - QTRY_VERIFY(currentIndexChangedSpy.count() > 0); + QTRY_VERIFY(currentIndexChangedSpy.size() > 0); // since we have set currentIndex to an item out of view, the listview will scroll QTRY_COMPARE(window->rootObject()->property("current").toInt(), 3); - QTRY_VERIFY(horizontalVelocitySpy.count() > 0); + QTRY_VERIFY(horizontalVelocitySpy.size() > 0); // velocity should be always > 0.0 QTRY_COMPARE(window->rootObject()->property("horizontalVelocityZeroCount").toInt(), 0); @@ -9618,7 +9618,7 @@ void tst_QQuickListView::QTBUG_61537_modelChangesAsync() // Check that the number of delegates we expect to be visible in // the listview matches the number of items we find if we count. int reportedCount = listView->count(); - int actualCount = findItems<QQuickItem>(listView, "delegate").count(); + int actualCount = findItems<QQuickItem>(listView, "delegate").size(); QCOMPARE(reportedCount, actualCount); } @@ -9749,7 +9749,7 @@ public: m_animals.push_back(Animal {5, QLatin1String("Cherry")}); } - int rowCount(const QModelIndex & = QModelIndex()) const override {return m_animals.count();} + int rowCount(const QModelIndex & = QModelIndex()) const override {return m_animals.size();} QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override { if (!checkIndex(index)) @@ -9865,7 +9865,7 @@ void tst_QQuickListView::reuse_checkThatItemsAreReused() QVERIFY(listView->reuseItems()); auto items = findItems<QQuickItem>(listView, "delegate"); - const int initialItemCount = items.count(); + const int initialItemCount = items.size(); QVERIFY(initialItemCount > 0); // Sanity check that the size of the initial list of items match the count we tracked from QML @@ -10090,9 +10090,9 @@ void tst_QQuickListView::requiredObjectListModel() const auto *root = qobject_cast<QQuickListView *>(view.rootObject()); QVERIFY(root); - QCOMPARE(root->count(), dataList.count()); + QCOMPARE(root->count(), dataList.size()); - for (int i = 0, end = dataList.count(); i != end; ++i) { + for (int i = 0, end = dataList.size(); i != end; ++i) { const auto *rect = qobject_cast<QQuickRectangle *>(root->itemAtIndex(i)); QVERIFY(rect); const auto *data = qobject_cast<DataObject *>(dataList.at(i)); diff --git a/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp b/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp index cebd8a6081..e736725f19 100644 --- a/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp +++ b/tests/auto/quick/qquicklistview2/tst_qquicklistview2.cpp @@ -275,7 +275,7 @@ void tst_QQuickListView2::metaSequenceAsModel() QScopedPointer<QObject> o(c.create()); QVERIFY(!o.isNull()); QStringList strings = qvariant_cast<QStringList>(o->property("texts")); - QCOMPARE(strings.length(), 2); + QCOMPARE(strings.size(), 2); QCOMPARE(strings[0], QStringLiteral("1/2")); QCOMPARE(strings[1], QStringLiteral("5/6")); } @@ -432,7 +432,7 @@ void tst_QQuickListView2::tapDelegateDuringFlicking() // QTBUG-103832 QVERIFY(lastPressed > 5); QCOMPARE(releasedDelegates.last(), lastPressed); QCOMPARE(tappedDelegates.last(), lastPressed); - QCOMPARE(canceledDelegates.count(), 1); // only the first press was canceled, not the second + QCOMPARE(canceledDelegates.size(), 1); // only the first press was canceled, not the second } void tst_QQuickListView2::flickDuringFlicking_data() @@ -652,7 +652,7 @@ void tst_QQuickListView2::wheelSnap() if (highlightRangeMode == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(listview->currentIndex(), listview->count() - 1); - QCOMPARE(currentIndexSpy.count(), listview->count() - 1); + QCOMPARE(currentIndexSpy.size(), listview->count() - 1); } // flick to start @@ -673,7 +673,7 @@ void tst_QQuickListView2::wheelSnap() if (highlightRangeMode == QQuickItemView::StrictlyEnforceRange) { QCOMPARE(listview->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), (listview->count() - 1) * 2); + QCOMPARE(currentIndexSpy.size(), (listview->count() - 1) * 2); } } diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index b9c6eaab17..1c310c0fd5 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -161,7 +161,7 @@ void tst_QQuickLoader::sourceOrComponent() QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), error ? QQuickLoader::Error : QQuickLoader::Ready); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), error ? 0: 1); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), error ? 0: 1); if (!error) { bool sourceComponentIsChildOfLoader = false; @@ -222,12 +222,12 @@ void tst_QQuickLoader::clear() QVERIFY(loader != nullptr); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 1); QTRY_VERIFY(!loader->item()); QCOMPARE(loader->progress(), 0.0); QCOMPARE(loader->status(), QQuickLoader::Null); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 0); } { QQmlComponent component(&engine, testFileUrl("/SetSourceComponent.qml")); @@ -238,14 +238,14 @@ void tst_QQuickLoader::clear() QVERIFY(loader); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); loader->setSourceComponent(nullptr); QVERIFY(!loader->item()); QCOMPARE(loader->progress(), 0.0); QCOMPARE(loader->status(), QQuickLoader::Null); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 0); } { QQmlComponent component(&engine, testFileUrl("/SetSourceComponent.qml")); @@ -256,14 +256,14 @@ void tst_QQuickLoader::clear() QVERIFY(loader); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); QMetaObject::invokeMethod(item.data(), "clear"); QVERIFY(!loader->item()); QCOMPARE(loader->progress(), 0.0); QCOMPARE(loader->status(), QQuickLoader::Null); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 0); } } @@ -284,7 +284,7 @@ void tst_QQuickLoader::urlToComponent() QTRY_VERIFY(loader != nullptr); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 1); QCOMPARE(loader->width(), 10.0); QCOMPARE(loader->height(), 10.0); } @@ -300,12 +300,12 @@ void tst_QQuickLoader::componentToUrl() QVERIFY(loader); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); loader->setSource(testFileUrl("/Rect120x60.qml")); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); QCOMPARE(loader->width(), 120.0); QCOMPARE(loader->height(), 60.0); } @@ -435,7 +435,7 @@ void tst_QQuickLoader::networkRequestUrl() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->property("signalCount").toInt(), 1); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 1); } /* XXX Component waits until all dependencies are loaded. Is this actually possible? */ @@ -466,7 +466,7 @@ void tst_QQuickLoader::networkComponent() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - QCOMPARE(static_cast<QQuickItem*>(loader)->children().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->children().size(), 1); } @@ -489,7 +489,7 @@ void tst_QQuickLoader::failNetworkRequest() QVERIFY(!loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->property("did_load").toInt(), 123); - QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().size(), 0); } void tst_QQuickLoader::active() @@ -789,7 +789,7 @@ void tst_QQuickLoader::deleteComponentCrash() QCOMPARE(loader->status(), QQuickLoader::Ready); QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QTRY_COMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QTRY_COMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); QCOMPARE(loader->source(), QUrl("BlueRect.qml")); } @@ -866,8 +866,8 @@ void tst_QQuickLoader::implicitSize() QCOMPARE(loader->property("implicitWidth").toReal(), 200.); QCOMPARE(loader->property("implicitHeight").toReal(), 300.); - QCOMPARE(implWidthSpy.count(), 1); - QCOMPARE(implHeightSpy.count(), 1); + QCOMPARE(implWidthSpy.size(), 1); + QCOMPARE(implHeightSpy.size(), 1); } void tst_QQuickLoader::QTBUG_17114() @@ -970,7 +970,7 @@ void tst_QQuickLoader::asynchronous_clear() QCOMPARE(loader->progress(), 0.0); QCOMPARE(loader->status(), QQuickLoader::Null); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 0); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 0); // check loading component root->setProperty("comp", "BigComponent.qml"); @@ -983,7 +983,7 @@ void tst_QQuickLoader::asynchronous_clear() QTRY_VERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); } void tst_QQuickLoader::simultaneousSyncAsync() @@ -1047,7 +1047,7 @@ void tst_QQuickLoader::asyncToSync1() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); } void tst_QQuickLoader::asyncToSync2() @@ -1079,7 +1079,7 @@ void tst_QQuickLoader::asyncToSync2() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); + QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().size(), 1); } void tst_QQuickLoader::loadedSignal() @@ -1287,7 +1287,7 @@ void tst_QQuickLoader::sourceComponentGarbageCollection() if (spy.isEmpty()) QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } // QTBUG-51995 diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 7da0913e0c..755dad6312 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -196,18 +196,18 @@ void tst_QQuickMouseArea::dragProperties() QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(drag, SIGNAL(targetChanged())); drag->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); drag->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); // axis QCOMPARE(drag->axis(), QQuickDrag::XAndYAxis); QSignalSpy axisSpy(drag, SIGNAL(axisChanged())); drag->setAxis(QQuickDrag::XAxis); QCOMPARE(drag->axis(), QQuickDrag::XAxis); - QCOMPARE(axisSpy.count(),1); + QCOMPARE(axisSpy.size(),1); drag->setAxis(QQuickDrag::XAxis); - QCOMPARE(axisSpy.count(),1); + QCOMPARE(axisSpy.size(),1); // minimum and maximum properties QSignalSpy xminSpy(drag, SIGNAL(minimumXChanged())); @@ -230,20 +230,20 @@ void tst_QQuickMouseArea::dragProperties() QCOMPARE(drag->ymin(), 10.0); QCOMPARE(drag->ymax(), 10.0); - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); + QCOMPARE(xminSpy.size(),1); + QCOMPARE(xmaxSpy.size(),1); + QCOMPARE(yminSpy.size(),1); + QCOMPARE(ymaxSpy.size(),1); drag->setXmin(10); drag->setXmax(10); drag->setYmin(10); drag->setYmax(10); - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); + QCOMPARE(xminSpy.size(),1); + QCOMPARE(xmaxSpy.size(),1); + QCOMPARE(yminSpy.size(),1); + QCOMPARE(ymaxSpy.size(),1); // filterChildren QSignalSpy filterChildrenSpy(drag, SIGNAL(filterChildrenChanged())); @@ -251,24 +251,24 @@ void tst_QQuickMouseArea::dragProperties() drag->setFilterChildren(true); QVERIFY(drag->filterChildren()); - QCOMPARE(filterChildrenSpy.count(), 1); + QCOMPARE(filterChildrenSpy.size(), 1); drag->setFilterChildren(true); - QCOMPARE(filterChildrenSpy.count(), 1); + QCOMPARE(filterChildrenSpy.size(), 1); // threshold QCOMPARE(int(drag->threshold()), qApp->styleHints()->startDragDistance()); QSignalSpy thresholdSpy(drag, SIGNAL(thresholdChanged())); drag->setThreshold(0.0); QCOMPARE(drag->threshold(), 0.0); - QCOMPARE(thresholdSpy.count(), 1); + QCOMPARE(thresholdSpy.size(), 1); drag->setThreshold(99); - QCOMPARE(thresholdSpy.count(), 2); + QCOMPARE(thresholdSpy.size(), 2); drag->setThreshold(99); - QCOMPARE(thresholdSpy.count(), 2); + QCOMPARE(thresholdSpy.size(), 2); drag->resetThreshold(); QCOMPARE(int(drag->threshold()), qApp->styleHints()->startDragDistance()); - QCOMPARE(thresholdSpy.count(), 3); + QCOMPARE(thresholdSpy.size(), 3); } void tst_QQuickMouseArea::resetDrag() @@ -293,7 +293,7 @@ void tst_QQuickMouseArea::resetDrag() auto root = window.rootObject(); QQmlProperty haveTarget {root, "haveTarget"}; haveTarget.write(false); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); QVERIFY(!drag->target()); } @@ -1050,7 +1050,7 @@ void tst_QQuickMouseArea::preventStealing() QTest::mouseMove(&window, p); // We should have received all four move events - QTRY_COMPARE(mousePositionSpy.count(), 4); + QTRY_COMPARE(mousePositionSpy.size(), 4); mousePositionSpy.clear(); QVERIFY(mouseArea->pressed()); @@ -1079,7 +1079,7 @@ void tst_QQuickMouseArea::preventStealing() QTest::mouseMove(&window, p); // We should only have received the first move event - QTRY_COMPARE(mousePositionSpy.count(), 1); + QTRY_COMPARE(mousePositionSpy.size(), 1); // Our press should be taken away QVERIFY(!mouseArea->pressed()); @@ -1320,12 +1320,12 @@ void tst_QQuickMouseArea::hoverVisible() QTest::mouseMove(&window,QPoint(11,33)); QCOMPARE(mouseTracker->hovered(), false); - QCOMPARE(enteredSpy.count(), 0); + QCOMPARE(enteredSpy.size(), 0); mouseTracker->setVisible(true); QCOMPARE(mouseTracker->hovered(), true); - QCOMPARE(enteredSpy.count(), 1); + QCOMPARE(enteredSpy.size(), 1); QCOMPARE(QPointF(mouseTracker->mouseX(), mouseTracker->mouseY()), QPointF(11,33)); @@ -1455,7 +1455,7 @@ void tst_QQuickMouseArea::disableAfterPress() QVERIFY(!drag->active()); QPoint p = QPoint(100,100); QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); - QTRY_COMPARE(mousePressSpy.count(), 1); + QTRY_COMPARE(mousePressSpy.size(), 1); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -1469,7 +1469,7 @@ void tst_QQuickMouseArea::disableAfterPress() p += QPoint(11, 11); QTest::mouseMove(&window, p); - QTRY_COMPARE(mousePositionSpy.count(), 2); + QTRY_COMPARE(mousePositionSpy.size(), 2); QTRY_VERIFY(drag->active()); QTRY_COMPARE(blackRect->x(), 61.0); @@ -1483,7 +1483,7 @@ void tst_QQuickMouseArea::disableAfterPress() p += QPoint(11, 11); QTest::mouseMove(&window, p); - QTRY_COMPARE(mousePositionSpy.count(), 4); + QTRY_COMPARE(mousePositionSpy.size(), 4); QVERIFY(drag->active()); QCOMPARE(blackRect->x(), 83.0); @@ -1494,7 +1494,7 @@ void tst_QQuickMouseArea::disableAfterPress() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); - QTRY_COMPARE(mouseReleaseSpy.count(), 1); + QTRY_COMPARE(mouseReleaseSpy.size(), 1); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 83.0); @@ -1513,14 +1513,14 @@ void tst_QQuickMouseArea::disableAfterPress() QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(50); - QCOMPARE(mousePressSpy.count(), 0); + QCOMPARE(mousePressSpy.size(), 0); QTest::mouseMove(&window, QPoint(111,111)); QTest::qWait(50); QTest::mouseMove(&window, QPoint(122,122)); QTest::qWait(50); - QCOMPARE(mousePositionSpy.count(), 0); + QCOMPARE(mousePositionSpy.size(), 0); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -1529,7 +1529,7 @@ void tst_QQuickMouseArea::disableAfterPress() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(122,122)); QTest::qWait(50); - QCOMPARE(mouseReleaseSpy.count(), 0); + QCOMPARE(mouseReleaseSpy.size(), 0); } void tst_QQuickMouseArea::onWheel() @@ -1692,7 +1692,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons() mouseArea->setAcceptedMouseButtons(accepted); QPoint point(10, 10); - for (int i = 0; i < mouseEvents.count(); ++i) { + for (int i = 0; i < mouseEvents.size(); ++i) { const MouseEvent mouseEvent = mouseEvents.at(i); if (mouseEvent.type == QEvent::MouseButtonPress) QTest::mousePress(&window, mouseEvent.button, Qt::NoModifier, point); @@ -1702,8 +1702,8 @@ void tst_QQuickMouseArea::pressedMultipleButtons() QCOMPARE(mouseArea->pressedButtons(), pressedButtons.at(i)); } - QCOMPARE(pressedSpy.count(), 2); - QCOMPARE(pressedButtonsSpy.count(), changeCount); + QCOMPARE(pressedSpy.size(), 2); + QCOMPARE(pressedButtonsSpy.size(), changeCount); } void tst_QQuickMouseArea::changeAxis() @@ -1783,15 +1783,15 @@ void tst_QQuickMouseArea::cursorShape() mouseArea->setCursorShape(Qt::IBeamCursor); QCOMPARE(mouseArea->cursorShape(), Qt::IBeamCursor); QCOMPARE(mouseArea->cursor().shape(), Qt::IBeamCursor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); mouseArea->setCursorShape(Qt::IBeamCursor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); mouseArea->setCursorShape(Qt::WaitCursor); QCOMPARE(mouseArea->cursorShape(), Qt::WaitCursor); QCOMPARE(mouseArea->cursor().shape(), Qt::WaitCursor); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } #endif @@ -2004,25 +2004,25 @@ void tst_QQuickMouseArea::containsPress() QCOMPARE(mouseArea->hovered(), true); QTRY_COMPARE(mouseArea->pressed(), true); QCOMPARE(mouseArea->containsPress(), true); - QCOMPARE(containsPressSpy.count(), 1); + QCOMPARE(containsPressSpy.size(), 1); QTest::mouseMove(&window, QPoint(22,33)); QCOMPARE(mouseArea->hovered(), false); QCOMPARE(mouseArea->pressed(), true); QCOMPARE(mouseArea->containsPress(), false); - QCOMPARE(containsPressSpy.count(), 2); + QCOMPARE(containsPressSpy.size(), 2); QTest::mouseMove(&window, QPoint(200,200)); QCOMPARE(mouseArea->hovered(), true); QCOMPARE(mouseArea->pressed(), true); QCOMPARE(mouseArea->containsPress(), true); - QCOMPARE(containsPressSpy.count(), 3); + QCOMPARE(containsPressSpy.size(), 3); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(200,200)); QCOMPARE(mouseArea->hovered(), hoverEnabled); QCOMPARE(mouseArea->pressed(), false); QCOMPARE(mouseArea->containsPress(), false); - QCOMPARE(containsPressSpy.count(), 4); + QCOMPARE(containsPressSpy.size(), 4); } void tst_QQuickMouseArea::ignoreBySource() @@ -2344,8 +2344,8 @@ void tst_QQuickMouseArea::negativeZStackingOrder() // QTBUG-83114 QSignalSpy clickSpyChild(childMouseArea, &QQuickMouseArea::clicked); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, QPoint(150, 100)); - QCOMPARE(clickSpyChild.count(), 1); - QCOMPARE(clickSpyParent.count(), 0); + QCOMPARE(clickSpyChild.size(), 1); + QCOMPARE(clickSpyParent.size(), 0); auto order = root->property("clicks").toList(); QVERIFY(order.at(0) == "childMouseArea"); @@ -2353,8 +2353,8 @@ void tst_QQuickMouseArea::negativeZStackingOrder() // QTBUG-83114 childMouseArea->parentItem()->setZ(-1); root->setProperty("clicks", QVariantList()); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, QPoint(150, 100)); - QCOMPARE(clickSpyChild.count(), 1); - QCOMPARE(clickSpyParent.count(), 1); + QCOMPARE(clickSpyChild.size(), 1); + QCOMPARE(clickSpyParent.size(), 1); order = root->property("clicks").toList(); QVERIFY(order.at(0) == "parentMouseArea"); } @@ -2437,13 +2437,13 @@ void tst_QQuickMouseArea::releaseFirstTouchAfterSecond() // QTBUG-103766 QSignalSpy releaseSpy(mouseArea, &QQuickMouseArea::released); QTest::touchEvent(&window, device).press(0, {20, 20}); - QTRY_COMPARE(pressSpy.count(), 1); + QTRY_COMPARE(pressSpy.size(), 1); QTest::touchEvent(&window, device).stationary(0).press(1, {100, 20}); - QCOMPARE(pressSpy.count(), 1); // touchpoint 0 is the touchmouse, touchpoint 1 is ignored + QCOMPARE(pressSpy.size(), 1); // touchpoint 0 is the touchmouse, touchpoint 1 is ignored QTest::touchEvent(&window, device).stationary(0).release(1, {100, 20}); - QCOMPARE(releaseSpy.count(), 0); // touchpoint 0 is the touchmouse, and remains pressed + QCOMPARE(releaseSpy.size(), 0); // touchpoint 0 is the touchmouse, and remains pressed QTest::touchEvent(&window, device).release(0, {20, 20}); - QTRY_COMPARE(releaseSpy.count(), 1); + QTRY_COMPARE(releaseSpy.size(), 1); } #if QT_CONFIG(tabletevent) @@ -2465,15 +2465,15 @@ void tst_QQuickMouseArea::tabletStylusTap() Qt::LeftButton, 0.5, 0, 0, 0, 0, 0, stylusId, Qt::NoModifier); if (QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse) QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, point); // simulate what the platform does - QTRY_COMPARE(pressSpy.count(), 1); + QTRY_COMPARE(pressSpy.size(), 1); QWindowSystemInterface::handleTabletEvent(&window, point, window.mapToGlobal(point), int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::NoButton, 0.5, 0, 0, 0, 0, 0, stylusId, Qt::NoModifier); if (QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse) QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, point); - QTRY_COMPARE(releaseSpy.count(), 1); - QCOMPARE(clickSpy.count(), 1); - QCOMPARE(pressSpy.count(), 1); + QTRY_COMPARE(releaseSpy.size(), 1); + QCOMPARE(clickSpy.size(), 1); + QCOMPARE(pressSpy.size(), 1); } #endif diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 5da20ce9a2..509465b174 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -1243,22 +1243,22 @@ void tst_QQuickMultiPointTouchArea::mouseGestureStarted() // QTBUG-70258 QPoint p1 = QPoint(distanceFromOrigin, distanceFromOrigin); QTest::mousePress(view.data(), Qt::LeftButton, Qt::NoModifier, p1); - QCOMPARE(gestureStartedSpy.count(), 0); + QCOMPARE(gestureStartedSpy.size(), 0); p1 += QPoint(dragThreshold, dragThreshold); QTest::mouseMove(view.data(), p1); - QCOMPARE(gestureStartedSpy.count(), 0); + QCOMPARE(gestureStartedSpy.size(), 0); p1 += QPoint(1, 1); QTest::mouseMove(view.data(), p1); - QTRY_COMPARE(gestureStartedSpy.count(), 1); + QTRY_COMPARE(gestureStartedSpy.size(), 1); QTRY_COMPARE(area->property("gestureStartedX").toInt(), distanceFromOrigin); QCOMPARE(area->property("gestureStartedY").toInt(), distanceFromOrigin); p1 += QPoint(10, 10); QTest::mouseMove(view.data(), p1); // if nobody called gesteure->grab(), gestureStarted will keep happening - QTRY_COMPARE(gestureStartedSpy.count(), grabGesture ? 1 : 2); + QTRY_COMPARE(gestureStartedSpy.size(), grabGesture ? 1 : 2); QCOMPARE(area->property("gestureStartedX").toInt(), distanceFromOrigin); QCOMPARE(area->property("gestureStartedY").toInt(), distanceFromOrigin); @@ -1370,7 +1370,7 @@ void tst_QQuickMultiPointTouchArea::touchFiltering() // QTBUG-74028 QQuickTouchUtils::flush(window.data()); QTRY_COMPARE(mpta->parentItem()->property("mptaPoint").toPoint(), pt); QCOMPARE(mpta->parentItem()->property("maPoint").toPoint(), ma->boundingRect().center().toPoint()); - QCOMPARE(mptaSpy.count(), 1); + QCOMPARE(mptaSpy.size(), 1); } void tst_QQuickMultiPointTouchArea::nestedPinchAreaMouse() // QTBUG-83662 @@ -1391,32 +1391,32 @@ void tst_QQuickMultiPointTouchArea::nestedPinchAreaMouse() // QTBUG-83662 QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(point1->pressed(), true); QCOMPARE(point2->pressed(), false); - QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(pressedSpy.size(), 1); QCOMPARE(mpta->property("pressedCount").toInt(), 1); - QCOMPARE(updatedSpy.count(), 0); + QCOMPARE(updatedSpy.size(), 0); QCOMPARE(mpta->property("updatedCount").toInt(), 0); - QCOMPARE(releasedSpy.count(), 0); + QCOMPARE(releasedSpy.size(), 0); QCOMPARE(mpta->property("releasedCount").toInt(), 0); p1 += QPoint(0, 15); QTest::mouseMove(window.data(), p1); QCOMPARE(point1->pressed(), true); QCOMPARE(point2->pressed(), false); - QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(pressedSpy.size(), 1); QCOMPARE(mpta->property("pressedCount").toInt(), 1); - QCOMPARE(updatedSpy.count(), 1); + QCOMPARE(updatedSpy.size(), 1); QCOMPARE(mpta->property("updatedCount").toInt(), 1); - QCOMPARE(releasedSpy.count(), 0); + QCOMPARE(releasedSpy.size(), 0); QCOMPARE(mpta->property("releasedCount").toInt(), 0); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(point1->pressed(), false); QCOMPARE(point2->pressed(), false); - QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(pressedSpy.size(), 1); QCOMPARE(mpta->property("pressedCount").toInt(), 1); - QCOMPARE(updatedSpy.count(), 1); + QCOMPARE(updatedSpy.size(), 1); QCOMPARE(mpta->property("updatedCount").toInt(), 1); - QCOMPARE(releasedSpy.count(), 1); + QCOMPARE(releasedSpy.size(), 1); QCOMPARE(mpta->property("releasedCount").toInt(), 1); } diff --git a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp index f002de0e3d..56ebfdbd48 100644 --- a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp +++ b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp @@ -282,24 +282,24 @@ void tst_QQuickPaintedItem::contentsSize() item.setContentsSize(QSize()); QCOMPARE(item.contentsSize(), QSize()); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); item.setContentsSize(QSize(320, 240)); QCOMPARE(item.contentsSize(), QSize(320, 240)); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); clearDirtyContentFlag(&item); item.setContentsSize(QSize(320, 240)); QCOMPARE(item.contentsSize(), QSize(320, 240)); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.resetContentsSize(); QCOMPARE(item.contentsSize(), QSize()); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QQuickPaintedItem::contentScale() @@ -315,7 +315,7 @@ void tst_QQuickPaintedItem::contentScale() item.setContentsScale(1.); QCOMPARE(item.contentsScale(), 1.); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); item.update(); QTRY_COMPARE(hasDirtyContentFlag(&item), false); @@ -325,7 +325,7 @@ void tst_QQuickPaintedItem::contentScale() item.setContentsScale(0.4); QCOMPARE(item.contentsScale(), 0.4); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTRY_COMPARE(hasDirtyContentFlag(&item), false); QVERIFY(item.paintNode); @@ -334,12 +334,12 @@ void tst_QQuickPaintedItem::contentScale() item.setContentsScale(0.4); QCOMPARE(item.contentsScale(), 0.4); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setContentsScale(2.5); QCOMPARE(item.contentsScale(), 2.5); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QTRY_COMPARE(hasDirtyContentFlag(&item), false); QVERIFY(item.paintNode); @@ -397,7 +397,7 @@ void tst_QQuickPaintedItem::fillColor() item.setFillColor(QColor(Qt::transparent)); QCOMPARE(item.fillColor(), QColor(Qt::transparent)); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); item.update(); QTRY_COMPARE(hasDirtyContentFlag(&item), false); @@ -407,7 +407,7 @@ void tst_QQuickPaintedItem::fillColor() item.setFillColor(QColor(Qt::green)); QCOMPARE(item.fillColor(), QColor(Qt::green)); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTRY_COMPARE(hasDirtyContentFlag(&item), false); QVERIFY(item.paintNode); @@ -416,12 +416,12 @@ void tst_QQuickPaintedItem::fillColor() item.setFillColor(QColor(Qt::green)); QCOMPARE(item.fillColor(), QColor(Qt::green)); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setFillColor(QColor(Qt::blue)); QCOMPARE(item.fillColor(), QColor(Qt::blue)); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QTRY_COMPARE(hasDirtyContentFlag(&item), false); QVERIFY(item.paintNode); @@ -440,24 +440,24 @@ void tst_QQuickPaintedItem::renderTarget() item.setRenderTarget(QQuickPaintedItem::Image); QCOMPARE(item.renderTarget(), QQuickPaintedItem::Image); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); item.setRenderTarget(QQuickPaintedItem::FramebufferObject); QCOMPARE(item.renderTarget(), QQuickPaintedItem::FramebufferObject); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); clearDirtyContentFlag(&item); item.setRenderTarget(QQuickPaintedItem::FramebufferObject); QCOMPARE(item.renderTarget(), QQuickPaintedItem::FramebufferObject); QCOMPARE(hasDirtyContentFlag(&item), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setRenderTarget(QQuickPaintedItem::InvertedYFramebufferObject); QCOMPARE(item.renderTarget(), QQuickPaintedItem::InvertedYFramebufferObject); QCOMPARE(hasDirtyContentFlag(&item), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } QTEST_MAIN(tst_QQuickPaintedItem) diff --git a/tests/auto/quick/qquickpalette/tst_qquickpalette.cpp b/tests/auto/quick/qquickpalette/tst_qquickpalette.cpp index 90d850ce8a..53fa22dba5 100644 --- a/tests/auto/quick/qquickpalette/tst_qquickpalette.cpp +++ b/tests/auto/quick/qquickpalette/tst_qquickpalette.cpp @@ -117,8 +117,8 @@ void tst_QQuickPalette::newColorSubgroup() anotherPalette.fromQPalette(Qt::red); (p.*setter)((anotherPalette.*getter)()); - QCOMPARE(subgroupChanged.count(), 1); - QCOMPARE(paletteChanged.count(), 1); + QCOMPARE(subgroupChanged.size(), 1); + QCOMPARE(paletteChanged.size(), 1); } } @@ -161,7 +161,7 @@ void tst_QQuickPalette::paletteChangedWhenColorGroupChanged() p.inactive()->setMid(Qt::green); p.disabled()->setMid(Qt::blue); - QCOMPARE(sp.count(), 3); + QCOMPARE(sp.size(), 3); } void tst_QQuickPalette::createDefault() @@ -182,7 +182,7 @@ void tst_QQuickPalette::changeCurrentColorGroup() palette.setCurrentGroup(QPalette::Disabled); QCOMPARE(palette.currentColorGroup(), QPalette::Disabled); - QCOMPARE(ss.count(), 1); + QCOMPARE(ss.size(), 1); } void tst_QQuickPalette::inheritColor() @@ -266,10 +266,10 @@ void tst_QQuickPalette::createFromQtPalette() QSignalSpy sp(&palette, &QQuickColorGroup::changed); palette.fromQPalette(QPalette()); - QCOMPARE(sp.count(), 0); + QCOMPARE(sp.size(), 0); palette.fromQPalette(somePalette); - QCOMPARE(sp.count(), 1); + QCOMPARE(sp.size(), 1); } void tst_QQuickPalette::convertToQtPalette() diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index cc134dce5a..122ac3e029 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -211,7 +211,7 @@ void tst_QQuickPathView::items() QCOMPARE(pathview->count(), model.count()); QCOMPARE(window->rootObject()->property("count").toInt(), model.count()); - QCOMPARE(pathview->childItems().count(), model.count()+1); // assumes all are visible, including highlight + QCOMPARE(pathview->childItems().size(), model.count()+1); // assumes all are visible, including highlight for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(pathview, "textName", i); @@ -681,7 +681,7 @@ void tst_QQuickPathView::consecutiveModelChanges() else pathview->setOffset(4); - for (int i=0; i<changes.count(); i++) { + for (int i=0; i<changes.size(); i++) { switch (changes[i].type) { case ListChange::Inserted: { @@ -709,7 +709,7 @@ void tst_QQuickPathView::consecutiveModelChanges() } QQuickTest::qWaitForPolish(pathview); - QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), count); + QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), count); QCOMPARE(pathview->count(), count); QTRY_COMPARE(pathview->offset(), offset); @@ -812,7 +812,7 @@ void tst_QQuickPathView::dataModel() QTest::qWait(100); QCOMPARE(window->rootObject()->property("viewCount").toInt(), model.count()); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 14); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 14); QCOMPARE(pathview->currentIndex(), 0); QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 0)); @@ -832,7 +832,7 @@ void tst_QQuickPathView::dataModel() QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); QVERIFY(!testObject->error()); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); QQuickRectangle *testItem = findItem<QQuickRectangle>(pathview, "wrapper", 4); QVERIFY(testItem != nullptr); @@ -845,7 +845,7 @@ void tst_QQuickPathView::dataModel() model.insertItem(2, "pink", "2"); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); QCOMPARE(pathview->currentIndex(), 1); QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 1)); @@ -853,14 +853,14 @@ void tst_QQuickPathView::dataModel() QCOMPARE(text->text(), model.name(2)); model.removeItem(3); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); text = findItem<QQuickText>(pathview, "myText", 3); QVERIFY(text); QCOMPARE(text->text(), model.name(3)); QCOMPARE(pathview->currentItem(), findItem<QQuickItem>(pathview, "wrapper", 1)); model.moveItem(3, 5); - QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); QList<QQuickItem*> items = findItems<QQuickItem>(pathview, "wrapper"); foreach (QQuickItem *item, items) { QVERIFY(item->property("onPath").toBool()); @@ -870,7 +870,7 @@ void tst_QQuickPathView::dataModel() // QTBUG-14199 pathview->setOffset(7); pathview->setOffset(0); - QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); + QCOMPARE(findItems<QQuickItem>(pathview, "wrapper").size(), 5); pathview->setCurrentIndex(model.count()-1); QTRY_COMPARE(pathview->offset(), 1.0); @@ -1121,7 +1121,7 @@ void tst_QQuickPathView::setCurrentIndex() pathview->setSnapMode(QQuickPathView::SnapToItem); pathview->setCurrentIndex(3); QTRY_COMPARE(pathview->currentIndex(), 3); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); } void tst_QQuickPathView::setCurrentIndexWrap() @@ -1142,8 +1142,8 @@ void tst_QQuickPathView::setCurrentIndexWrap() pathview->setCurrentIndex(0); pathview->setCurrentIndex(4); QCOMPARE(pathview->currentIndex(), 4); - QCOMPARE(currentIndexSpy.count(), 2); - QCOMPARE(movementStartedSpy.count(), 0); + QCOMPARE(currentIndexSpy.size(), 2); + QCOMPARE(movementStartedSpy.size(), 0); } void tst_QQuickPathView::resetModel() @@ -1208,21 +1208,21 @@ void tst_QQuickPathView::propertyChanges() QCOMPARE(pathView->preferredHighlightEnd(), 0.4); QCOMPARE(pathView->dragMargin(), 20.0); - QCOMPARE(snapPositionSpy.count(), 1); - QCOMPARE(dragMarginSpy.count(), 1); + QCOMPARE(snapPositionSpy.size(), 1); + QCOMPARE(dragMarginSpy.size(), 1); pathView->setPreferredHighlightBegin(0.4); pathView->setPreferredHighlightEnd(0.4); pathView->setDragMargin(20.0); - QCOMPARE(snapPositionSpy.count(), 1); - QCOMPARE(dragMarginSpy.count(), 1); + QCOMPARE(snapPositionSpy.size(), 1); + QCOMPARE(dragMarginSpy.size(), 1); QSignalSpy maximumFlickVelocitySpy(pathView, SIGNAL(maximumFlickVelocityChanged())); pathView->setMaximumFlickVelocity(1000); - QCOMPARE(maximumFlickVelocitySpy.count(), 1); + QCOMPARE(maximumFlickVelocitySpy.size(), 1); pathView->setMaximumFlickVelocity(1000); - QCOMPARE(maximumFlickVelocitySpy.count(), 1); + QCOMPARE(maximumFlickVelocitySpy.size(), 1); } @@ -1250,14 +1250,14 @@ void tst_QQuickPathView::pathChanges() QCOMPARE(path->startX(), 240.0); QCOMPARE(path->startY(), 220.0); - QCOMPARE(startXSpy.count(),1); - QCOMPARE(startYSpy.count(),1); + QCOMPARE(startXSpy.size(),1); + QCOMPARE(startYSpy.size(),1); path->setStartX(240); path->setStartY(220); - QCOMPARE(startXSpy.count(),1); - QCOMPARE(startYSpy.count(),1); + QCOMPARE(startXSpy.size(),1); + QCOMPARE(startYSpy.size(),1); QQuickPath *alternatePath = window->rootObject()->findChild<QQuickPath*>("alternatePath"); QVERIFY(alternatePath); @@ -1268,10 +1268,10 @@ void tst_QQuickPathView::pathChanges() pathView->setPath(alternatePath); QCOMPARE(pathView->path(), alternatePath); - QCOMPARE(pathSpy.count(),1); + QCOMPARE(pathSpy.size(),1); pathView->setPath(alternatePath); - QCOMPARE(pathSpy.count(),1); + QCOMPARE(pathSpy.size(),1); QQuickPathAttribute *pathAttribute = window->rootObject()->findChild<QQuickPathAttribute*>("pathAttribute"); QVERIFY(pathAttribute); @@ -1281,10 +1281,10 @@ void tst_QQuickPathView::pathChanges() pathAttribute->setName("scale"); QCOMPARE(pathAttribute->name(), QString("scale")); - QCOMPARE(nameSpy.count(),1); + QCOMPARE(nameSpy.size(),1); pathAttribute->setName("scale"); - QCOMPARE(nameSpy.count(),1); + QCOMPARE(nameSpy.size(),1); } void tst_QQuickPathView::componentChanges() @@ -1303,10 +1303,10 @@ void tst_QQuickPathView::componentChanges() pathView->setDelegate(&delegateComponent); QCOMPARE(pathView->delegate(), &delegateComponent); - QCOMPARE(delegateSpy.count(),1); + QCOMPARE(delegateSpy.size(),1); pathView->setDelegate(&delegateComponent); - QCOMPARE(delegateSpy.count(),1); + QCOMPARE(delegateSpy.size(),1); } void tst_QQuickPathView::modelChanges() @@ -1329,17 +1329,17 @@ void tst_QQuickPathView::modelChanges() QCOMPARE(pathView->currentIndex(), 3); pathView->setModel(modelVariant); QCOMPARE(pathView->model(), modelVariant); - QCOMPARE(modelSpy.count(),1); + QCOMPARE(modelSpy.size(),1); QCOMPARE(pathView->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); pathView->setModel(modelVariant); - QCOMPARE(modelSpy.count(),1); + QCOMPARE(modelSpy.size(),1); pathView->setModel(QVariant()); - QCOMPARE(modelSpy.count(),2); + QCOMPARE(modelSpy.size(),2); QCOMPARE(pathView->currentIndex(), 0); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); } @@ -1523,12 +1523,12 @@ void tst_QQuickPathView::mouseDrag() // first move beyond threshold does not trigger drag QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 0); - QCOMPARE(dragStartedSpy.count(), 0); - QCOMPARE(dragEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 0); + QCOMPARE(dragStartedSpy.size(), 0); + QCOMPARE(dragEndedSpy.size(), 0); { QMouseEvent mv(QEvent::MouseMove, QPoint(90,100), window->mapToGlobal(QPoint(90,100)), @@ -1542,23 +1542,23 @@ void tst_QQuickPathView::mouseDrag() #endif // Q_OS_WIN QVERIFY(pathview->isMoving()); QVERIFY(pathview->isDragging()); - QCOMPARE(movingSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 1); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 1); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 0); QVERIFY(pathview->currentIndex() != current); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(40,100)); QVERIFY(!pathview->isDragging()); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QTRY_COMPARE(movingSpy.count(), 2); - QTRY_COMPARE(moveEndedSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QTRY_COMPARE(movingSpy.size(), 2); + QTRY_COMPARE(moveEndedSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); } @@ -1617,30 +1617,30 @@ void tst_QQuickPathView::flickNClick() // QTBUG-77173 // Dragging the child mouse area should animate the PathView (MA has no drag target) flick(window.data(), QPoint(199,199), QPoint(399,199), duration); QVERIFY(pathview->isMoving()); - QCOMPARE(movingChangedSpy.count(), 1); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QVERIFY(currentIndexSpy.count() > 0); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(flickingSpy.count(), 1); - QCOMPARE(flickStartedSpy.count(), 1); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingChangedSpy.size(), 1); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QVERIFY(currentIndexSpy.size() > 0); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(flickingSpy.size(), 1); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 0); // Now while it's still moving, click it. // The PathView should stop at a position such that offset is a whole number. QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(200, 200)); QTRY_VERIFY(!pathview->isMoving()); - QCOMPARE(movingChangedSpy.count(), 2); // QTBUG-78926 - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 1); - QCOMPARE(flickingSpy.count(), 2); - QCOMPARE(flickStartedSpy.count(), 1); - QCOMPARE(flickEndedSpy.count(), 1); + QCOMPARE(movingChangedSpy.size(), 2); // QTBUG-78926 + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 1); + QCOMPARE(flickingSpy.size(), 2); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 1); QVERIFY(qFuzzyIsNull(pathview->offset() - int(pathview->offset()))); } } @@ -1762,7 +1762,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() model.insertItem(0, "item1", "1"); qApp->processEvents(); - QCOMPARE(currentIndexSpy.count(), 1); + QCOMPARE(currentIndexSpy.size(), 1); // currentIndex is now 1 item = findItem<QQuickRectangle>(pathview, "wrapper", 1); @@ -1775,7 +1775,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() model.insertItem(0, "item2", "2"); qApp->processEvents(); - QCOMPARE(currentIndexSpy.count(), 2); + QCOMPARE(currentIndexSpy.size(), 2); // currentIndex is now 2 item = findItem<QQuickRectangle>(pathview, "wrapper", 2); @@ -1788,7 +1788,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() model.removeItem(0); qApp->processEvents(); - QCOMPARE(currentIndexSpy.count(), 3); + QCOMPARE(currentIndexSpy.size(), 3); // currentIndex is now 1 item = findItem<QQuickRectangle>(pathview, "wrapper", 1); @@ -1896,9 +1896,9 @@ void tst_QQuickPathView::cancelDrag() QTRY_VERIFY(hasFraction(pathview->offset())); QTRY_VERIFY(pathview->isMoving()); QVERIFY(pathview->isDragging()); - QCOMPARE(draggingSpy.count(), 1); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 0); + QCOMPARE(draggingSpy.size(), 1); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 0); // steal mouse grab - cancels PathView dragging auto mouse = QPointingDevice::primaryPointingDevice(); @@ -1911,9 +1911,9 @@ void tst_QQuickPathView::cancelDrag() QTRY_COMPARE(pathview->offset(), qreal(qFloor(pathview->offset()))); QTRY_VERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(40,100)); } @@ -2021,7 +2021,7 @@ void tst_QQuickPathView::snapOneItem() QSignalSpy snapModeSpy(pathview, SIGNAL(snapModeChanged())); window->rootObject()->setProperty("snapOne", true); - QCOMPARE(snapModeSpy.count(), 1); + QCOMPARE(snapModeSpy.size(), 1); QTRY_VERIFY(!pathview->isMoving()); // ensure stable int currentIndex = pathview->currentIndex(); @@ -2302,22 +2302,22 @@ void tst_QQuickPathView::nestedinFlickable() // first move beyond threshold does not trigger drag QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(fflickingSpy.count(), 0); - QCOMPARE(fflickStartedSpy.count(), 0); - QCOMPARE(fflickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(fflickingSpy.size(), 0); + QCOMPARE(fflickStartedSpy.size(), 0); + QCOMPARE(fflickEndedSpy.size(), 0); // no further moves after the initial move beyond threshold QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(73,219)); - QTRY_COMPARE(movingSpy.count(), 2); - QTRY_COMPARE(moveEndedSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); + QTRY_COMPARE(movingSpy.size(), 2); + QTRY_COMPARE(moveEndedSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); // Flickable should not handle this - QCOMPARE(fflickingSpy.count(), 0); - QCOMPARE(fflickStartedSpy.count(), 0); - QCOMPARE(fflickEndedSpy.count(), 0); + QCOMPARE(fflickingSpy.size(), 0); + QCOMPARE(fflickStartedSpy.size(), 0); + QCOMPARE(fflickEndedSpy.size(), 0); // now test that two quick flicks are both handled by the pathview movingSpy.clear(); @@ -2351,25 +2351,25 @@ void tst_QQuickPathView::nestedinFlickable() // we allow the multiple signal count case, rather than simply: // QTRY_COMPARE(moveEndedSpy.count(), 1); // QCOMPARE(moveStartedSpy.count(), 1); - QTRY_VERIFY(moveEndedSpy.count() > 0); + QTRY_VERIFY(moveEndedSpy.size() > 0); qCDebug(lcTests) << "After receiving moveEnded signal:" - << "moveEndedSpy.count():" << moveEndedSpy.count() - << "moveStartedSpy.count():" << moveStartedSpy.count() - << "fflickingSpy.count():" << fflickingSpy.count() - << "fflickStartedSpy.count():" << fflickStartedSpy.count() - << "fflickEndedSpy.count():" << fflickEndedSpy.count(); - QTRY_COMPARE(moveStartedSpy.count(), moveEndedSpy.count()); + << "moveEndedSpy.count():" << moveEndedSpy.size() + << "moveStartedSpy.count():" << moveStartedSpy.size() + << "fflickingSpy.count():" << fflickingSpy.size() + << "fflickStartedSpy.count():" << fflickStartedSpy.size() + << "fflickEndedSpy.count():" << fflickEndedSpy.size(); + QTRY_COMPARE(moveStartedSpy.size(), moveEndedSpy.size()); qCDebug(lcTests) << "After receiving matched moveEnded signal(s):" - << "moveEndedSpy.count():" << moveEndedSpy.count() - << "moveStartedSpy.count():" << moveStartedSpy.count() - << "fflickingSpy.count():" << fflickingSpy.count() - << "fflickStartedSpy.count():" << fflickStartedSpy.count() - << "fflickEndedSpy.count():" << fflickEndedSpy.count(); - QVERIFY(moveStartedSpy.count() <= 2); + << "moveEndedSpy.count():" << moveEndedSpy.size() + << "moveStartedSpy.count():" << moveStartedSpy.size() + << "fflickingSpy.count():" << fflickingSpy.size() + << "fflickStartedSpy.count():" << fflickStartedSpy.size() + << "fflickEndedSpy.count():" << fflickEndedSpy.size(); + QVERIFY(moveStartedSpy.size() <= 2); // Flickable should not handle this - QCOMPARE(fflickingSpy.count(), 0); - QCOMPARE(fflickStartedSpy.count(), 0); - QCOMPARE(fflickEndedSpy.count(), 0); + QCOMPARE(fflickingSpy.size(), 0); + QCOMPARE(fflickStartedSpy.size(), 0); + QCOMPARE(fflickEndedSpy.size(), 0); } @@ -2440,22 +2440,22 @@ void tst_QQuickPathView::flickableDelegate() // first move beyond threshold does not trigger drag QVERIFY(!flickable->isMoving()); QVERIFY(!flickable->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(fflickingSpy.count(), 0); - QCOMPARE(fflickStartedSpy.count(), 0); - QCOMPARE(fflickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(fflickingSpy.size(), 0); + QCOMPARE(fflickStartedSpy.size(), 0); + QCOMPARE(fflickEndedSpy.size(), 0); // no further moves after the initial move beyond threshold QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(53,100)); - QTRY_COMPARE(fflickingSpy.count(), 2); - QTRY_COMPARE(fflickStartedSpy.count(), 1); - QCOMPARE(fflickEndedSpy.count(), 1); + QTRY_COMPARE(fflickingSpy.size(), 2); + QTRY_COMPARE(fflickStartedSpy.size(), 1); + QCOMPARE(fflickEndedSpy.size(), 1); // PathView should not handle this - QTRY_COMPARE(movingSpy.count(), 0); - QTRY_COMPARE(moveEndedSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); + QTRY_COMPARE(movingSpy.size(), 0); + QTRY_COMPARE(moveEndedSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); } void tst_QQuickPathView::jsArrayChange() @@ -2478,11 +2478,11 @@ void tst_QQuickPathView::jsArrayChange() } view->setModel(QVariant::fromValue(array1)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // no change view->setModel(QVariant::fromValue(array2)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQuickPathView::qtbug37815() @@ -2776,14 +2776,14 @@ void tst_QQuickPathView::touchMove() QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 0); - QCOMPARE(dragStartedSpy.count(), 0); - QCOMPARE(dragEndedSpy.count(), 0); - QCOMPARE(flickStartedSpy.count(), 0); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 0); + QCOMPARE(dragStartedSpy.size(), 0); + QCOMPARE(dragEndedSpy.size(), 0); + QCOMPARE(flickStartedSpy.size(), 0); + QCOMPARE(flickEndedSpy.size(), 0); from -= QPoint(QGuiApplication::styleHints()->startDragDistance() + 1, 0); QTest::touchEvent(window.data(), touchDevice.data()).move(0, from, window.data()); @@ -2792,14 +2792,14 @@ void tst_QQuickPathView::touchMove() // first move does not trigger move/drag QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 0); - QCOMPARE(moveStartedSpy.count(), 0); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 0); - QCOMPARE(dragStartedSpy.count(), 0); - QCOMPARE(dragEndedSpy.count(), 0); - QCOMPARE(flickStartedSpy.count(), 0); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 0); + QCOMPARE(moveStartedSpy.size(), 0); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 0); + QCOMPARE(dragStartedSpy.size(), 0); + QCOMPARE(dragEndedSpy.size(), 0); + QCOMPARE(flickStartedSpy.size(), 0); + QCOMPARE(flickEndedSpy.size(), 0); QPoint diff = from - to; int moveCount = 4; @@ -2809,14 +2809,14 @@ void tst_QQuickPathView::touchMove() QVERIFY(pathview->isMoving()); QVERIFY(pathview->isDragging()); - QCOMPARE(movingSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 1); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 0); - QCOMPARE(flickStartedSpy.count(), 0); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 1); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 0); + QCOMPARE(flickStartedSpy.size(), 0); + QCOMPARE(flickEndedSpy.size(), 0); } QVERIFY(pathview->currentIndex() != current); @@ -2825,14 +2825,14 @@ void tst_QQuickPathView::touchMove() QVERIFY(pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 1); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 0); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QCOMPARE(flickStartedSpy.count(), 1); - QCOMPARE(flickEndedSpy.count(), 0); + QCOMPARE(movingSpy.size(), 1); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 0); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 0); // Wait for the flick to finish QVERIFY(QTest::qWaitFor([&]() @@ -2840,14 +2840,14 @@ void tst_QQuickPathView::touchMove() )); QVERIFY(!pathview->isMoving()); QVERIFY(!pathview->isDragging()); - QCOMPARE(movingSpy.count(), 2); - QCOMPARE(moveStartedSpy.count(), 1); - QCOMPARE(moveEndedSpy.count(), 1); - QCOMPARE(draggingSpy.count(), 2); - QCOMPARE(dragStartedSpy.count(), 1); - QCOMPARE(dragEndedSpy.count(), 1); - QCOMPARE(flickStartedSpy.count(), 1); - QCOMPARE(flickEndedSpy.count(), 1); + QCOMPARE(movingSpy.size(), 2); + QCOMPARE(moveStartedSpy.size(), 1); + QCOMPARE(moveEndedSpy.size(), 1); + QCOMPARE(draggingSpy.size(), 2); + QCOMPARE(dragStartedSpy.size(), 1); + QCOMPARE(dragEndedSpy.size(), 1); + QCOMPARE(flickStartedSpy.size(), 1); + QCOMPARE(flickEndedSpy.size(), 1); } diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp index 1ab1429692..800d7211fb 100644 --- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp +++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp @@ -64,18 +64,18 @@ void tst_QQuickPinchArea::pinchProperties() QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(pinch, SIGNAL(targetChanged())); pinch->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); pinch->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); + QCOMPARE(targetSpy.size(),1); // axis QCOMPARE(pinch->axis(), QQuickPinch::XAndYAxis); QSignalSpy axisSpy(pinch, SIGNAL(dragAxisChanged())); pinch->setAxis(QQuickPinch::XAxis); QCOMPARE(pinch->axis(), QQuickPinch::XAxis); - QCOMPARE(axisSpy.count(),1); + QCOMPARE(axisSpy.size(),1); pinch->setAxis(QQuickPinch::XAxis); - QCOMPARE(axisSpy.count(),1); + QCOMPARE(axisSpy.size(),1); // minimum and maximum drag properties QSignalSpy xminSpy(pinch, SIGNAL(minimumXChanged())); @@ -98,20 +98,20 @@ void tst_QQuickPinchArea::pinchProperties() QCOMPARE(pinch->ymin(), 10.0); QCOMPARE(pinch->ymax(), 10.0); - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); + QCOMPARE(xminSpy.size(),1); + QCOMPARE(xmaxSpy.size(),1); + QCOMPARE(yminSpy.size(),1); + QCOMPARE(ymaxSpy.size(),1); pinch->setXmin(10); pinch->setXmax(10); pinch->setYmin(10); pinch->setYmax(10); - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); + QCOMPARE(xminSpy.size(),1); + QCOMPARE(xmaxSpy.size(),1); + QCOMPARE(yminSpy.size(),1); + QCOMPARE(ymaxSpy.size(),1); // minimum and maximum scale properties QSignalSpy scaleMinSpy(pinch, SIGNAL(minimumScaleChanged())); @@ -126,14 +126,14 @@ void tst_QQuickPinchArea::pinchProperties() QCOMPARE(pinch->minimumScale(), 0.5); QCOMPARE(pinch->maximumScale(), 1.5); - QCOMPARE(scaleMinSpy.count(),1); - QCOMPARE(scaleMaxSpy.count(),1); + QCOMPARE(scaleMinSpy.size(),1); + QCOMPARE(scaleMaxSpy.size(),1); pinch->setMinimumScale(0.5); pinch->setMaximumScale(1.5); - QCOMPARE(scaleMinSpy.count(),1); - QCOMPARE(scaleMaxSpy.count(),1); + QCOMPARE(scaleMinSpy.size(),1); + QCOMPARE(scaleMaxSpy.size(),1); // minimum and maximum rotation properties QSignalSpy rotMinSpy(pinch, SIGNAL(minimumRotationChanged())); @@ -148,14 +148,14 @@ void tst_QQuickPinchArea::pinchProperties() QCOMPARE(pinch->minimumRotation(), -90.0); QCOMPARE(pinch->maximumRotation(), 45.0); - QCOMPARE(rotMinSpy.count(),1); - QCOMPARE(rotMaxSpy.count(),1); + QCOMPARE(rotMinSpy.size(),1); + QCOMPARE(rotMaxSpy.size(),1); pinch->setMinimumRotation(-90.0); pinch->setMaximumRotation(45.0); - QCOMPARE(rotMinSpy.count(),1); - QCOMPARE(rotMaxSpy.count(),1); + QCOMPARE(rotMinSpy.size(),1); + QCOMPARE(rotMaxSpy.size(),1); } QEventPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) @@ -388,7 +388,7 @@ void tst_QQuickPinchArea::retouch() pinchSequence.move(0, p1,window).move(1, p2,window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(startedSpy.count(), 1); + QCOMPARE(startedSpy.size(), 1); QCOMPARE(root->property("scale").toReal(), 1.5); QCOMPARE(root->property("center").toPointF(), QPointF(40, 40)); // blackrect is at 50,50 @@ -396,15 +396,15 @@ void tst_QQuickPinchArea::retouch() QCOMPARE(window->rootObject()->property("pointCount").toInt(), 2); - QCOMPARE(startedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(startedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); // Hold down the first finger but release the second one pinchSequence.stationary(0).release(1, p2, window).commit(); QQuickTouchUtils::flush(window); - QCOMPARE(startedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(startedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); QCOMPARE(window->rootObject()->property("pointCount").toInt(), 1); @@ -417,8 +417,8 @@ void tst_QQuickPinchArea::retouch() QQuickTouchUtils::flush(window); // Lifting and retouching results in onPinchStarted being called again - QCOMPARE(startedSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(startedSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 0); QCOMPARE(window->rootObject()->property("pointCount").toInt(), 2); @@ -426,8 +426,8 @@ void tst_QQuickPinchArea::retouch() QQuickTouchUtils::flush(window); QVERIFY(!root->property("pinchActive").toBool()); - QCOMPARE(startedSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 1); + QCOMPARE(startedSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 1); } } diff --git a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp index dbcb502653..590f022e4e 100644 --- a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp +++ b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp @@ -203,7 +203,7 @@ void tst_qquickpixmapcache::parallel() QList<bool> pending; QList<Slotter*> getters; - for (int i=0; i<targets.count(); ++i) { + for (int i=0; i<targets.size(); ++i) { QUrl target = targets.at(i); QQuickPixmap *pixmap = new QQuickPixmap; @@ -223,9 +223,9 @@ void tst_qquickpixmapcache::parallel() } } - if (incache + slotters != targets.count()) + if (incache + slotters != targets.size()) QFAIL(QString::fromLatin1("pixmap counts don't add up: %1 incache, %2 slotters, %3 total") - .arg(incache).arg(slotters).arg(targets.count()).toLatin1().constData()); + .arg(incache).arg(slotters).arg(targets.size()).toLatin1().constData()); if (cancel >= 0) { pixmaps.at(cancel)->clear(getters[cancel]); @@ -237,7 +237,7 @@ void tst_qquickpixmapcache::parallel() QVERIFY(!QTestEventLoop::instance().timeout()); } - for (int i=0; i<targets.count(); ++i) { + for (int i=0; i<targets.size(); ++i) { QQuickPixmap *pixmap = pixmaps[i]; if (i == cancel) { diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp index ab8e83b488..317694f06c 100644 --- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp +++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp @@ -1149,7 +1149,7 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName) targetItems = findItems<QQuickItem>(positioner, "wrapper", targetIndexes); - QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), targetData.count()); + QTRY_COMPARE(window->rootObject()->property("addTransitionsDone").toInt(), targetData.size()); QTRY_COMPARE(window->rootObject()->property("displaceTransitionsDone").toInt(), expectedDisplacedIndexes.count()); // check the target and displaced items were animated @@ -1262,9 +1262,9 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName) model_displacedItems_transitionVia.matchAgainst(expectedDisplacedValues, "wasn't animated with displaced anim", "shouldn't have been animated with displaced anim"); // check attached properties - QCOMPARE(window->rootObject()->property("targetTrans_items").toMap().count(), 0); - QCOMPARE(window->rootObject()->property("targetTrans_targetIndexes").toList().count(), 0); - QCOMPARE(window->rootObject()->property("targetTrans_targetItems").toList().count(), 0); + QCOMPARE(window->rootObject()->property("targetTrans_items").toMap().size(), 0); + QCOMPARE(window->rootObject()->property("targetTrans_targetIndexes").toList().size(), 0); + QCOMPARE(window->rootObject()->property("targetTrans_targetItems").toList().size(), 0); if (expectedDisplacedIndexes.isValid()) { // adjust expectedDisplacedIndexes to their final values after the move QList<int> displacedIndexes; @@ -1279,12 +1279,12 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName) matchItemsAndIndexes(window->rootObject()->property("displacedTrans_items").toMap(), model, displacedIndexes); QVariantList listOfEmptyIntLists; - for (int i=0; i<displacedIndexes.count(); i++) + for (int i=0; i<displacedIndexes.size(); i++) listOfEmptyIntLists << QVariant::fromValue(QList<int>()); QCOMPARE(window->rootObject()->property("displacedTrans_targetIndexes").toList(), listOfEmptyIntLists); QVariantList listOfEmptyObjectLists; - for (int i=0; i<displacedIndexes.count(); i++) - listOfEmptyObjectLists.insert(listOfEmptyObjectLists.count(), QVariantList()); + for (int i=0; i<displacedIndexes.size(); i++) + listOfEmptyObjectLists.insert(listOfEmptyObjectLists.size(), QVariantList()); QCOMPARE(window->rootObject()->property("displacedTrans_targetItems").toList(), listOfEmptyObjectLists); } @@ -2938,37 +2938,37 @@ void tst_qquickpositioners::test_propertychanges() grid->setMove(rowTransition); QCOMPARE(grid->add(), rowTransition); QCOMPARE(grid->move(), rowTransition); - QCOMPARE(addSpy.count(),1); - QCOMPARE(moveSpy.count(),1); + QCOMPARE(addSpy.size(),1); + QCOMPARE(moveSpy.size(),1); grid->setAdd(rowTransition); grid->setMove(rowTransition); - QCOMPARE(addSpy.count(),1); - QCOMPARE(moveSpy.count(),1); + QCOMPARE(addSpy.size(),1); + QCOMPARE(moveSpy.size(),1); grid->setAdd(nullptr); grid->setMove(nullptr); - QCOMPARE(addSpy.count(),2); - QCOMPARE(moveSpy.count(),2); + QCOMPARE(addSpy.size(),2); + QCOMPARE(moveSpy.size(),2); grid->setColumns(-1); grid->setRows(3); QCOMPARE(grid->columns(), -1); QCOMPARE(grid->rows(), 3); - QCOMPARE(columnsSpy.count(),1); - QCOMPARE(rowsSpy.count(),1); + QCOMPARE(columnsSpy.size(),1); + QCOMPARE(rowsSpy.size(),1); grid->setColumns(-1); grid->setRows(3); - QCOMPARE(columnsSpy.count(),1); - QCOMPARE(rowsSpy.count(),1); + QCOMPARE(columnsSpy.size(),1); + QCOMPARE(rowsSpy.size(),1); QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*QML Grid: Grid contains more visible items \\(20\\) than rows\\*columns \\(6\\)")); grid->setColumns(2); QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*QML Grid: Grid contains more visible items \\(20\\) than rows\\*columns \\(4\\)")); grid->setRows(2); - QCOMPARE(columnsSpy.count(),2); - QCOMPARE(rowsSpy.count(),2); + QCOMPARE(columnsSpy.size(),2); + QCOMPARE(rowsSpy.size(),2); } @@ -4012,7 +4012,7 @@ QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait void tst_qquickpositioners::matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes) { const QSet<int> expectedIndexSet(expectedIndexes.cbegin(), expectedIndexes.cend()); - for (int i=0; i<indexLists.count(); i++) { + for (int i=0; i<indexLists.size(); i++) { const auto ¤tList = indexLists[i].value<QList<int> >(); const QSet<int> current(currentList.cbegin(), currentList.cend()); if (current != expectedIndexSet) @@ -4032,20 +4032,20 @@ void tst_qquickpositioners::matchItemsAndIndexes(const QVariantMap &items, const qDebug() << itemIndex; QCOMPARE(model.name(itemIndex), name); } - QCOMPARE(items.count(), expectedIndexes.count()); + QCOMPARE(items.size(), expectedIndexes.size()); } void tst_qquickpositioners::matchItemLists(const QVariantList &itemLists, const QList<QQuickItem *> &expectedItems) { - for (int i=0; i<itemLists.count(); i++) { + for (int i=0; i<itemLists.size(); i++) { QCOMPARE(itemLists[i].typeId(), QMetaType::QVariantList); QVariantList current = itemLists[i].toList(); - for (int j=0; j<current.count(); j++) { + for (int j=0; j<current.size(); j++) { QQuickItem *o = qobject_cast<QQuickItem*>(current[j].value<QObject*>()); QVERIFY2(o, QTest::toString(QString("Invalid actual item at %1").arg(j))); QVERIFY2(expectedItems.contains(o), QTest::toString(QString("Cannot match item %1").arg(j))); } - QCOMPARE(current.count(), expectedItems.count()); + QCOMPARE(current.size(), expectedItems.size()); } } diff --git a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp index 644e698647..d5520de682 100644 --- a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp +++ b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp @@ -75,7 +75,7 @@ void tst_qquickrectangle::gradient() QCOMPARE(stops.at(&stops, 1)->color(), QColor("white")); QGradientStops gradientStops = grad->gradientStops(); - QCOMPARE(gradientStops.count(), 2); + QCOMPARE(gradientStops.size(), 2); QCOMPARE(gradientStops.at(0).first, 0.0); QCOMPARE(gradientStops.at(0).second, QColor("gray")); QCOMPARE(gradientStops.at(1).first, 1.0); @@ -189,46 +189,46 @@ void tst_qquickrectangle::antialiasing() rect->setAntialiasing(true); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); rect->setAntialiasing(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); rect->setRadius(5); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); rect->setRadius(0); QCOMPARE(rect->antialiasing(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); rect->setRadius(5); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); rect->setAntialiasing(false); QCOMPARE(rect->antialiasing(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); rect->resetAntialiasing(); QCOMPARE(rect->antialiasing(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); } QTEST_MAIN(tst_qquickrectangle) diff --git a/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp b/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp index b1cc9563eb..2d56312f9d 100644 --- a/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp +++ b/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp @@ -388,7 +388,7 @@ void tst_RenderControl::renderAndReadBackWithVulkanNative() f->vkGetPhysicalDeviceQueueFamilyProperties(physDev, &queueCount, queueFamilyProps.data()); int gfxQueueFamilyIdx = -1; - for (int i = 0; i < queueFamilyProps.count(); ++i) { + for (int i = 0; i < queueFamilyProps.size(); ++i) { if (queueFamilyProps[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) { gfxQueueFamilyIdx = i; break; diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp index befa16b632..5a6498a5d7 100644 --- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp +++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp @@ -106,7 +106,7 @@ void tst_QQuickRepeater::numberModel() QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); QVERIFY(repeater != nullptr); - QCOMPARE(repeater->parentItem()->childItems().count(), 5+1); + QCOMPARE(repeater->parentItem()->childItems().size(), 5+1); QVERIFY(!repeater->itemAt(-1)); for (int i=0; i<repeater->count(); i++) @@ -117,10 +117,10 @@ void tst_QQuickRepeater::numberModel() QVERIFY(!testObject->error()); ctxt->setContextProperty("testData", std::numeric_limits<int>::max()); - QCOMPARE(repeater->parentItem()->childItems().count(), 1); + QCOMPARE(repeater->parentItem()->childItems().size(), 1); ctxt->setContextProperty("testData", -1234); - QCOMPARE(repeater->parentItem()->childItems().count(), 1); + QCOMPARE(repeater->parentItem()->childItems().size(), 1); delete testObject; delete window; @@ -166,15 +166,15 @@ void tst_QQuickRepeater::objectList() QCOMPARE(repeater->property("instantiated").toInt(), 100); QVERIFY(!repeater->itemAt(-1)); - for (int i=0; i<data.count(); i++) + for (int i=0; i<data.size(); i++) QCOMPARE(repeater->itemAt(i), repeater->parentItem()->childItems().at(i)); - QVERIFY(!repeater->itemAt(data.count())); + QVERIFY(!repeater->itemAt(data.size())); QSignalSpy addedSpy(repeater, SIGNAL(itemAdded(int,QQuickItem*))); QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QQuickItem*))); ctxt->setContextProperty("testData", QVariant::fromValue(data)); - QCOMPARE(addedSpy.count(), data.count()); - QCOMPARE(removedSpy.count(), data.count()); + QCOMPARE(addedSpy.size(), data.size()); + QCOMPARE(removedSpy.size(), data.size()); qDeleteAll(data); delete window; @@ -207,22 +207,22 @@ void tst_QQuickRepeater::stringList() QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(container->childItems().count(), data.count() + 3); + QCOMPARE(container->childItems().size(), data.size() + 3); bool saw_repeater = false; - for (int i = 0; i < container->childItems().count(); ++i) { + for (int i = 0; i < container->childItems().size(); ++i) { if (i == 0) { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); QVERIFY(name != nullptr); QCOMPARE(name->text(), QLatin1String("Zero")); - } else if (i == container->childItems().count() - 2) { + } else if (i == container->childItems().size() - 2) { // The repeater itself QQuickRepeater *rep = qobject_cast<QQuickRepeater*>(container->childItems().at(i)); QCOMPARE(rep, repeater); saw_repeater = true; continue; - } else if (i == container->childItems().count() - 1) { + } else if (i == container->childItems().size() - 1) { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); QVERIFY(name != nullptr); QCOMPARE(name->text(), QLatin1String("Last")); @@ -262,8 +262,8 @@ void tst_QQuickRepeater::dataModel_adding() // add to empty model testModel.addItem("two", "2"); QCOMPARE(repeater->itemAt(0), container->childItems().at(0)); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(addedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(addedSpy.size(), 1); QCOMPARE(addedSpy.at(0).at(0).toInt(), 0); QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(0)); addedSpy.clear(); @@ -271,8 +271,8 @@ void tst_QQuickRepeater::dataModel_adding() // insert at start testModel.insertItem(0, "one", "1"); QCOMPARE(repeater->itemAt(0), container->childItems().at(0)); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(addedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(addedSpy.size(), 1); QCOMPARE(addedSpy.at(0).at(0).toInt(), 0); QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(0)); addedSpy.clear(); @@ -280,8 +280,8 @@ void tst_QQuickRepeater::dataModel_adding() // insert at end testModel.insertItem(2, "four", "4"); QCOMPARE(repeater->itemAt(2), container->childItems().at(2)); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(addedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(addedSpy.size(), 1); QCOMPARE(addedSpy.at(0).at(0).toInt(), 2); QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(2)); addedSpy.clear(); @@ -289,8 +289,8 @@ void tst_QQuickRepeater::dataModel_adding() // insert in middle testModel.insertItem(2, "three", "3"); QCOMPARE(repeater->itemAt(2), container->childItems().at(2)); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(addedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(addedSpy.size(), 1); QCOMPARE(addedSpy.at(0).at(0).toInt(), 2); QCOMPARE(addedSpy.at(0).at(1).value<QQuickItem*>(), container->childItems().at(2)); addedSpy.clear(); @@ -300,8 +300,8 @@ void tst_QQuickRepeater::dataModel_adding() QList<QPair<QString, QString> > multiData; multiData << qMakePair(QStringLiteral("five"), QStringLiteral("5")) << qMakePair(QStringLiteral("six"), QStringLiteral("6")) << qMakePair(QStringLiteral("seven"), QStringLiteral("7")); testModel.insertItems(1, multiData); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(addedSpy.count(), 3); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(addedSpy.size(), 3); QCOMPARE(container->childItems().size(), childItemsSize + 3); QCOMPARE(repeater->itemAt(2), container->childItems().at(2)); addedSpy.clear(); @@ -335,7 +335,7 @@ void tst_QQuickRepeater::dataModel_removing() QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(container->childItems().count(), repeater->count()+1); + QCOMPARE(container->childItems().size(), repeater->count()+1); QSignalSpy countSpy(repeater, SIGNAL(countChanged())); QSignalSpy removedSpy(repeater, SIGNAL(itemRemoved(int,QQuickItem*))); @@ -346,8 +346,8 @@ void tst_QQuickRepeater::dataModel_removing() testModel.removeItem(0); QVERIFY(repeater->itemAt(0) != item); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(removedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(removedSpy.size(), 1); QCOMPARE(removedSpy.at(0).at(0).toInt(), 0); QCOMPARE(removedSpy.at(0).at(1).value<QQuickItem*>(), item); removedSpy.clear(); @@ -359,8 +359,8 @@ void tst_QQuickRepeater::dataModel_removing() testModel.removeItem(lastIndex); QVERIFY(repeater->itemAt(lastIndex) != item); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(removedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(removedSpy.size(), 1); QCOMPARE(removedSpy.at(0).at(0).toInt(), lastIndex); QCOMPARE(removedSpy.at(0).at(1).value<QQuickItem*>(), item); removedSpy.clear(); @@ -371,8 +371,8 @@ void tst_QQuickRepeater::dataModel_removing() testModel.removeItem(1); QVERIFY(repeater->itemAt(lastIndex) != item); - QCOMPARE(countSpy.count(), 1); countSpy.clear(); - QCOMPARE(removedSpy.count(), 1); + QCOMPARE(countSpy.size(), 1); countSpy.clear(); + QCOMPARE(removedSpy.size(), 1); QCOMPARE(removedSpy.at(0).at(0).toInt(), 1); QCOMPARE(removedSpy.at(0).at(1).value<QQuickItem*>(), item); removedSpy.clear(); @@ -401,7 +401,7 @@ void tst_QQuickRepeater::dataModel_changes() QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(container->childItems().count(), repeater->count()+1); + QCOMPARE(container->childItems().size(), repeater->count()+1); // Check that model changes are propagated QQuickText *text = findItem<QQuickText>(window->rootObject(), "myName", 1); @@ -437,7 +437,7 @@ void tst_QQuickRepeater::itemModel() QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(container->childItems().count(), 1); + QCOMPARE(container->childItems().size(), 1); testObject->setUseModel(true); QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); @@ -450,20 +450,20 @@ void tst_QQuickRepeater::itemModel() window->dumpObjectTree(); } - QCOMPARE(container->childItems().count(), 4); + QCOMPARE(container->childItems().size(), 4); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(0))->objectName(), QLatin1String("item1")); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(1))->objectName(), QLatin1String("item2")); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(2))->objectName(), QLatin1String("item3")); QCOMPARE(container->childItems().at(3), repeater); QMetaObject::invokeMethod(window->rootObject(), "switchModel"); - QCOMPARE(container->childItems().count(), 3); + QCOMPARE(container->childItems().size(), 3); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(0))->objectName(), QLatin1String("item4")); QCOMPARE(qobject_cast<QObject*>(container->childItems().at(1))->objectName(), QLatin1String("item5")); QCOMPARE(container->childItems().at(2), repeater); testObject->setUseModel(false); - QCOMPARE(container->childItems().count(), 1); + QCOMPARE(container->childItems().size(), 1); delete testObject; delete window; @@ -486,7 +486,7 @@ void tst_QQuickRepeater::resetModel() QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); QVERIFY(container != nullptr); - QCOMPARE(repeater->count(), dataA.count()); + QCOMPARE(repeater->count(), dataA.size()); for (int i=0; i<repeater->count(); i++) QCOMPARE(repeater->itemAt(i), container->childItems().at(i+1)); // +1 to skip first Text object @@ -501,13 +501,13 @@ void tst_QQuickRepeater::resetModel() // reset context property ctxt->setContextProperty("testData", dataB); - QCOMPARE(repeater->count(), dataB.count()); + QCOMPARE(repeater->count(), dataB.size()); - QCOMPARE(modelChangedSpy.count(), 1); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), dataA.count()); - QCOMPARE(addedSpy.count(), dataB.count()); - for (int i=0; i<dataB.count(); i++) { + QCOMPARE(modelChangedSpy.size(), 1); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), dataA.size()); + QCOMPARE(addedSpy.size(), dataB.size()); + for (int i=0; i<dataB.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -518,13 +518,13 @@ void tst_QQuickRepeater::resetModel() // reset via setModel() repeater->setModel(dataA); - QCOMPARE(repeater->count(), dataA.count()); + QCOMPARE(repeater->count(), dataA.size()); - QCOMPARE(modelChangedSpy.count(), 1); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), dataB.count()); - QCOMPARE(addedSpy.count(), dataA.count()); - for (int i=0; i<dataA.count(); i++) { + QCOMPARE(modelChangedSpy.size(), 1); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), dataB.size()); + QCOMPARE(addedSpy.size(), dataA.size()); + for (int i=0; i<dataA.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -551,12 +551,12 @@ void tst_QQuickRepeater::modelChanged() repeater->setModel(4); QCOMPARE(repeater->count(), 4); QCOMPARE(repeater->property("itemsCount").toInt(), 4); - QCOMPARE(repeater->property("itemsFound").toList().count(), 4); + QCOMPARE(repeater->property("itemsFound").toList().size(), 4); repeater->setModel(10); QCOMPARE(repeater->count(), 10); QCOMPARE(repeater->property("itemsCount").toInt(), 10); - QCOMPARE(repeater->property("itemsFound").toList().count(), 10); + QCOMPARE(repeater->property("itemsFound").toList().size(), 10); delete rootObject; } @@ -593,10 +593,10 @@ void tst_QQuickRepeater::modelReset() model.resetItems(items); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), 0); - QCOMPARE(addedSpy.count(), items.count()); - for (int i = 0; i< items.count(); i++) { + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), 0); + QCOMPARE(addedSpy.size(), items.size()); + for (int i = 0; i< items.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -605,10 +605,10 @@ void tst_QQuickRepeater::modelReset() addedSpy.clear(); model.reset(); - QCOMPARE(countSpy.count(), 0); - QCOMPARE(removedSpy.count(), 3); - QCOMPARE(addedSpy.count(), 3); - for (int i = 0; i< items.count(); i++) { + QCOMPARE(countSpy.size(), 0); + QCOMPARE(removedSpy.size(), 3); + QCOMPARE(addedSpy.size(), 3); + for (int i = 0; i< items.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -620,10 +620,10 @@ void tst_QQuickRepeater::modelReset() items.append(qMakePair(QString::fromLatin1("five"), QString::fromLatin1("5"))); model.resetItems(items); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), 3); - QCOMPARE(addedSpy.count(), 5); - for (int i = 0; i< items.count(); i++) { + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), 3); + QCOMPARE(addedSpy.size(), 5); + for (int i = 0; i< items.size(); i++) { QCOMPARE(addedSpy.at(i).at(0).toInt(), i); QCOMPARE(addedSpy.at(i).at(1).value<QQuickItem*>(), repeater->itemAt(i)); } @@ -634,9 +634,9 @@ void tst_QQuickRepeater::modelReset() items.clear(); model.resetItems(items); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(removedSpy.count(), 5); - QCOMPARE(addedSpy.count(), 0); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(removedSpy.size(), 5); + QCOMPARE(addedSpy.size(), 0); } // QTBUG-46828 @@ -672,9 +672,9 @@ void tst_QQuickRepeater::properties() QSignalSpy modelSpy(repeater, SIGNAL(modelChanged())); repeater->setModel(3); - QCOMPARE(modelSpy.count(),1); + QCOMPARE(modelSpy.size(),1); repeater->setModel(3); - QCOMPARE(modelSpy.count(),1); + QCOMPARE(modelSpy.size(),1); QSignalSpy delegateSpy(repeater, SIGNAL(delegateChanged())); @@ -682,9 +682,9 @@ void tst_QQuickRepeater::properties() rectComponent.setData("import QtQuick 2.0; Rectangle {}", QUrl::fromLocalFile("")); repeater->setDelegate(&rectComponent); - QCOMPARE(delegateSpy.count(),1); + QCOMPARE(delegateSpy.size(),1); repeater->setDelegate(&rectComponent); - QCOMPARE(delegateSpy.count(),1); + QCOMPARE(delegateSpy.size(),1); delete rootObject; } @@ -805,7 +805,7 @@ void tst_QQuickRepeater::invalidContextCrash() engine.rootContext()->setContextProperty("badModel", model); QScopedPointer<QObject> root(component.create()); - QCOMPARE(root->children().count(), 1); + QCOMPARE(root->children().size(), 1); QObject *repeater = root->children().first(); // Make sure the model comes first in the child list, so it will be @@ -815,7 +815,7 @@ void tst_QQuickRepeater::invalidContextCrash() repeater->setParent(nullptr); repeater->setParent(root.data()); - QCOMPARE(root->children().count(), 2); + QCOMPARE(root->children().size(), 2); QCOMPARE(root->children().at(0), model); QCOMPARE(root->children().at(1), repeater); @@ -844,11 +844,11 @@ void tst_QQuickRepeater::jsArrayChange() } repeater->setModel(QVariant::fromValue(array1)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // no change repeater->setModel(QVariant::fromValue(array2)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQuickRepeater::clearRemovalOrder() @@ -876,7 +876,7 @@ void tst_QQuickRepeater::clearRemovalOrder() // we should have 0 items, and 3 removal signals. QCOMPARE(repeater->count(), 0); - QCOMPARE(removedSpy.count(), 3); + QCOMPARE(removedSpy.size(), 3); // column 1 is for the items, we won't bother verifying these. just look at // the indices and make sure they're sane. diff --git a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp index 64547108b8..ccdf69facf 100644 --- a/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp +++ b/tests/auto/quick/qquickscreen/tst_qquickscreen.cpp @@ -50,7 +50,7 @@ void tst_qquickscreen::basicProperties() QCOMPARE(screen->geometry().x(), root->property("vx").toInt()); QCOMPARE(screen->geometry().y(), root->property("vy").toInt()); - QVERIFY(root->property("screenCount").toInt() == QGuiApplication::screens().count()); + QVERIFY(root->property("screenCount").toInt() == QGuiApplication::screens().size()); } void tst_qquickscreen::screenOnStartup() @@ -89,7 +89,7 @@ void tst_qquickscreen::fullScreenList() QVERIFY(screensArray.isArray()); int length = screensArray.property("length").toInt(); const QList<QScreen *> screenList = QGuiApplication::screens(); - QVERIFY(length == screenList.count()); + QVERIFY(length == screenList.size()); for (int i = 0; i < length; ++i) { QQuickScreenInfo *info = qobject_cast<QQuickScreenInfo *>(screensArray.property(i).toQObject()); diff --git a/tests/auto/quick/qquickshape/tst_qquickshape.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp index 4da77cd35b..a9e15939d3 100644 --- a/tests/auto/quick/qquickshape/tst_qquickshape.cpp +++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp @@ -204,7 +204,7 @@ void tst_QQuickShape::changeSignals() QSignalSpy asyncPropSpy(obj, SIGNAL(asynchronousChanged())); obj->setAsynchronous(true); obj->setAsynchronous(false); - QCOMPARE(asyncPropSpy.count(), 2); + QCOMPARE(asyncPropSpy.size(), 2); QQmlListReference list(obj, "data"); QQuickShapePath *vp = qobject_cast<QQuickShapePath *>(list.at(0)); @@ -224,29 +224,29 @@ void tst_QQuickShape::changeSignals() vp->setCapStyle(QQuickShapePath::RoundCap); vp->setDashOffset(10); vp->setDashPattern(QVector<qreal>() << 1 << 2 << 3 << 4); - QCOMPARE(strokeColorPropSpy.count(), 1); - QCOMPARE(vpChangeSpy.count(), 10); + QCOMPARE(strokeColorPropSpy.size(), 1); + QCOMPARE(vpChangeSpy.size(), 10); // Verify that property changes from Path and its elements bubble up and result in shapePathChanged(). QQuickPath *path = vp; path->setStartX(30); - QCOMPARE(vpChangeSpy.count(), 11); + QCOMPARE(vpChangeSpy.size(), 11); QQmlListReference pathList(path, "pathElements"); qobject_cast<QQuickPathLine *>(pathList.at(1))->setY(200); - QCOMPARE(vpChangeSpy.count(), 12); + QCOMPARE(vpChangeSpy.size(), 12); // Verify that property changes from the gradient bubble up and result in shapePathChanged(). vp->setFillGradient(g); - QCOMPARE(vpChangeSpy.count(), 13); + QCOMPARE(vpChangeSpy.size(), 13); QQuickShapeLinearGradient *lgrad = qobject_cast<QQuickShapeLinearGradient *>(g); lgrad->setX2(200); - QCOMPARE(vpChangeSpy.count(), 14); + QCOMPARE(vpChangeSpy.size(), 14); QQmlListReference stopList(lgrad, "stops"); QCOMPARE(stopList.count(), 5); qobject_cast<QQuickGradientStop *>(stopList.at(1))->setPosition(0.3); - QCOMPARE(vpChangeSpy.count(), 15); + QCOMPARE(vpChangeSpy.size(), 15); qobject_cast<QQuickGradientStop *>(stopList.at(1))->setColor(Qt::black); - QCOMPARE(vpChangeSpy.count(), 16); + QCOMPARE(vpChangeSpy.size(), 16); } void tst_QQuickShape::render() diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp index 6aceaf9827..62fca7d280 100644 --- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp +++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp @@ -1328,7 +1328,7 @@ void tst_qquickstates::illegalObjectCreation() QQmlComponent component(&engine, testFileUrl("illegalObj.qml")); QList<QQmlError> errors = component.errors(); - QCOMPARE(errors.count(), 1); + QCOMPARE(errors.size(), 1); const QQmlError &error = errors.at(0); QCOMPARE(error.line(), 9); QCOMPARE(error.column(), 23); @@ -1483,7 +1483,7 @@ void tst_qquickstates::editProperties() rectPrivate->setState(""); - QCOMPARE(propertyChangesBlue->actions().length(), 2); + QCOMPARE(propertyChangesBlue->actions().size(), 2); QVERIFY(propertyChangesBlue->containsValue("width")); QVERIFY(!propertyChangesBlue->containsProperty("x")); QCOMPARE(propertyChangesBlue->value("width").toInt(), 50); @@ -1491,20 +1491,20 @@ void tst_qquickstates::editProperties() propertyChangesBlue->changeValue("width", 60); QCOMPARE(propertyChangesBlue->value("width").toInt(), 60); - QCOMPARE(propertyChangesBlue->actions().length(), 2); + QCOMPARE(propertyChangesBlue->actions().size(), 2); propertyChangesBlue->changeExpression("width", "myRectangle.width / 2"); QVERIFY(!propertyChangesBlue->containsValue("width")); QVERIFY(propertyChangesBlue->containsExpression("width")); QCOMPARE(propertyChangesBlue->value("width").toInt(), 0); - QCOMPARE(propertyChangesBlue->actions().length(), 2); + QCOMPARE(propertyChangesBlue->actions().size(), 2); propertyChangesBlue->changeValue("width", 50); QVERIFY(propertyChangesBlue->containsValue("width")); QVERIFY(!propertyChangesBlue->containsExpression("width")); QCOMPARE(propertyChangesBlue->value("width").toInt(), 50); - QCOMPARE(propertyChangesBlue->actions().length(), 2); + QCOMPARE(propertyChangesBlue->actions().size(), 2); QVERIFY(QQmlAnyBinding::ofProperty(QQmlProperty(childRect, "width"))); rectPrivate->setState("blue"); @@ -1513,7 +1513,7 @@ void tst_qquickstates::editProperties() propertyChangesBlue->changeValue("width", 60); QCOMPARE(propertyChangesBlue->value("width").toInt(), 60); - QCOMPARE(propertyChangesBlue->actions().length(), 2); + QCOMPARE(propertyChangesBlue->actions().size(), 2); QCOMPARE(childRect->width(), qreal(60)); QVERIFY(!QQmlAnyBinding::ofProperty(QQmlProperty(childRect, "width"))); @@ -1521,7 +1521,7 @@ void tst_qquickstates::editProperties() QVERIFY(!propertyChangesBlue->containsValue("width")); QVERIFY(propertyChangesBlue->containsExpression("width")); QCOMPARE(propertyChangesBlue->value("width").toInt(), 0); - QCOMPARE(propertyChangesBlue->actions().length(), 2); + QCOMPARE(propertyChangesBlue->actions().size(), 2); QVERIFY(QQmlAnyBinding::ofProperty(QQmlProperty(childRect, "width"))); QCOMPARE(childRect->width(), qreal(200)); @@ -1532,13 +1532,13 @@ void tst_qquickstates::editProperties() QCOMPARE(childRect->width(), qreal(402)); QVERIFY(QQmlAnyBinding::ofProperty(QQmlProperty(childRect, "width"))); - QCOMPARE(propertyChangesGreen->actions().length(), 2); + QCOMPARE(propertyChangesGreen->actions().size(), 2); rectPrivate->setState("green"); QCOMPARE(childRect->width(), qreal(200)); QCOMPARE(childRect->height(), qreal(100)); QVERIFY(QQmlAnyBinding::ofProperty(QQmlProperty(childRect, "width"))); QVERIFY(greenState->bindingInRevertList(childRect, "width")); - QCOMPARE(propertyChangesGreen->actions().length(), 2); + QCOMPARE(propertyChangesGreen->actions().size(), 2); propertyChangesGreen->removeProperty("height"); @@ -1884,10 +1884,10 @@ void tst_qquickstates::parentChangeInvolvingBindings() QCOMPARE(root->property("childRotation").toInt(), 100); // First change to 40 via reverse(), then to 20 via binding. - QCOMPARE(xSpy.count(), 2); + QCOMPARE(xSpy.size(), 2); // First change to 400 via reverse(), then to 200 via binding. - QCOMPARE(widthSpy.count(), 2); + QCOMPARE(widthSpy.size(), 2); QCOMPARE(root->property("childX").toInt(), 20); QCOMPARE(root->property("childWidth").toInt(), 200); diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp index 28249afb08..aebd9990f7 100644 --- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp +++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp @@ -152,8 +152,8 @@ void tst_qquickstyledtext::textOutput() const QVector<QTextLayout::FormatRange> layoutFormats = layout.formats(); - QCOMPARE(layoutFormats.count(), formats.count()); - for (int i = 0; i < formats.count(); ++i) { + QCOMPARE(layoutFormats.size(), formats.size()); + for (int i = 0; i < formats.size(); ++i) { QCOMPARE(layoutFormats.at(i).start, formats.at(i).start); QCOMPARE(layoutFormats.at(i).length, formats.at(i).length); if (formats.at(i).type & Format::Bold) @@ -182,8 +182,8 @@ void tst_qquickstyledtext::anchors() const QVector<QTextLayout::FormatRange> layoutFormats = layout.formats(); - QCOMPARE(layoutFormats.count(), formats.count()); - for (int i = 0; i < formats.count(); ++i) { + QCOMPARE(layoutFormats.size(), formats.size()); + for (int i = 0; i < formats.size(); ++i) { QCOMPARE(layoutFormats.at(i).start, formats.at(i).start); QCOMPARE(layoutFormats.at(i).length, formats.at(i).length); QVERIFY(layoutFormats.at(i).format.isAnchor() == bool(formats.at(i).type & Format::Anchor)); diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 63b6df5605..90057e9bf8 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -488,14 +488,14 @@ void tst_qquicktext::wrap() textObject->setWrapMode(QQuickText::Wrap); QCOMPARE(textObject->wrapMode(), QQuickText::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->setWrapMode(QQuickText::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->setWrapMode(QQuickText::NoWrap); QCOMPARE(textObject->wrapMode(), QQuickText::NoWrap); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } } @@ -760,14 +760,14 @@ void tst_qquicktext::textFormat() text->setTextFormat(QQuickText::StyledText); QCOMPARE(text->textFormat(), QQuickText::StyledText); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setTextFormat(QQuickText::StyledText); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setTextFormat(QQuickText::AutoText); QCOMPARE(text->textFormat(), QQuickText::AutoText); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } { @@ -1244,25 +1244,25 @@ void tst_qquicktext::color() textObject->setColor(QColor("white")); QCOMPARE(textObject->color(), QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textObject->setLinkColor(QColor("black")); QCOMPARE(textObject->linkColor(), QColor("black")); - QCOMPARE(linkColorSpy.count(), 1); + QCOMPARE(linkColorSpy.size(), 1); textObject->setColor(QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textObject->setLinkColor(QColor("black")); - QCOMPARE(linkColorSpy.count(), 1); + QCOMPARE(linkColorSpy.size(), 1); textObject->setColor(QColor("black")); QCOMPARE(textObject->color(), QColor("black")); - QCOMPARE(colorSpy.count(), 2); + QCOMPARE(colorSpy.size(), 2); textObject->setLinkColor(QColor("blue")); QCOMPARE(textObject->linkColor(), QColor("blue")); - QCOMPARE(linkColorSpy.count(), 2); + QCOMPARE(linkColorSpy.size(), 2); delete textObject; } @@ -1329,12 +1329,12 @@ void tst_qquicktext::color() QCOMPARE(textObject->color(), testColor); textObject->setColor(testColor); QCOMPARE(textObject->color(), testColor); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); testColor = QColor("black"); textObject->setColor(testColor); QCOMPARE(textObject->color(), testColor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } { QString colorStr = "#001234"; QColor testColor(colorStr); @@ -1350,12 +1350,12 @@ void tst_qquicktext::color() QCOMPARE(textObject->styleColor(), testColor); textObject->setStyleColor(testColor); QCOMPARE(textObject->styleColor(), testColor); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); testColor = QColor("black"); textObject->setStyleColor(testColor); QCOMPARE(textObject->styleColor(), testColor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } { QString colorStr = "#001234"; QColor testColor(colorStr); @@ -1371,12 +1371,12 @@ void tst_qquicktext::color() QCOMPARE(textObject->linkColor(), testColor); textObject->setLinkColor(testColor); QCOMPARE(textObject->linkColor(), testColor); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); testColor = QColor("black"); textObject->setLinkColor(testColor); QCOMPARE(textObject->linkColor(), testColor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } } @@ -1440,14 +1440,14 @@ void tst_qquicktext::renderType() text->setRenderType(QQuickText::NativeRendering); QCOMPARE(text->renderType(), QQuickText::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setRenderType(QQuickText::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setRenderType(QQuickText::QtRendering); QCOMPARE(text->renderType(), QQuickText::QtRendering); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktext::antialiasing() @@ -1464,14 +1464,14 @@ void tst_qquicktext::antialiasing() text->setAntialiasing(false); QCOMPARE(text->antialiasing(), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->setAntialiasing(false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); text->resetAntialiasing(); QCOMPARE(text->antialiasing(), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // QTBUG-39047 component.setData("import QtQuick 2.0\n Text { antialiasing: true }", QUrl()); @@ -2075,7 +2075,7 @@ void tst_qquicktext::linkInteraction() QObject::connect(textObject, SIGNAL(linkActivated(QString)), &test, SLOT(linkClicked(QString))); QObject::connect(textObject, SIGNAL(linkHovered(QString)), &test, SLOT(linkHovered(QString))); - QVERIFY(mousePositions.count() > 0); + QVERIFY(mousePositions.size() > 0); QPointF mousePosition = mousePositions.first(); auto globalPos = textObject->mapToGlobal(mousePosition); @@ -2091,7 +2091,7 @@ void tst_qquicktext::linkInteraction() QCOMPARE(textObject->hoveredLink(), hoverEnterLink); QCOMPARE(textObject->linkAt(mousePosition.x(), mousePosition.y()), hoverEnterLink); - for (int i = 1; i < mousePositions.count(); ++i) { + for (int i = 1; i < mousePositions.size(); ++i) { mousePosition = mousePositions.at(i); auto globalPos = textObject->mapToGlobal(mousePosition); @@ -2137,15 +2137,15 @@ void tst_qquicktext::baseUrl() textObject->setBaseUrl(localUrl); QCOMPARE(textObject->baseUrl(), localUrl); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); textObject->setBaseUrl(remoteUrl); QCOMPARE(textObject->baseUrl(), remoteUrl); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->resetBaseUrl(); QCOMPARE(textObject->baseUrl(), localUrl); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktext::embeddedImages_data() @@ -2449,23 +2449,23 @@ void tst_qquicktext::contentSize() QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() < textObject->height()); - QCOMPARE(spySize.count(), 1); - QCOMPARE(spyWidth.count(), 1); - QCOMPARE(spyHeight.count(), 0); + QCOMPARE(spySize.size(), 1); + QCOMPARE(spyWidth.size(), 1); + QCOMPARE(spyHeight.size(), 0); textObject->setWrapMode(QQuickText::WordWrap); QVERIFY(textObject->contentWidth() <= textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spySize.count(), 2); - QCOMPARE(spyWidth.count(), 2); - QCOMPARE(spyHeight.count(), 1); + QCOMPARE(spySize.size(), 2); + QCOMPARE(spyWidth.size(), 2); + QCOMPARE(spyHeight.size(), 1); textObject->setElideMode(QQuickText::ElideRight); QVERIFY(textObject->contentWidth() <= textObject->width()); QVERIFY(textObject->contentHeight() < textObject->height()); - QCOMPARE(spySize.count(), 3); - QCOMPARE(spyWidth.count(), 3); - QCOMPARE(spyHeight.count(), 2); + QCOMPARE(spySize.size(), 3); + QCOMPARE(spyWidth.size(), 3); + QCOMPARE(spyHeight.size(), 2); int spyCount = 3; qreal elidedWidth = textObject->contentWidth(); @@ -2474,16 +2474,16 @@ void tst_qquicktext::contentSize() QVERIFY(textObject->contentHeight() < textObject->height()); // this text probably won't have the same elided width, but it's not guaranteed. if (textObject->contentWidth() != elidedWidth) - QCOMPARE(spySize.count(), ++spyCount); + QCOMPARE(spySize.size(), ++spyCount); else - QCOMPARE(spySize.count(), spyCount); + QCOMPARE(spySize.size(), spyCount); textObject->setElideMode(QQuickText::ElideNone); QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spySize.count(), ++spyCount); - QCOMPARE(spyWidth.count(), spyCount); - QCOMPARE(spyHeight.count(), 3); + QCOMPARE(spySize.size(), ++spyCount); + QCOMPARE(spyWidth.size(), spyCount); + QCOMPARE(spyHeight.size(), 3); } void tst_qquicktext::geometryChanged() @@ -3297,7 +3297,7 @@ void tst_qquicktext::imgTagsMultipleImages() QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); QVERIFY(textPrivate != nullptr); - QCOMPARE(textPrivate->extra->visibleImgTags.count(), 2); + QCOMPARE(textPrivate->extra->visibleImgTags.size(), 2); delete textObject; } @@ -3310,9 +3310,9 @@ void tst_qquicktext::imgTagsElide() QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); QVERIFY(textPrivate != nullptr); - QCOMPARE(textPrivate->extra->visibleImgTags.count(), 0); + QCOMPARE(textPrivate->extra->visibleImgTags.size(), 0); myText->setMaximumLineCount(20); - QTRY_COMPARE(textPrivate->extra->visibleImgTags.count(), 1); + QTRY_COMPARE(textPrivate->extra->visibleImgTags.size(), 1); delete myText; } @@ -3329,16 +3329,16 @@ void tst_qquicktext::imgTagsUpdates() QVERIFY(textPrivate != nullptr); myText->setText("This is a heart<img src=\"images/heart200.png\">."); - QCOMPARE(textPrivate->extra->visibleImgTags.count(), 1); - QCOMPARE(spy.count(), 1); + QCOMPARE(textPrivate->extra->visibleImgTags.size(), 1); + QCOMPARE(spy.size(), 1); myText->setMaximumLineCount(2); myText->setText("This is another heart<img src=\"images/heart200.png\">."); - QTRY_COMPARE(textPrivate->extra->visibleImgTags.count(), 1); + QTRY_COMPARE(textPrivate->extra->visibleImgTags.size(), 1); // if maximumLineCount is set and the img tag doesn't have an explicit size // we relayout twice. - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); delete myText; } @@ -3635,11 +3635,11 @@ void tst_qquicktext::fontSizeMode() const qreal oldBaselineOffset = myText->baselineOffset(); myText->setHeight(myText->height() + 42); QVERIFY(QQuickTest::qWaitForPolish(myText)); - QCOMPARE(baselineOffsetSpy.count(), 1); + QCOMPARE(baselineOffsetSpy.size(), 1); QCOMPARE(myText->baselineOffset(), oldBaselineOffset + 42); myText->setHeight(myText->height() - 42); QVERIFY(QQuickTest::qWaitForPolish(myText)); - QCOMPARE(baselineOffsetSpy.count(), 2); + QCOMPARE(baselineOffsetSpy.size(), 2); QCOMPARE(myText->baselineOffset(), oldBaselineOffset); } diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 7445f72783..36543357a2 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -244,7 +244,7 @@ Q_DECLARE_METATYPE(QQuickTextEdit::TextFormat) void tst_qquicktextedit::simulateKeys(QWindow *window, const QList<Key> &keys) { - for (int i = 0; i < keys.count(); ++i) { + for (int i = 0; i < keys.size(); ++i) { const int key = keys.at(i).first; const int modifiers = key & Qt::KeyboardModifierMask; const QString text = !keys.at(i).second.isNull() ? QString(keys.at(i).second) : QString(); @@ -417,7 +417,7 @@ void tst_qquicktextedit::text() QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), standard.at(i)); - QCOMPARE(textEditObject->length(), standard.at(i).length()); + QCOMPARE(textEditObject->length(), standard.at(i).size()); } for (int i = 0; i < richText.size(); i++) @@ -433,7 +433,7 @@ void tst_qquicktextedit::text() QString expected = richText.at(i); expected.replace(QRegularExpression("\\\\(.)"),"\\1"); QCOMPARE(textEditObject->text(), expected); - QCOMPARE(textEditObject->length(), expected.length()); + QCOMPARE(textEditObject->length(), expected.size()); } for (int i = 0; i < standard.size(); i++) @@ -452,7 +452,7 @@ void tst_qquicktextedit::text() actual.remove(QRegularExpression("(<[^>]*>)+")); expected.remove("\n"); QCOMPARE(actual.simplified(), expected); - QCOMPARE(textEditObject->length(), expected.length()); + QCOMPARE(textEditObject->length(), expected.size()); } for (int i = 0; i < richText.size(); i++) @@ -472,7 +472,7 @@ void tst_qquicktextedit::text() QCOMPARE(actual.simplified(),expected.simplified()); expected.replace("<>", " "); - QCOMPARE(textEditObject->length(), expected.simplified().length()); + QCOMPARE(textEditObject->length(), expected.simplified().size()); } for (int i = 0; i < standard.size(); i++) @@ -484,7 +484,7 @@ void tst_qquicktextedit::text() QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), standard.at(i)); - QCOMPARE(textEditObject->length(), standard.at(i).length()); + QCOMPARE(textEditObject->length(), standard.at(i).size()); } for (int i = 0; i < richText.size(); i++) @@ -504,7 +504,7 @@ void tst_qquicktextedit::text() QCOMPARE(actual.simplified(),expected.simplified()); expected.replace("<>", " "); - QCOMPARE(textEditObject->length(), expected.simplified().length()); + QCOMPARE(textEditObject->length(), expected.simplified().size()); } } @@ -622,14 +622,14 @@ void tst_qquicktextedit::wrap() edit->setWrapMode(QQuickTextEdit::Wrap); QCOMPARE(edit->wrapMode(), QQuickTextEdit::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setWrapMode(QQuickTextEdit::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setWrapMode(QQuickTextEdit::NoWrap); QCOMPARE(edit->wrapMode(), QQuickTextEdit::NoWrap); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } } @@ -678,18 +678,18 @@ void tst_qquicktextedit::textFormat() edit->setTextFormat(QQuickTextEdit::RichText); QCOMPARE(edit->textFormat(), QQuickTextEdit::RichText); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setTextFormat(QQuickTextEdit::RichText); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setTextFormat(QQuickTextEdit::PlainText); QCOMPARE(edit->textFormat(), QQuickTextEdit::PlainText); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit->setTextFormat(QQuickTextEdit::MarkdownText); QCOMPARE(edit->textFormat(), QQuickTextEdit::MarkdownText); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); } } @@ -891,7 +891,7 @@ void tst_qquicktextedit::hAlign_RightToLeft() QSignalSpy cursorRectangleSpy(textEdit, SIGNAL(cursorRectangleChanged())); platformInputContext.setInputDirection(Qt::RightToLeft); - QCOMPARE(cursorRectangleSpy.count(), 1); + QCOMPARE(cursorRectangleSpy.size(), 1); QCOMPARE(qApp->inputMethod()->inputDirection(), Qt::RightToLeft); QCOMPARE(textEdit->hAlign(), QQuickTextEdit::AlignRight); QVERIFY(textEdit->positionToRectangle(0).x() > window.width()/2); @@ -1202,36 +1202,36 @@ void tst_qquicktextedit::color() textEditObject->setColor(QColor("white")); QCOMPARE(textEditObject->color(), QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textEditObject->setSelectionColor(QColor("black")); QCOMPARE(textEditObject->selectionColor(), QColor("black")); - QCOMPARE(selectionColorSpy.count(), 1); + QCOMPARE(selectionColorSpy.size(), 1); textEditObject->setSelectedTextColor(QColor("blue")); QCOMPARE(textEditObject->selectedTextColor(), QColor("blue")); - QCOMPARE(selectedTextColorSpy.count(), 1); + QCOMPARE(selectedTextColorSpy.size(), 1); textEditObject->setColor(QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textEditObject->setSelectionColor(QColor("black")); - QCOMPARE(selectionColorSpy.count(), 1); + QCOMPARE(selectionColorSpy.size(), 1); textEditObject->setSelectedTextColor(QColor("blue")); - QCOMPARE(selectedTextColorSpy.count(), 1); + QCOMPARE(selectedTextColorSpy.size(), 1); textEditObject->setColor(QColor("black")); QCOMPARE(textEditObject->color(), QColor("black")); - QCOMPARE(colorSpy.count(), 2); + QCOMPARE(colorSpy.size(), 2); textEditObject->setSelectionColor(QColor("blue")); QCOMPARE(textEditObject->selectionColor(), QColor("blue")); - QCOMPARE(selectionColorSpy.count(), 2); + QCOMPARE(selectionColorSpy.size(), 2); textEditObject->setSelectedTextColor(QColor("white")); QCOMPARE(textEditObject->selectedTextColor(), QColor("white")); - QCOMPARE(selectedTextColorSpy.count(), 2); + QCOMPARE(selectedTextColorSpy.size(), 2); } //test normal @@ -1312,7 +1312,7 @@ void tst_qquicktextedit::persistentSelection() edit->setPersistentSelection(false); QCOMPARE(edit->persistentSelection(), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); edit->select(1, 4); QCOMPARE(edit->property("selected").toString(), QLatin1String("ell")); @@ -1325,7 +1325,7 @@ void tst_qquicktextedit::persistentSelection() edit->setPersistentSelection(true); QCOMPARE(edit->persistentSelection(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->select(1, 4); QCOMPARE(edit->property("selected").toString(), QLatin1String("ell")); @@ -1341,7 +1341,7 @@ void tst_qquicktextedit::persistentSelection() edit->setPersistentSelection(false); QCOMPARE(edit->persistentSelection(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit->select(1, 4); QCOMPARE(edit->property("selected").toString(), QLatin1String("ell")); @@ -1354,7 +1354,7 @@ void tst_qquicktextedit::persistentSelection() edit->setPersistentSelection(true); QCOMPARE(edit->persistentSelection(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); edit->select(1, 4); QCOMPARE(edit->property("selected").toString(), QLatin1String("ell")); @@ -1432,7 +1432,7 @@ void tst_qquicktextedit::focusOnPress() textEditObject->setFocusOnPress(true); QCOMPARE(textEditObject->focusOnPress(), true); - QCOMPARE(activeFocusOnPressSpy.count(), 0); + QCOMPARE(activeFocusOnPressSpy.size(), 0); QQuickWindow window; window.resize(100, 50); @@ -1450,20 +1450,20 @@ void tst_qquicktextedit::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textEditObject->hasFocus(), true); QCOMPARE(textEditObject->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(), 1); - QCOMPARE(activeFocusSpy.count(), 1); + QCOMPARE(focusSpy.size(), 1); + QCOMPARE(activeFocusSpy.size(), 1); QCOMPARE(textEditObject->selectedText(), QString()); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint); textEditObject->setFocusOnPress(false); QCOMPARE(textEditObject->focusOnPress(), false); - QCOMPARE(activeFocusOnPressSpy.count(), 1); + QCOMPARE(activeFocusOnPressSpy.size(), 1); textEditObject->setFocus(false); QCOMPARE(textEditObject->hasFocus(), false); QCOMPARE(textEditObject->hasActiveFocus(), false); - QCOMPARE(focusSpy.count(), 2); - QCOMPARE(activeFocusSpy.count(), 2); + QCOMPARE(focusSpy.size(), 2); + QCOMPARE(activeFocusSpy.size(), 2); // Wait for double click timeout to expire before clicking again. QTest::qWait(400); @@ -1471,13 +1471,13 @@ void tst_qquicktextedit::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textEditObject->hasFocus(), false); QCOMPARE(textEditObject->hasActiveFocus(), false); - QCOMPARE(focusSpy.count(), 2); - QCOMPARE(activeFocusSpy.count(), 2); + QCOMPARE(focusSpy.size(), 2); + QCOMPARE(activeFocusSpy.size(), 2); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint); textEditObject->setFocusOnPress(true); QCOMPARE(textEditObject->focusOnPress(), true); - QCOMPARE(activeFocusOnPressSpy.count(), 2); + QCOMPARE(activeFocusOnPressSpy.size(), 2); // Test a selection made in the on(Active)FocusChanged handler isn't overwritten. textEditObject->setProperty("selectOnFocus", true); @@ -1487,8 +1487,8 @@ void tst_qquicktextedit::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textEditObject->hasFocus(), true); QCOMPARE(textEditObject->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(), 3); - QCOMPARE(activeFocusSpy.count(), 3); + QCOMPARE(focusSpy.size(), 3); + QCOMPARE(activeFocusSpy.size(), 3); QCOMPARE(textEditObject->selectedText(), textEditObject->text()); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, centerPoint); } @@ -1525,7 +1525,7 @@ void tst_qquicktextedit::selection() QCOMPARE(textEditObject->selectionEnd(), 0); QVERIFY(textEditObject->selectedText().isNull()); - textEditObject->setCursorPosition(textEditObject->text().length()+1); + textEditObject->setCursorPosition(textEditObject->text().size()+1); QCOMPARE(textEditObject->cursorPosition(), 0); QCOMPARE(textEditObject->selectionStart(), 0); QCOMPARE(textEditObject->selectionEnd(), 0); @@ -1596,37 +1596,37 @@ void tst_qquicktextedit::overwriteMode() QVERIFY(textEdit->hasActiveFocus()); textEdit->setOverwriteMode(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(true, textEdit->overwriteMode()); textEdit->setOverwriteMode(false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(false, textEdit->overwriteMode()); QVERIFY(!textEdit->overwriteMode()); QString insertString = "Some first text"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textEdit->text(), QString("Some first text")); textEdit->setOverwriteMode(true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); textEdit->setCursorPosition(5); insertString = "shiny"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textEdit->text(), QString("Some shiny text")); - textEdit->setCursorPosition(textEdit->text().length()); + textEdit->setCursorPosition(textEdit->text().size()); QTest::keyClick(&window, Qt::Key_Enter); textEdit->setOverwriteMode(false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); insertString = "Second paragraph"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textEdit->lineCount(), 2); @@ -1635,10 +1635,10 @@ void tst_qquicktextedit::overwriteMode() QCOMPARE(textEdit->cursorPosition(), 15); textEdit->setOverwriteMode(true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); insertString = " blah"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textEdit->lineCount(), 2); @@ -1682,24 +1682,24 @@ void tst_qquicktextedit::isRightToLeft() // first test that the right string is delivered to the QString::isRightToLeft() QCOMPARE(textEdit.isRightToLeft(0,0), text.mid(0,0).isRightToLeft()); QCOMPARE(textEdit.isRightToLeft(0,1), text.mid(0,1).isRightToLeft()); - QCOMPARE(textEdit.isRightToLeft(text.length()-2, text.length()-1), text.mid(text.length()-2, text.length()-1).isRightToLeft()); - QCOMPARE(textEdit.isRightToLeft(text.length()/2, text.length()/2 + 1), text.mid(text.length()/2, text.length()/2 + 1).isRightToLeft()); - QCOMPARE(textEdit.isRightToLeft(0,text.length()/4), text.mid(0,text.length()/4).isRightToLeft()); - QCOMPARE(textEdit.isRightToLeft(text.length()/4,3*text.length()/4), text.mid(text.length()/4,3*text.length()/4).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(text.size()-2, text.size()-1), text.mid(text.size()-2, text.size()-1).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(text.size()/2, text.size()/2 + 1), text.mid(text.size()/2, text.size()/2 + 1).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(0,text.size()/4), text.mid(0,text.size()/4).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(text.size()/4,3*text.size()/4), text.mid(text.size()/4,3*text.size()/4).isRightToLeft()); if (text.isEmpty()) QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start."); - QCOMPARE(textEdit.isRightToLeft(3*text.length()/4,text.length()-1), text.mid(3*text.length()/4,text.length()-1).isRightToLeft()); + QCOMPARE(textEdit.isRightToLeft(3*text.size()/4,text.size()-1), text.mid(3*text.size()/4,text.size()-1).isRightToLeft()); // then test that the feature actually works QCOMPARE(textEdit.isRightToLeft(0,0), emptyString); QCOMPARE(textEdit.isRightToLeft(0,1), firstCharacter); - QCOMPARE(textEdit.isRightToLeft(text.length()-2, text.length()-1), lastCharacter); - QCOMPARE(textEdit.isRightToLeft(text.length()/2, text.length()/2 + 1), middleCharacter); - QCOMPARE(textEdit.isRightToLeft(0,text.length()/4), startString); - QCOMPARE(textEdit.isRightToLeft(text.length()/4,3*text.length()/4), midString); + QCOMPARE(textEdit.isRightToLeft(text.size()-2, text.size()-1), lastCharacter); + QCOMPARE(textEdit.isRightToLeft(text.size()/2, text.size()/2 + 1), middleCharacter); + QCOMPARE(textEdit.isRightToLeft(0,text.size()/4), startString); + QCOMPARE(textEdit.isRightToLeft(text.size()/4,3*text.size()/4), midString); if (text.isEmpty()) QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextEdit: isRightToLeft(start, end) called with the end property being smaller than the start."); - QCOMPARE(textEdit.isRightToLeft(3*text.length()/4,text.length()-1), endString); + QCOMPARE(textEdit.isRightToLeft(3*text.size()/4,text.size()-1), endString); } void tst_qquicktextedit::keySelection() @@ -1721,31 +1721,31 @@ void tst_qquicktextedit::keySelection() simulateKey(&window, Qt::Key_Right, Qt::ShiftModifier); QVERIFY(input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString("a")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); simulateKey(&window, Qt::Key_Right); QVERIFY(input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); simulateKey(&window, Qt::Key_Right); QVERIFY(!input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); simulateKey(&window, Qt::Key_Left); QVERIFY(input->hasActiveFocus()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); simulateKey(&window, Qt::Key_Left, Qt::ShiftModifier); QVERIFY(input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString("a")); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); simulateKey(&window, Qt::Key_Left); QVERIFY(input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); simulateKey(&window, Qt::Key_Left); QVERIFY(!input->hasActiveFocus()); QCOMPARE(input->selectedText(), QString()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); } void tst_qquicktextedit::moveCursorSelection_data() @@ -2227,7 +2227,7 @@ void tst_qquicktextedit::dragMouseSelection() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QTest::qWait(300); QString str1; - QTRY_VERIFY((str1 = textEditObject->selectedText()).length() > 3); + QTRY_VERIFY((str1 = textEditObject->selectedText()).size() > 3); // press and drag the current selection. x1 = 40; @@ -2237,7 +2237,7 @@ void tst_qquicktextedit::dragMouseSelection() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QTest::qWait(300); QString str2; - QTRY_VERIFY((str2 = textEditObject->selectedText()).length() > 3); + QTRY_VERIFY((str2 = textEditObject->selectedText()).size() > 3); QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and not the first moved. @@ -2283,7 +2283,7 @@ void tst_qquicktextedit::mouseSelectionMode() if (selectWords) { QTRY_COMPARE(textEditObject->selectedText(), text); } else { - QTRY_VERIFY(textEditObject->selectedText().length() > 3); + QTRY_VERIFY(textEditObject->selectedText().size() > 3); QVERIFY(str != text); } } @@ -2302,14 +2302,14 @@ void tst_qquicktextedit::mouseSelectionMode_accessors() edit->setMouseSelectionMode(QQuickTextEdit::SelectWords); QCOMPARE(edit->mouseSelectionMode(), QQuickTextEdit::SelectWords); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setMouseSelectionMode(QQuickTextEdit::SelectWords); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setMouseSelectionMode(QQuickTextEdit::SelectCharacters); QCOMPARE(edit->mouseSelectionMode(), QQuickTextEdit::SelectCharacters); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextedit::selectByMouse() @@ -2326,15 +2326,15 @@ void tst_qquicktextedit::selectByMouse() edit->setSelectByMouse(true); QCOMPARE(edit->selectByMouse(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); edit->setSelectByMouse(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setSelectByMouse(false); QCOMPARE(edit->selectByMouse(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(1).at(0).toBool(), false); } @@ -2357,21 +2357,21 @@ void tst_qquicktextedit::selectByKeyboard() edit->setReadOnly(true); QCOMPARE(edit->selectByKeyboard(), false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); edit->setSelectByKeyboard(true); QCOMPARE(edit->selectByKeyboard(), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(1).at(0).toBool(), true); edit->setReadOnly(false); QCOMPARE(edit->selectByKeyboard(), true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit->setSelectByKeyboard(false); QCOMPARE(edit->selectByKeyboard(), false); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); QCOMPARE(spy.at(2).at(0).toBool(), false); } @@ -2477,14 +2477,14 @@ void tst_qquicktextedit::renderType() edit->setRenderType(QQuickTextEdit::NativeRendering); QCOMPARE(edit->renderType(), QQuickTextEdit::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setRenderType(QQuickTextEdit::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit->setRenderType(QQuickTextEdit::QtRendering); QCOMPARE(edit->renderType(), QQuickTextEdit::QtRendering); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextedit::inputMethodHints() @@ -2500,9 +2500,9 @@ void tst_qquicktextedit::inputMethodHints() QSignalSpy inputMethodHintSpy(textEditObject, SIGNAL(inputMethodHintsChanged())); textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly); - QCOMPARE(inputMethodHintSpy.count(), 1); + QCOMPARE(inputMethodHintSpy.size(), 1); textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); - QCOMPARE(inputMethodHintSpy.count(), 1); + QCOMPARE(inputMethodHintSpy.size(), 1); QQuickTextEdit plainTextEdit; QCOMPARE(plainTextEdit.inputMethodHints(), Qt::ImhNone); @@ -2640,22 +2640,22 @@ void tst_qquicktextedit::linkHover() const QPoint textPos = window.mapToGlobal(texteditObject->positionToRectangle(2).center().toPoint()); QCursor::setPos(linkPos); - QTRY_COMPARE(hover.count(), 1); + QTRY_COMPARE(hover.size(), 1); QCOMPARE(window.cursor().shape(), Qt::PointingHandCursor); QCOMPARE(hover.last()[0].toString(), link); QCursor::setPos(textPos); - QTRY_COMPARE(hover.count(), 2); + QTRY_COMPARE(hover.size(), 2); QCOMPARE(window.cursor().shape(), Qt::IBeamCursor); QCOMPARE(hover.last()[0].toString(), QString()); QCursor::setPos(linkPos); - QTRY_COMPARE(hover.count(), 3); + QTRY_COMPARE(hover.size(), 3); QCOMPARE(window.cursor().shape(), Qt::PointingHandCursor); QCOMPARE(hover.last()[0].toString(), link); QCursor::setPos(textPos); - QTRY_COMPARE(hover.count(), 4); + QTRY_COMPARE(hover.size(), 4); QCOMPARE(window.cursor().shape(), Qt::IBeamCursor); QCOMPARE(hover.last()[0].toString(), QString()); } @@ -2683,16 +2683,16 @@ void tst_qquicktextedit::linkInteraction() const QPointF textPos = texteditObject->positionToRectangle(2).center(); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, linkPos.toPoint()); - QTRY_COMPARE(spy.count(), 1); - QTRY_COMPARE(hover.count(), 1); + QTRY_COMPARE(spy.size(), 1); + QTRY_COMPARE(hover.size(), 1); QCOMPARE(spy.last()[0].toString(), link); QCOMPARE(hover.last()[0].toString(), link); QCOMPARE(texteditObject->hoveredLink(), link); QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, textPos.toPoint()); - QTRY_COMPARE(spy.count(), 1); - QTRY_COMPARE(hover.count(), 2); + QTRY_COMPARE(spy.size(), 1); + QTRY_COMPARE(hover.size(), 2); QCOMPARE(hover.last()[0].toString(), QString()); QCOMPARE(texteditObject->hoveredLink(), QString()); QCOMPARE(texteditObject->linkAt(textPos.x(), textPos.y()), QString()); @@ -2700,16 +2700,16 @@ void tst_qquicktextedit::linkInteraction() texteditObject->setReadOnly(true); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, linkPos.toPoint()); - QTRY_COMPARE(spy.count(), 2); - QTRY_COMPARE(hover.count(), 3); + QTRY_COMPARE(spy.size(), 2); + QTRY_COMPARE(hover.size(), 3); QCOMPARE(spy.last()[0].toString(), link); QCOMPARE(hover.last()[0].toString(), link); QCOMPARE(texteditObject->hoveredLink(), link); QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, textPos.toPoint()); - QTRY_COMPARE(spy.count(), 2); - QTRY_COMPARE(hover.count(), 4); + QTRY_COMPARE(spy.size(), 2); + QTRY_COMPARE(hover.size(), 4); QCOMPARE(hover.last()[0].toString(), QString()); QCOMPARE(texteditObject->hoveredLink(), QString()); QCOMPARE(texteditObject->linkAt(textPos.x(), textPos.y()), QString()); @@ -2742,7 +2742,7 @@ void tst_qquicktextedit::cursorDelegate() QVERIFY(delegateObject); QCOMPARE(delegateObject->property("localProperty").toString(), QString("Hello")); //Test Delegate gets moved - for (int i=0; i<= textEditObject->text().length(); i++) { + for (int i=0; i<= textEditObject->text().size(); i++) { textEditObject->setCursorPosition(i); QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); @@ -2878,27 +2878,27 @@ void tst_qquicktextedit::cursorVisible() edit.setCursorVisible(true); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); edit.setCursorVisible(false); QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit.setFocus(true); QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); edit.setParentItem(view.rootObject()); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); edit.setFocus(false); QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); edit.setFocus(true); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); QWindow alternateView; alternateView.show(); @@ -2906,12 +2906,12 @@ void tst_qquicktextedit::cursorVisible() QVERIFY(QTest::qWaitForWindowActive(&alternateView)); QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); { // Cursor attribute with 0 length hides cursor. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -2919,7 +2919,7 @@ void tst_qquicktextedit::cursorVisible() QCoreApplication::sendEvent(&edit, &ev); } QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 8); + QCOMPARE(spy.size(), 8); { // Cursor attribute with non zero length shows cursor. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -2927,7 +2927,7 @@ void tst_qquicktextedit::cursorVisible() QCoreApplication::sendEvent(&edit, &ev); } QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 9); + QCOMPARE(spy.size(), 9); { // If the cursor is hidden by the input method and the text is changed it should be visible again. @@ -2936,11 +2936,11 @@ void tst_qquicktextedit::cursorVisible() QCoreApplication::sendEvent(&edit, &ev); } QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 10); + QCOMPARE(spy.size(), 10); edit.setText("something"); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 11); + QCOMPARE(spy.size(), 11); { // If the cursor is hidden by the input method and the cursor position is changed it should be visible again. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -2948,11 +2948,11 @@ void tst_qquicktextedit::cursorVisible() QCoreApplication::sendEvent(&edit, &ev); } QCOMPARE(edit.isCursorVisible(), false); - QCOMPARE(spy.count(), 12); + QCOMPARE(spy.size(), 12); edit.setCursorPosition(5); QCOMPARE(edit.isCursorVisible(), true); - QCOMPARE(spy.count(), 13); + QCOMPARE(spy.size(), 13); } void tst_qquicktextedit::delegateLoading_data() @@ -3099,16 +3099,16 @@ void tst_qquicktextedit::copyAndPaste() QVERIFY(textEdit != nullptr); // copy and paste - QCOMPARE(textEdit->text().length(), 12); - textEdit->select(0, textEdit->text().length());; + QCOMPARE(textEdit->text().size(), 12); + textEdit->select(0, textEdit->text().size());; textEdit->copy(); QCOMPARE(textEdit->selectedText(), QString("Hello world!")); - QCOMPARE(textEdit->selectedText().length(), 12); + QCOMPARE(textEdit->selectedText().size(), 12); textEdit->setCursorPosition(0); QVERIFY(textEdit->canPaste()); textEdit->paste(); QCOMPARE(textEdit->text(), QString("Hello world!Hello world!")); - QCOMPARE(textEdit->text().length(), 24); + QCOMPARE(textEdit->text().size(), 24); // canPaste QVERIFY(textEdit->canPaste()); @@ -3116,7 +3116,7 @@ void tst_qquicktextedit::copyAndPaste() QVERIFY(!textEdit->canPaste()); textEdit->paste(); QCOMPARE(textEdit->text(), QString("Hello world!Hello world!")); - QCOMPARE(textEdit->text().length(), 24); + QCOMPARE(textEdit->text().size(), 24); textEdit->setReadOnly(false); QVERIFY(textEdit->canPaste()); @@ -3144,10 +3144,10 @@ void tst_qquicktextedit::copyAndPaste() // select all and cut textEdit->selectAll(); textEdit->cut(); - QCOMPARE(textEdit->text().length(), 0); + QCOMPARE(textEdit->text().size(), 0); textEdit->paste(); QCOMPARE(textEdit->text(), QString("Hello world!Hello world!")); - QCOMPARE(textEdit->text().length(), 24); + QCOMPARE(textEdit->text().size(), 24); // Copy first word. textEdit->setCursorPosition(0); @@ -3233,7 +3233,7 @@ void tst_qquicktextedit::middleClickPaste() QTest::mouseClick(&window, Qt::MiddleButton, Qt::NoModifier, p3); if (QGuiApplication::clipboard()->supportsSelection()) - QCOMPARE(textEditObject->text().mid(1, selectedText.length()), selectedText); + QCOMPARE(textEditObject->text().mid(1, selectedText.size()), selectedText); else QCOMPARE(textEditObject->text(), originalText); } @@ -3263,7 +3263,7 @@ void tst_qquicktextedit::readOnly() edit->setCursorPosition(3); edit->setReadOnly(false); QCOMPARE(edit->isReadOnly(), false); - QCOMPARE(edit->cursorPosition(), edit->text().length()); + QCOMPARE(edit->cursorPosition(), edit->text().size()); } void tst_qquicktextedit::inFlickableMouse_data() @@ -3410,7 +3410,7 @@ void tst_qquicktextedit::textInput() event.setCommitString( "Hello world!", 0, 0); QGuiApplication::sendEvent(edit, &event); QCOMPARE(edit->text(), QString("Hello world!")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // QTBUG-12339 // test that document and internal text attribute are in sync @@ -3580,7 +3580,7 @@ void tst_qquicktextedit::openInputPanel() anotherEdit.setFocus(true); QCOMPARE(qApp->inputMethod()->isVisible(), true); QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherEdit)); - QCOMPARE(inputPanelVisibilitySpy.count(), 0); + QCOMPARE(inputPanelVisibilitySpy.size(), 0); anotherEdit.setFocus(false); QVERIFY(qApp->focusObject() != &anotherEdit); @@ -3696,18 +3696,18 @@ void tst_qquicktextedit::contentSize() QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() < textObject->height()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->setWrapMode(QQuickTextEdit::WordWrap); QVERIFY(textObject->contentWidth() <= textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); textObject->setText("The quickredfoxjumpedoverthe lazy brown dog"); QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); } void tst_qquicktextedit::implicitSizeBinding_data() @@ -3882,7 +3882,7 @@ void tst_qquicktextedit::renderingAroundSelection() QVERIFY(QQuickTest::showView(window, testFileUrl("threeLines.qml"))); NodeCheckerTextEdit *textItem = qmlobject_cast<NodeCheckerTextEdit*>(window.rootObject()); QVERIFY(textItem); - QTRY_VERIFY(textItem->linePositions.count() > 0); + QTRY_VERIFY(textItem->linePositions.size() > 0); const auto linePositions = textItem->linePositions; const int lastLinePosition = textItem->lastLinePosition; QQuickTextEditPrivate *textPriv = QQuickTextEditPrivate::get(textItem); @@ -3891,7 +3891,7 @@ void tst_qquicktextedit::renderingAroundSelection() if (lcTests().isDebugEnabled()) QTest::qWait(500); // for visual check; not needed in CI - const int renderCount = renderSpy.count(); + const int renderCount = renderSpy.size(); QPoint p1 = textItem->mapToScene(textItem->positionToRectangle(8).center()).toPoint(); QPoint p2 = textItem->mapToScene(textItem->positionToRectangle(10).center()).toPoint(); qCDebug(lcTests) << "drag from" << p1 << "to" << p2; @@ -3899,7 +3899,7 @@ void tst_qquicktextedit::renderingAroundSelection() QTest::mouseMove(&window, p2); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p2); // ensure that QQuickTextEdit::updatePaintNode() has a chance to run - QTRY_COMPARE_GT(renderSpy.count(), renderCount); + QTRY_COMPARE_GT(renderSpy.size(), renderCount); if (lcTests().isDebugEnabled()) QTest::qWait(500); // for visual check; not needed in CI @@ -3938,7 +3938,7 @@ void tst_qquicktextedit::signal_editingfinished() QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); - QTRY_COMPARE(editingFinished1Spy.count(), 1); + QTRY_COMPARE(editingFinished1Spy.size(), 1); QTRY_VERIFY(!input1->hasActiveFocus()); QTRY_VERIFY(input2->hasActiveFocus()); @@ -3954,7 +3954,7 @@ void tst_qquicktextedit::signal_editingfinished() QKeyEvent key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); - QTRY_COMPARE(editingFinished2Spy.count(), 1); + QTRY_COMPARE(editingFinished2Spy.size(), 1); QTRY_VERIFY(input1->hasActiveFocus()); QTRY_VERIFY(!input2->hasActiveFocus()); @@ -4158,7 +4158,7 @@ void tst_qquicktextedit::preeditCursorRectangle() // Verify that the micro focus rect is positioned the same for position 0 as // it would be if there was no preedit text. QInputMethodEvent imEvent(preeditText, QList<QInputMethodEvent::Attribute>() - << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, preeditText.length(), QVariant())); + << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, preeditText.size(), QVariant())); QCoreApplication::sendEvent(edit, &imEvent); QCoreApplication::sendEvent(edit, &query); currentRect = query.value(Qt::ImCursorRectangle).toRectF(); @@ -4172,15 +4172,15 @@ void tst_qquicktextedit::preeditCursorRectangle() panelSpy.clear(); for (int i = 1; i <= 5; ++i) { QInputMethodEvent imEvent(preeditText, QList<QInputMethodEvent::Attribute>() - << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, i, preeditText.length(), QVariant())); + << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, i, preeditText.size(), QVariant())); QCoreApplication::sendEvent(edit, &imEvent); QCoreApplication::sendEvent(edit, &query); currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(edit->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); QVERIFY(previousRect.left() < currentRect.left()); - QCOMPARE(editSpy.count(), 1); editSpy.clear(); - QCOMPARE(panelSpy.count(), 1); panelSpy.clear(); + QCOMPARE(editSpy.size(), 1); editSpy.clear(); + QCOMPARE(panelSpy.size(), 1); panelSpy.clear(); previousRect = currentRect; } @@ -4195,8 +4195,8 @@ void tst_qquicktextedit::preeditCursorRectangle() currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(edit->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); - QCOMPARE(editSpy.count(), 1); - QCOMPARE(panelSpy.count(), 1); + QCOMPARE(editSpy.size(), 1); + QCOMPARE(panelSpy.size(), 1); // Verify that if there is no preedit cursor then the micro focus rect is the // same as it would be if it were positioned at the end of the preedit text. @@ -4209,8 +4209,8 @@ void tst_qquicktextedit::preeditCursorRectangle() QCOMPARE(edit->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); QCOMPARE(currentRect, previousRect); - QCOMPARE(editSpy.count(), 1); - QCOMPARE(panelSpy.count(), 1); + QCOMPARE(editSpy.size(), 1); + QCOMPARE(panelSpy.size(), 1); } void tst_qquicktextedit::inputMethodComposing() @@ -4237,37 +4237,37 @@ void tst_qquicktextedit::inputMethodComposing() } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); { QInputMethodEvent event(text.mid(12), QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(edit, &event); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); { QInputMethodEvent event; QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // Changing the text while not composing doesn't alter the composing state. edit->setText(text.mid(0, 16)); QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); { QInputMethodEvent event(text.mid(16), QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); // Changing the text while composing cancels composition. edit->setText(text.mid(0, 12)); QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); { // Preedit cursor positioned outside (empty) preedit; composing. QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4275,7 +4275,7 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Cursor hidden; composing QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4283,7 +4283,7 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Default cursor attributes; composing. QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4291,7 +4291,7 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Selections are persisted: not composing QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4299,7 +4299,7 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); edit->setCursorPosition(0); @@ -4311,14 +4311,14 @@ void tst_qquicktextedit::inputMethodComposing() QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); { QInputMethodEvent event; QGuiApplication::sendEvent(edit, &event); } QCOMPARE(edit->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 8); + QCOMPARE(spy.size(), 8); } void tst_qquicktextedit::cursorRectangleSize_data() @@ -4394,7 +4394,7 @@ void tst_qquicktextedit::getText_data() QTest::newRow("all plain text") << standard.at(0) - << 0 << standard.at(0).length() + << 0 << standard.at(0).size() << standard.at(0); QTest::newRow("plain text sub string") @@ -4414,17 +4414,17 @@ void tst_qquicktextedit::getText_data() QTest::newRow("plain text cropped end") << standard.at(0) - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(23); QTest::newRow("plain text cropped beginning and end") << standard.at(0) - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << standard.at(0); QTest::newRow("all rich text") << richBoldText - << 0 << plainBoldText.length() + << 0 << plainBoldText.size() << plainBoldText; QTest::newRow("rich text sub string") @@ -4435,7 +4435,7 @@ void tst_qquicktextedit::getText_data() // Line break. QTest::newRow("all plain text (line break)") << standard.at(1) - << 0 << standard.at(1).length() + << 0 << standard.at(1).size() << standard.at(1); QTest::newRow("plain text sub string (line break)") @@ -4455,17 +4455,17 @@ void tst_qquicktextedit::getText_data() QTest::newRow("plain text cropped end (line break)") << standard.at(1) - << 23 << standard.at(1).length() + 8 + << 23 << standard.at(1).size() + 8 << standard.at(1).mid(23); QTest::newRow("plain text cropped beginning and end (line break)") << standard.at(1) - << -9 << standard.at(1).length() + 4 + << -9 << standard.at(1).size() + 4 << standard.at(1); QTest::newRow("all rich text (line break)") << richBoldTextLB - << 0 << plainBoldTextLB.length() + << 0 << plainBoldTextLB.size() << plainBoldTextLB; QTest::newRow("rich text sub string (line break)") @@ -4504,7 +4504,7 @@ void tst_qquicktextedit::getFormattedText_data() QTest::newRow("all plain text") << standard.at(0) << QQuickTextEdit::PlainText - << 0 << standard.at(0).length() + << 0 << standard.at(0).size() << standard.at(0); QTest::newRow("plain text sub string") @@ -4528,31 +4528,31 @@ void tst_qquicktextedit::getFormattedText_data() QTest::newRow("plain text cropped end") << standard.at(0) << QQuickTextEdit::PlainText - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(23); QTest::newRow("plain text cropped beginning and end") << standard.at(0) << QQuickTextEdit::PlainText - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << standard.at(0); QTest::newRow("all rich (Auto) text") << richBoldText << QQuickTextEdit::AutoText - << 0 << plainBoldText.length() + << 0 << plainBoldText.size() << QString("This is some \\<.*\\>bold\\</.*\\> text"); QTest::newRow("all rich (Rich) text") << richBoldText << QQuickTextEdit::RichText - << 0 << plainBoldText.length() + << 0 << plainBoldText.size() << QString("This is some \\<.*\\>bold\\</.*\\> text"); QTest::newRow("all rich (Plain) text") << richBoldText << QQuickTextEdit::PlainText - << 0 << richBoldText.length() + << 0 << richBoldText.size() << richBoldText; QTest::newRow("rich (Auto) text sub string") @@ -4631,10 +4631,10 @@ void tst_qquicktextedit::append_data() QTest::newRow("cursor follows (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("\nHello") - << standard.at(0).length() + 6 << standard.at(0).length() + 6 << standard.at(0).length() + 6 + << standard.at(0).size() + 6 << standard.at(0).size() + 6 << standard.at(0).size() + 6 << false << true; QTest::newRow("selection kept intact (beginning)") @@ -4655,10 +4655,10 @@ void tst_qquicktextedit::append_data() QTest::newRow("selection kept intact, cursor follows (end)") << standard.at(0) << QQuickTextEdit::PlainText - << 18 << standard.at(0).length() + << 18 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("\nHello") - << 18 << standard.at(0).length() + 6 << standard.at(0).length() + 6 + << 18 << standard.at(0).size() + 6 << standard.at(0).size() + 6 << true << true; QTest::newRow("reversed selection kept intact") @@ -4744,12 +4744,12 @@ void tst_qquicktextedit::append() if (textFormat == QQuickTextEdit::RichText || textFormat == QQuickTextEdit::MarkdownText || (textFormat == QQuickTextEdit::AutoText && (Qt::mightBeRichText(text) || Qt::mightBeRichText(appendText)))) { - QCOMPARE(textEdit->getText(0, expectedText.length()), expectedText); + QCOMPARE(textEdit->getText(0, expectedText.size()), expectedText); } else { QCOMPARE(textEdit->text(), expectedText); } - QCOMPARE(textEdit->length(), expectedText.length()); + QCOMPARE(textEdit->length(), expectedText.size()); QCOMPARE(textEdit->selectionStart(), expectedSelectionStart); QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd); @@ -4758,11 +4758,11 @@ void tst_qquicktextedit::append() if (selectionStart > selectionEnd) qSwap(selectionStart, selectionEnd); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); - QCOMPARE(cursorPositionSpy.count() > 0, cursorPositionChanged); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); + QCOMPARE(cursorPositionSpy.size() > 0, cursorPositionChanged); } void tst_qquicktextedit::insert_data() @@ -4790,10 +4790,10 @@ void tst_qquicktextedit::insert_data() QTest::newRow("at cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") - << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5 + << standard.at(0).size() + 5 << standard.at(0).size() + 5 << standard.at(0).size() + 5 << false << true; QTest::newRow("at cursor position (middle)") @@ -4814,10 +4814,10 @@ void tst_qquicktextedit::insert_data() QTest::newRow("before cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() << 18 + << standard.at(0).size() << standard.at(0).size() << 18 << QString("Hello") << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18) - << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5 + << standard.at(0).size() + 5 << standard.at(0).size() + 5 << standard.at(0).size() + 5 << false << true; QTest::newRow("before cursor position (middle)") @@ -4830,7 +4830,7 @@ void tst_qquicktextedit::insert_data() QTest::newRow("after cursor position (middle)") << standard.at(0) << QQuickTextEdit::PlainText - << 18 << 18 << standard.at(0).length() + << 18 << 18 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 18 << 18 << 18 @@ -4854,7 +4854,7 @@ void tst_qquicktextedit::insert_data() QTest::newRow("after selection") << standard.at(0) << QQuickTextEdit::PlainText - << 14 << 19 << standard.at(0).length() + << 14 << 19 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 14 << 19 << 19 @@ -4862,7 +4862,7 @@ void tst_qquicktextedit::insert_data() QTest::newRow("after reversed selection") << standard.at(0) << QQuickTextEdit::PlainText - << 19 << 14 << standard.at(0).length() + << 19 << 14 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 14 << 19 << 14 @@ -4918,7 +4918,7 @@ void tst_qquicktextedit::insert_data() QTest::newRow("past end") << standard.at(0) << QQuickTextEdit::PlainText - << 0 << 0 << standard.at(0).length() + 3 + << 0 << 0 << standard.at(0).size() + 3 << QString("Hello") << standard.at(0) << 0 << 0 << 0 @@ -4993,12 +4993,12 @@ void tst_qquicktextedit::insert() if (textFormat == QQuickTextEdit::RichText || textFormat == QQuickTextEdit::MarkdownText || (textFormat == QQuickTextEdit::AutoText && (Qt::mightBeRichText(text) || Qt::mightBeRichText(insertText)))) { - QCOMPARE(textEdit->getText(0, expectedText.length()), expectedText); + QCOMPARE(textEdit->getText(0, expectedText.size()), expectedText); qCDebug(lcTests) << "with formatting:" << textEdit->getFormattedText(0, 100); } else { QCOMPARE(textEdit->text(), expectedText); } - QCOMPARE(textEdit->length(), expectedText.length()); + QCOMPARE(textEdit->length(), expectedText.size()); QCOMPARE(textEdit->selectionStart(), expectedSelectionStart); QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd); @@ -5007,11 +5007,11 @@ void tst_qquicktextedit::insert() if (selectionStart > selectionEnd) qSwap(selectionStart, selectionEnd); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); - QCOMPARE(cursorPositionSpy.count() > 0, cursorPositionChanged); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); + QCOMPARE(cursorPositionSpy.size() > 0, cursorPositionChanged); } void tst_qquicktextedit::remove_data() @@ -5050,18 +5050,18 @@ void tst_qquicktextedit::remove_data() QTest::newRow("to cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() - << standard.at(0).length() << standard.at(0).length() - 5 - << standard.at(0).mid(0, standard.at(0).length() - 5) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() << standard.at(0).size() + << standard.at(0).size() << standard.at(0).size() - 5 + << standard.at(0).mid(0, standard.at(0).size() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("to cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() << standard.at(0).size() + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("from cursor position (middle)") @@ -5090,10 +5090,10 @@ void tst_qquicktextedit::remove_data() QTest::newRow("before cursor position (end)") << standard.at(0) << QQuickTextEdit::PlainText - << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << 18 << 23 << standard.at(0).mid(0, 18) + standard.at(0).mid(23) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("before cursor position (middle)") @@ -5131,16 +5131,16 @@ void tst_qquicktextedit::remove_data() QTest::newRow("after selection") << standard.at(0) << QQuickTextEdit::PlainText << 14 << 19 - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) << 14 << 19 << 19 << false << false; QTest::newRow("after reversed selection") << standard.at(0) << QQuickTextEdit::PlainText << 19 << 14 - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) << 14 << 19 << 14 << false << false; @@ -5171,7 +5171,7 @@ void tst_qquicktextedit::remove_data() QTest::newRow("plain text cropped end") << standard.at(0) << QQuickTextEdit::PlainText << 0 << 0 - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(0, 23) << 0 << 0 << 0 << false << false; @@ -5179,7 +5179,7 @@ void tst_qquicktextedit::remove_data() QTest::newRow("plain text cropped beginning and end") << standard.at(0) << QQuickTextEdit::PlainText << 0 << 0 - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << QString() << 0 << 0 << 0 << false << false; @@ -5187,7 +5187,7 @@ void tst_qquicktextedit::remove_data() QTest::newRow("all rich text") << richBoldText << QQuickTextEdit::RichText << 0 << 0 - << 0 << plainBoldText.length() + << 0 << plainBoldText.size() << QString() << 0 << 0 << 0 << false << false; @@ -5235,11 +5235,11 @@ void tst_qquicktextedit::remove() if (textFormat == QQuickTextEdit::RichText || (textFormat == QQuickTextEdit::AutoText && Qt::mightBeRichText(text))) { - QCOMPARE(textEdit->getText(0, expectedText.length()), expectedText); + QCOMPARE(textEdit->getText(0, expectedText.size()), expectedText); } else { QCOMPARE(textEdit->text(), expectedText); } - QCOMPARE(textEdit->length(), expectedText.length()); + QCOMPARE(textEdit->length(), expectedText.size()); if (selectionStart > selectionEnd) // qSwap(selectionStart, selectionEnd); @@ -5248,14 +5248,14 @@ void tst_qquicktextedit::remove() QCOMPARE(textEdit->selectionEnd(), expectedSelectionEnd); QCOMPARE(textEdit->cursorPosition(), expectedCursorPosition); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); if (cursorPositionChanged) // - QVERIFY(cursorPositionSpy.count() > 0); + QVERIFY(cursorPositionSpy.size() > 0); } #if QT_CONFIG(shortcut) @@ -5594,11 +5594,11 @@ void tst_qquicktextedit::undo() // QTest::keyClick(testWidget, Qt::Key_End, Qt::ShiftModifier); } - for (int j = 0; j < insertString.at(i).length(); j++) + for (int j = 0; j < insertString.at(i).size(); j++) QTest::keyClick(&window, insertString.at(i).at(j).toLatin1()); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // STEP 2: Next call undo several times and see if we can restore to the previous state for (i = 0; i < expectedString.size() - 1; ++i) { @@ -5610,7 +5610,7 @@ void tst_qquicktextedit::undo() // STEP 3: Verify that we have undone everything QVERIFY(textEdit->text().isEmpty()); QVERIFY(!textEdit->canUndo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextedit::redo_data() @@ -5671,13 +5671,13 @@ void tst_qquicktextedit::redo() for (i = 0; i < insertString.size(); ++i) { if (insertIndex[i] > -1) textEdit->setCursorPosition(insertIndex[i]); - for (int j = 0; j < insertString.at(i).length(); j++) + for (int j = 0; j < insertString.at(i).size(); j++) QTest::keyClick(&window, insertString.at(i).at(j).toLatin1()); QVERIFY(textEdit->canUndo()); QVERIFY(!textEdit->canRedo()); } - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // undo everything while (!textEdit->text().isEmpty()) { @@ -5686,7 +5686,7 @@ void tst_qquicktextedit::redo() QVERIFY(textEdit->canRedo()); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); for (i = 0; i < expectedString.size(); ++i) { QVERIFY(textEdit->canRedo()); @@ -5695,7 +5695,7 @@ void tst_qquicktextedit::redo() QVERIFY(textEdit->canUndo()); } QVERIFY(!textEdit->canRedo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } #if QT_CONFIG(shortcut) @@ -5917,12 +5917,12 @@ void tst_qquicktextedit::clear() textEdit->clear(); QVERIFY(textEdit->text().isEmpty()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // checks that clears can be undone textEdit->undo(); QVERIFY(!textEdit->canUndo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(textEdit->text(), QString("I am Legend")); textEdit->setCursorPosition(4); @@ -5934,12 +5934,12 @@ void tst_qquicktextedit::clear() textEdit->clear(); QVERIFY(textEdit->text().isEmpty()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); // checks that clears can be undone textEdit->undo(); QVERIFY(!textEdit->canUndo()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); QCOMPARE(textEdit->text(), QString("I am Legend")); textEdit->setText(QString("<i>I am Legend</i>")); @@ -5947,11 +5947,11 @@ void tst_qquicktextedit::clear() textEdit->clear(); QVERIFY(textEdit->text().isEmpty()); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); // checks that clears can be undone textEdit->undo(); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); QCOMPARE(textEdit->text(), QString("<i>I am Legend</i>")); } @@ -5970,15 +5970,15 @@ void tst_qquicktextedit::baseUrl() textObject->setBaseUrl(localUrl); QCOMPARE(textObject->baseUrl(), localUrl); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); textObject->setBaseUrl(remoteUrl); QCOMPARE(textObject->baseUrl(), remoteUrl); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->resetBaseUrl(); QCOMPARE(textObject->baseUrl(), localUrl); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextedit::embeddedImages_data() @@ -6076,7 +6076,7 @@ void tst_qquicktextedit::cursorRectangle_QTBUG_38947() QRectF rect = edit->positionToRectangle(i); QTest::mouseMove(&window, rect.center().toPoint()); QCOMPARE(edit->cursorRectangle(), rect); - QCOMPARE(spy.count(), i); + QCOMPARE(spy.size(), i); } QPoint to = edit->positionToRectangle(edit->length() - 1).center().toPoint(); @@ -6105,13 +6105,13 @@ void tst_qquicktextedit::doubleSelect_QTBUG_38704() QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged())); textEdit->select(0,1); //Select some text initially - QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(selectionSpy.size(), 1); textEdit->select(0,1); //No change to selection start/end - QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(selectionSpy.size(), 1); textEdit->select(0,2); //Change selection end - QCOMPARE(selectionSpy.count(), 2); + QCOMPARE(selectionSpy.size(), 2); textEdit->select(1,2); //Change selection start - QCOMPARE(selectionSpy.count(), 3); + QCOMPARE(selectionSpy.size(), 3); } void tst_qquicktextedit::padding() @@ -6297,28 +6297,28 @@ void tst_qquicktextedit::keyEventPropagation() QQuickTextEdit *textEdit = root->findChild<QQuickTextEdit *>(); QVERIFY(textEdit->hasActiveFocus()); simulateKey(&view, Qt::Key_Back); - QCOMPARE(downSpy.count(), 1); - QCOMPARE(upSpy.count(), 1); + QCOMPARE(downSpy.size(), 1); + QCOMPARE(upSpy.size(), 1); auto downKey = downSpy.takeFirst(); auto upKey = upSpy.takeFirst(); QCOMPARE(downKey.at(0).toInt(), Qt::Key_Back); QCOMPARE(upKey.at(0).toInt(), Qt::Key_Back); simulateKey(&view, Qt::Key_Shift); - QCOMPARE(downSpy.count(), 1); - QCOMPARE(upSpy.count(), 1); + QCOMPARE(downSpy.size(), 1); + QCOMPARE(upSpy.size(), 1); downKey = downSpy.takeFirst(); upKey = upSpy.takeFirst(); QCOMPARE(downKey.at(0).toInt(), Qt::Key_Shift); QCOMPARE(upKey.at(0).toInt(), Qt::Key_Shift); simulateKey(&view, Qt::Key_A); - QCOMPARE(downSpy.count(), 0); - QCOMPARE(upSpy.count(), 0); + QCOMPARE(downSpy.size(), 0); + QCOMPARE(upSpy.size(), 0); simulateKey(&view, Qt::Key_Right); - QCOMPARE(downSpy.count(), 0); - QCOMPARE(upSpy.count(), 1); + QCOMPARE(downSpy.size(), 0); + QCOMPARE(upSpy.size(), 1); upKey = upSpy.takeFirst(); QCOMPARE(upKey.at(0).toInt(), Qt::Key_Right); } @@ -6453,7 +6453,7 @@ void tst_qquicktextedit::touchscreenSetsFocusAndMovesCursor() QVERIFY(top); QQuickTextEdit *bottom = window.rootObject()->findChild<QQuickTextEdit*>("bottom"); QVERIFY(bottom); - const auto len = bottom->text().length(); + const auto len = bottom->text().size(); // tap the bottom field QPoint p1 = bottom->mapToScene({6, 6}).toPoint(); @@ -6466,7 +6466,7 @@ void tst_qquicktextedit::touchscreenSetsFocusAndMovesCursor() QVERIFY(!bottom->text().startsWith('q')); QTest::keyClick(&window, Qt::Key_Q); QVERIFY(bottom->text().startsWith('q')); - QCOMPARE(bottom->text().length(), len + 1); + QCOMPARE(bottom->text().size(), len + 1); QTest::touchEvent(&window, touchDevice).release(0, p1, &window); QQuickTouchUtils::flush(&window); // the cursor gets moved on release, as long as TextInput's grab wasn't stolen (e.g. by Flickable) diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 54f650f86e..9475d63930 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -226,7 +226,7 @@ Q_DECLARE_METATYPE(KeyList) void tst_qquicktextinput::simulateKeys(QWindow *window, const QList<Key> &keys) { - for (int i = 0; i < keys.count(); ++i) { + for (int i = 0; i < keys.size(); ++i) { const Qt::KeyboardModifiers modifiers = keys.at(i).keyCombination.keyboardModifiers(); const QChar character = keys.at(i).character; if (!character.isNull()) @@ -318,7 +318,7 @@ void tst_qquicktextinput::text() QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->text(), standard.at(i)); - QCOMPARE(textinputObject->length(), standard.at(i).length()); + QCOMPARE(textinputObject->length(), standard.at(i).size()); delete textinputObject; } @@ -470,36 +470,36 @@ void tst_qquicktextinput::color() textInputObject->setColor(QColor("white")); QCOMPARE(textInputObject->color(), QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textInputObject->setSelectionColor(QColor("black")); QCOMPARE(textInputObject->selectionColor(), QColor("black")); - QCOMPARE(selectionColorSpy.count(), 1); + QCOMPARE(selectionColorSpy.size(), 1); textInputObject->setSelectedTextColor(QColor("blue")); QCOMPARE(textInputObject->selectedTextColor(), QColor("blue")); - QCOMPARE(selectedTextColorSpy.count(), 1); + QCOMPARE(selectedTextColorSpy.size(), 1); textInputObject->setColor(QColor("white")); - QCOMPARE(colorSpy.count(), 1); + QCOMPARE(colorSpy.size(), 1); textInputObject->setSelectionColor(QColor("black")); - QCOMPARE(selectionColorSpy.count(), 1); + QCOMPARE(selectionColorSpy.size(), 1); textInputObject->setSelectedTextColor(QColor("blue")); - QCOMPARE(selectedTextColorSpy.count(), 1); + QCOMPARE(selectedTextColorSpy.size(), 1); textInputObject->setColor(QColor("black")); QCOMPARE(textInputObject->color(), QColor("black")); - QCOMPARE(colorSpy.count(), 2); + QCOMPARE(colorSpy.size(), 2); textInputObject->setSelectionColor(QColor("blue")); QCOMPARE(textInputObject->selectionColor(), QColor("blue")); - QCOMPARE(selectionColorSpy.count(), 2); + QCOMPARE(selectionColorSpy.size(), 2); textInputObject->setSelectedTextColor(QColor("white")); QCOMPARE(textInputObject->selectedTextColor(), QColor("white")); - QCOMPARE(selectedTextColorSpy.count(), 2); + QCOMPARE(selectedTextColorSpy.size(), 2); } //test color @@ -575,7 +575,7 @@ void tst_qquicktextinput::wrap() delete textObject; } - for (int i = 0; i < standard.count(); i++) { + for (int i = 0; i < standard.size(); i++) { QString componentStr = "import QtQuick 2.0\nTextInput { wrapMode: Text.WrapAnywhere; width: 30; text: \"" + standard.at(i) + "\" }"; QQmlComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -605,14 +605,14 @@ void tst_qquicktextinput::wrap() input->setWrapMode(QQuickTextInput::Wrap); QCOMPARE(input->wrapMode(), QQuickTextInput::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setWrapMode(QQuickTextInput::Wrap); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setWrapMode(QQuickTextInput::NoWrap); QCOMPARE(input->wrapMode(), QQuickTextInput::NoWrap); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } } @@ -648,7 +648,7 @@ void tst_qquicktextinput::selection() QCOMPARE(textinputObject->selectionEnd(), 0); QVERIFY(textinputObject->selectedText().isNull()); - textinputObject->setCursorPosition(textinputObject->text().length() + 1); + textinputObject->setCursorPosition(textinputObject->text().size() + 1); QCOMPARE(textinputObject->cursorPosition(), 0); QCOMPARE(textinputObject->selectionStart(), 0); QCOMPARE(textinputObject->selectionEnd(), 0); @@ -708,7 +708,7 @@ void tst_qquicktextinput::selection() QInputMethodEvent event("", attributes); QGuiApplication::sendEvent(textinputObject, &event); } - QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(selectionSpy.size(), 1); QCOMPARE(textinputObject->selectionStart(), 12); QCOMPARE(textinputObject->selectionEnd(), 17); @@ -732,7 +732,7 @@ void tst_qquicktextinput::persistentSelection() input->setPersistentSelection(false); QCOMPARE(input->persistentSelection(), false); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); input->select(1, 4); QCOMPARE(input->property("selected").toString(), QLatin1String("ell")); @@ -745,7 +745,7 @@ void tst_qquicktextinput::persistentSelection() input->setPersistentSelection(true); QCOMPARE(input->persistentSelection(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->select(1, 4); QCOMPARE(input->property("selected").toString(), QLatin1String("ell")); @@ -776,25 +776,25 @@ void tst_qquicktextinput::overwriteMode() QVERIFY(textInput->hasActiveFocus()); textInput->setOverwriteMode(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(true, textInput->overwriteMode()); textInput->setOverwriteMode(false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(false, textInput->overwriteMode()); QVERIFY(!textInput->overwriteMode()); QString insertString = "Some first text"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textInput->text(), QString("Some first text")); textInput->setOverwriteMode(true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); textInput->setCursorPosition(5); insertString = "shiny"; - for (int j = 0; j < insertString.length(); j++) + for (int j = 0; j < insertString.size(); j++) QTest::keyClick(&window, insertString.at(j).toLatin1()); QCOMPARE(textInput->text(), QString("Some shiny text")); } @@ -836,24 +836,24 @@ void tst_qquicktextinput::isRightToLeft() // first test that the right string is delivered to the QString::isRightToLeft() QCOMPARE(textInput.isRightToLeft(0,0), text.mid(0,0).isRightToLeft()); QCOMPARE(textInput.isRightToLeft(0,1), text.mid(0,1).isRightToLeft()); - QCOMPARE(textInput.isRightToLeft(text.length()-2, text.length()-1), text.mid(text.length()-2, text.length()-1).isRightToLeft()); - QCOMPARE(textInput.isRightToLeft(text.length()/2, text.length()/2 + 1), text.mid(text.length()/2, text.length()/2 + 1).isRightToLeft()); - QCOMPARE(textInput.isRightToLeft(0,text.length()/4), text.mid(0,text.length()/4).isRightToLeft()); - QCOMPARE(textInput.isRightToLeft(text.length()/4,3*text.length()/4), text.mid(text.length()/4,3*text.length()/4).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(text.size()-2, text.size()-1), text.mid(text.size()-2, text.size()-1).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(text.size()/2, text.size()/2 + 1), text.mid(text.size()/2, text.size()/2 + 1).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(0,text.size()/4), text.mid(0,text.size()/4).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(text.size()/4,3*text.size()/4), text.mid(text.size()/4,3*text.size()/4).isRightToLeft()); if (text.isEmpty()) QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start."); - QCOMPARE(textInput.isRightToLeft(3*text.length()/4,text.length()-1), text.mid(3*text.length()/4,text.length()-1).isRightToLeft()); + QCOMPARE(textInput.isRightToLeft(3*text.size()/4,text.size()-1), text.mid(3*text.size()/4,text.size()-1).isRightToLeft()); // then test that the feature actually works QCOMPARE(textInput.isRightToLeft(0,0), emptyString); QCOMPARE(textInput.isRightToLeft(0,1), firstCharacter); - QCOMPARE(textInput.isRightToLeft(text.length()-2, text.length()-1), lastCharacter); - QCOMPARE(textInput.isRightToLeft(text.length()/2, text.length()/2 + 1), middleCharacter); - QCOMPARE(textInput.isRightToLeft(0,text.length()/4), startString); - QCOMPARE(textInput.isRightToLeft(text.length()/4,3*text.length()/4), midString); + QCOMPARE(textInput.isRightToLeft(text.size()-2, text.size()-1), lastCharacter); + QCOMPARE(textInput.isRightToLeft(text.size()/2, text.size()/2 + 1), middleCharacter); + QCOMPARE(textInput.isRightToLeft(0,text.size()/4), startString); + QCOMPARE(textInput.isRightToLeft(text.size()/4,3*text.size()/4), midString); if (text.isEmpty()) QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML TextInput: isRightToLeft(start, end) called with the end property being smaller than the start."); - QCOMPARE(textInput.isRightToLeft(3*text.length()/4,text.length()-1), endString); + QCOMPARE(textInput.isRightToLeft(3*text.size()/4,text.size()-1), endString); } void tst_qquicktextinput::moveCursorSelection_data() @@ -1289,8 +1289,8 @@ void tst_qquicktextinput::dragMouseSelection() QTest::mouseMove(&window, QPoint(x2, y)); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str1; - QTRY_VERIFY((str1 = textInputObject->selectedText()).length() > 3); - QTRY_VERIFY(str1.length() > 3); + QTRY_VERIFY((str1 = textInputObject->selectedText()).size() > 3); + QTRY_VERIFY(str1.size() > 3); // press and drag the current selection. x1 = 40; @@ -1299,7 +1299,7 @@ void tst_qquicktextinput::dragMouseSelection() QTest::mouseMove(&window, QPoint(x2, y)); QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str2 = textInputObject->selectedText(); - QTRY_VERIFY(str2.length() > 3); + QTRY_VERIFY(str2.size() > 3); QTRY_VERIFY(str1 != str2); } @@ -1355,7 +1355,7 @@ void tst_qquicktextinput::mouseSelectionMode() if (selectWords) { QTRY_COMPARE(textInputObject->selectedText(), text); } else { - QTRY_VERIFY(textInputObject->selectedText().length() > 3); + QTRY_VERIFY(textInputObject->selectedText().size() > 3); QVERIFY(textInputObject->selectedText() != text); } } @@ -1374,14 +1374,14 @@ void tst_qquicktextinput::mouseSelectionMode_accessors() input->setMouseSelectionMode(QQuickTextInput::SelectWords); QCOMPARE(input->mouseSelectionMode(), QQuickTextInput::SelectWords); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setMouseSelectionMode(QQuickTextInput::SelectWords); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setMouseSelectionMode(QQuickTextInput::SelectCharacters); QCOMPARE(input->mouseSelectionMode(), QQuickTextInput::SelectCharacters); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextinput::selectByMouse() @@ -1398,15 +1398,15 @@ void tst_qquicktextinput::selectByMouse() input->setSelectByMouse(true); QCOMPARE(input->selectByMouse(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); input->setSelectByMouse(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setSelectByMouse(false); QCOMPARE(input->selectByMouse(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(1).at(0).toBool(), false); } @@ -1424,14 +1424,14 @@ void tst_qquicktextinput::renderType() input->setRenderType(QQuickTextInput::NativeRendering); QCOMPARE(input->renderType(), QQuickTextInput::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setRenderType(QQuickTextInput::NativeRendering); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input->setRenderType(QQuickTextInput::QtRendering); QCOMPARE(input->renderType(), QQuickTextInput::QtRendering); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextinput::horizontalAlignment_RightToLeft() @@ -1541,7 +1541,7 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft() QSignalSpy cursorRectangleSpy(textInput, SIGNAL(cursorRectangleChanged())); platformInputContext.setInputDirection(Qt::RightToLeft); QCOMPARE(qApp->inputMethod()->inputDirection(), Qt::RightToLeft); - QCOMPARE(cursorRectangleSpy.count(), 1); + QCOMPARE(cursorRectangleSpy.size(), 1); QCOMPARE(textInput->hAlign(), QQuickTextInput::AlignRight); QVERIFY(textInput->boundingRect().right() >= textInput->width() - 1); QVERIFY(textInput->boundingRect().right() <= textInput->width() + 1); @@ -1876,15 +1876,15 @@ void tst_qquicktextinput::maxLength() QVERIFY(textinputObject->text().isEmpty()); QCOMPARE(textinputObject->maxLength(), 10); foreach (const QString &str, standard) { - QVERIFY(textinputObject->text().length() <= 10); + QVERIFY(textinputObject->text().size() <= 10); textinputObject->setText(str); - QVERIFY(textinputObject->text().length() <= 10); + QVERIFY(textinputObject->text().size() <= 10); } textinputObject->setText(""); QTRY_VERIFY(textinputObject->hasActiveFocus()); for (int i=0; i<20; i++) { - QTRY_COMPARE(textinputObject->text().length(), qMin(i,10)); + QTRY_COMPARE(textinputObject->text().size(), qMin(i,10)); QTest::keyClick(&window, Qt::Key_A); } } @@ -1900,11 +1900,11 @@ void tst_qquicktextinput::masks() QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); QVERIFY(textinputObject != nullptr); QTRY_VERIFY(textinputObject->hasActiveFocus()); - QCOMPARE(textinputObject->text().length(), 0); + QCOMPARE(textinputObject->text().size(), 0); QCOMPARE(textinputObject->inputMask(), QString("HHHHhhhh; ")); QCOMPARE(textinputObject->length(), 8); for (int i=0; i<10; i++) { - QTRY_COMPARE(qMin(i,8), textinputObject->text().length()); + QTRY_COMPARE(qMin(i,8), textinputObject->text().size()); QCOMPARE(textinputObject->length(), 8); QCOMPARE(textinputObject->getText(0, qMin(i, 8)), QString(qMin(i, 8), 'a')); QCOMPARE(textinputObject->getText(qMin(i, 8), 8), QString(8 - qMin(i, 8), ' ')); @@ -1956,10 +1956,10 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(intInput->text(), QLatin1String("1")); QCOMPARE(intInput->hasAcceptableInput(), false); QCOMPARE(intInput->property("acceptable").toBool(), false); - QCOMPARE(intSpy.count(), 0); + QCOMPARE(intSpy.size(), 0); QCOMPARE(intInput->hasAcceptableInput(), false); QCOMPARE(intInput->property("acceptable").toBool(), false); - QCOMPARE(intSpy.count(), 0); + QCOMPARE(intSpy.size(), 0); QTest::keyPress(&window, Qt::Key_Period); QTest::keyRelease(&window, Qt::Key_Period, Qt::NoModifier); QTRY_COMPARE(intInput->text(), QLatin1String("1")); @@ -1987,13 +1987,13 @@ void tst_qquicktextinput::validators() QCOMPARE(intInput->text(), QLatin1String("11")); QCOMPARE(intInput->hasAcceptableInput(), true); QCOMPARE(intInput->property("acceptable").toBool(), true); - QCOMPARE(intSpy.count(), 1); + QCOMPARE(intSpy.size(), 1); QTest::keyPress(&window, Qt::Key_0); QTest::keyRelease(&window, Qt::Key_0, Qt::NoModifier); QCOMPARE(intInput->text(), QLatin1String("11")); QCOMPARE(intInput->hasAcceptableInput(), true); QCOMPARE(intInput->property("acceptable").toBool(), true); - QCOMPARE(intSpy.count(), 1); + QCOMPARE(intSpy.size(), 1); QQuickTextInput *dblInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("dblInput"))); QVERIFY(dblInput); @@ -2019,13 +2019,13 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(dblInput->text(), QLatin1String("1")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 0); + QCOMPARE(dblSpy.size(), 0); QTest::keyPress(&window, Qt::Key_2); QTest::keyRelease(&window, Qt::Key_2, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1); + QCOMPARE(dblSpy.size(), 1); QTest::keyPress(&window, Qt::Key_Comma); QTest::keyRelease(&window, Qt::Key_Comma, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12,")); @@ -2066,84 +2066,84 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(dblInput->text(), QLatin1String("12.")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1 + extraSignals); + QCOMPARE(dblSpy.size(), 1 + extraSignals); QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.1")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1 + extraSignals); + QCOMPARE(dblSpy.size(), 1 + extraSignals); QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1 + extraSignals); + QCOMPARE(dblSpy.size(), 1 + extraSignals); QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), true); QCOMPARE(dblInput->property("acceptable").toBool(), true); - QCOMPARE(dblSpy.count(), 1 + extraSignals); + QCOMPARE(dblSpy.size(), 1 + extraSignals); // Ensure the validator doesn't prevent characters being removed. dblInput->setValidator(intInput->validator()); QCOMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.1")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); // Once unacceptable input is in anything goes until it reaches an acceptable state again. QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.11")); QCOMPARE(dblInput->hasAcceptableInput(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.1")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12.")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("12")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_Backspace); QTest::keyRelease(&window, Qt::Key_Backspace, Qt::NoModifier); QTRY_COMPARE(dblInput->text(), QLatin1String("1")); QCOMPARE(dblInput->hasAcceptableInput(), false); QCOMPARE(dblInput->property("acceptable").toBool(), false); - QCOMPARE(dblSpy.count(), 2 + extraSignals); + QCOMPARE(dblSpy.size(), 2 + extraSignals); QTest::keyPress(&window, Qt::Key_1); QTest::keyRelease(&window, Qt::Key_1, Qt::NoModifier); QCOMPARE(dblInput->text(), QLatin1String("11")); QCOMPARE(dblInput->property("acceptable").toBool(), true); QCOMPARE(dblInput->hasAcceptableInput(), true); - QCOMPARE(dblSpy.count(), 3 + extraSignals); + QCOMPARE(dblSpy.size(), 3 + extraSignals); // Changing the validator properties will re-evaluate whether the input is acceptable. intValidator->setTop(10); QCOMPARE(dblInput->property("acceptable").toBool(), false); QCOMPARE(dblInput->hasAcceptableInput(), false); - QCOMPARE(dblSpy.count(), 4 + extraSignals); + QCOMPARE(dblSpy.size(), 4 + extraSignals); intValidator->setTop(12); QCOMPARE(dblInput->property("acceptable").toBool(), true); QCOMPARE(dblInput->hasAcceptableInput(), true); - QCOMPARE(dblSpy.count(), 5 + extraSignals); + QCOMPARE(dblSpy.size(), 5 + extraSignals); QQuickTextInput *strInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("strInput"))); QVERIFY(strInput); @@ -2157,37 +2157,37 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(strInput->text(), QLatin1String("")); QCOMPARE(strInput->hasAcceptableInput(), false); QCOMPARE(strInput->property("acceptable").toBool(), false); - QCOMPARE(strSpy.count(), 0); + QCOMPARE(strSpy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("a")); QCOMPARE(strInput->hasAcceptableInput(), false); QCOMPARE(strInput->property("acceptable").toBool(), false); - QCOMPARE(strSpy.count(), 0); + QCOMPARE(strSpy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("aa")); QCOMPARE(strInput->hasAcceptableInput(), true); QCOMPARE(strInput->property("acceptable").toBool(), true); - QCOMPARE(strSpy.count(), 1); + QCOMPARE(strSpy.size(), 1); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("aaa")); QCOMPARE(strInput->hasAcceptableInput(), true); QCOMPARE(strInput->property("acceptable").toBool(), true); - QCOMPARE(strSpy.count(), 1); + QCOMPARE(strSpy.size(), 1); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("aaaa")); QCOMPARE(strInput->hasAcceptableInput(), true); QCOMPARE(strInput->property("acceptable").toBool(), true); - QCOMPARE(strSpy.count(), 1); + QCOMPARE(strSpy.size(), 1); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(strInput->text(), QLatin1String("aaaa")); QCOMPARE(strInput->hasAcceptableInput(), true); QCOMPARE(strInput->property("acceptable").toBool(), true); - QCOMPARE(strSpy.count(), 1); + QCOMPARE(strSpy.size(), 1); QQuickTextInput *unvalidatedInput = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("unvalidatedInput"))); QVERIFY(unvalidatedInput); @@ -2201,13 +2201,13 @@ void tst_qquicktextinput::validators() QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1")); QCOMPARE(unvalidatedInput->hasAcceptableInput(), true); QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true); - QCOMPARE(unvalidatedSpy.count(), 0); + QCOMPARE(unvalidatedSpy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(unvalidatedInput->text(), QLatin1String("1a")); QCOMPARE(unvalidatedInput->hasAcceptableInput(), true); QCOMPARE(unvalidatedInput->property("acceptable").toBool(), true); - QCOMPARE(unvalidatedSpy.count(), 0); + QCOMPARE(unvalidatedSpy.size(), 0); } void tst_qquicktextinput::inputMethods() @@ -2225,9 +2225,9 @@ void tst_qquicktextinput::inputMethods() QSignalSpy inputMethodHintSpy(input, SIGNAL(inputMethodHintsChanged())); input->setInputMethodHints(Qt::ImhUppercaseOnly); QVERIFY(input->inputMethodHints() & Qt::ImhUppercaseOnly); - QCOMPARE(inputMethodHintSpy.count(), 1); + QCOMPARE(inputMethodHintSpy.size(), 1); input->setInputMethodHints(Qt::ImhUppercaseOnly); - QCOMPARE(inputMethodHintSpy.count(), 1); + QCOMPARE(inputMethodHintSpy.size(), 1); // default value QQuickTextInput plainInput; @@ -2286,8 +2286,8 @@ void tst_qquicktextinput::inputMethods() // input should reset selection even if replacement parameters are out of bounds input->setText("text"); input->setCursorPosition(0); - input->moveCursorSelection(input->text().length()); - event.setCommitString("replacement", -input->text().length(), input->text().length()); + input->moveCursorSelection(input->text().size()); + event.setCommitString("replacement", -input->text().size(), input->text().size()); QGuiApplication::sendEvent(input, &event); QCOMPARE(input->selectionStart(), input->selectionEnd()); QCOMPARE(input->text(), QString("replacement")); @@ -2326,22 +2326,22 @@ void tst_qquicktextinput::signal_accepted() QTRY_COMPARE(input->text(), QLatin1String("a")); QCOMPARE(input->hasAcceptableInput(), false); QCOMPARE(input->property("acceptable").toBool(), false); - QTRY_COMPARE(inputSpy.count(), 0); + QTRY_COMPARE(inputSpy.size(), 0); QTest::keyPress(&window, Qt::Key_Enter); QTest::keyRelease(&window, Qt::Key_Enter, Qt::NoModifier); - QTRY_COMPARE(acceptedSpy.count(), 0); + QTRY_COMPARE(acceptedSpy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(input->text(), QLatin1String("aa")); QCOMPARE(input->hasAcceptableInput(), true); QCOMPARE(input->property("acceptable").toBool(), true); - QTRY_COMPARE(inputSpy.count(), 1); + QTRY_COMPARE(inputSpy.size(), 1); QTest::keyPress(&window, Qt::Key_Enter); QTest::keyRelease(&window, Qt::Key_Enter, Qt::NoModifier); - QTRY_COMPARE(acceptedSpy.count(), 1); + QTRY_COMPARE(acceptedSpy.size(), 1); } void tst_qquicktextinput::signal_editingfinished() @@ -2369,23 +2369,23 @@ void tst_qquicktextinput::signal_editingfinished() QTRY_COMPARE(input1->text(), QLatin1String("a")); QCOMPARE(input1->hasAcceptableInput(), false); QCOMPARE(input1->property("acceptable").toBool(), false); - QTRY_COMPARE(input1Spy.count(), 0); + QTRY_COMPARE(input1Spy.size(), 0); QTest::keyPress(&window, Qt::Key_Enter); QTest::keyRelease(&window, Qt::Key_Enter, Qt::NoModifier); - QTRY_COMPARE(editingFinished1Spy.count(), 0); + QTRY_COMPARE(editingFinished1Spy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(input1->text(), QLatin1String("aa")); QCOMPARE(input1->hasAcceptableInput(), true); QCOMPARE(input1->property("acceptable").toBool(), true); - QTRY_COMPARE(input1Spy.count(), 1); + QTRY_COMPARE(input1Spy.size(), 1); QTest::keyPress(&window, Qt::Key_Enter); QTest::keyRelease(&window, Qt::Key_Enter, Qt::NoModifier); - QTRY_COMPARE(editingFinished1Spy.count(), 1); - QTRY_COMPARE(input1Spy.count(), 1); + QTRY_COMPARE(editingFinished1Spy.size(), 1); + QTRY_COMPARE(input1Spy.size(), 1); QSignalSpy editingFinished2Spy(input2, SIGNAL(editingFinished())); QSignalSpy input2Spy(input2, SIGNAL(acceptableInputChanged())); @@ -2399,19 +2399,19 @@ void tst_qquicktextinput::signal_editingfinished() QTRY_COMPARE(input2->text(), QLatin1String("a")); QCOMPARE(input2->hasAcceptableInput(), false); QCOMPARE(input2->property("acceptable").toBool(), false); - QTRY_COMPARE(input2Spy.count(), 0); + QTRY_COMPARE(input2Spy.size(), 0); QTest::keyPress(&window, Qt::Key_A); QTest::keyRelease(&window, Qt::Key_A, Qt::NoModifier); QTRY_COMPARE(input2->text(), QLatin1String("aa")); QCOMPARE(input2->hasAcceptableInput(), true); QCOMPARE(input2->property("acceptable").toBool(), true); - QTRY_COMPARE(input2Spy.count(), 1); + QTRY_COMPARE(input2Spy.size(), 1); input1->setFocus(true); QTRY_VERIFY(input1->hasActiveFocus()); QTRY_VERIFY(!input2->hasActiveFocus()); - QTRY_COMPARE(editingFinished2Spy.count(), 1); + QTRY_COMPARE(editingFinished2Spy.size(), 1); } void tst_qquicktextinput::signal_textEdited() @@ -2437,32 +2437,32 @@ void tst_qquicktextinput::signal_textEdited() int textEdits = 0; QTest::keyClick(&window, Qt::Key_A); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); QTest::keyClick(&window, Qt::Key_B); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); QTest::keyClick(&window, Qt::Key_C); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); QTest::keyClick(&window, Qt::Key_Space); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); QTest::keyClick(&window, Qt::Key_Backspace); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), ++textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), ++textEdits); input->clear(); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), textEdits); input->setText("TextInput"); - QCOMPARE(textChangedSpy.count(), ++textChanges); - QCOMPARE(textEditedSpy.count(), textEdits); + QCOMPARE(textChangedSpy.size(), ++textChanges); + QCOMPARE(textEditedSpy.size(), textEdits); } /* @@ -2488,12 +2488,12 @@ void tst_qquicktextinput::navigation() QTest::keyClick(&window, Qt::Key_Right); QVERIFY(input->hasActiveFocus()); //QT-2944: If text is selected, ensure we deselect upon cursor motion - input->setCursorPosition(input->text().length()); - input->select(0,input->text().length()); + input->setCursorPosition(input->text().size()); + input->select(0,input->text().size()); QVERIFY(input->selectionStart() != input->selectionEnd()); QTest::keyClick(&window, Qt::Key_Right); QCOMPARE(input->selectionStart(), input->selectionEnd()); - QCOMPARE(input->selectionStart(), input->text().length()); + QCOMPARE(input->selectionStart(), input->text().size()); QVERIFY(input->hasActiveFocus()); QTest::keyClick(&window, Qt::Key_Right); QVERIFY(!input->hasActiveFocus()); @@ -2544,7 +2544,7 @@ void tst_qquicktextinput::navigation_RTL() QTest::keyClick(&window, Qt::Key_Left); QVERIFY(input->hasActiveFocus()); - input->setCursorPosition(input->text().length()); + input->setCursorPosition(input->text().size()); QVERIFY(input->hasActiveFocus()); // move off @@ -2569,16 +2569,16 @@ void tst_qquicktextinput::copyAndPaste() QVERIFY(textInput != nullptr); // copy and paste - QCOMPARE(textInput->text().length(), 12); - textInput->select(0, textInput->text().length()); + QCOMPARE(textInput->text().size(), 12); + textInput->select(0, textInput->text().size()); textInput->copy(); QCOMPARE(textInput->selectedText(), QString("Hello world!")); - QCOMPARE(textInput->selectedText().length(), 12); + QCOMPARE(textInput->selectedText().size(), 12); textInput->setCursorPosition(0); QTRY_VERIFY(textInput->canPaste()); textInput->paste(); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); // can paste QVERIFY(textInput->canPaste()); @@ -2586,7 +2586,7 @@ void tst_qquicktextinput::copyAndPaste() QVERIFY(!textInput->canPaste()); textInput->paste(); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); textInput->setReadOnly(false); QVERIFY(textInput->canPaste()); @@ -2608,10 +2608,10 @@ void tst_qquicktextinput::copyAndPaste() // select all and cut textInput->selectAll(); textInput->cut(); - QCOMPARE(textInput->text().length(), 0); + QCOMPARE(textInput->text().size(), 0); textInput->paste(); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); // Copy first word. textInput->setCursorPosition(0); @@ -2638,7 +2638,7 @@ void tst_qquicktextinput::copyAndPaste() QQuickTextInput::EchoMode echoMode = QQuickTextInput::EchoMode(index); textInput->setEchoMode(echoMode); textInput->setText("My password"); - textInput->select(0, textInput->text().length()); + textInput->select(0, textInput->text().size()); textInput->copy(); if (echoMode == QQuickTextInput::Normal) { QVERIFY(!clipboard->text().isEmpty()); @@ -2674,24 +2674,24 @@ void tst_qquicktextinput::copyAndPasteKeySequence() // copy and paste QVERIFY(textInput->hasActiveFocus()); - QCOMPARE(textInput->text().length(), 12); - textInput->select(0, textInput->text().length()); + QCOMPARE(textInput->text().size(), 12); + textInput->select(0, textInput->text().size()); simulateKeys(&window, QKeySequence::Copy); QCOMPARE(textInput->selectedText(), QString("Hello world!")); - QCOMPARE(textInput->selectedText().length(), 12); + QCOMPARE(textInput->selectedText().size(), 12); textInput->setCursorPosition(0); QVERIFY(textInput->canPaste()); simulateKeys(&window, QKeySequence::Paste); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); // select all and cut simulateKeys(&window, QKeySequence::SelectAll); simulateKeys(&window, QKeySequence::Cut); - QCOMPARE(textInput->text().length(), 0); + QCOMPARE(textInput->text().size(), 0); simulateKeys(&window, QKeySequence::Paste); QCOMPARE(textInput->text(), QString("Hello world!Hello world!")); - QCOMPARE(textInput->text().length(), 24); + QCOMPARE(textInput->text().size(), 24); // clear copy buffer QClipboard *clipboard = QGuiApplication::clipboard(); @@ -2706,7 +2706,7 @@ void tst_qquicktextinput::copyAndPasteKeySequence() QQuickTextInput::EchoMode echoMode = QQuickTextInput::EchoMode(index); textInput->setEchoMode(echoMode); textInput->setText("My password"); - textInput->select(0, textInput->text().length()); + textInput->select(0, textInput->text().size()); simulateKeys(&window, QKeySequence::Copy); if (echoMode == QQuickTextInput::Normal) { QVERIFY(!clipboard->text().isEmpty()); @@ -2733,7 +2733,7 @@ void tst_qquicktextinput::canPasteEmpty() QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); QVERIFY(textInput != nullptr); - bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0; + bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().size() != 0; QCOMPARE(textInput->canPaste(), cp); } #endif @@ -2749,7 +2749,7 @@ void tst_qquicktextinput::canPaste() QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); QVERIFY(textInput != nullptr); - bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0; + bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().size() != 0; QCOMPARE(textInput->canPaste(), cp); } #endif @@ -2792,7 +2792,7 @@ void tst_qquicktextinput::middleClickPaste() QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10); if (QGuiApplication::clipboard()->supportsSelection()) - QCOMPARE(textInputObject->text().mid(1, selectedText.length()), selectedText); + QCOMPARE(textInputObject->text().mid(1, selectedText.size()), selectedText); else QCOMPARE(textInputObject->text(), originalText); } @@ -2844,7 +2844,7 @@ void tst_qquicktextinput::cursorDelegate() QVERIFY(delegateObject); QCOMPARE(delegateObject->property("localProperty").toString(), QString("Hello")); //Test Delegate gets moved - for (int i=0; i<= textInputObject->text().length(); i++) { + for (int i=0; i<= textInputObject->text().size(); i++) { textInputObject->setCursorPosition(i); QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y()); @@ -2982,27 +2982,27 @@ void tst_qquicktextinput::cursorVisible() input.setCursorVisible(true); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); input.setCursorVisible(false); QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); input.setFocus(true); QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); input.setParentItem(view.rootObject()); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); input.setFocus(false); QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); input.setFocus(true); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); QQuickView alternateView; alternateView.show(); @@ -3010,12 +3010,12 @@ void tst_qquicktextinput::cursorVisible() QVERIFY(QTest::qWaitForWindowActive(&alternateView)); QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); { // Cursor attribute with 0 length hides cursor. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -3023,7 +3023,7 @@ void tst_qquicktextinput::cursorVisible() QCoreApplication::sendEvent(&input, &ev); } QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 8); + QCOMPARE(spy.size(), 8); { // Cursor attribute with non zero length shows cursor. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -3031,7 +3031,7 @@ void tst_qquicktextinput::cursorVisible() QCoreApplication::sendEvent(&input, &ev); } QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 9); + QCOMPARE(spy.size(), 9); { // If the cursor is hidden by the input method and the text is changed it should be visible again. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -3039,11 +3039,11 @@ void tst_qquicktextinput::cursorVisible() QCoreApplication::sendEvent(&input, &ev); } QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 10); + QCOMPARE(spy.size(), 10); input.setText("something"); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 11); + QCOMPARE(spy.size(), 11); { // If the cursor is hidden by the input method and the cursor position is changed it should be visible again. QInputMethodEvent ev(QString(), QList<QInputMethodEvent::Attribute>() @@ -3051,11 +3051,11 @@ void tst_qquicktextinput::cursorVisible() QCoreApplication::sendEvent(&input, &ev); } QCOMPARE(input.isCursorVisible(), false); - QCOMPARE(spy.count(), 12); + QCOMPARE(spy.size(), 12); input.setCursorPosition(5); QCOMPARE(input.isCursorVisible(), true); - QCOMPARE(spy.count(), 13); + QCOMPARE(spy.size(), 13); } void tst_qquicktextinput::cursorRectangle_data() @@ -3132,14 +3132,14 @@ void tst_qquicktextinput::cursorRectangle() // Check the cursor rectangle remains within the input bounding rect when auto scrolling. QCOMPARE(r.left(), leftToRight ? input.width() : 0); - for (int i = positionAtWidth + 1; i < text.length(); ++i) { + for (int i = positionAtWidth + 1; i < text.size(); ++i) { input.setCursorPosition(i); QCOMPARE(r, input.cursorRectangle()); COMPARE_INPUT_METHOD_QUERY(QRectF, (&input), Qt::ImCursorRectangle, toRectF, r); QCOMPARE(input.positionToRectangle(i), r); } - for (int i = text.length() - 2; i >= 0; --i) { + for (int i = text.size() - 2; i >= 0; --i) { input.setCursorPosition(i); r = input.cursorRectangle(); QCOMPARE(r.top(), 0.); @@ -3178,7 +3178,7 @@ void tst_qquicktextinput::cursorRectangle() COMPARE_INPUT_METHOD_QUERY(QRectF, (&input), Qt::ImCursorRectangle, toRectF, r); QCOMPARE(input.positionToRectangle(11), r); - for (int i = wrapPosition + 1; i < text.length(); ++i) { + for (int i = wrapPosition + 1; i < text.size(); ++i) { input.setCursorPosition(i); r = input.cursorRectangle(); QVERIFY(r.top() >= line.height() - 5); @@ -3219,7 +3219,7 @@ void tst_qquicktextinput::cursorRectangle() COMPARE_INPUT_METHOD_QUERY(QRectF, (&input), Qt::ImCursorRectangle, toRectF, r); QCOMPARE(input.positionToRectangle(11), r); - for (int i = wrapPosition + 1; i < text.length(); ++i) { + for (int i = wrapPosition + 1; i < text.size(); ++i) { input.setCursorPosition(i); r = input.cursorRectangle(); QVERIFY(r.bottom() >= input.height()); @@ -3227,7 +3227,7 @@ void tst_qquicktextinput::cursorRectangle() QCOMPARE(input.positionToRectangle(i), r); } - for (int i = text.length() - 2; i >= wrapPosition; --i) { + for (int i = text.size() - 2; i >= wrapPosition; --i) { input.setCursorPosition(i); r = input.cursorRectangle(); QVERIFY(r.bottom() >= input.height()); @@ -3268,7 +3268,7 @@ void tst_qquicktextinput::cursorRectangle() widerText[1] = 'W'; // Assumes shortText is at least two characters long. input.setText(widerText); - QCOMPARE(cursorRectangleSpy.count(), 1); + QCOMPARE(cursorRectangleSpy.size(), 1); } void tst_qquicktextinput::readOnly() @@ -3296,7 +3296,7 @@ void tst_qquicktextinput::readOnly() input->setCursorPosition(3); input->setReadOnly(false); QCOMPARE(input->isReadOnly(), false); - QCOMPARE(input->cursorPosition(), input->text().length()); + QCOMPARE(input->cursorPosition(), input->text().size()); QVERIFY(input->isCursorVisible()); } @@ -3418,7 +3418,7 @@ void tst_qquicktextinput::passwordEchoDelay() QSignalSpy cursorSpy(input, SIGNAL(cursorRectangleChanged())); QTest::qWait(maskDelay); QTRY_COMPARE(input->displayText(), QString(5, fillChar)); - QCOMPARE(cursorSpy.count(), 1); + QCOMPARE(cursorSpy.size(), 1); QCOMPARE(input->cursorRectangle().topLeft(), cursor->position()); QTest::keyPress(&window, '5'); @@ -3469,7 +3469,7 @@ void tst_qquicktextinput::focusOnPress() textInputObject->setFocusOnPress(true); QCOMPARE(textInputObject->focusOnPress(), true); - QCOMPARE(activeFocusOnPressSpy.count(), 0); + QCOMPARE(activeFocusOnPressSpy.size(), 0); QQuickWindow window; window.resize(100, 50); @@ -3486,20 +3486,20 @@ void tst_qquicktextinput::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), true); QCOMPARE(textInputObject->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(), 1); - QCOMPARE(activeFocusSpy.count(), 1); + QCOMPARE(focusSpy.size(), 1); + QCOMPARE(activeFocusSpy.size(), 1); QCOMPARE(textInputObject->selectedText(), QString()); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers); textInputObject->setFocusOnPress(false); QCOMPARE(textInputObject->focusOnPress(), false); - QCOMPARE(activeFocusOnPressSpy.count(), 1); + QCOMPARE(activeFocusOnPressSpy.size(), 1); textInputObject->setFocus(false); QCOMPARE(textInputObject->hasFocus(), false); QCOMPARE(textInputObject->hasActiveFocus(), false); - QCOMPARE(focusSpy.count(), 2); - QCOMPARE(activeFocusSpy.count(), 2); + QCOMPARE(focusSpy.size(), 2); + QCOMPARE(activeFocusSpy.size(), 2); // Wait for double click timeout to expire before clicking again. QTest::qWait(400); @@ -3507,13 +3507,13 @@ void tst_qquicktextinput::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), false); QCOMPARE(textInputObject->hasActiveFocus(), false); - QCOMPARE(focusSpy.count(), 2); - QCOMPARE(activeFocusSpy.count(), 2); + QCOMPARE(focusSpy.size(), 2); + QCOMPARE(activeFocusSpy.size(), 2); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers); textInputObject->setFocusOnPress(true); QCOMPARE(textInputObject->focusOnPress(), true); - QCOMPARE(activeFocusOnPressSpy.count(), 2); + QCOMPARE(activeFocusOnPressSpy.size(), 2); // Test a selection made in the on(Active)FocusChanged handler isn't overwritten. textInputObject->setProperty("selectOnFocus", true); @@ -3523,8 +3523,8 @@ void tst_qquicktextinput::focusOnPress() QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), true); QCOMPARE(textInputObject->hasActiveFocus(), true); - QCOMPARE(focusSpy.count(), 3); - QCOMPARE(activeFocusSpy.count(), 3); + QCOMPARE(focusSpy.size(), 3); + QCOMPARE(activeFocusSpy.size(), 3); QCOMPARE(textInputObject->selectedText(), textInputObject->text()); QTest::mouseRelease(&window, Qt::LeftButton, noModifiers); } @@ -3615,7 +3615,7 @@ void tst_qquicktextinput::openInputPanel() anotherInput.setFocus(true); QCOMPARE(qApp->inputMethod()->isVisible(), true); QCOMPARE(qApp->focusObject(), qobject_cast<QObject*>(&anotherInput)); - QCOMPARE(inputPanelVisibilitySpy.count(), 0); + QCOMPARE(inputPanelVisibilitySpy.size(), 0); anotherInput.setFocus(false); QVERIFY(qApp->focusObject() != &anotherInput); @@ -3764,18 +3764,18 @@ void tst_qquicktextinput::contentSize() QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() < textObject->height()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); textObject->setWrapMode(QQuickTextInput::WordWrap); QVERIFY(textObject->contentWidth() <= textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); textObject->setText("The quickredfoxjumpedoverthe lazy brown dog"); QVERIFY(textObject->contentWidth() > textObject->width()); QVERIFY(textObject->contentHeight() > textObject->height()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); textObject->setText("The quick red fox jumped over the lazy brown dog"); for (int w = 60; w < 120; ++w) { @@ -3788,7 +3788,7 @@ void tst_qquicktextinput::contentSize() static void sendPreeditText(QQuickItem *item, const QString &text, int cursor) { QInputMethodEvent event(text, QList<QInputMethodEvent::Attribute>() - << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursor, text.length(), QVariant())); + << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursor, text.size(), QVariant())); QCoreApplication::sendEvent(item, &event); } @@ -3813,14 +3813,14 @@ void tst_qquicktextinput::preeditAutoScroll() sendPreeditText(input, preeditText.mid(0, 3), 1); QVERIFY(evaluate<int>(input, QString("positionAt(0)")) != 0); QVERIFY(input->cursorRectangle().left() < input->boundingRect().width()); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); // test the text is scrolled back when the preedit is removed. QInputMethodEvent imEvent; QCoreApplication::sendEvent(input, &imEvent); QCOMPARE(evaluate<int>(input, QString("positionAt(%1)").arg(0)), 0); QCOMPARE(evaluate<int>(input, QString("positionAt(%1)").arg(input->width())), 5); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); QTextLayout layout(preeditText); layout.setFont(input->font()); @@ -3841,7 +3841,7 @@ void tst_qquicktextinput::preeditAutoScroll() int width = ceil(line.cursorToX(i, QTextLine::Trailing)) - floor(line.cursorToX(i)); QVERIFY(input->cursorRectangle().right() >= width - 3); QVERIFY(input->positionToRectangle(0).x() < x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); x = input->positionToRectangle(0).x(); } for (int i = 1; i >= 0; --i) { @@ -3849,24 +3849,24 @@ void tst_qquicktextinput::preeditAutoScroll() int width = ceil(line.cursorToX(i, QTextLine::Trailing)) - floor(line.cursorToX(i)); QVERIFY(input->cursorRectangle().right() >= width - 3); QVERIFY(input->positionToRectangle(0).x() > x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); x = input->positionToRectangle(0).x(); } // Test incrementing the preedit cursor doesn't cause further // scrolling when right most text is visible. - sendPreeditText(input, preeditText, preeditText.length() - 3); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + sendPreeditText(input, preeditText, preeditText.size() - 3); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); x = input->positionToRectangle(0).x(); for (int i = 2; i >= 0; --i) { - sendPreeditText(input, preeditText, preeditText.length() - i); + sendPreeditText(input, preeditText, preeditText.size() - i); QCOMPARE(input->positionToRectangle(0).x(), x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); } for (int i = 1; i < 3; ++i) { - sendPreeditText(input, preeditText, preeditText.length() - i); + sendPreeditText(input, preeditText, preeditText.size() - i); QCOMPARE(input->positionToRectangle(0).x(), x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QCOMPARE(cursorRectangleSpy.size(), ++cursorRectangleChanges); } // Test disabling auto scroll. @@ -3920,8 +3920,8 @@ void tst_qquicktextinput::preeditCursorRectangle() QVERIFY(previousRect.left() < currentRect.left()); QCOMPARE(input->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); - QVERIFY(inputSpy.count() > 0); inputSpy.clear(); - QVERIFY(panelSpy.count() > 0); panelSpy.clear(); + QVERIFY(inputSpy.size() > 0); inputSpy.clear(); + QVERIFY(panelSpy.size() > 0); panelSpy.clear(); previousRect = currentRect; } @@ -3934,8 +3934,8 @@ void tst_qquicktextinput::preeditCursorRectangle() currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(input->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); - QCOMPARE(inputSpy.count(), 1); - QCOMPARE(panelSpy.count(), 1); + QCOMPARE(inputSpy.size(), 1); + QCOMPARE(panelSpy.size(), 1); // Verify that if there is no preedit cursor then the micro focus rect is the // same as it would be if it were positioned at the end of the preedit text. @@ -3948,8 +3948,8 @@ void tst_qquicktextinput::preeditCursorRectangle() QCOMPARE(currentRect, previousRect); QCOMPARE(input->cursorRectangle(), currentRect); QCOMPARE(cursor->position(), currentRect.topLeft()); - QCOMPARE(inputSpy.count(), 1); - QCOMPARE(panelSpy.count(), 1); + QCOMPARE(inputSpy.size(), 1); + QCOMPARE(panelSpy.size(), 1); } void tst_qquicktextinput::inputContextMouseHandler() @@ -4016,37 +4016,37 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); { QInputMethodEvent event(text.mid(12), QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(input, &event); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); { QInputMethodEvent event; QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // Changing the text while not composing doesn't alter the composing state. input->setText(text.mid(0, 16)); QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); { QInputMethodEvent event(text.mid(16), QList<QInputMethodEvent::Attribute>()); QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); // Changing the text while composing cancels composition. input->setText(text.mid(0, 12)); QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); { // Preedit cursor positioned outside (empty) preedit; composing. QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4054,7 +4054,7 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Cursor hidden; composing @@ -4063,7 +4063,7 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Default cursor attributes; composing. QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4071,7 +4071,7 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); { // Selections are persisted: not composing QInputMethodEvent event(QString(), QList<QInputMethodEvent::Attribute>() @@ -4079,7 +4079,7 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); input->setCursorPosition(12); @@ -4091,14 +4091,14 @@ void tst_qquicktextinput::inputMethodComposing() QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), true); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); { QInputMethodEvent event; QGuiApplication::sendEvent(input, &event); } QCOMPARE(input->isInputMethodComposing(), false); - QCOMPARE(spy.count(), 8); + QCOMPARE(spy.size(), 8); } void tst_qquicktextinput::inputMethodUpdate() @@ -4285,7 +4285,7 @@ void tst_qquicktextinput::getText_data() QTest::newRow("all plain text") << standard.at(0) << QString() - << 0 << standard.at(0).length() + << 0 << standard.at(0).size() << standard.at(0); QTest::newRow("plain text sub string") @@ -4309,13 +4309,13 @@ void tst_qquicktextinput::getText_data() QTest::newRow("plain text cropped end") << standard.at(0) << QString() - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(23); QTest::newRow("plain text cropped beginning and end") << standard.at(0) << QString() - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << standard.at(0); } @@ -4363,10 +4363,10 @@ void tst_qquicktextinput::insert_data() QTest::newRow("at cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") - << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5 + << standard.at(0).size() + 5 << standard.at(0).size() + 5 << standard.at(0).size() + 5 << false << true; QTest::newRow("at cursor position (middle)") @@ -4390,10 +4390,10 @@ void tst_qquicktextinput::insert_data() QTest::newRow("before cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() << 18 + << standard.at(0).size() << standard.at(0).size() << 18 << QString("Hello") << standard.at(0).mid(0, 18) + QString("Hello") + standard.at(0).mid(18) - << standard.at(0).length() + 5 << standard.at(0).length() + 5 << standard.at(0).length() + 5 + << standard.at(0).size() + 5 << standard.at(0).size() + 5 << standard.at(0).size() + 5 << false << true; QTest::newRow("before cursor position (middle)") @@ -4408,7 +4408,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("after cursor position (middle)") << standard.at(0) << QString() - << 18 << 18 << standard.at(0).length() + << 18 << 18 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 18 << 18 << 18 @@ -4435,7 +4435,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("after selection") << standard.at(0) << QString() - << 14 << 19 << standard.at(0).length() + << 14 << 19 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 14 << 19 << 19 @@ -4444,7 +4444,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("after reversed selection") << standard.at(0) << QString() - << 19 << 14 << standard.at(0).length() + << 19 << 14 << standard.at(0).size() << QString("Hello") << standard.at(0) + QString("Hello") << 14 << 19 << 14 @@ -4489,7 +4489,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("past end") << standard.at(0) << QString() - << 0 << 0 << standard.at(0).length() + 3 + << 0 << 0 << standard.at(0).size() + 3 << QString("Hello") << standard.at(0) << 0 << 0 << 0 @@ -4510,10 +4510,10 @@ void tst_qquicktextinput::insert_data() QTest::newRow("mask: at cursor position (end)") << ip << inputMask - << inputMask.length() << inputMask.length() << inputMask.length() + << inputMask.size() << inputMask.size() << inputMask.size() << QString("8") << ip - << inputMask.length() << inputMask.length() << inputMask.length() + << inputMask.size() << inputMask.size() << inputMask.size() << false << false; QTest::newRow("mask: at cursor position (middle)") @@ -4537,10 +4537,10 @@ void tst_qquicktextinput::insert_data() QTest::newRow("mask: before cursor position (end)") << ip << inputMask - << inputMask.length() << inputMask.length() << 6 + << inputMask.size() << inputMask.size() << 6 << QString("75.2") << QString("192.167.5.24") - << inputMask.length() << inputMask.length() << inputMask.length() + << inputMask.size() << inputMask.size() << inputMask.size() << false << false; QTest::newRow("mask: before cursor position (middle)") @@ -4627,7 +4627,7 @@ void tst_qquicktextinput::insert_data() QTest::newRow("mask: past end") << ip << inputMask - << 0 << 0 << ip.length() + 3 + << 0 << 0 << ip.size() + 3 << QString("4") << ip << 0 << 0 << 0 @@ -4684,7 +4684,7 @@ void tst_qquicktextinput::insert() textInput->insert(insertPosition, insertText); QCOMPARE(textInput->text(), expectedText); - QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.length() : inputMask.length()); + QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.size() : inputMask.size()); QCOMPARE(textInput->selectionStart(), expectedSelectionStart); QCOMPARE(textInput->selectionEnd(), expectedSelectionEnd); @@ -4693,11 +4693,11 @@ void tst_qquicktextinput::insert() if (selectionStart > selectionEnd) qSwap(selectionStart, selectionEnd); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); - QCOMPARE(cursorPositionSpy.count() > 0, cursorPositionChanged); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); + QCOMPARE(cursorPositionSpy.size() > 0, cursorPositionChanged); } void tst_qquicktextinput::remove_data() @@ -4736,19 +4736,19 @@ void tst_qquicktextinput::remove_data() QTest::newRow("to cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() - << standard.at(0).length() << standard.at(0).length() - 5 - << standard.at(0).mid(0, standard.at(0).length() - 5) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() << standard.at(0).size() + << standard.at(0).size() << standard.at(0).size() - 5 + << standard.at(0).mid(0, standard.at(0).size() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("to cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() << standard.at(0).size() + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("from cursor position (middle)") @@ -4781,10 +4781,10 @@ void tst_qquicktextinput::remove_data() QTest::newRow("before cursor position (end)") << standard.at(0) << QString() - << standard.at(0).length() << standard.at(0).length() + << standard.at(0).size() << standard.at(0).size() << 18 << 23 << standard.at(0).mid(0, 18) + standard.at(0).mid(23) - << standard.at(0).length() - 5 << standard.at(0).length() - 5 << standard.at(0).length() - 5 + << standard.at(0).size() - 5 << standard.at(0).size() - 5 << standard.at(0).size() - 5 << false << true; QTest::newRow("before cursor position (middle)") @@ -4827,8 +4827,8 @@ void tst_qquicktextinput::remove_data() << standard.at(0) << QString() << 14 << 19 - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) << 14 << 19 << 19 << false << false; @@ -4836,8 +4836,8 @@ void tst_qquicktextinput::remove_data() << standard.at(0) << QString() << 19 << 14 - << standard.at(0).length() - 5 << standard.at(0).length() - << standard.at(0).mid(0, standard.at(0).length() - 5) + << standard.at(0).size() - 5 << standard.at(0).size() + << standard.at(0).mid(0, standard.at(0).size() - 5) << 14 << 19 << 14 << false << false; @@ -4872,7 +4872,7 @@ void tst_qquicktextinput::remove_data() << standard.at(0) << QString() << 0 << 0 - << 23 << standard.at(0).length() + 8 + << 23 << standard.at(0).size() + 8 << standard.at(0).mid(0, 23) << 0 << 0 << 0 << false << false; @@ -4881,7 +4881,7 @@ void tst_qquicktextinput::remove_data() << standard.at(0) << QString() << 0 << 0 - << -9 << standard.at(0).length() + 4 + << -9 << standard.at(0).size() + 4 << QString() << 0 << 0 << 0 << false << false; @@ -5039,7 +5039,7 @@ void tst_qquicktextinput::remove() textInput->remove(removeStart, removeEnd); QCOMPARE(textInput->text(), expectedText); - QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.length() : inputMask.length()); + QCOMPARE(textInput->length(), inputMask.isEmpty() ? expectedText.size() : inputMask.size()); if (selectionStart > selectionEnd) // qSwap(selectionStart, selectionEnd); @@ -5048,13 +5048,13 @@ void tst_qquicktextinput::remove() QCOMPARE(textInput->selectionEnd(), expectedSelectionEnd); QCOMPARE(textInput->cursorPosition(), expectedCursorPosition); - QCOMPARE(selectionSpy.count() > 0, selectionChanged); - QCOMPARE(selectionStartSpy.count() > 0, selectionStart != expectedSelectionStart); - QCOMPARE(selectionEndSpy.count() > 0, selectionEnd != expectedSelectionEnd); - QCOMPARE(textSpy.count() > 0, text != expectedText); + QCOMPARE(selectionSpy.size() > 0, selectionChanged); + QCOMPARE(selectionStartSpy.size() > 0, selectionStart != expectedSelectionStart); + QCOMPARE(selectionEndSpy.size() > 0, selectionEnd != expectedSelectionEnd); + QCOMPARE(textSpy.size() > 0, text != expectedText); if (cursorPositionChanged) // - QVERIFY(cursorPositionSpy.count() > 0); + QVERIFY(cursorPositionSpy.size() > 0); } #if QT_CONFIG(shortcut) @@ -5414,11 +5414,11 @@ void tst_qquicktextinput::undo() // QTest::keyClick(testWidget, Qt::Key_End, Qt::ShiftModifier); } - for (int j = 0; j < insertString.at(i).length(); j++) + for (int j = 0; j < insertString.at(i).size(); j++) QTest::keyClick(&window, insertString.at(i).at(j).toLatin1()); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // STEP 2: Next call undo several times and see if we can restore to the previous state for (i = 0; i < expectedString.size() - 1; ++i) { @@ -5430,7 +5430,7 @@ void tst_qquicktextinput::undo() // STEP 3: Verify that we have undone everything QVERIFY(textInput->text().isEmpty()); QVERIFY(!textInput->canUndo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_qquicktextinput::redo_data() @@ -5491,13 +5491,13 @@ void tst_qquicktextinput::redo() for (i = 0; i < insertString.size(); ++i) { if (insertIndex[i] > -1) textInput->setCursorPosition(insertIndex[i]); - for (int j = 0; j < insertString.at(i).length(); j++) + for (int j = 0; j < insertString.at(i).size(); j++) QTest::keyClick(&window, insertString.at(i).at(j).toLatin1()); QVERIFY(textInput->canUndo()); QVERIFY(!textInput->canRedo()); } - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // undo everything while (!textInput->text().isEmpty()) { @@ -5506,7 +5506,7 @@ void tst_qquicktextinput::redo() QVERIFY(textInput->canRedo()); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); for (i = 0; i < expectedString.size(); ++i) { QVERIFY(textInput->canRedo()); @@ -5515,7 +5515,7 @@ void tst_qquicktextinput::redo() QVERIFY(textInput->canUndo()); } QVERIFY(!textInput->canRedo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } #if QT_CONFIG(shortcut) @@ -5849,12 +5849,12 @@ void tst_qquicktextinput::clear() textInput->clear(); QVERIFY(textInput->text().isEmpty()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // checks that clears can be undone textInput->undo(); QVERIFY(!textInput->canUndo()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(textInput->text(), QString("I am Legend")); textInput->setCursorPosition(4); @@ -5868,12 +5868,12 @@ void tst_qquicktextinput::clear() QVERIFY(textInput->text().isEmpty()); QVERIFY2(textInput->preeditText().isEmpty(), "Pre-edit text must be empty after clear"); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); // checks that clears can be undone textInput->undo(); QVERIFY(!textInput->canUndo()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); QCOMPARE(textInput->text(), QString("I am Legend")); QVERIFY2(textInput->preeditText().isEmpty(), "Pre-edit text must be empty after undo"); } @@ -5890,7 +5890,7 @@ void tst_qquicktextinput::backspaceSurrogatePairs() QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); QVERIFY(textInput != nullptr); textInput->setText(text); - textInput->setCursorPosition(text.length()); + textInput->setCursorPosition(text.size()); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -5899,7 +5899,7 @@ void tst_qquicktextinput::backspaceSurrogatePairs() QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(QGuiApplication::focusWindow(), &window); - for (int i = text.length(); i >= 0; i -= 2) { + for (int i = text.size(); i >= 0; i -= 2) { QCOMPARE(textInput->text(), text.mid(0, i)); QTest::keyClick(&window, Qt::Key_Backspace, Qt::NoModifier); } @@ -5908,7 +5908,7 @@ void tst_qquicktextinput::backspaceSurrogatePairs() textInput->setText(text); textInput->setCursorPosition(0); - for (int i = 0; i < text.length(); i += 2) { + for (int i = 0; i < text.size(); i += 2) { QCOMPARE(textInput->text(), text.mid(i)); QTest::keyClick(&window, Qt::Key_Delete, Qt::NoModifier); } @@ -6397,7 +6397,7 @@ void tst_qquicktextinput::setInputMask() unescapedMask.replace(QLatin1String("\\\\"), QLatin1String("\\")); // simple unescape QSignalSpy spy(textInput, SIGNAL(inputMaskChanged(const QString &))); textInput->setInputMask(unescapedMask); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // then either insert using insert() or keyboard if (insert_text) { @@ -6411,7 +6411,7 @@ void tst_qquicktextinput::setInputMask() QVERIFY(textInput->hasActiveFocus()); QTest::keyClick(&window, Qt::Key_Home); - for (int i = 0; i < input.length(); i++) + for (int i = 0; i < input.size(); i++) QTest::keyClick(&window, input.at(i).toLatin1()); } @@ -6891,7 +6891,7 @@ void tst_qquicktextinput::ensureVisible() input->ensureVisible(input->length()); - QCOMPARE(cursorSpy.count(), 1); + QCOMPARE(cursorSpy.size(), 1); QCOMPARE(input->boundingRect().x(), input->width() - line.naturalTextWidth()); QCOMPARE(input->boundingRect().y(), qreal(0)); @@ -7167,13 +7167,13 @@ void tst_qquicktextinput::touchscreenSetsFocusAndMovesCursor() QQuickTouchUtils::flush(&window); QCOMPARE(qApp->focusObject(), bottom); // text cursor is at the end by default, on press - const auto len = bottom->text().length(); + const auto len = bottom->text().size(); QCOMPARE(bottom->cursorPosition(), len); // so typing a character appends it QVERIFY(!bottom->text().endsWith('q')); QTest::keyClick(&window, Qt::Key_Q); QVERIFY(bottom->text().endsWith('q')); - QCOMPARE(bottom->text().length(), len + 1); + QCOMPARE(bottom->text().size(), len + 1); QTest::touchEvent(&window, touchscreen.data()).release(0, QPoint(x1,y), &window); QQuickTouchUtils::flush(&window); // the cursor gets moved on release, as long as TextInput's grab wasn't stolen (e.g. by Flickable) diff --git a/tests/auto/quick/qquicktreeview/testmodel.cpp b/tests/auto/quick/qquicktreeview/testmodel.cpp index 49bbc5a458..9962234a06 100644 --- a/tests/auto/quick/qquicktreeview/testmodel.cpp +++ b/tests/auto/quick/qquicktreeview/testmodel.cpp @@ -60,7 +60,7 @@ int TestModel::rowCount(const QModelIndex &parent) const { if (!parent.isValid()) return 1; // root of the tree - return treeItem(parent)->m_childItems.count(); + return treeItem(parent)->m_childItems.size(); } int TestModel::columnCount(const QModelIndex &) const diff --git a/tests/auto/quick/qquicktreeview/tst_qquicktreeview.cpp b/tests/auto/quick/qquicktreeview/tst_qquicktreeview.cpp index 776e7c4968..06c95888bd 100644 --- a/tests/auto/quick/qquicktreeview/tst_qquicktreeview.cpp +++ b/tests/auto/quick/qquicktreeview/tst_qquicktreeview.cpp @@ -140,7 +140,7 @@ void tst_qquicktreeview::expandAndCollapseRoot() // Expand the root treeView->expand(0); - QCOMPARE(expandedSpy.count(), 1); + QCOMPARE(expandedSpy.size(), 1); auto signalArgs = expandedSpy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == 0); QVERIFY(signalArgs.at(1).toInt() == 1); @@ -190,7 +190,7 @@ void tst_qquicktreeview::expandAndCollapseChildren() treeView->expand(nodeToExpand); - QCOMPARE(expandedSpy.count(), 1); + QCOMPARE(expandedSpy.size(), 1); auto signalArgs = expandedSpy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == nodeToExpand); QVERIFY(signalArgs.at(1).toInt() == 1); @@ -314,7 +314,7 @@ void tst_qquicktreeview::emptyModel() treeView->setModel(QVariant()); WAIT_UNTIL_POLISHED; - QCOMPARE(treeViewPrivate->loadedItems.count(), 0); + QCOMPARE(treeViewPrivate->loadedItems.size(), 0); QCOMPARE(treeView->rows(), 0); QCOMPARE(treeView->columns(), 0); @@ -435,10 +435,10 @@ void tst_qquicktreeview::expandRecursivelyRoot() treeView->expandRecursively(rowToExpand, depth); if (depth == 0) { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } else { - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == rowToExpand); QVERIFY(signalArgs.at(1).toInt() == depth); @@ -491,7 +491,7 @@ void tst_qquicktreeview::expandRecursivelyChild() treeView->expand(0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == 0); QVERIFY(signalArgs.at(1).toInt() == 1); @@ -499,9 +499,9 @@ void tst_qquicktreeview::expandRecursivelyChild() treeView->expandRecursively(rowToExpand, depth); if (depth == 0) { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } else { - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == rowToExpand); QVERIFY(signalArgs.at(1).toInt() == depth); @@ -542,7 +542,7 @@ void tst_qquicktreeview::expandRecursivelyWholeTree() QSignalSpy spy(treeView, SIGNAL(expanded(int, int))); treeView->expandRecursively(-1, -1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == -1); QVERIFY(signalArgs.at(1).toInt() == -1); @@ -576,7 +576,7 @@ void tst_qquicktreeview::collapseRecursivelyRoot() // Collapse the whole tree again. This time, only the root should end up visible treeView->collapseRecursively(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == -1); QVERIFY(signalArgs.at(1).toBool() == true); @@ -627,7 +627,7 @@ void tst_qquicktreeview::collapseRecursivelyChild() QCOMPARE(expectedLabel, QStringLiteral("3, 0")); treeView->collapseRecursively(rowToCollapse); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == rowToCollapse); QVERIFY(signalArgs.at(1).toBool() == true); @@ -669,7 +669,7 @@ void tst_qquicktreeview::collapseRecursivelyWholeTree() treeView->expandRecursively(); treeView->collapseRecursively(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == -1); QVERIFY(signalArgs.at(1).toBool() == true); @@ -705,7 +705,7 @@ void tst_qquicktreeview::expandToIndex() QVERIFY(treeView->isExpanded(treeView->rowAtIndex(child1))); QVERIFY(treeView->isExpanded(treeView->rowAtIndex(child2))); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); auto signalArgs = spy.takeFirst(); QVERIFY(signalArgs.at(0).toInt() == 0); QVERIFY(signalArgs.at(1).toInt() == 3); @@ -859,7 +859,7 @@ void tst_qquicktreeview::selectionBehaviorCells() } const int expectedCount = (x2 - x1 + 1) * (y2 - y1 + 1); - const int actualCount = selectionModel->selectedIndexes().count(); + const int actualCount = selectionModel->selectedIndexes().size(); QCOMPARE(actualCount, expectedCount); // Wrap the selection @@ -872,7 +872,7 @@ void tst_qquicktreeview::selectionBehaviorCells() } } - const int actualCountAfterWrap = selectionModel->selectedIndexes().count(); + const int actualCountAfterWrap = selectionModel->selectedIndexes().size(); QCOMPARE(actualCountAfterWrap, expectedCount); treeViewPrivate->clearSelection(); @@ -901,7 +901,7 @@ void tst_qquicktreeview::selectionBehaviorRows() QCOMPARE(selectionModel->hasSelection(), true); const int expectedCount = treeView->columns() * 3; // all columns * three rows - int actualCount = selectionModel->selectedIndexes().count(); + int actualCount = selectionModel->selectedIndexes().size(); QCOMPARE(actualCount, expectedCount); for (int x = 0; x < treeView->columns(); ++x) { @@ -920,7 +920,7 @@ void tst_qquicktreeview::selectionBehaviorRows() QCOMPARE(selectionModel->hasSelection(), true); - actualCount = selectionModel->selectedIndexes().count(); + actualCount = selectionModel->selectedIndexes().size(); QCOMPARE(actualCount, expectedCount); for (int x = 0; x < treeView->columns(); ++x) { @@ -952,7 +952,7 @@ void tst_qquicktreeview::selectionBehaviorColumns() QCOMPARE(selectionModel->hasSelection(), true); const int expectedCount = treeView->rows() * 3; // all rows * three columns - int actualCount = selectionModel->selectedIndexes().count(); + int actualCount = selectionModel->selectedIndexes().size(); QCOMPARE(actualCount, expectedCount); for (int x = 0; x < 3; ++x) { @@ -971,7 +971,7 @@ void tst_qquicktreeview::selectionBehaviorColumns() QCOMPARE(selectionModel->hasSelection(), true); - actualCount = selectionModel->selectedIndexes().count(); + actualCount = selectionModel->selectedIndexes().size(); QCOMPARE(actualCount, expectedCount); for (int x = 0; x < 3; ++x) { diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index cb7cdb1c5d..e226cfdca7 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -123,7 +123,7 @@ void tst_QQuickView::resizemodeitem() view->resize(QSize(200,300)); QTRY_COMPARE(item->width(), 200.0); - for (int i = 0; i < sizeListener.count(); ++i) { + for (int i = 0; i < sizeListener.size(); ++i) { // Check that we have the correct geometry on all signals QCOMPARE(sizeListener.at(i), view->size()); } @@ -171,7 +171,7 @@ void tst_QQuickView::errors() QQmlTestMessageHandler messageHandler; view.setSource(testFileUrl("error1.qml")); QCOMPARE(view.status(), QQuickView::Error); - QCOMPARE(view.errors().count(), 1); + QCOMPARE(view.errors().size(), 1); } { @@ -179,7 +179,7 @@ void tst_QQuickView::errors() QQmlTestMessageHandler messageHandler; view.setSource(testFileUrl("error2.qml")); QCOMPARE(view.status(), QQuickView::Error); - QCOMPARE(view.errors().count(), 1); + QCOMPARE(view.errors().size(), 1); view.show(); } } diff --git a/tests/auto/quick/qquickview_extra/tst_qquickview_extra.cpp b/tests/auto/quick/qquickview_extra/tst_qquickview_extra.cpp index 114b97779a..0cd4b69e00 100644 --- a/tests/auto/quick/qquickview_extra/tst_qquickview_extra.cpp +++ b/tests/auto/quick/qquickview_extra/tst_qquickview_extra.cpp @@ -44,7 +44,7 @@ void tst_QQuickViewExtra::qtbug_87228() // for the sake of this test, any child would be suitable, so pick first deletionSpy.reset(new QSignalSpy(children[0], SIGNAL(destroyed(QObject *)))); } - QCOMPARE(deletionSpy->count(), 1); + QCOMPARE(deletionSpy->size(), 1); } QTEST_APPLESS_MAIN(tst_QQuickViewExtra) diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index 2a567cb307..dd845b37d5 100644 --- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -61,7 +61,7 @@ public: Branch(Branch *parent = nullptr) : parent(parent) {} ~Branch() { foreach (const Node &child, children) delete child.branch; } int indexOf(Branch *branch) const { - for (int i = 0; i < children.count(); ++i) { + for (int i = 0; i < children.size(); ++i) { if (children.at(i).branch == branch) return i; } @@ -109,7 +109,7 @@ public: if (row < 0 || column != 0) return QModelIndex(); Branch * const branch = branchForIndex(parent); - return branch && row < branch->children.count() + return branch && row < branch->children.size() ? createIndex(row, column, branch) : QModelIndex(); } @@ -123,7 +123,7 @@ public: int rowCount(const QModelIndex &parent) const override { Branch * const branch = branchForIndex(parent); - return branch ? branch->children.count() : 0; + return branch ? branch->children.size() : 0; } int columnCount(const QModelIndex &parent) const override { @@ -138,9 +138,9 @@ public: } void insert(const QModelIndex &parent, int index, const QStringList &data) { - beginInsertRows(parent, index, index + data.count() - 1); + beginInsertRows(parent, index, index + data.size() - 1); Branch * const branch = createBranchForIndex(parent); - for (int i = 0; i < data.count(); ++i) + for (int i = 0; i < data.size(); ++i) branch->children.insert(index + i, Node(data.at(i))); endInsertRows(); } @@ -188,14 +188,14 @@ public: } void setList(const QStringList &l) { - if (trunk.children.count() > 0) { - beginRemoveRows(QModelIndex(), 0, trunk.children.count() - 1); + if (trunk.children.size() > 0) { + beginRemoveRows(QModelIndex(), 0, trunk.children.size() - 1); foreach (const Node &child, trunk.children) delete child.branch; trunk.children.clear(); endRemoveRows(); } - if (l.count() > 0) { - beginInsertRows(QModelIndex(), 0, l.count() -1); + if (l.size() > 0) { + beginInsertRows(QModelIndex(), 0, l.size() -1); foreach (const QString &string, l) trunk.children.append(Node(string)); endInsertRows(); @@ -1040,14 +1040,14 @@ void tst_qquickvisualdatamodel::qaimRowsMoved() QSignalSpy spy(obj, SIGNAL(modelUpdated(QQmlChangeSet,bool))); model.emitMove(sourceFirst, sourceLast, destinationChild); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); - QCOMPARE(spy[0].count(), 2); + QCOMPARE(spy[0].size(), 2); QQmlChangeSet changeSet = spy[0][0].value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 1); + QCOMPARE(changeSet.removes().size(), 1); QCOMPARE(changeSet.removes().at(0).index, expectFrom); QCOMPARE(changeSet.removes().at(0).count, expectCount); - QCOMPARE(changeSet.inserts().count(), 1); + QCOMPARE(changeSet.inserts().size(), 1); QCOMPARE(changeSet.inserts().at(0).index, expectTo); QCOMPARE(changeSet.inserts().at(0).count, expectCount); QCOMPARE(changeSet.removes().at(0).moveId, changeSet.inserts().at(0).moveId); @@ -1109,33 +1109,33 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved() // Move items from the current root index to a sub tree. model.move(QModelIndex(), 1, model.index(0, 0), 3, 2); QCOMPARE(vdm->count(), 2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 1); + QCOMPARE(changeSet.removes().size(), 1); QCOMPARE(changeSet.removes().at(0).index, 1); QCOMPARE(changeSet.removes().at(0).count, 2); - QCOMPARE(changeSet.inserts().count(), 0); + QCOMPARE(changeSet.inserts().size(), 0); // Move items from a sub tree to the current root index. model.move(model.index(0, 0), 4, QModelIndex(), 2, 1); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 0); - QCOMPARE(changeSet.inserts().count(), 1); + QCOMPARE(changeSet.removes().size(), 0); + QCOMPARE(changeSet.inserts().size(), 1); QCOMPARE(changeSet.inserts().at(0).index, 2); QCOMPARE(changeSet.inserts().at(0).count, 1); vdm->setRootIndex(QVariant::fromValue(model.index(2, 0))); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(2, 0)); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); changeSet = spy.at(2).at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 1); + QCOMPARE(changeSet.removes().size(), 1); QCOMPARE(changeSet.removes().at(0).index, 0); QCOMPARE(changeSet.removes().at(0).count, 3); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.inserts().count(), 1); + QCOMPARE(changeSet.inserts().size(), 1); QCOMPARE(changeSet.inserts().at(0).index, 0); QCOMPARE(changeSet.inserts().at(0).count, 3); @@ -1143,41 +1143,41 @@ void tst_qquickvisualdatamodel::subtreeRowsMoved() model.move(QModelIndex(), 2, QModelIndex(), 0, 1); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(0, 0)); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); // Move the current root index, changing its parent. model.move(QModelIndex(), 0, model.index(1, 0), 0, 1); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(0, 0, model.index(0, 0))); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); model.insert(model.index(0, 0), 0, QStringList() << "new1" << "new2"); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(2, 0, model.index(0, 0))); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); model.remove(model.index(0, 0), 1, 1); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), model.index(1, 0, model.index(0, 0))); QCOMPARE(vdm->count(), 3); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); model.remove(model.index(0, 0), 1, 1); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), QModelIndex()); QCOMPARE(vdm->count(), 0); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 1); + QCOMPARE(changeSet.removes().size(), 1); QCOMPARE(changeSet.removes().at(0).index, 0); QCOMPARE(changeSet.removes().at(0).count, 3); - QCOMPARE(changeSet.inserts().count(), 0); + QCOMPARE(changeSet.inserts().size(), 0); vdm->setRootIndex(QVariant::fromValue(QModelIndex())); QCOMPARE(vdm->rootIndex().value<QModelIndex>(), QModelIndex()); QCOMPARE(vdm->count(), 2); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); changeSet = spy.last().at(0).value<QQmlChangeSet>(); - QCOMPARE(changeSet.removes().count(), 0); - QCOMPARE(changeSet.inserts().count(), 1); + QCOMPARE(changeSet.removes().size(), 0); + QCOMPARE(changeSet.inserts().size(), 1); QCOMPARE(changeSet.inserts().at(0).index, 0); QCOMPARE(changeSet.inserts().at(0).count, 2); } @@ -1209,44 +1209,44 @@ void tst_qquickvisualdatamodel::watchedRoles() QCOMPARE(vdm->count(), 30); emit model.dataChanged(model.index(0), model.index(4)); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); emit model.dataChanged(model.index(0), model.index(4), QVector<int>() << QaimModel::Name); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); emit model.dataChanged(model.index(0), model.index(4), QVector<int>() << QaimModel::Number); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); vdm->setWatchedRoles(QList<QByteArray>() << "name" << "dummy"); emit model.dataChanged(model.index(0), model.index(4)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 0); QCOMPARE(changeSet.changes().at(0).count, 5); emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 1); QCOMPARE(changeSet.changes().at(0).count, 6); emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); vdm->setWatchedRoles(QList<QByteArray>() << "number" << "dummy"); emit model.dataChanged(model.index(0), model.index(4)); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 0); QCOMPARE(changeSet.changes().at(0).count, 5); emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 8); QCOMPARE(changeSet.changes().at(0).count, 1); @@ -1254,19 +1254,19 @@ void tst_qquickvisualdatamodel::watchedRoles() vdm->setWatchedRoles(QList<QByteArray>() << "number" << "name"); emit model.dataChanged(model.index(0), model.index(4)); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 0); QCOMPARE(changeSet.changes().at(0).count, 5); emit model.dataChanged(model.index(1), model.index(6), QVector<int>() << QaimModel::Name); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 1); QCOMPARE(changeSet.changes().at(0).count, 6); emit model.dataChanged(model.index(8), model.index(8), QVector<int>() << QaimModel::Number); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); changeSet = spy.last().at(0).value<QQmlChangeSet>(); QCOMPARE(changeSet.changes().at(0).index, 8); QCOMPARE(changeSet.changes().at(0).count, 1); @@ -2427,24 +2427,24 @@ void tst_qquickvisualdatamodel::incompleteModel() QSignalSpy persistedItemsSpy(model->items(), SIGNAL(countChanged())); evaluate<void>(model, "items.removeGroups(0, items.count, \"items\")"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); evaluate<void>(model, "items.setGroups(0, items.count, \"persistedItems\")"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); evaluate<void>(model, "items.addGroups(0, items.count, \"persistedItems\")"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); evaluate<void>(model, "items.remove(0, items.count)"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); evaluate<void>(model, "items.insert([ \"color\": \"blue\" ])"); - QCOMPARE(itemsSpy.count(), 0); - QCOMPARE(persistedItemsSpy.count(), 0); + QCOMPARE(itemsSpy.size(), 0); + QCOMPARE(persistedItemsSpy.size(), 0); QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*get: index out of range")); QVERIFY(evaluate<bool>(model, "items.get(0) === undefined")); @@ -3070,7 +3070,7 @@ void tst_qquickvisualdatamodel::insert() QCOMPARE(evaluate<int>(visualModel, "visibleItems.count"), visible ? visualCount : modelCount); QCOMPARE(evaluate<int>(visualModel, "selectedItems.count"), selected ? 1 : 0); - QCOMPARE(propertyData.count(), visualCount); + QCOMPARE(propertyData.size(), visualCount); for (int i = 0; i < visualCount; ++i) { int modelIndex = i; if (modelIndex > index) @@ -3538,7 +3538,7 @@ void tst_qquickvisualdatamodel::resolve() QCOMPARE(evaluate<int>(visualModel, "visibleItems.count"), visible ? visualCount : modelCount); QCOMPARE(evaluate<int>(visualModel, "selectedItems.count"), selected ? 1 : 0); - QCOMPARE(propertyData.count(), visualCount); + QCOMPARE(propertyData.size(), visualCount); for (int i = 0; i < visualCount; ++i) { int modelIndex = i; @@ -3939,7 +3939,7 @@ void tst_qquickvisualdatamodel::invalidAttachment() QScopedPointer<QObject> object(component.create()); QVERIFY(object); - QCOMPARE(component.errors().count(), 0); + QCOMPARE(component.errors().size(), 0); QVariant property = object->property("invalidVdm"); QCOMPARE(property.userType(), qMetaTypeId<QQmlDelegateModel *>()); @@ -4268,7 +4268,7 @@ public: static qsizetype listLength(QQmlListProperty<QObject> *property) { auto objectsProvider = qobject_cast<ObjectsProvider*>(property->object); - return objectsProvider ? objectsProvider->m_objects.length() : 0; + return objectsProvider ? objectsProvider->m_objects.size() : 0; } static QObject* listAt(QQmlListProperty<QObject> *property, qsizetype index) diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 9b9ca12d71..ec98013c8b 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -54,7 +54,7 @@ QDebug operator<<(QDebug dbg, const struct Event &event) { if (event.points.isEmpty()) dbg << " @ " << event.mousePos << " global " << event.mousePosGlobal; else - dbg << ", " << event.points.count() << " touchpoints: " << event.points; + dbg << ", " << event.points.size() << " touchpoints: " << event.points; dbg << ')'; return dbg; } @@ -796,7 +796,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() qCDebug(lcTests) << "expected filtered events: actual TouchBegin and replayed TouchBegin" << filteredEventList; QTRY_COMPARE(eventItem1->eventList.size(), 1); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress); - QCOMPARE(filteredEventList.count(), 2); // actual touch begin and replayed touch begin + QCOMPARE(filteredEventList.size(), 2); // actual touch begin and replayed touch begin } if (!releaseBeforeDelayIsOver) { @@ -811,7 +811,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() if (scrollBeforeDelayIsOver) { QCOMPARE(eventItem1->eventList.size(), 0); qCDebug(lcTests) << "expected filtered events: 1 TouchBegin and 3 TouchUpdate" << filteredEventList; - QCOMPARE(filteredEventList.count(), 4); + QCOMPARE(filteredEventList.size(), 4); } else { qCDebug(lcTests) << "expected delivered events: press(mouse), move(mouse), move(mouse), ungrab(mouse)" << eventItem1->eventList; QCOMPARE(eventItem1->eventList.size(), 4); @@ -819,7 +819,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseMove); QCOMPARE(eventItem1->eventList.last().type, QEvent::UngrabMouse); qCDebug(lcTests) << "expected filtered events: 2 TouchBegin and 3 TouchUpdate" << filteredEventList; - QCOMPARE(filteredEventList.count(), 5); + QCOMPARE(filteredEventList.size(), 5); } // flickable should have the touchpoint grab: it no longer relies on synth-mouse @@ -840,17 +840,17 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonRelease); QCOMPARE(eventItem1->eventList.last().type, QEvent::UngrabMouse); // QQuickWindow filters the delayed press and release - QCOMPARE(filteredEventList.count(), 4); - QCOMPARE(filteredEventList.at(filteredEventList.count() - 2).type, QEvent::TouchBegin); + QCOMPARE(filteredEventList.size(), 4); + QCOMPARE(filteredEventList.at(filteredEventList.size() - 2).type, QEvent::TouchBegin); QCOMPARE(filteredEventList.last().type, QEvent::TouchEnd); } else { // QQuickWindow filters the delayed press if there was one if (scrollBeforeDelayIsOver) { qCDebug(lcTests) << "expected filtered events: 1 TouchBegin, 3 TouchUpdate, 1 TouchEnd" << filteredEventList; - QCOMPARE(filteredEventList.count(), 5); + QCOMPARE(filteredEventList.size(), 5); } else { qCDebug(lcTests) << "expected filtered events: 2 TouchBegin, 3 TouchUpdate, 1 TouchEnd" << filteredEventList; - QCOMPARE(filteredEventList.count(), 6); + QCOMPARE(filteredEventList.size(), 6); QCOMPARE(filteredEventList.at(0).type, QEvent::TouchBegin); QCOMPARE(filteredEventList.last().type, QEvent::TouchEnd); } @@ -965,7 +965,7 @@ void tst_TouchMouse::buttonOnTouch() touchSeq.press(0, p1, &window).press(1, p2, &window).commit(); QQuickTouchUtils::flush(&window); QCOMPARE(button1->scale(), 1); - QCOMPARE(eventItem1->eventList.count(), 1); + QCOMPARE(eventItem1->eventList.size(), 1); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress); p1 -= QPoint(10, 0); @@ -1277,16 +1277,16 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne() QTest::touchEvent(&window, device).release(0, p1, &window); QQuickTouchUtils::flush(&window); - QCOMPARE(bottomClickedSpy.count(), 1); - QCOMPARE(bottomDoubleClickedSpy.count(), 0); + QCOMPARE(bottomClickedSpy.size(), 1); + QCOMPARE(bottomDoubleClickedSpy.size(), 0); QTest::touchEvent(&window, device).press(0, p1, &window); QQuickTouchUtils::flush(&window); QTest::touchEvent(&window, device).release(0, p1, &window); QQuickTouchUtils::flush(&window); - QCOMPARE(bottomClickedSpy.count(), 1); - QCOMPARE(bottomDoubleClickedSpy.count(), 1); + QCOMPARE(bottomClickedSpy.size(), 1); + QCOMPARE(bottomDoubleClickedSpy.size(), 1); } /* @@ -1461,21 +1461,21 @@ void tst_TouchMouse::hoverEnabled() // QTBUG-40856 // ------------------------- Mouse move to mouseArea1 QTest::mouseMove(&window, p1); - QVERIFY(enterSpy1.count() == 1); + QVERIFY(enterSpy1.size() == 1); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); // ------------------------- Touch click on mouseArea1 QTest::touchEvent(&window, device).press(0, p1, &window); - QCOMPARE(enterSpy1.count(), 1); - QCOMPARE(enterSpy2.count(), 0); + QCOMPARE(enterSpy1.size(), 1); + QCOMPARE(enterSpy2.size(), 0); QVERIFY(mouseArea1->pressed()); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); QTest::touchEvent(&window, device).release(0, p1, &window); - QVERIFY(clickSpy1.count() == 1); + QVERIFY(clickSpy1.size() == 1); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); @@ -1485,28 +1485,28 @@ void tst_TouchMouse::hoverEnabled() // QTBUG-40856 QVERIFY(mouseArea1->hovered()); QVERIFY(mouseArea2->hovered()); QVERIFY(mouseArea2->pressed()); - QCOMPARE(enterSpy1.count(), 1); - QCOMPARE(enterSpy2.count(), 1); + QCOMPARE(enterSpy1.size(), 1); + QCOMPARE(enterSpy2.size(), 1); QTest::touchEvent(&window, device).release(0, p2, &window); - QVERIFY(clickSpy2.count() == 1); + QVERIFY(clickSpy2.size() == 1); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); - QCOMPARE(exitSpy1.count(), 0); - QCOMPARE(exitSpy2.count(), 1); + QCOMPARE(exitSpy1.size(), 0); + QCOMPARE(exitSpy2.size(), 1); // ------------------------- Another touch click on mouseArea1 QTest::touchEvent(&window, device).press(0, p1, &window); - QCOMPARE(enterSpy1.count(), 1); - QCOMPARE(enterSpy2.count(), 1); + QCOMPARE(enterSpy1.size(), 1); + QCOMPARE(enterSpy2.size(), 1); QVERIFY(mouseArea1->pressed()); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); QTest::touchEvent(&window, device).release(0, p1, &window); - QCOMPARE(clickSpy1.count(), 2); + QCOMPARE(clickSpy1.size(), 2); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea1->pressed()); QVERIFY(!mouseArea2->hovered()); @@ -1557,20 +1557,20 @@ void tst_TouchMouse::touchCancelWillCancelMousePress() // Begin a new touch, that gets converted to a mouse press QTest::touchEvent(&window, device).press(0, p1); - QCOMPARE(eventItem->eventList.count(), 1); + QCOMPARE(eventItem->eventList.size(), 1); QCOMPARE(eventItem->eventList.at(0).type, QEvent::MouseButtonPress); // Cancel it... QTouchEvent cancelEvent(QEvent::TouchCancel, device); QCoreApplication::sendEvent(&window, &cancelEvent); - QCOMPARE(eventItem->eventList.count(), 3); + QCOMPARE(eventItem->eventList.size(), 3); QCOMPARE(eventItem->eventList.at(1).type, QEvent::TouchCancel); QCOMPARE(eventItem->eventList.at(2).type, QEvent::UngrabMouse); // Begin a second touch. Since the last one was cancelled, this // should end up as a new mouse press on the target item. QTest::touchEvent(&window, device).press(0, p1); - QVERIFY(eventItem->eventList.count() >= 5); + QVERIFY(eventItem->eventList.size() >= 5); QCOMPARE(eventItem->eventList.at(3).type, QEvent::MouseButtonPress); QTest::touchEvent(&window, device).release(0, p1); // clean up potential state diff --git a/tests/auto/quickcontrols2/focus/tst_focus.cpp b/tests/auto/quickcontrols2/focus/tst_focus.cpp index fc38865921..98b2f3bd24 100644 --- a/tests/auto/quickcontrols2/focus/tst_focus.cpp +++ b/tests/auto/quickcontrols2/focus/tst_focus.cpp @@ -421,7 +421,7 @@ void tst_focus::visualFocus() QQuickItem *column = view.rootObject(); QVERIFY(column); - QCOMPARE(column->childItems().count(), 2); + QCOMPARE(column->childItems().size(), 2); QQuickControl *button = qobject_cast<QQuickControl *>(column->childItems().first()); QVERIFY(button); diff --git a/tests/auto/quickcontrols2/pointerhandlers/tst_pointerhandlers.cpp b/tests/auto/quickcontrols2/pointerhandlers/tst_pointerhandlers.cpp index ffb57718e3..aa83175252 100644 --- a/tests/auto/quickcontrols2/pointerhandlers/tst_pointerhandlers.cpp +++ b/tests/auto/quickcontrols2/pointerhandlers/tst_pointerhandlers.cpp @@ -199,8 +199,8 @@ void tst_pointerhandlers::buttonTapHandler() // QTBUG-105609 case QPointingDevice::DeviceType::Mouse: // click it QTest::mouseClick(&window, mouseButton, Qt::NoModifier, pos); - QTRY_COMPARE(clickedSpy.count(), 1); // perhaps Button should not react to right-click, but it does - QCOMPARE(tappedSpy.count(), 1); + QTRY_COMPARE(clickedSpy.size(), 1); // perhaps Button should not react to right-click, but it does + QCOMPARE(tappedSpy.size(), 1); break; case QPointingDevice::DeviceType::TouchScreen: { @@ -209,8 +209,8 @@ void tst_pointerhandlers::buttonTapHandler() // QTBUG-105609 touch.press(0, pos, &window).commit(); QTRY_COMPARE(target->property("pressed").toBool(), true); touch.release(0, pos, &window).commit(); - QTRY_COMPARE(clickedSpy.count(), 1); - QCOMPARE(tappedSpy.count(), 1); + QTRY_COMPARE(clickedSpy.size(), 1); + QCOMPARE(tappedSpy.size(), 1); break; } default: @@ -247,7 +247,7 @@ void tst_pointerhandlers::buttonDragHandler() // QTBUG-105610 case QPointingDevice::DeviceType::Mouse: // click it QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, dragPos); - QTRY_COMPARE(clickedSpy.count(), 1); + QTRY_COMPARE(clickedSpy.size(), 1); // drag it QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, dragPos); @@ -266,7 +266,7 @@ void tst_pointerhandlers::buttonDragHandler() // QTBUG-105610 // tap it touch.press(0, dragPos, &window).commit(); touch.release(0, dragPos, &window).commit(); - QTRY_COMPARE(clickedSpy.count(), 1); + QTRY_COMPARE(clickedSpy.size(), 1); // drag it touch.press(0, dragPos, &window).commit(); @@ -286,7 +286,7 @@ void tst_pointerhandlers::buttonDragHandler() // QTBUG-105610 // click it again QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, dragPos); - QTRY_COMPARE(clickedSpy.count(), 2); + QTRY_COMPARE(clickedSpy.size(), 2); } QTEST_MAIN(tst_pointerhandlers) diff --git a/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp b/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp index 170e61cafa..98013a1d0c 100644 --- a/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp +++ b/tests/auto/quickcontrols2/pressandhold/tst_pressandhold.cpp @@ -79,16 +79,16 @@ void tst_PressAndHold::pressAndHold() // pressAndHold() emitted QGuiApplication::sendEvent(control.data(), &press); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QGuiApplication::sendEvent(control.data(), &release); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); // pressAndHold() canceled by release QGuiApplication::sendEvent(control.data(), &press); QGuiApplication::processEvents(); QGuiApplication::sendEvent(control.data(), &release); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // pressAndHold() canceled by move QGuiApplication::sendEvent(control.data(), &press); @@ -97,12 +97,12 @@ void tst_PressAndHold::pressAndHold() // by the time the second control emits pressAndHold(), we can reliably // assume that the first control would have emitted pressAndHold() if it // wasn't canceled as appropriate by the move event above - QTRY_COMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QTRY_COMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); QGuiApplication::sendEvent(control.data(), &release); QGuiApplication::sendEvent(waitControl.data(), &release); - QCOMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QCOMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); waitSpy.clear(); // pressAndHold() canceled by 2nd press @@ -112,12 +112,12 @@ void tst_PressAndHold::pressAndHold() // by the time the second control emits pressAndHold(), we can reliably // assume that the first control would have emitted pressAndHold() if it // wasn't canceled as appropriate by the 2nd press event above - QTRY_COMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QTRY_COMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); QGuiApplication::sendEvent(control.data(), &release); QGuiApplication::sendEvent(waitControl.data(), &release); - QCOMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QCOMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); waitSpy.clear(); } @@ -158,9 +158,9 @@ void tst_PressAndHold::keepSelection() // pressAndHold() emitted => selection remains QGuiApplication::sendEvent(control.data(), &press); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QGuiApplication::sendEvent(control.data(), &release); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(control->property("selectedText"), control->property("text")); spy.clear(); @@ -168,7 +168,7 @@ void tst_PressAndHold::keepSelection() QGuiApplication::sendEvent(control.data(), &press); QGuiApplication::processEvents(); QGuiApplication::sendEvent(control.data(), &release); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QVERIFY(control->property("selectedText").toString().isEmpty()); QVERIFY(QMetaObject::invokeMethod(control.data(), "selectAll")); @@ -181,12 +181,12 @@ void tst_PressAndHold::keepSelection() // by the time the second control emits pressAndHold(), we can reliably // assume that the first control would have emitted pressAndHold() if it // wasn't canceled as appropriate by the move event above - QTRY_COMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QTRY_COMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); QGuiApplication::sendEvent(control.data(), &release); QGuiApplication::sendEvent(waitControl.data(), &release); - QCOMPARE(waitSpy.count(), 1); - QCOMPARE(spy.count(), 0); + QCOMPARE(waitSpy.size(), 1); + QCOMPARE(spy.size(), 0); QVERIFY(control->property("selectedText").toString().isEmpty()); waitSpy.clear(); } diff --git a/tests/auto/quickcontrols2/qquickapplicationwindow/tst_qquickapplicationwindow.cpp b/tests/auto/quickcontrols2/qquickapplicationwindow/tst_qquickapplicationwindow.cpp index 000b4e22af..e055340dde 100644 --- a/tests/auto/quickcontrols2/qquickapplicationwindow/tst_qquickapplicationwindow.cpp +++ b/tests/auto/quickcontrols2/qquickapplicationwindow/tst_qquickapplicationwindow.cpp @@ -700,7 +700,7 @@ void tst_QQuickApplicationWindow::focusAfterPopupClosed() QSignalSpy focusScopeSpy(window.data(), SIGNAL(focusScopeKeyPressed())); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusScopeSpy.count(), 1); + QCOMPARE(focusScopeSpy.size(), 1); // Open the menu. QQuickItem* toolButton = window->property("toolButton").value<QQuickItem*>(); @@ -711,14 +711,14 @@ void tst_QQuickApplicationWindow::focusAfterPopupClosed() // The FocusScope shouldn't receive any key events while the menu is open. QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusScopeSpy.count(), 1); + QCOMPARE(focusScopeSpy.size(), 1); // Close the menu. The FocusScope should regain focus. QTest::keyClick(window.data(), Qt::Key_Escape); QVERIFY(focusScope->hasActiveFocus()); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusScopeSpy.count(), 2); + QCOMPARE(focusScopeSpy.size(), 2); QQuickPopup *focusPopup = window->property("focusPopup").value<QQuickPopup*>(); QVERIFY(focusPopup); @@ -729,7 +729,7 @@ void tst_QQuickApplicationWindow::focusAfterPopupClosed() QSignalSpy focusPopupSpy(window.data(), SIGNAL(focusPopupKeyPressed())); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusPopupSpy.count(), 1); + QCOMPARE(focusPopupSpy.size(), 1); QQuickMenu *fileMenu = window->property("fileMenu").value<QQuickMenu*>(); QVERIFY(fileMenu); @@ -738,21 +738,21 @@ void tst_QQuickApplicationWindow::focusAfterPopupClosed() // The Popup shouldn't receive any key events while the menu is open. QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusPopupSpy.count(), 1); + QCOMPARE(focusPopupSpy.size(), 1); // Close the menu. The Popup should regain focus. QTest::keyClick(window.data(), Qt::Key_Escape); QVERIFY(focusPopup->hasActiveFocus()); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusPopupSpy.count(), 2); + QCOMPARE(focusPopupSpy.size(), 2); // Close the popup. The FocusScope should regain focus. QTest::keyClick(window.data(), Qt::Key_Escape); QVERIFY(focusScope->hasActiveFocus()); QTest::keyClick(window.data(), Qt::Key_Space); - QCOMPARE(focusScopeSpy.count(), 3); + QCOMPARE(focusScopeSpy.size(), 3); } void tst_QQuickApplicationWindow::clearFocusOnDestruction() @@ -796,7 +796,7 @@ void tst_QQuickApplicationWindow::clearFocusOnDestruction() Therefore, if you have good reasons to change the behavior (and not emit it) take the test below with a grain of salt. */ - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQuickApplicationWindow::layout() diff --git a/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp b/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp index ca6183e41d..ddb4b7ff8b 100644 --- a/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp +++ b/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp @@ -66,12 +66,12 @@ void tst_QQuickControl::flickable() QPoint p(button->width() / 2, button->height() / 2); QTest::touchEvent(window, touchDevice.data()).press(0, p); - QTRY_COMPARE(buttonPressedSpy.count(), 1); + QTRY_COMPARE(buttonPressedSpy.size(), 1); p += QPoint(1, 1); // less than the drag threshold QTest::touchEvent(window, touchDevice.data()).move(0, p); QTest::touchEvent(window, touchDevice.data()).release(0, p); - QTRY_COMPARE(buttonReleasedSpy.count(), 1); - QTRY_COMPARE(buttonClickedSpy.count(), 1); + QTRY_COMPARE(buttonReleasedSpy.size(), 1); + QTRY_COMPARE(buttonClickedSpy.size(), 1); } void tst_QQuickControl::fractionalFontSize() diff --git a/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp b/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp index 48e1a541be..344d96b6fb 100644 --- a/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp +++ b/tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer.cpp @@ -225,71 +225,71 @@ void tst_QQuickDrawer::state() // open programmatically... drawer->open(); - QCOMPARE(visibleChangedSpy.count(), ++visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), ++aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), ++visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), ++aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), closedCount); // ...and wait until fully open QVERIFY(openedSpy.wait()); - QCOMPARE(visibleChangedSpy.count(), visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), ++openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), ++openedCount); + QCOMPARE(closedSpy.size(), closedCount); // close programmatically... drawer->close(); - QCOMPARE(visibleChangedSpy.count(), visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), ++aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), ++aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), closedCount); // ...and wait until fully closed QVERIFY(closedSpy.wait()); - QCOMPARE(visibleChangedSpy.count(), ++visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), ++closedCount); + QCOMPARE(visibleChangedSpy.size(), ++visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), ++closedCount); // open interactively... QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, drawer->height() / 2)); QTest::mouseMove(window, QPoint(drawer->width() * 0.2, drawer->height() / 2), 16); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(drawer->width() * 0.8, drawer->height() / 2), 16); - QCOMPARE(visibleChangedSpy.count(), ++visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), ++aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), ++visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), ++aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), closedCount); // ...and wait until fully open QVERIFY(openedSpy.wait()); - QCOMPARE(visibleChangedSpy.count(), visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), ++openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), ++openedCount); + QCOMPARE(closedSpy.size(), closedCount); // close interactively... QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(drawer->width(), drawer->height() / 2)); QTest::mouseMove(window, QPoint(drawer->width() * 0.8, drawer->height() / 2), 16); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(drawer->width() * 0.2, drawer->height() / 2), 16); - QCOMPARE(visibleChangedSpy.count(), visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), ++aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), closedCount); + QCOMPARE(visibleChangedSpy.size(), visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), ++aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), closedCount); // ...and wait until fully closed QVERIFY(closedSpy.wait()); - QCOMPARE(visibleChangedSpy.count(), ++visibleChangedCount); - QCOMPARE(aboutToShowSpy.count(), aboutToShowCount); - QCOMPARE(aboutToHideSpy.count(), aboutToHideCount); - QCOMPARE(openedSpy.count(), openedCount); - QCOMPARE(closedSpy.count(), ++closedCount); + QCOMPARE(visibleChangedSpy.size(), ++visibleChangedCount); + QCOMPARE(aboutToShowSpy.size(), aboutToShowCount); + QCOMPARE(aboutToHideSpy.size(), aboutToHideCount); + QCOMPARE(openedSpy.size(), openedCount); + QCOMPARE(closedSpy.size(), ++closedCount); } void tst_QQuickDrawer::position_data() @@ -518,7 +518,7 @@ void tst_QQuickDrawer::header() QSignalSpy clickSpy(button, SIGNAL(clicked())); QVERIFY(clickSpy.isValid()); QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(button->x() + button->width() / 2, button->y() + button->height() / 2)); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); } void tst_QQuickDrawer::dragHandlerInteraction() @@ -577,7 +577,7 @@ void tst_QQuickDrawer::hover() QSignalSpy openedSpy(drawer, SIGNAL(opened())); QVERIFY(openedSpy.isValid()); drawer->open(); - QVERIFY(openedSpy.count() == 1 || openedSpy.wait()); + QVERIFY(openedSpy.size() == 1 || openedSpy.wait()); // hover the background button outside the drawer QTest::mouseMove(window, QPoint(window->width() - 1, window->height() - 1)); @@ -600,7 +600,7 @@ void tst_QQuickDrawer::hover() QSignalSpy closedSpy(drawer, SIGNAL(closed())); QVERIFY(closedSpy.isValid()); drawer->close(); - QVERIFY(closedSpy.count() == 1 || closedSpy.wait()); + QVERIFY(closedSpy.size() == 1 || closedSpy.wait()); // hover the background button after closing the drawer QTest::mouseMove(window, QPoint(window->width() / 2, window->height() / 2)); @@ -665,7 +665,7 @@ void tst_QQuickDrawer::wheel() QSignalSpy openedSpy(drawer, SIGNAL(opened())); QVERIFY(openedSpy.isValid()); drawer->open(); - QVERIFY(openedSpy.count() == 1 || openedSpy.wait()); + QVERIFY(openedSpy.size() == 1 || openedSpy.wait()); { // wheel over the drawer content @@ -725,9 +725,9 @@ void tst_QQuickDrawer::multiple() // no drawers open, click the content QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 0); - QCOMPARE(rightClickSpy.count(), 0); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 0); + QCOMPARE(rightClickSpy.size(), 0); // drag the left drawer open QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, window->height() / 2)); @@ -754,30 +754,30 @@ void tst_QQuickDrawer::multiple() // click the left drawer's button QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 0); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 0); // click the left drawer's background (button disabled, don't leak through to the right drawer below) leftButton->setEnabled(false); QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 0); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 0); leftButton->setEnabled(true); // click the overlay of the left drawer (don't leak through to right drawer below) QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() - (window->width() - leftDrawer->width()) / 2, window->height() / 2)); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 0); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 0); QTRY_VERIFY(!leftDrawer->isVisible()); // click the right drawer's button QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 1); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 1); // cannot drag the left drawer while the right drawer is open QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, window->height() / 2)); @@ -791,23 +791,23 @@ void tst_QQuickDrawer::multiple() // click the right drawer's background (button disabled, don't leak through to the content below) rightButton->setEnabled(false); QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 1); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 1); rightButton->setEnabled(true); // click the overlay of the right drawer (don't leak through to the content below) QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint((window->width() - rightDrawer->width()) / 2, window->height() / 2)); - QCOMPARE(contentClickSpy.count(), 1); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 1); + QCOMPARE(contentClickSpy.size(), 1); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 1); QTRY_VERIFY(!rightDrawer->isVisible()); // no drawers open, click the content QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(contentClickSpy.count(), 2); - QCOMPARE(leftClickSpy.count(), 1); - QCOMPARE(rightClickSpy.count(), 1); + QCOMPARE(contentClickSpy.size(), 2); + QCOMPARE(leftClickSpy.size(), 1); + QCOMPARE(rightClickSpy.size(), 1); // drag the right drawer open QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() - 1, window->height() / 2)); @@ -920,33 +920,33 @@ void tst_QQuickDrawer::multiTouch() QTest::touchEvent(window, touchDevice.data()).press(0, QPoint(300, 100)); QVERIFY(popup->isVisible()); QVERIFY(drawer->isVisible()); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 1); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 1); // 2nd press (blocked & ignored) QTest::touchEvent(window, touchDevice.data()).stationary(0).press(1, QPoint(300, 200)); QVERIFY(popup->isVisible()); QVERIFY(drawer->isVisible()); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 2); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 2); // 2nd release (blocked & ignored) QTest::touchEvent(window, touchDevice.data()).stationary(0).release(1, QPoint(300, 200)); QVERIFY(popup->isVisible()); QVERIFY(drawer->isVisible()); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(buttonReleasedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 2); - QCOMPARE(overlayReleasedSpy.count(), 1); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(buttonReleasedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 2); + QCOMPARE(overlayReleasedSpy.size(), 1); // 1st release QTest::touchEvent(window, touchDevice.data()).release(0, QPoint(300, 100)); QVERIFY(popup->isVisible()); QTRY_VERIFY(!drawer->isVisible()); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(buttonReleasedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 2); - QCOMPARE(overlayReleasedSpy.count(), 2); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(buttonReleasedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 2); + QCOMPARE(overlayReleasedSpy.size(), 2); drawer->open(); QVERIFY(drawer->isVisible()); @@ -954,8 +954,8 @@ void tst_QQuickDrawer::multiTouch() // 1st drag QTest::touchEvent(window, touchDevice.data()).press(0, QPoint(300, 100)); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 3); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 3); for (int x = 300; x >= 100; x -= 10) { QTest::touchEvent(window, touchDevice.data()).move(0, QPoint(x, 100)); QVERIFY(popup->isVisible()); @@ -965,8 +965,8 @@ void tst_QQuickDrawer::multiTouch() // 2nd drag (blocked & ignored) QTest::touchEvent(window, touchDevice.data()).stationary(0).press(1, QPoint(300, 200)); - QCOMPARE(buttonPressedSpy.count(), 0); - QCOMPARE(overlayPressedSpy.count(), 4); + QCOMPARE(buttonPressedSpy.size(), 0); + QCOMPARE(overlayPressedSpy.size(), 4); for (int x = 300; x >= 0; x -= 10) { QTest::touchEvent(window, touchDevice.data()).stationary(0).move(1, QPoint(x, 200)); QVERIFY(popup->isVisible()); @@ -979,15 +979,15 @@ void tst_QQuickDrawer::multiTouch() QVERIFY(popup->isVisible()); QVERIFY(drawer->isVisible()); QCOMPARE(drawer->position(), 0.5); - QCOMPARE(buttonReleasedSpy.count(), 0); - QCOMPARE(overlayReleasedSpy.count(), 3); + QCOMPARE(buttonReleasedSpy.size(), 0); + QCOMPARE(overlayReleasedSpy.size(), 3); // 1st release QTest::touchEvent(window, touchDevice.data()).release(0, QPoint(300, 100)); QVERIFY(popup->isVisible()); QTRY_VERIFY(!drawer->isVisible()); - QCOMPARE(buttonReleasedSpy.count(), 0); - QCOMPARE(overlayReleasedSpy.count(), 4); + QCOMPARE(buttonReleasedSpy.size(), 0); + QCOMPARE(overlayReleasedSpy.size(), 4); } void tst_QQuickDrawer::grabber() @@ -1021,10 +1021,10 @@ void tst_QQuickDrawer::grabber() QVERIFY(popupClosedSpy.isValid()); popup->open(); - QTRY_COMPARE(popupOpenedSpy.count(), 1); + QTRY_COMPARE(popupOpenedSpy.size(), 1); QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 300)); - QTRY_COMPARE(popupClosedSpy.count(), 1); + QTRY_COMPARE(popupClosedSpy.size(), 1); } void tst_QQuickDrawer::interactive_data() @@ -1062,7 +1062,7 @@ void tst_QQuickDrawer::interactive() // click outside QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(300, 100)); - QCOMPARE(aboutToHideSpy.count(), 0); + QCOMPARE(aboutToHideSpy.size(), 0); // drag inside QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(drawer->width(), 0)); @@ -1070,7 +1070,7 @@ void tst_QQuickDrawer::interactive() QCOMPARE(drawer->position(), 1.0); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, 0)); QCOMPARE(drawer->position(), 1.0); - QCOMPARE(aboutToHideSpy.count(), 0); + QCOMPARE(aboutToHideSpy.size(), 0); // drag outside QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() - 1, 0)); @@ -1078,11 +1078,11 @@ void tst_QQuickDrawer::interactive() QCOMPARE(drawer->position(), 1.0); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(0, 0)); QCOMPARE(drawer->position(), 1.0); - QCOMPARE(aboutToHideSpy.count(), 0); + QCOMPARE(aboutToHideSpy.size(), 0); // close on escape QTest::keyClick(window, Qt::Key_Escape); - QCOMPARE(aboutToHideSpy.count(), 0); + QCOMPARE(aboutToHideSpy.size(), 0); } void tst_QQuickDrawer::flickable_data() diff --git a/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp b/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp index d9d2ab5691..28b92fef71 100644 --- a/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp +++ b/tests/auto/quickcontrols2/qquickheaderview/tst_qquickheaderview.cpp @@ -329,16 +329,16 @@ void tst_QQuickHeaderView::testModel() QVERIFY(modelChangedSpy.isValid()); hhv->setModel(QVariant::fromValue(thm)); - QCOMPARE(modelChangedSpy.count(), 0); + QCOMPARE(modelChangedSpy.size(), 0); hhv->setModel(QVariant::fromValue(pm)); - QCOMPARE(modelChangedSpy.count(), 1); + QCOMPARE(modelChangedSpy.size(), 1); TestTableModel ttm2; ttm2.setRowCount(100); ttm2.setColumnCount(30); hhv->setModel(QVariant::fromValue(&ttm2)); - QCOMPARE(modelChangedSpy.count(), 2); + QCOMPARE(modelChangedSpy.size(), 2); } void tst_QQuickHeaderView::listModel() diff --git a/tests/auto/quickcontrols2/qquickmenubar/tst_qquickmenubar.cpp b/tests/auto/quickcontrols2/qquickmenubar/tst_qquickmenubar.cpp index 2544aa4d79..f4b3aaf210 100644 --- a/tests/auto/quickcontrols2/qquickmenubar/tst_qquickmenubar.cpp +++ b/tests/auto/quickcontrols2/qquickmenubar/tst_qquickmenubar.cpp @@ -568,19 +568,19 @@ void tst_qquickmenubar::mnemonics() // trigger a menu item to close the menu, which shouldn't trigger a button // action behind the menu (QTBUG-86276) - QCOMPARE(oopsButtonSpy.count(), 0); + QCOMPARE(oopsButtonSpy.size(), 0); keySim.click(Qt::Key_O); // "&Open..." keySim.release(Qt::Key_Alt); QVERIFY(!fileMenuBarItem->isHighlighted()); QVERIFY(!fileMenuBarMenu->isOpened()); QTRY_VERIFY(!fileMenuBarMenu->isVisible()); - QCOMPARE(oopsButtonSpy.count(), 0); + QCOMPARE(oopsButtonSpy.size(), 0); // trigger a button action while menu is closed keySim.press(Qt::Key_Alt); keySim.click(Qt::Key_O); // "&Oops" keySim.release(Qt::Key_Alt); - QCOMPARE(oopsButtonSpy.count(), 1); + QCOMPARE(oopsButtonSpy.size(), 1); } void tst_qquickmenubar::addRemove() diff --git a/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp b/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp index d11e5c8536..c1fb1f7264 100644 --- a/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp +++ b/tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage.cpp @@ -152,7 +152,7 @@ void tst_qquickninepatchimage::inset_data() const QStringList files = QStringList() << "inset-all.9.png" << "inset-topleft.9.png" << "inset-bottomright.9.png"; const QList<QMarginsF> insets = QList<QMarginsF>() << QMarginsF(2, 1, 3, 4) << QMarginsF(2, 1, 0, 0) << QMarginsF(0, 0, 3, 4); - for (int i = 0; i < files.count(); ++i) { + for (int i = 0; i < files.size(); ++i) { QString file = files.at(i); for (int dpr = 1; dpr <= 4; ++dpr) QTest::newRow(qPrintable(QString::fromLatin1("%1 DPR=%2").arg(file).arg(dpr))) << dpr << file << insets.at(i); diff --git a/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp b/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp index ab20bd71b4..a22846b700 100644 --- a/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp +++ b/tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup.cpp @@ -179,18 +179,18 @@ void tst_QQuickPopup::state() QVERIFY(closedSpy.isValid()); popup->open(); - QCOMPARE(visibleChangedSpy.count(), 1); - QCOMPARE(aboutToShowSpy.count(), 1); - QCOMPARE(aboutToHideSpy.count(), 0); - QTRY_COMPARE(openedSpy.count(), 1); - QCOMPARE(closedSpy.count(), 0); + QCOMPARE(visibleChangedSpy.size(), 1); + QCOMPARE(aboutToShowSpy.size(), 1); + QCOMPARE(aboutToHideSpy.size(), 0); + QTRY_COMPARE(openedSpy.size(), 1); + QCOMPARE(closedSpy.size(), 0); popup->close(); - QTRY_COMPARE(visibleChangedSpy.count(), 2); - QCOMPARE(aboutToShowSpy.count(), 1); - QCOMPARE(aboutToHideSpy.count(), 1); - QCOMPARE(openedSpy.count(), 1); - QTRY_COMPARE(closedSpy.count(), 1); + QTRY_COMPARE(visibleChangedSpy.size(), 2); + QCOMPARE(aboutToShowSpy.size(), 1); + QCOMPARE(aboutToHideSpy.size(), 1); + QCOMPARE(openedSpy.size(), 1); + QTRY_COMPARE(closedSpy.size(), 1); } void tst_QQuickPopup::overlay_data() @@ -234,8 +234,8 @@ void tst_QQuickPopup::overlay() QVERIFY(!overlay->isVisible()); // no popups open QTest::mouseClick(window, Qt::LeftButton); - QCOMPARE(overlayPressedSignal.count(), 0); - QCOMPARE(overlayReleasedSignal.count(), 0); + QCOMPARE(overlayPressedSignal.size(), 0); + QCOMPARE(overlayReleasedSignal.size(), 0); QQuickPopup *popup = window->property("popup").value<QQuickPopup*>(); QVERIFY(popup); @@ -261,19 +261,19 @@ void tst_QQuickPopup::overlay() QTRY_VERIFY(popup->isOpened()); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTRY_VERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); // no modal-popups open - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); // no modal-popups open + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); popup->setDim(dim); popup->setModal(modal); @@ -286,16 +286,16 @@ void tst_QQuickPopup::overlay() QTRY_VERIFY(popup->isOpened()); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), ++overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), ++overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTRY_VERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); @@ -307,16 +307,16 @@ void tst_QQuickPopup::overlay() QTRY_VERIFY(popup->isOpened()); QTest::touchEvent(window, touchScreen.data()).press(0, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTest::touchEvent(window, touchScreen.data()).release(0, QPoint(1, 1)); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), ++overlayReleaseCount); - QCOMPARE(overlayAttachedPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayAttachedReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), ++overlayReleaseCount); + QCOMPARE(overlayAttachedPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayAttachedReleasedSignal.size(), overlayReleaseCount); QTRY_VERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); @@ -332,29 +332,29 @@ void tst_QQuickPopup::overlay() QVERIFY(popup->isVisible()); QVERIFY(overlay->isVisible()); QCOMPARE(button->isPressed(), !modal); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); QTest::touchEvent(window, touchScreen.data()).stationary(0).press(1, button->mapToScene(QPointF(button->width() / 2, button->height() / 2)).toPoint()); QVERIFY(popup->isVisible()); QVERIFY(overlay->isVisible()); QCOMPARE(button->isPressed(), !modal); - QCOMPARE(overlayPressedSignal.count(), ++overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), ++overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); QTest::touchEvent(window, touchScreen.data()).release(0, button->mapToScene(QPointF(1, 1)).toPoint()).stationary(1); QTRY_VERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); QVERIFY(!button->isPressed()); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), ++overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), ++overlayReleaseCount); QTest::touchEvent(window, touchScreen.data()).release(1, button->mapToScene(QPointF(button->width() / 2, button->height() / 2)).toPoint()); QVERIFY(!popup->isVisible()); QVERIFY(!overlay->isVisible()); QVERIFY(!button->isPressed()); - QCOMPARE(overlayPressedSignal.count(), overlayPressCount); - QCOMPARE(overlayReleasedSignal.count(), overlayReleaseCount); + QCOMPARE(overlayPressedSignal.size(), overlayPressCount); + QCOMPARE(overlayReleasedSignal.size(), overlayReleaseCount); } void tst_QQuickPopup::zOrder_data() @@ -407,40 +407,40 @@ void tst_QQuickPopup::windowChange() QQuickItem item; popup.setParentItem(&item); QVERIFY(!popup.window()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QQuickWindow window; item.setParentItem(window.contentItem()); QCOMPARE(popup.window(), &window); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setParentItem(nullptr); QVERIFY(!popup.window()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); popup.setParentItem(window.contentItem()); QCOMPARE(popup.window(), &window); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); popup.resetParentItem(); QVERIFY(!popup.window()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); popup.setParent(&window); popup.resetParentItem(); QCOMPARE(popup.window(), &window); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); popup.setParent(this); popup.resetParentItem(); QVERIFY(!popup.window()); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); item.setParentItem(window.contentItem()); popup.setParent(&item); popup.resetParentItem(); QCOMPARE(popup.window(), &window); - QCOMPARE(spy.count(), 7); + QCOMPARE(spy.size(), 7); popup.setParent(nullptr); } @@ -969,7 +969,7 @@ void tst_QQuickPopup::hover() QSignalSpy openedSpy(popup, SIGNAL(opened())); QVERIFY(openedSpy.isValid()); popup->open(); - QVERIFY(openedSpy.count() == 1 || openedSpy.wait()); + QVERIFY(openedSpy.size() == 1 || openedSpy.wait()); QTRY_VERIFY(popup->width() > 10); // somehow this can take a short time with macOS style // hover the parent button outside the popup @@ -990,7 +990,7 @@ void tst_QQuickPopup::hover() QSignalSpy closedSpy(popup, SIGNAL(closed())); QVERIFY(closedSpy.isValid()); popup->close(); - QVERIFY(closedSpy.count() == 1 || closedSpy.wait()); + QVERIFY(closedSpy.size() == 1 || closedSpy.wait()); // hover the parent button after closing the popup QTest::mouseMove(window, QPoint(window->width() / 2, window->height() / 2)); @@ -1057,7 +1057,7 @@ void tst_QQuickPopup::wheel() QSignalSpy openedSpy(popup, SIGNAL(opened())); QVERIFY(openedSpy.isValid()); popup->open(); - QVERIFY(openedSpy.count() == 1 || openedSpy.wait()); + QVERIFY(openedSpy.size() == 1 || openedSpy.wait()); { // wheel over the popup content @@ -1397,12 +1397,12 @@ void tst_QQuickPopup::enabled() popup.setEnabled(false); QVERIFY(!popup.isEnabled()); QVERIFY(!popup.popupItem()->isEnabled()); - QCOMPARE(enabledSpy.count(), 1); + QCOMPARE(enabledSpy.size(), 1); popup.popupItem()->setEnabled(true); QVERIFY(popup.isEnabled()); QVERIFY(popup.popupItem()->isEnabled()); - QCOMPARE(enabledSpy.count(), 2); + QCOMPARE(enabledSpy.size(), 2); } void tst_QQuickPopup::orientation_data() @@ -1521,15 +1521,15 @@ void tst_QQuickPopup::disabledPalette() auto palette = QQuickPopupPrivate::get(popup)->palette(); palette->setBase(Qt::green); palette->disabled()->setBase(Qt::red); - QCOMPARE(popupPaletteSpy.count(), 2); - QCOMPARE(popupItemPaletteSpy.count(), 2); + QCOMPARE(popupPaletteSpy.size(), 2); + QCOMPARE(popupItemPaletteSpy.size(), 2); QCOMPARE(popup->background()->property("color").value<QColor>(), Qt::green); popup->setEnabled(false); - QCOMPARE(popupEnabledSpy.count(), 1); - QCOMPARE(popupItemEnabledSpy.count(), 1); - QCOMPARE(popupPaletteSpy.count(), 3); - QCOMPARE(popupItemPaletteSpy.count(), 3); + QCOMPARE(popupEnabledSpy.size(), 1); + QCOMPARE(popupItemEnabledSpy.size(), 1); + QCOMPARE(popupPaletteSpy.size(), 3); + QCOMPARE(popupItemPaletteSpy.size(), 3); QCOMPARE(popup->background()->property("color").value<QColor>(), Qt::red); } @@ -1561,8 +1561,8 @@ void tst_QQuickPopup::disabledParentPalette() auto palette = QQuickPopupPrivate::get(popup)->palette(); palette->setBase(Qt::green); palette->disabled()->setBase(Qt::red); - QCOMPARE(popupPaletteSpy.count(), 2); - QCOMPARE(popupItemPaletteSpy.count(), 2); + QCOMPARE(popupPaletteSpy.size(), 2); + QCOMPARE(popupItemPaletteSpy.size(), 2); QCOMPARE(popup->background()->property("color").value<QColor>(), Qt::green); // Disable the overlay (which is QQuickPopupItem's parent) to ensure that @@ -1573,10 +1573,10 @@ void tst_QQuickPopup::disabledParentPalette() QVERIFY(!popup->isEnabled()); QVERIFY(!popup->popupItem()->isEnabled()); QCOMPARE(popup->background()->property("color").value<QColor>(), Qt::red); - QCOMPARE(popupEnabledSpy.count(), 1); - QCOMPARE(popupItemEnabledSpy.count(), 1); - QCOMPARE(popupPaletteSpy.count(), 3); - QCOMPARE(popupItemPaletteSpy.count(), 3); + QCOMPARE(popupEnabledSpy.size(), 1); + QCOMPARE(popupItemEnabledSpy.size(), 1); + QCOMPARE(popupPaletteSpy.size(), 3); + QCOMPARE(popupItemPaletteSpy.size(), 3); popup->close(); QTRY_VERIFY(!popup->isVisible()); @@ -1734,7 +1734,7 @@ void tst_QQuickPopup::invisibleToolTipOpen() QVERIFY(componentLoadedSpy.isValid()); loader->setProperty("active", true); - QTRY_COMPARE(componentLoadedSpy.count(), 1); + QTRY_COMPARE(componentLoadedSpy.size(), 1); QTRY_VERIFY(toolTip->isVisible()); } diff --git a/tests/auto/quickcontrols2/qquicktextarea/tst_qquicktextarea.cpp b/tests/auto/quickcontrols2/qquicktextarea/tst_qquicktextarea.cpp index 1d80287324..1c40b078f7 100644 --- a/tests/auto/quickcontrols2/qquicktextarea/tst_qquicktextarea.cpp +++ b/tests/auto/quickcontrols2/qquicktextarea/tst_qquicktextarea.cpp @@ -113,7 +113,7 @@ void tst_QQuickTextArea::touchscreenSetsFocusAndMovesCursor() QVERIFY(top); QQuickTextEdit *bottom = window.rootObject()->findChild<QQuickTextEdit*>("bottom"); QVERIFY(bottom); - const auto len = bottom->text().length(); + const auto len = bottom->text().size(); // tap the bottom field const qreal yOffset = bottom->topPadding() + 6; // where to tap or drag to hit the text @@ -131,7 +131,7 @@ void tst_QQuickTextArea::touchscreenSetsFocusAndMovesCursor() // typing a character inserts it at the cursor position QVERIFY(!bottom->text().contains('q')); QTest::keyClick(&window, Qt::Key_Q); - QCOMPARE(bottom->text().length(), len + 1); + QCOMPARE(bottom->text().size(), len + 1); QCOMPARE_GT(bottom->text().indexOf('q'), 0); // press-drag-and-release from p1 to p2 on the top field diff --git a/tests/auto/quickcontrols2/qquicktreeviewdelegate/testmodel.cpp b/tests/auto/quickcontrols2/qquicktreeviewdelegate/testmodel.cpp index 22e45f62cb..6c6da8452b 100644 --- a/tests/auto/quickcontrols2/qquicktreeviewdelegate/testmodel.cpp +++ b/tests/auto/quickcontrols2/qquicktreeviewdelegate/testmodel.cpp @@ -51,7 +51,7 @@ int TestModel::rowCount(const QModelIndex &parent) const { if (!parent.isValid()) return 1; // root of the tree - return treeItem(parent)->m_childItems.count(); + return treeItem(parent)->m_childItems.size(); } int TestModel::columnCount(const QModelIndex &) const diff --git a/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp b/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp index eaa9bac2ea..834729e133 100644 --- a/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp +++ b/tests/auto/quickcontrols2/qquicktreeviewdelegate/tst_qquicktreeviewdelegate.cpp @@ -297,7 +297,7 @@ void tst_qquicktreeviewdelegate::checkClickedSignal() QPoint localPos = QPoint(item->width() / 2, item->height() / 2); QPoint pos = item->window()->contentItem()->mapFromItem(item, localPos).toPoint(); QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier, pos); - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); clickedSpy.clear(); // Click on the indicator @@ -306,7 +306,7 @@ void tst_qquicktreeviewdelegate::checkClickedSignal() localPos = QPoint(indicator->x() + indicator->width() / 2, indicator->y() + indicator->height() / 2); pos = item->window()->contentItem()->mapFromItem(item, localPos).toPoint(); QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier, pos); - QCOMPARE(clickedSpy.count(), 0); + QCOMPARE(clickedSpy.size(), 0); } void tst_qquicktreeviewdelegate::clearSelectionOnClick() @@ -316,7 +316,7 @@ void tst_qquicktreeviewdelegate::clearSelectionOnClick() // Select root item const auto index = treeView->selectionModel()->model()->index(0, 0); treeView->selectionModel()->select(index, QItemSelectionModel::Select); - QCOMPARE(treeView->selectionModel()->selectedIndexes().count(), 1); + QCOMPARE(treeView->selectionModel()->selectedIndexes().size(), 1); // Click on a cell. This should remove the selection const auto item = qobject_cast<QQuickTreeViewDelegate *>(treeView->itemAtCell(0, 0)); @@ -324,7 +324,7 @@ void tst_qquicktreeviewdelegate::clearSelectionOnClick() QPoint localPos = QPoint(item->width() / 2, item->height() / 2); QPoint pos = item->window()->contentItem()->mapFromItem(item, localPos).toPoint(); QTest::mouseClick(item->window(), Qt::LeftButton, Qt::NoModifier, pos); - QCOMPARE(treeView->selectionModel()->selectedIndexes().count(), 0); + QCOMPARE(treeView->selectionModel()->selectedIndexes().size(), 0); } void tst_qquicktreeviewdelegate::dragToSelect() @@ -361,7 +361,7 @@ void tst_qquicktreeviewdelegate::dragToSelect() // Since TreeView uses TableView.SelectRows by default, we // now expect cells from 0,0 and 1,1 to be selected. - QCOMPARE(treeView->selectionModel()->selectedIndexes().count(), 4); + QCOMPARE(treeView->selectionModel()->selectedIndexes().size(), 4); } void tst_qquicktreeviewdelegate::pressAndHoldToSelect() @@ -392,7 +392,7 @@ void tst_qquicktreeviewdelegate::pressAndHoldToSelect() QTRY_VERIFY(treeView->selectionModel()->hasSelection()); // Since TreeView uses TableView.SelectRows by default, we // now expect both cell 0,0 and 1,0 to be selected. - QCOMPARE(treeView->selectionModel()->selectedIndexes().count(), 2); + QCOMPARE(treeView->selectionModel()->selectedIndexes().size(), 2); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, windowPos0_0); } diff --git a/tests/auto/quickcontrols2/translation/tst_translation.cpp b/tests/auto/quickcontrols2/translation/tst_translation.cpp index 76e3244cbd..f0798d0367 100644 --- a/tests/auto/quickcontrols2/translation/tst_translation.cpp +++ b/tests/auto/quickcontrols2/translation/tst_translation.cpp @@ -157,7 +157,7 @@ void tst_translation::stackView() QVERIFY(button); // Shouldn't crash when calling retranslate. QVERIFY(clickButton(button)); - QTRY_COMPARE(calledTranslateSpy.count(), 1); + QTRY_COMPARE(calledTranslateSpy.size(), 1); } QTEST_MAIN(tst_translation) diff --git a/tests/auto/quickdialogs/qquickcolordialogimpl/tst_qquickcolordialogimpl.cpp b/tests/auto/quickdialogs/qquickcolordialogimpl/tst_qquickcolordialogimpl.cpp index b404c4ef11..3a463c8b08 100644 --- a/tests/auto/quickdialogs/qquickcolordialogimpl/tst_qquickcolordialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickcolordialogimpl/tst_qquickcolordialogimpl.cpp @@ -167,7 +167,7 @@ void tst_QQuickColorDialogImpl::moveColorPickerHandle() // Move handle to where the saturation is the highest and the lightness is 'neutral' QTest::mouseClick(dialogHelper.window(), Qt::LeftButton, Qt::NoModifier, topCenter); - QCOMPARE(colorChangedSpy.count(), 1); + QCOMPARE(colorChangedSpy.size(), 1); const qreal floatingPointComparisonThreshold = 1.0 / colorPicker->width(); const QString floatComparisonErrorString( @@ -195,7 +195,7 @@ void tst_QQuickColorDialogImpl::moveColorPickerHandle() QCOMPARE(colorPicker->hue(), QColorConstants::Cyan.hslHueF()); QCOMPARE(colorPicker->color().rgba(), QColorConstants::Cyan.rgba()); - QCOMPARE(colorChangedSpy.count(), 2); + QCOMPARE(colorChangedSpy.size(), 2); QPoint bottomCenter = colorPicker->mapToScene({ colorPicker->width() / 2, colorPicker->height() }).toPoint(); @@ -208,7 +208,7 @@ void tst_QQuickColorDialogImpl::moveColorPickerHandle() // This means that the current color was changed twice. // (The press happens 1 pixel above the release, to work around an issue where the mouse event // wasn't received by the color picker) - QCOMPARE(colorChangedSpy.count(), 4); + QCOMPARE(colorChangedSpy.size(), 4); FUZZYCOMPARE(colorPicker->saturation(), 0.0, floatingPointComparisonThreshold, qPrintable(floatComparisonErrorString.arg("saturation()").arg(colorPicker->saturation()).arg(0.0).arg(floatingPointComparisonThreshold))); FUZZYCOMPARE(dialogHelper.quickDialog->saturation(), 0.0, floatingPointComparisonThreshold, @@ -317,7 +317,7 @@ void tst_QQuickColorDialogImpl::changeHex() // Modify the value in the TextField to something else. colorTextField->forceActiveFocus(); - colorTextField->select(1, colorTextField->text().length()); + colorTextField->select(1, colorTextField->text().size()); QVERIFY(colorTextField->hasActiveFocus()); QTest::keyClick(dialogHelper.window(), Qt::Key_Backspace); QTest::keyClick(dialogHelper.window(), '0'); diff --git a/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp b/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp index 097bc3a9af..a4b445b50b 100644 --- a/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickfolderdialogimpl/tst_qquickfolderdialogimpl.cpp @@ -231,10 +231,10 @@ void tst_QQuickFolderDialogImpl::chooseFolderViaStandardButtons() COMPARE_URL(dialogHelper.quickDialog->selectedFolder(), QUrl::fromLocalFile(tempSubDir2.path())); COMPARE_URL(dialogHelper.dialog->selectedFolder(), QUrl::fromLocalFile(tempSubDir2.path())); // Only selectedFile-related signals should be emitted. - QCOMPARE(signalHelper.dialogSelectedFolderChangedSpy.count(), 1); - QCOMPARE(signalHelper.quickDialogSelectedFolderChangedSpy.count(), 1); - QCOMPARE(signalHelper.dialogCurrentFolderChangedSpy.count(), 0); - QCOMPARE(signalHelper.quickDialogCurrentFolderChangedSpy.count(), 0); + QCOMPARE(signalHelper.dialogSelectedFolderChangedSpy.size(), 1); + QCOMPARE(signalHelper.quickDialogSelectedFolderChangedSpy.size(), 1); + QCOMPARE(signalHelper.dialogCurrentFolderChangedSpy.size(), 0); + QCOMPARE(signalHelper.quickDialogCurrentFolderChangedSpy.size(), 0); // Click the "Open" button. QVERIFY(dialogHelper.quickDialog->footer()); @@ -245,10 +245,10 @@ void tst_QQuickFolderDialogImpl::chooseFolderViaStandardButtons() QVERIFY(clickButton(openButton)); COMPARE_URL(dialogHelper.dialog->selectedFolder(), QUrl::fromLocalFile(tempSubDir2.path())); COMPARE_URL(dialogHelper.quickDialog->selectedFolder(), QUrl::fromLocalFile(tempSubDir2.path())); - QCOMPARE(signalHelper.dialogSelectedFolderChangedSpy.count(), 1); - QCOMPARE(signalHelper.quickDialogSelectedFolderChangedSpy.count(), 1); - QCOMPARE(signalHelper.dialogCurrentFolderChangedSpy.count(), 0); - QCOMPARE(signalHelper.quickDialogCurrentFolderChangedSpy.count(), 0); + QCOMPARE(signalHelper.dialogSelectedFolderChangedSpy.size(), 1); + QCOMPARE(signalHelper.quickDialogSelectedFolderChangedSpy.size(), 1); + QCOMPARE(signalHelper.dialogCurrentFolderChangedSpy.size(), 0); + QCOMPARE(signalHelper.quickDialogCurrentFolderChangedSpy.size(), 0); QTRY_VERIFY(!dialogHelper.quickDialog->isVisible()); QVERIFY(!dialogHelper.dialog->isVisible()); } @@ -323,10 +323,10 @@ void tst_QQuickFolderDialogImpl::changeFolderViaDoubleClick() COMPARE_URL(dialogHelper.dialog->selectedFolder(), QUrl()); // selectedFolder is set to the folder when clicked and then set to an empty URL after // the double click. - QCOMPARE(signalHelper.dialogSelectedFolderChangedSpy.count(), 2); - QCOMPARE(signalHelper.quickDialogSelectedFolderChangedSpy.count(), 2); - QCOMPARE(signalHelper.dialogCurrentFolderChangedSpy.count(), 1); - QCOMPARE(signalHelper.quickDialogCurrentFolderChangedSpy.count(), 1); + QCOMPARE(signalHelper.dialogSelectedFolderChangedSpy.size(), 2); + QCOMPARE(signalHelper.quickDialogSelectedFolderChangedSpy.size(), 2); + QCOMPARE(signalHelper.dialogCurrentFolderChangedSpy.size(), 1); + QCOMPARE(signalHelper.quickDialogCurrentFolderChangedSpy.size(), 1); // Since we only changed the current folder, the dialog should still be open. QVERIFY(dialogHelper.dialog->isVisible()); @@ -396,10 +396,10 @@ void tst_QQuickFolderDialogImpl::changeFolderViaEnter() QTest::keyClick(dialogHelper.window(), Qt::Key_Return); COMPARE_URL(dialogHelper.dialog->currentFolder(), QUrl::fromLocalFile(tempSubDir1.path())); COMPARE_URL(dialogHelper.dialog->selectedFolder(), QUrl::fromLocalFile(tempSubSubDir.path())); - QCOMPARE(signalHelper.dialogSelectedFolderChangedSpy.count(), 1); - QCOMPARE(signalHelper.quickDialogSelectedFolderChangedSpy.count(), 1); - QCOMPARE(signalHelper.dialogCurrentFolderChangedSpy.count(), 1); - QCOMPARE(signalHelper.quickDialogCurrentFolderChangedSpy.count(), 1); + QCOMPARE(signalHelper.dialogSelectedFolderChangedSpy.size(), 1); + QCOMPARE(signalHelper.quickDialogSelectedFolderChangedSpy.size(), 1); + QCOMPARE(signalHelper.dialogCurrentFolderChangedSpy.size(), 1); + QCOMPARE(signalHelper.quickDialogCurrentFolderChangedSpy.size(), 1); // Since we only changed the current folder, the dialog should still be open. QVERIFY(dialogHelper.dialog->isVisible()); diff --git a/tests/auto/quickdialogs/qquickfontdialogimpl/tst_qquickfontdialogimpl.cpp b/tests/auto/quickdialogs/qquickfontdialogimpl/tst_qquickfontdialogimpl.cpp index 78a0060824..5de4fe291b 100644 --- a/tests/auto/quickdialogs/qquickfontdialogimpl/tst_qquickfontdialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickfontdialogimpl/tst_qquickfontdialogimpl.cpp @@ -151,7 +151,7 @@ void tst_QQuickFontDialogImpl::changingWritingSystem() QVERIFY(anyDelegate); QCOMPARE(anyDelegate->text(), QFontDatabase::writingSystemName(QFontDatabase::Any)); - QCOMPARE(fontFamilyModelSpy.count(), 0); + QCOMPARE(fontFamilyModelSpy.size(), 0); // Select "Japanese" from the ComboBox. const int japaneseIndex = QFontDatabase::Japanese; @@ -162,7 +162,7 @@ void tst_QQuickFontDialogImpl::changingWritingSystem() QTRY_VERIFY(!writingSystemComboBox->popup()->isVisible()); // Check that the contents of the font family listview changed - QCOMPARE(fontFamilyModelSpy.count(), 1); + QCOMPARE(fontFamilyModelSpy.size(), 1); // And that the sample text is correctly set QCOMPARE(sampleEdit->text(), QFontDatabase::writingSystemSample(QFontDatabase::Japanese)); @@ -235,11 +235,11 @@ void tst_QQuickFontDialogImpl::clickAroundInTheFamilyListView() const QString expected2 = fontListModel[i], actual2 = dialogHelper.dialog->selectedFont().family(); QVERIFY2(expected2 == actual2, qPrintable(err.arg(expected2, actual2).append(", FONT ").append(fontDelegate->text()))); - const int selectedFontSpyCount = selectedFontSpy.count(); + const int selectedFontSpyCount = selectedFontSpy.size(); QVERIFY2(selectedFontSpyCount == 1, qPrintable(err.arg(1).arg(selectedFontSpyCount).append(", FONT ").append(fontDelegate->text()))); - QVERIFY2((oldStyleModel == fontStyleListView->model()) != (styleModelSpy.count() == 1), + QVERIFY2((oldStyleModel == fontStyleListView->model()) != (styleModelSpy.size() == 1), qPrintable(QString("LOOP INDEX %1").arg(i))); - QVERIFY2((oldSizeModel == fontSizeListView->model()) != (sizeModelSpy.count() == 1), + QVERIFY2((oldSizeModel == fontSizeListView->model()) != (sizeModelSpy.size() == 1), qPrintable(QString("LOOP INDEX %1").arg(i))); } @@ -269,25 +269,25 @@ void tst_QQuickFontDialogImpl::settingUnderlineAndStrikeoutEffects() QVERIFY(clickButton(underlineCheckBox)); - QCOMPARE(selectedFontSpy.count(), 1); + QCOMPARE(selectedFontSpy.size(), 1); QVERIFY(dialogHelper.dialog->selectedFont().underline()); QVERIFY(!dialogHelper.dialog->selectedFont().strikeOut()); QVERIFY(clickButton(underlineCheckBox)); - QCOMPARE(selectedFontSpy.count(), 2); + QCOMPARE(selectedFontSpy.size(), 2); QVERIFY(!dialogHelper.dialog->selectedFont().underline()); QVERIFY(!dialogHelper.dialog->selectedFont().strikeOut()); QVERIFY(clickButton(strikeoutCheckBox)); - QCOMPARE(selectedFontSpy.count(), 3); + QCOMPARE(selectedFontSpy.size(), 3); QVERIFY(!dialogHelper.dialog->selectedFont().underline()); QVERIFY(dialogHelper.dialog->selectedFont().strikeOut()); QVERIFY(clickButton(strikeoutCheckBox)); - QCOMPARE(selectedFontSpy.count(), 4); + QCOMPARE(selectedFontSpy.size(), 4); QVERIFY(!dialogHelper.dialog->selectedFont().underline()); QVERIFY(!dialogHelper.dialog->selectedFont().strikeOut()); @@ -401,7 +401,7 @@ public: do { m_searchText.append(searchText); - for (int i = 0; i < m_model.count(); ++i) { + for (int i = 0; i < m_model.size(); ++i) { if (m_model.at(i).startsWith(m_searchText, Qt::CaseInsensitive)) return i; } @@ -512,7 +512,7 @@ void tst_QQuickFontDialogImpl::setCurrentFontFromApi() QVERIFY(fontSizeEdit); // From when the listviews are populated - QCOMPARE(selectedFontSpy.count(), 1); + QCOMPARE(selectedFontSpy.size(), 1); selectedFontSpy.clear(); @@ -538,16 +538,16 @@ void tst_QQuickFontDialogImpl::setCurrentFontFromApi() QCOMPARE(styleModel.at(fontStyleListView->currentIndex()), style); QCOMPARE(fontSizeEdit->text(), QString::number(size++)); - QCOMPARE(selectedFontSpy.count(), ++spyCounter); + QCOMPARE(selectedFontSpy.size(), ++spyCounter); - for (int styleIt = 0; styleIt < qMin(styleModel.count(), maxNumberOfStyles); ++styleIt) { + for (int styleIt = 0; styleIt < qMin(styleModel.size(), maxNumberOfStyles); ++styleIt) { const QString currentStyle = styleModel.at(styleIt); const QFont f = QFontDatabase::font(*family, currentStyle, size); dialogHelper.dialog->setSelectedFont(f); QCOMPARE(styleModel.at(fontStyleListView->currentIndex()), currentStyle); - QCOMPARE(selectedFontSpy.count(), ++spyCounter); + QCOMPARE(selectedFontSpy.size(), ++spyCounter); } } diff --git a/tests/auto/quickdialogs/qquickmessagedialogimpl/tst_qquickmessagedialogimpl.cpp b/tests/auto/quickdialogs/qquickmessagedialogimpl/tst_qquickmessagedialogimpl.cpp index 93b29d6a16..b2f3d6456c 100644 --- a/tests/auto/quickdialogs/qquickmessagedialogimpl/tst_qquickmessagedialogimpl.cpp +++ b/tests/auto/quickdialogs/qquickmessagedialogimpl/tst_qquickmessagedialogimpl.cpp @@ -79,7 +79,7 @@ void tst_QQuickMessageDialogImpl::changeText() // update the text property dialogHelper.dialog->setText(testString1); - QCOMPARE(textSpy.count(), 1); + QCOMPARE(textSpy.size(), 1); // The textLabel is empty until dialog is re-opened QCOMPARE(dialogHelper.dialog->text(), testString1); @@ -91,7 +91,7 @@ void tst_QQuickMessageDialogImpl::changeText() // The textLabel isn't updated immediately dialogHelper.dialog->setText(testString2); - QCOMPARE(textSpy.count(), 2); + QCOMPARE(textSpy.size(), 2); QCOMPARE(textLabel->text(), testString1); dialogHelper.dialog->close(); @@ -128,7 +128,7 @@ void tst_QQuickMessageDialogImpl::changeInformativeText() // update the informativeText property dialogHelper.dialog->setInformativeText(testString1); - QCOMPARE(informativeTextSpy.count(), 1); + QCOMPARE(informativeTextSpy.size(), 1); // The textLabel is empty until dialog is re-opened QCOMPARE(dialogHelper.dialog->informativeText(), testString1); @@ -140,7 +140,7 @@ void tst_QQuickMessageDialogImpl::changeInformativeText() // The textLabel shouldn't update immediately dialogHelper.dialog->setInformativeText(testString2); - QCOMPARE(informativeTextSpy.count(), 2); + QCOMPARE(informativeTextSpy.size(), 2); QCOMPARE(informativeTextLabel->text(), testString1); dialogHelper.dialog->close(); @@ -169,7 +169,7 @@ void tst_QQuickMessageDialogImpl::changeStandardButtons() QPlatformDialogHelper::StandardButtons(QPlatformDialogHelper::StandardButton::Save | QPlatformDialogHelper::StandardButton::Cancel | QPlatformDialogHelper::StandardButton::Apply)); - QCOMPARE(buttonBoxSpy.count(), 1); + QCOMPARE(buttonBoxSpy.size(), 1); QCOMPARE(buttonBox->count(), 1); dialogHelper.dialog->close(); dialogHelper.dialog->open(); @@ -190,7 +190,7 @@ void tst_QQuickMessageDialogImpl::changeStandardButtons() dialogHelper.dialog->setButtons( QPlatformDialogHelper::StandardButton(QPlatformDialogHelper::StandardButton::Ok | QPlatformDialogHelper::StandardButton::Close)); - QCOMPARE(buttonBoxSpy.count(), 2); + QCOMPARE(buttonBoxSpy.size(), 2); QCOMPARE(buttonBox->count(), 3); dialogHelper.dialog->open(); QCOMPARE(buttonBox->count(), 2); @@ -233,7 +233,7 @@ void tst_QQuickMessageDialogImpl::detailedText() // Set the detailed text to a non-empty string dialogHelper.dialog->setDetailedText(nonEmptyString); QCOMPARE(dialogHelper.dialog->detailedText(), nonEmptyString); - QCOMPARE(detailedTextSpy.count(), 1); + QCOMPARE(detailedTextSpy.size(), 1); QCOMPARE(detailedTextArea->text(), emptyString); QVERIFY(!detailedTextButton->isVisible()); dialogHelper.dialog->close(); @@ -246,7 +246,7 @@ void tst_QQuickMessageDialogImpl::detailedText() // Set the detailed text to an empty string dialogHelper.dialog->setDetailedText(emptyString); - QCOMPARE(detailedTextSpy.count(), 2); + QCOMPARE(detailedTextSpy.size(), 2); QCOMPARE(dialogHelper.dialog->detailedText(), emptyString); QCOMPARE(detailedTextArea->text(), nonEmptyString); QVERIFY(detailedTextButton->isVisible()); @@ -260,7 +260,7 @@ void tst_QQuickMessageDialogImpl::detailedText() // Change the detailed text property while the dialog is already open, should not immediately // update the dialog ui dialogHelper.dialog->setDetailedText(nonEmptyString); - QCOMPARE(detailedTextSpy.count(), 3); + QCOMPARE(detailedTextSpy.size(), 3); QCOMPARE(dialogHelper.dialog->detailedText(), nonEmptyString); QCOMPARE(detailedTextArea->text(), emptyString); QVERIFY2(!detailedTextButton->isVisible(), diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp index fb86ef9e72..c569447357 100644 --- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp +++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp @@ -340,7 +340,7 @@ void tst_qquickwidget::errors() QQmlTestMessageHandler messageHandler; view->setSource(testFileUrl("error1.qml")); QCOMPARE(view->status(), QQuickWidget::Error); - QCOMPARE(view->errors().count(), 1); + QCOMPARE(view->errors().size(), 1); } void tst_qquickwidget::engine() @@ -613,9 +613,9 @@ void tst_qquickwidget::synthMouseFromTouch() QTest::touchEvent(&window, device).move(0, p2, &window); QTest::touchEvent(&window, device).release(0, p2, &window); - QCOMPARE(item->m_touchEvents.count(), synthMouse ? 0 : (acceptTouch ? 3 : 1)); - QCOMPARE(item->m_mouseEvents.count(), synthMouse ? 3 : 0); - QCOMPARE(childView->m_mouseEvents.count(), 0); + QCOMPARE(item->m_touchEvents.size(), synthMouse ? 0 : (acceptTouch ? 3 : 1)); + QCOMPARE(item->m_mouseEvents.size(), synthMouse ? 3 : 0); + QCOMPARE(childView->m_mouseEvents.size(), 0); for (const auto &ev : item->m_mouseEvents) QCOMPARE(ev, Qt::MouseEventSynthesizedByQt); } diff --git a/tests/baseline/controls/tst_baseline_controls.cpp b/tests/baseline/controls/tst_baseline_controls.cpp index 7e5833b786..2e69bebfce 100644 --- a/tests/baseline/controls/tst_baseline_controls.cpp +++ b/tests/baseline/controls/tst_baseline_controls.cpp @@ -183,8 +183,8 @@ void tst_Baseline_Controls::setupTestSuite() QSKIP("No .qml test files found in " + testSuitePath.toLatin1()); for (const auto &filePath : qAsConst(testFiles)) { - QString itemName = filePath.sliced(testSuitePath.length() + 1); - itemName = itemName.left(itemName.length() - qmlExt.length()); + QString itemName = filePath.sliced(testSuitePath.size() + 1); + itemName = itemName.left(itemName.size() - qmlExt.size()); QBaselineTest::newRow(itemName.toLatin1()) << filePath; } } diff --git a/tests/baseline/scenegraph/scenegraph/tst_baseline_scenegraph.cpp b/tests/baseline/scenegraph/scenegraph/tst_baseline_scenegraph.cpp index fe8eb66ce9..5bab4aa4ef 100644 --- a/tests/baseline/scenegraph/scenegraph/tst_baseline_scenegraph.cpp +++ b/tests/baseline/scenegraph/scenegraph/tst_baseline_scenegraph.cpp @@ -159,7 +159,7 @@ void tst_Scenegraph::setupTestSuite(const QByteArray& filter) while (it.hasNext()) { QString fp = it.next(); if (fp.endsWith(".qml")) { - QString itemName = fp.mid(testSuitePath.length() + 1); + QString itemName = fp.mid(testSuitePath.size() + 1); if (!ignoreItems.contains(itemName) && (filter.isEmpty() || !itemName.startsWith(filter))) itemFiles.append(it.filePath()); } @@ -167,7 +167,7 @@ void tst_Scenegraph::setupTestSuite(const QByteArray& filter) std::sort(itemFiles.begin(), itemFiles.end()); for (const QString &filePath : qAsConst(itemFiles)) { - QByteArray itemName = filePath.mid(testSuitePath.length() + 1).toLatin1(); + QByteArray itemName = filePath.mid(testSuitePath.size() + 1).toLatin1(); QBaselineTest::newRow(itemName, checksumFileOrDir(filePath)) << filePath; numItems++; } diff --git a/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp b/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp index c4400f4d1b..f64a44d66a 100644 --- a/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp +++ b/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp @@ -239,7 +239,7 @@ void tst_librarymetrics_performance::compilation() if (nResults.size() == 0) nResults.append(9999); for (int i = 0; i < nResults.size(); ++i) totaltime += nResults.at(i); - double average = ((double)totaltime) / nResults.count(); + double average = ((double)totaltime) / nResults.size(); // and return it as the result QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds); @@ -288,7 +288,7 @@ void tst_librarymetrics_performance::instantiation_cached() if (nResults.size() == 0) nResults.append(9999); for (int i = 0; i < nResults.size(); ++i) totaltime += nResults.at(i); - double average = ((double)totaltime) / nResults.count(); + double average = ((double)totaltime) / nResults.size(); // and return it as the result QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds); @@ -345,7 +345,7 @@ void tst_librarymetrics_performance::instantiation() if (nResults.size() == 0) nResults.append(9999); for (int i = 0; i < nResults.size(); ++i) totaltime += nResults.at(i); - double average = ((double)totaltime) / nResults.count(); + double average = ((double)totaltime) / nResults.size(); // and return it as the result QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds); @@ -411,7 +411,7 @@ void tst_librarymetrics_performance::positioners() if (nResults.size() == 0) nResults.append(9999); for (int i = 0; i < nResults.size(); ++i) totaltime += nResults.at(i); - double average = ((double)totaltime) / nResults.count(); + double average = ((double)totaltime) / nResults.size(); // and return it as the result QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds); diff --git a/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp b/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp index dbda2048b4..4c4e5220c4 100644 --- a/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp +++ b/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp @@ -99,7 +99,7 @@ static void doBenchmark(QQmlEngine *engine, const QUrl &url) qInfo() << "\t" << object; } - QTest::setBenchmarkResult(objects.count(), QTest::Events); + QTest::setBenchmarkResult(objects.size(), QTest::Events); } void tst_ObjectCount::qobjects() diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 51adb49aa8..98fefcb838 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -364,7 +364,7 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory) if (dummyData && !quietMode) { printf("qml: Loaded dummy data: %s\n", qPrintable(dir.filePath(qml))); - qml.truncate(qml.length()-4); + qml.truncate(qml.size()-4); engine.rootContext()->setContextProperty(qml, dummyData); dummyData->setParent(&engine); } @@ -586,7 +586,7 @@ int main(int argc, char *argv[]) QLoggingCategory::setFilterRules(QStringLiteral("*=false")); } - if (files.count() <= 0) { + if (files.size() <= 0) { #if defined(Q_OS_DARWIN) && defined(QT_GUI_LIB) if (applicationType == QmlApplicationTypeGui) exitTimerId = static_cast<LoaderApplication *>(app.get())->startTimer(FILE_OPEN_EVENT_WAIT_TIME); @@ -599,7 +599,7 @@ int main(int argc, char *argv[]) loadConf(confFile, !verboseMode); // Load files - QScopedPointer<LoadWatcher> lw(new LoadWatcher(&e, files.count())); + QScopedPointer<LoadWatcher> lw(new LoadWatcher(&e, files.size())); #if QT_DEPRECATED_SINCE(6, 3) QString dummyDir; diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp index 4dd725afbc..700cb9ff34 100644 --- a/tools/qmleasing/splineeditor.cpp +++ b/tools/qmleasing/splineeditor.cpp @@ -169,7 +169,7 @@ void SplineEditor::paintEvent(QPaintEvent *) paintControlPoint(QPointF(0.0, 0.0), &painter, false, true, false, false); paintControlPoint(QPointF(1.0, 1.0), &painter, false, true, false, false); - for (int i = 0; i < m_controlPoints.count() - 1; ++i) + for (int i = 0; i < m_controlPoints.size() - 1; ++i) paintControlPoint(m_controlPoints.at(i), &painter, true, @@ -344,7 +344,7 @@ void SplineEditor::smoothPoint(int index) before = m_controlPoints.at(index - 3); QPointF after = QPointF(1.0, 1.0); - if ((index + 3) < m_controlPoints.count()) + if ((index + 3) < m_controlPoints.size()) after = m_controlPoints.at(index + 3); QPointF tangent = (after - before) / 6; @@ -354,7 +354,7 @@ void SplineEditor::smoothPoint(int index) if (index > 0) m_controlPoints[index - 1] = thisPoint - tangent; - if (index + 1 < m_controlPoints.count()) + if (index + 1 < m_controlPoints.size()) m_controlPoints[index + 1] = thisPoint + tangent; m_smoothList[index / 3] = true; @@ -372,7 +372,7 @@ void SplineEditor::cornerPoint(int index) before = m_controlPoints.at(index - 3); QPointF after = QPointF(1.0, 1.0); - if ((index + 3) < m_controlPoints.count()) + if ((index + 3) < m_controlPoints.size()) after = m_controlPoints.at(index + 3); QPointF thisPoint = m_controlPoints.at(index); @@ -380,7 +380,7 @@ void SplineEditor::cornerPoint(int index) if (index > 0) m_controlPoints[index - 1] = (before - thisPoint) / 3 + thisPoint; - if (index + 1 < m_controlPoints.count()) + if (index + 1 < m_controlPoints.size()) m_controlPoints[index + 1] = (after - thisPoint) / 3 + thisPoint; m_smoothList[(index) / 3] = false; @@ -412,7 +412,7 @@ void SplineEditor::addPoint(const QPointF point) before = m_controlPoints.at(splitIndex); QPointF after = QPointF(1.0, 1.0); - if ((splitIndex + 3) < m_controlPoints.count()) + if ((splitIndex + 3) < m_controlPoints.size()) after = m_controlPoints.at(splitIndex + 3); if (splitIndex > 0) { @@ -541,7 +541,7 @@ bool SplineEditor::isControlPointSmooth(int i) const if (i == 0) return false; - if (i == m_controlPoints.count() - 1) + if (i == m_controlPoints.size() - 1) return false; if (m_numberOfSegments == 1) @@ -552,7 +552,7 @@ bool SplineEditor::isControlPointSmooth(int i) const if (index == 0) return false; - if (index == m_controlPoints.count() - 1) + if (index == m_controlPoints.size() - 1) return false; return m_smoothList.at(index / 3); @@ -611,7 +611,7 @@ void SplineEditor::mouseMoveEvent(QMouseEvent *e) if ((m_activeControlPoint > 1) && (m_activeControlPoint % 3) == 0) { //right control point m_controlPoints[m_activeControlPoint - 2] -= distance; - } else if ((m_activeControlPoint < (m_controlPoints.count() - 2)) //left control point + } else if ((m_activeControlPoint < (m_controlPoints.size() - 2)) //left control point && (m_activeControlPoint % 3) == 1) { m_controlPoints[m_activeControlPoint + 2] -= distance; } @@ -628,7 +628,7 @@ void SplineEditor::setEasingCurve(const QEasingCurve &easingCurve) m_block = true; m_easingCurve = easingCurve; m_controlPoints = m_easingCurve.toCubicSpline(); - m_numberOfSegments = m_controlPoints.count() / 3; + m_numberOfSegments = m_controlPoints.size() / 3; update(); emit easingCurveChanged(); @@ -652,9 +652,9 @@ void SplineEditor::setEasingCurve(const QString &code) if (code.startsWith(QLatin1Char('[')) && code.endsWith(QLatin1Char(']'))) { const auto cleanCode = QStringView(code).mid(1, code.size() - 2); const auto stringList = cleanCode.split(QLatin1Char(','), Qt::SkipEmptyParts); - if (stringList.count() >= 6 && (stringList.count() % 6 == 0)) { + if (stringList.size() >= 6 && (stringList.size() % 6 == 0)) { QVector<qreal> realList; - realList.reserve(stringList.count()); + realList.reserve(stringList.size()); for (const QStringView &string : stringList) { bool ok; realList.append(string.toDouble(&ok)); @@ -662,14 +662,14 @@ void SplineEditor::setEasingCurve(const QString &code) return; } QVector<QPointF> points; - const int count = realList.count() / 2; + const int count = realList.size() / 2; points.reserve(count); for (int i = 0; i < count; ++i) points.append(QPointF(realList.at(i * 2), realList.at(i * 2 + 1))); if (points.constLast() == QPointF(1.0, 1.0)) { QEasingCurve easingCurve(QEasingCurve::BezierSpline); - for (int i = 0; i < points.count() / 3; ++i) { + for (int i = 0; i < points.size() / 3; ++i) { easingCurve.addCubicBezierSegment(points.at(i * 3), points.at(i * 3 + 1), points.at(i * 3 + 2)); diff --git a/tools/qmljsrootgen/main.cpp b/tools/qmljsrootgen/main.cpp index 921185b879..aeea1dcded 100644 --- a/tools/qmljsrootgen/main.cpp +++ b/tools/qmljsrootgen/main.cpp @@ -357,7 +357,7 @@ int main(int argc, char *argv[]) QStringList args = app.arguments(); - if (args.length() != 2) { + if (args.size() != 2) { qWarning().noquote() << app.applicationName() << "[output json path]"; return 1; } diff --git a/tools/qmlls/qmlcompletionsupport.cpp b/tools/qmlls/qmlcompletionsupport.cpp index f599787af4..8078e09adf 100644 --- a/tools/qmlls/qmlcompletionsupport.cpp +++ b/tools/qmlls/qmlcompletionsupport.cpp @@ -132,19 +132,19 @@ static qsizetype posAfterLineChar(QString code, int line, int character) { int targetLine = line; qsizetype i = 0; - while (i != code.length() && targetLine != 0) { + while (i != code.size() && targetLine != 0) { QChar c = code.at(i++); if (c == u'\n') { --targetLine; } if (c == u'\r') { - if (i != code.length() && code.at(i) == u'\n') + if (i != code.size() && code.at(i) == u'\n') ++i; --targetLine; } } qsizetype leftChars = character; - while (i != code.length() && leftChars) { + while (i != code.size() && leftChars) { QChar c = code.at(i); if (c == u'\n' || c == u'\r') break; @@ -301,7 +301,7 @@ static QList<CompletionItem> importCompletions(DomItem &file, const CompletionCo ImportCompletionType importCompletionType = ImportCompletionType::None; QRegularExpression spaceRe(uR"(\W+)"_s); QList<QStringView> linePieces = ctx.preLine().split(spaceRe, Qt::SkipEmptyParts); - qsizetype effectiveLength = linePieces.length() + qsizetype effectiveLength = linePieces.size() + ((!ctx.preLine().isEmpty() && ctx.preLine().last().isSpace()) ? 1 : 0); if (effectiveLength < 2) { CompletionItem comp; @@ -333,7 +333,7 @@ static QList<CompletionItem> importCompletions(DomItem &file, const CompletionCo for (const QString &uri : envPtr->moduleIndexUris(env)) { QStringView base = ctx.base(); // if we allow spaces we should get rid of them if (uri.startsWith(base)) { - QStringList rest = uri.mid(base.length()).split(u'.'); + QStringList rest = uri.mid(base.size()).split(u'.'); if (rest.isEmpty()) continue; CompletionItem comp; @@ -356,7 +356,7 @@ static QList<CompletionItem> importCompletions(DomItem &file, const CompletionCo bool hasMajorVersion = ctx.base().endsWith(u'.'); int majorV = -1; if (hasMajorVersion) - majorV = ctx.base().mid(0, ctx.base().length() - 1).toInt(&hasMajorVersion); + majorV = ctx.base().mid(0, ctx.base().size() - 1).toInt(&hasMajorVersion); if (!hasMajorVersion) break; if (std::shared_ptr<ModuleIndex> mIndex = @@ -559,7 +559,7 @@ QList<CompletionItem> CompletionRequest::completions(QmlLsp::OpenDocumentSnapsho QList<ItemLocation> itemsFound = findLastItemsContaining(file, completionParams.position.line, completionParams.position.character - ctx.filterChars().size()); - if (itemsFound.length() > 1) { + if (itemsFound.size() > 1) { QStringList paths; for (auto &it : itemsFound) paths.append(it.domItem.canonicalPath().toString()); diff --git a/tools/qmlls/qmllanguageservertool.cpp b/tools/qmlls/qmllanguageservertool.cpp index 2dfcc3894d..086515256a 100644 --- a/tools/qmlls/qmllanguageservertool.cpp +++ b/tools/qmlls/qmllanguageservertool.cpp @@ -208,7 +208,7 @@ int main(int argv, char *argc[]) QQmlLanguageServer qmlServer( [&writeMutex](const QByteArray &data) { QMutexLocker l(&writeMutex); - std::cout.write(data.constData(), data.length()); + std::cout.write(data.constData(), data.size()); std::cout.flush(); }, (parser.isSet(ignoreSettings) ? nullptr : &settings)); diff --git a/tools/qmlls/qqmlcodemodel.cpp b/tools/qmlls/qqmlcodemodel.cpp index 1250978cee..5d6c70790a 100644 --- a/tools/qmlls/qqmlcodemodel.cpp +++ b/tools/qmlls/qqmlcodemodel.cpp @@ -408,7 +408,7 @@ void QQmlCodeModel::openUpdateEnd() void QQmlCodeModel::newDocForOpenFile(const QByteArray &url, int version, const QString &docText) { qCDebug(codeModelLog) << "updating doc" << url << "to version" << version << "(" - << docText.length() << "chars)"; + << docText.size() << "chars)"; DomItem newCurrent = m_currentEnv.makeCopy(DomItem::CopyOption::EnvConnected).item(); QStringList loadPaths = buildPathsForFileUrl(url); loadPaths.append(QLibraryInfo::path(QLibraryInfo::QmlImportsPath)); @@ -527,9 +527,9 @@ QStringList QQmlCodeModel::buildPathsForFileUrl(const QByteArray &url) } // we want to longest match to be first, as it should override shorter matches std::sort(roots.begin(), roots.end(), [](const QByteArray &el1, const QByteArray &el2) { - if (el1.length() > el2.length()) + if (el1.size() > el2.size()) return true; - if (el1.length() < el2.length()) + if (el1.size() < el2.size()) return false; return el1 < el2; }); @@ -538,7 +538,7 @@ QStringList QQmlCodeModel::buildPathsForFileUrl(const QByteArray &url) if (!roots.isEmpty() && roots.last().isEmpty()) roots.removeLast(); QByteArray urlSlash(url); - if (!urlSlash.isEmpty() && isNotSeparator(urlSlash.at(urlSlash.length() - 1))) + if (!urlSlash.isEmpty() && isNotSeparator(urlSlash.at(urlSlash.size() - 1))) urlSlash.append('/'); // look if the file has a know prefix path for (const QByteArray &root : roots) { @@ -604,7 +604,7 @@ QStringList QQmlCodeModel::buildPathsForFileUrl(const QByteArray &url) void QQmlCodeModel::setBuildPathsForRootUrl(QByteArray url, const QStringList &paths) { QMutexLocker l(&m_mutex); - if (!url.isEmpty() && isNotSeparator(url.at(url.length() - 1))) + if (!url.isEmpty() && isNotSeparator(url.at(url.size() - 1))) url.append('/'); if (paths.isEmpty()) m_buildPathsForRootUrl.remove(url); @@ -671,7 +671,7 @@ QDebug OpenDocumentSnapshot::dump(QDebug dbg, DumpOptions options) << doc.field(Fields::code).value().toString() << "\n==========\n"; } else { dbg << u" doc:" - << (doc ? u"%1chars"_s.arg(doc.field(Fields::code).value().toString().length()) + << (doc ? u"%1chars"_s.arg(doc.field(Fields::code).value().toString().size()) : u"*none*"_s) << "\n"; } @@ -683,7 +683,7 @@ QDebug OpenDocumentSnapshot::dump(QDebug dbg, DumpOptions options) } else { dbg << u" validDoc:" << (validDoc ? u"%1chars"_s.arg( - validDoc.field(Fields::code).value().toString().length()) + validDoc.field(Fields::code).value().toString().size()) : u"*none*"_s) << "\n"; } diff --git a/tools/qmlls/textdocument.cpp b/tools/qmlls/textdocument.cpp index 2e6dc2cbd9..b5d4cc6f68 100644 --- a/tools/qmlls/textdocument.cpp +++ b/tools/qmlls/textdocument.cpp @@ -13,7 +13,7 @@ TextDocument::TextDocument(const QString &text) TextBlock TextDocument::findBlockByNumber(int blockNumber) const { - return (blockNumber >= 0 && blockNumber < m_blocks.length()) + return (blockNumber >= 0 && blockNumber < m_blocks.size()) ? m_blocks.at(blockNumber).textBlock : TextBlock(); } @@ -30,7 +30,7 @@ QChar TextDocument::characterAt(int pos) const int TextDocument::characterCount() const { - return m_content.length(); + return m_content.size(); } TextBlock TextDocument::begin() const @@ -70,7 +70,7 @@ void TextDocument::setPlainText(const QString &text) int blockStart = 0; int blockNumber = 0; - while (blockStart < text.length()) { + while (blockStart < text.size()) { Block block; block.textBlock.setBlockNumber(blockNumber++); block.textBlock.setPosition(blockStart); @@ -78,7 +78,7 @@ void TextDocument::setPlainText(const QString &text) int blockEnd = text.indexOf('\n', blockStart) + 1; if (blockEnd == 0) - blockEnd = text.length(); + blockEnd = text.size(); block.textBlock.setLength(blockEnd - blockStart); m_blocks.append(block); @@ -98,13 +98,13 @@ void TextDocument::setModified(bool modified) void TextDocument::setUserState(int blockNumber, int state) { - if (blockNumber >= 0 && blockNumber < m_blocks.length()) + if (blockNumber >= 0 && blockNumber < m_blocks.size()) m_blocks[blockNumber].userState = state; } int TextDocument::userState(int blockNumber) const { - return (blockNumber >= 0 && blockNumber < m_blocks.length()) ? m_blocks[blockNumber].userState + return (blockNumber >= 0 && blockNumber < m_blocks.size()) ? m_blocks[blockNumber].userState : -1; } diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 7180c33b47..70bb52463d 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -629,11 +629,11 @@ private: if (typeName->endsWith('*')) { *isPointer = true; - typeName->truncate(typeName->length() - 1); + typeName->truncate(typeName->size() - 1); removePointerAndList(typeName, isList, isPointer); } else if (typeName->startsWith(declListPrefix)) { *isList = true; - typeName->truncate(typeName->length() - 1); // get rid of the suffix '>' + typeName->truncate(typeName->size() - 1); // get rid of the suffix '>' *typeName = typeName->mid(declListPrefix.size()); removePointerAndList(typeName, isList, isPointer); } @@ -920,18 +920,18 @@ bool dependencyBetter(const QString &lhs, const QString &rhs) if (leftModule > rightModule) return false; - if (leftSegments.length() == 1) + if (leftSegments.size() == 1) return false; - if (rightSegments.length() == 1) + if (rightSegments.size() == 1) return true; const QStringList leftVersion = leftSegments.at(1).split(QLatin1Char('.')); const QStringList rightVersion = rightSegments.at(1).split(QLatin1Char('.')); auto compareSegment = [&](int segmentIndex) { - if (leftVersion.length() <= segmentIndex) - return rightVersion.length() > segmentIndex ? 1 : 0; - if (rightVersion.length() <= segmentIndex) + if (leftVersion.size() <= segmentIndex) + return rightVersion.size() > segmentIndex ? 1 : 0; + if (rightVersion.size() <= segmentIndex) return -1; bool leftOk = false; diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp index 2c2a387ff7..04752cd4e0 100644 --- a/tools/qmlprofiler/qmlprofilerapplication.cpp +++ b/tools/qmlprofiler/qmlprofilerapplication.cpp @@ -383,7 +383,7 @@ void QmlProfilerApplication::userCommand(const QString &command) } else if (m_profilerData->isEmpty()) { prompt(tr("No data was recorded so far.")); } else { - m_interactiveOutputFile = args.length() > 0 ? args.at(0).toString() : m_outputFile; + m_interactiveOutputFile = args.size() > 0 ? args.at(0).toString() : m_outputFile; if (checkOutputFile(REQUEST_OUTPUT_FILE)) output(); } @@ -400,7 +400,7 @@ void QmlProfilerApplication::userCommand(const QString &command) if (!m_recording && m_profilerData->isEmpty()) { prompt(tr("No data was recorded so far.")); } else { - m_interactiveOutputFile = args.length() > 0 ? args.at(0).toString() : m_outputFile; + m_interactiveOutputFile = args.size() > 0 ? args.at(0).toString() : m_outputFile; if (checkOutputFile(REQUEST_FLUSH_FILE)) flush(); } diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp index 51ac32f2d5..cac1364b87 100644 --- a/tools/qmlprofiler/qmlprofilerdata.cpp +++ b/tools/qmlprofiler/qmlprofilerdata.cpp @@ -248,7 +248,7 @@ bool compareStartTimes(const QQmlProfilerEvent &t1, const QQmlProfilerEvent &t2) void QmlProfilerData::sortStartTimes() { - if (d->events.count() < 2) + if (d->events.size() < 2) return; // assuming startTimes is partially sorted @@ -523,7 +523,7 @@ bool QmlProfilerData::save(const QString &filename) } case RangeEnd: { QStack<qint64> &ends = rangeEnds[type.rangeType()]; - if (starts.length() > ends.length()) { + if (starts.size() > ends.size()) { ends.push(event.timestamp()); if (--level == 0) sendPending(); @@ -542,7 +542,7 @@ bool QmlProfilerData::save(const QString &filename) } for (int i = 0; i < MaximumRangeType; ++i) { - while (rangeEnds[i].length() < rangeStarts[i].length()) { + while (rangeEnds[i].size() < rangeStarts[i].size()) { rangeEnds[i].push(d->traceEndTime); --level; } @@ -597,7 +597,7 @@ void QmlProfilerData::setState(QmlProfilerData::State state) int QmlProfilerData::numLoadedEventTypes() const { - return d->eventTypes.length(); + return d->eventTypes.size(); } #include "moc_qmlprofilerdata.cpp" diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index f4d11caca4..0bff754e4c 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -86,7 +86,7 @@ void RenderStatistics::updateStats() void RenderStatistics::printTotalStats() { - int count = timePerFrame.count(); + int count = timePerFrame.size(); if (count == 0) return; @@ -311,7 +311,7 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory) if (dummyData) { fprintf(stderr, "Loaded dummy data: %s\n", qPrintable(dir.filePath(qml))); - qml.truncate(qml.length()-4); + qml.truncate(qml.size()-4); engine.rootContext()->setContextProperty(qml, dummyData); dummyData->setParent(&engine); } diff --git a/tools/qmltc/qmltccommandlineutils.cpp b/tools/qmltc/qmltccommandlineutils.cpp index d6c6a9242c..e3f6b4d3b7 100644 --- a/tools/qmltc/qmltccommandlineutils.cpp +++ b/tools/qmltc/qmltccommandlineutils.cpp @@ -43,7 +43,7 @@ QString loadUrl(const QString &url) } QByteArray data(fi.size(), Qt::Uninitialized); - if (f.read(data.data(), data.length()) != data.length()) { + if (f.read(data.data(), data.size()) != data.size()) { fprintf(stderr, "Unable to read \"%s\": %s.\n", qPrintable(QDir::toNativeSeparators(fi.absoluteFilePath())), qPrintable(f.errorString())); |
