aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-05 07:29:16 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-07 23:38:48 +0200
commit958cd3ee1094a068b6d0ff27c73a4b3caff088ad (patch)
tree6d3816fedf5dab2307675fd6ef70d39758e246f5 /src
parente8e03215654ca730243336a80453cf9396cbdf58 (diff)
Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/masm/yarr/YarrInterpreter.cpp4
-rw-r--r--src/3rdparty/masm/yarr/YarrParser.h2
-rw-r--r--src/labs/folderlistmodel/qquickfolderlistmodel.cpp2
-rw-r--r--src/labs/models/qqmldelegatecomponent.cpp4
-rw-r--r--src/labs/models/qqmltablemodel.cpp2
-rw-r--r--src/labs/platform/qquicklabsplatformfiledialog.cpp2
-rw-r--r--src/labs/platform/qquicklabsplatformmenu.cpp8
-rw-r--r--src/labs/platform/qquicklabsplatformmenubar.cpp6
-rw-r--r--src/labs/platform/qquicklabsplatformmenuitemgroup.cpp2
-rw-r--r--src/labs/platform/widgets/qwidgetplatformfiledialog.cpp2
-rw-r--r--src/labs/platform/widgets/qwidgetplatformmenu.cpp2
-rw-r--r--src/labs/wavefrontmesh/qwavefrontmesh.cpp4
-rw-r--r--src/particles/qquickimageparticle.cpp10
-rw-r--r--src/particles/qquickmaskextruder.cpp4
-rw-r--r--src/particles/qquickparticlesystem.cpp8
-rw-r--r--src/particles/qquicktrailemitter.cpp2
-rw-r--r--src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp4
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp18
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp8
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp4
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp12
-rw-r--r--src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp4
-rw-r--r--src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_preview/qqmlpreviewhandler.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp4
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp14
-rw-r--r--src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_server/qqmldebugserverfactory.cpp6
-rw-r--r--src/qml/animations/qabstractanimationjob.cpp4
-rw-r--r--src/qml/animations/qabstractanimationjob_p.h2
-rw-r--r--src/qml/common/qqmljsfixedpoolarray_p.h4
-rw-r--r--src/qml/common/qqmltranslation.cpp2
-rw-r--r--src/qml/common/qv4compileddata_p.h4
-rw-r--r--src/qml/common/qv4stringtoarrayindex_p.h2
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp24
-rw-r--r--src/qml/compiler/qv4codegen.cpp6
-rw-r--r--src/qml/compiler/qv4compiler.cpp28
-rw-r--r--src/qml/compiler/qv4compilercontext.cpp8
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp2
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h2
-rw-r--r--src/qml/debugger/qqmldebugconnector.cpp2
-rw-r--r--src/qml/jsapi/qjsengine.cpp2
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4engine.cpp12
-rw-r--r--src/qml/jsruntime/qv4engine_p.h2
-rw-r--r--src/qml/jsruntime/qv4executableallocator_p.h4
-rw-r--r--src/qml/jsruntime/qv4executablecompilationunit.cpp2
-rw-r--r--src/qml/jsruntime/qv4function.cpp2
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp14
-rw-r--r--src/qml/jsruntime/qv4identifiertable.cpp6
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4module.cpp2
-rw-r--r--src/qml/jsruntime/qv4object.cpp2
-rw-r--r--src/qml/jsruntime/qv4propertykey.cpp2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp10
-rw-r--r--src/qml/jsruntime/qv4regexp.cpp12
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp18
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp4
-rw-r--r--src/qml/jsruntime/qv4stringiterator.cpp2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp58
-rw-r--r--src/qml/memory/qv4mm.cpp2
-rw-r--r--src/qml/parser/qqmljslexer.cpp4
-rw-r--r--src/qml/qml/ftw/qhashedstring_p.h8
-rw-r--r--src/qml/qml/ftw/qstringhash_p.h4
-rw-r--r--src/qml/qml/qqmlbuiltinfunctions.cpp6
-rw-r--r--src/qml/qml/qqmlcomponent.cpp6
-rw-r--r--src/qml/qml/qqmlcontext_p.h2
-rw-r--r--src/qml/qml/qqmlcustomparser.cpp4
-rw-r--r--src/qml/qml/qqmldatablob.cpp12
-rw-r--r--src/qml/qml/qqmlengine.cpp14
-rw-r--r--src/qml/qml/qqmlerror.cpp4
-rw-r--r--src/qml/qml/qqmlfile.cpp28
-rw-r--r--src/qml/qml/qqmlimport.cpp30
-rw-r--r--src/qml/qml/qqmlirloader.cpp10
-rw-r--r--src/qml/qml/qqmllocale.cpp4
-rw-r--r--src/qml/qml/qqmlmetatype.cpp6
-rw-r--r--src/qml/qml/qqmlmetatypedata.cpp14
-rw-r--r--src/qml/qml/qqmlnotifier.cpp4
-rw-r--r--src/qml/qml/qqmlopenmetaobject.cpp20
-rw-r--r--src/qml/qml/qqmlpluginimporter.cpp2
-rw-r--r--src/qml/qml/qqmlproperty.cpp16
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp18
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h4
-rw-r--r--src/qml/qml/qqmlpropertycachecreator.cpp2
-rw-r--r--src/qml/qml/qqmlpropertycachevector_p.h4
-rw-r--r--src/qml/qml/qqmlpropertyresolver.cpp2
-rw-r--r--src/qml/qml/qqmlscriptblob.cpp4
-rw-r--r--src/qml/qml/qqmlscriptdata.cpp4
-rw-r--r--src/qml/qml/qqmlscriptstring.cpp2
-rw-r--r--src/qml/qml/qqmltype.cpp20
-rw-r--r--src/qml/qml/qqmltypecompiler.cpp26
-rw-r--r--src/qml/qml/qqmltypecompiler_p.h2
-rw-r--r--src/qml/qml/qqmltypedata.cpp12
-rw-r--r--src/qml/qml/qqmltypeloader.cpp8
-rw-r--r--src/qml/qml/qqmltypemodule.cpp2
-rw-r--r--src/qml/qml/qqmltypenamecache.cpp4
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp26
-rw-r--r--src/qml/qmldirparser/qqmldirparser.cpp6
-rw-r--r--src/qml/qmldirparser/qqmlimportresolver.cpp4
-rw-r--r--src/qml/types/qqmlbind.cpp10
-rw-r--r--src/qml/types/qqmlconnections.cpp6
-rw-r--r--src/qml/util/qqmlpropertymap.cpp2
-rw-r--r--src/qmlcompiler/qqmljsbasicblocks.cpp12
-rw-r--r--src/qmlcompiler/qqmljscodegenerator.cpp8
-rw-r--r--src/qmlcompiler/qqmljscompilepass_p.h6
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp6
-rw-r--r--src/qmlcompiler/qqmljsfunctioninitializer.cpp6
-rw-r--r--src/qmlcompiler/qqmljsimporter.cpp2
-rw-r--r--src/qmlcompiler/qqmljsimportvisitor.cpp20
-rw-r--r--src/qmlcompiler/qqmljslinter.cpp4
-rw-r--r--src/qmlcompiler/qqmljsloadergenerator.cpp8
-rw-r--r--src/qmlcompiler/qqmljslogger.cpp6
-rw-r--r--src/qmlcompiler/qqmljsmetatypes_p.h2
-rw-r--r--src/qmlcompiler/qqmljsresourcefilemapper.cpp2
-rw-r--r--src/qmlcompiler/qqmljsscope.cpp6
-rw-r--r--src/qmlcompiler/qqmljsshadowcheck.cpp2
-rw-r--r--src/qmlcompiler/qqmljstypepropagator.cpp22
-rw-r--r--src/qmlcompiler/qqmljstyperesolver.cpp4
-rw-r--r--src/qmlcompiler/qqmljsutils.cpp14
-rw-r--r--src/qmlcompiler/qqmljsutils_p.h2
-rw-r--r--src/qmldebug/qv4debugclient.cpp2
-rw-r--r--src/qmldom/qqmldomastcreator.cpp24
-rw-r--r--src/qmldom/qqmldomcodeformatter.cpp2
-rw-r--r--src/qmldom/qqmldomcomments.cpp10
-rw-r--r--src/qmldom/qqmldomcomments_p.h4
-rw-r--r--src/qmldom/qqmldomelements.cpp28
-rw-r--r--src/qmldom/qqmldomelements_p.h2
-rw-r--r--src/qmldom/qqmldomerrormessage.cpp14
-rw-r--r--src/qmldom/qqmldomexternalitems_p.h6
-rw-r--r--src/qmldom/qqmldomitem.cpp16
-rw-r--r--src/qmldom/qqmldomitem_p.h24
-rw-r--r--src/qmldom/qqmldomlinewriter.cpp12
-rw-r--r--src/qmldom/qqmldomlinewriter_p.h2
-rw-r--r--src/qmldom/qqmldommoduleindex.cpp4
-rw-r--r--src/qmldom/qqmldompath.cpp62
-rw-r--r--src/qmldom/qqmldomscanner.cpp2
-rw-r--r--src/qmldom/qqmldomstringdumper.cpp8
-rw-r--r--src/qmldom/qqmldomtop.cpp16
-rw-r--r--src/qmldom/qqmldomtop_p.h4
-rw-r--r--src/qmldom/qqmldomtypesreader.cpp4
-rw-r--r--src/qmlmodels/qqmladaptormodel.cpp24
-rw-r--r--src/qmlmodels/qqmldelegatemodel.cpp48
-rw-r--r--src/qmlmodels/qqmlinstantiator.cpp18
-rw-r--r--src/qmlmodels/qqmllistmodel.cpp40
-rw-r--r--src/qmlmodels/qqmllistmodel_p_p.h2
-rw-r--r--src/qmlmodels/qqmlobjectmodel.cpp20
-rw-r--r--src/qmlmodels/qqmltableinstancemodel.cpp2
-rw-r--r--src/qmlmodels/qqmltreemodeltotablemodel.cpp38
-rw-r--r--src/qmlmodels/qquickpackage.cpp4
-rw-r--r--src/qmltest/quicktest.cpp6
-rw-r--r--src/qmltest/quicktestevent.cpp6
-rw-r--r--src/qmltest/quicktestresult.cpp2
-rw-r--r--src/qmlworkerscript/qv4serialize.cpp4
-rw-r--r--src/qmlxmllistmodel/qqmlxmllistmodel.cpp16
-rw-r--r--src/quick/accessible/qaccessiblequickitem.cpp24
-rw-r--r--src/quick/accessible/qaccessiblequickview.cpp6
-rw-r--r--src/quick/designer/qqmldesignermetaobject.cpp6
-rw-r--r--src/quick/handlers/qquickdraghandler.cpp2
-rw-r--r--src/quick/handlers/qquickhandlerpoint.cpp2
-rw-r--r--src/quick/handlers/qquickmultipointhandler.cpp6
-rw-r--r--src/quick/handlers/qquickpinchhandler.cpp4
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp2
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h2
-rw-r--r--src/quick/items/qquickdroparea.cpp2
-rw-r--r--src/quick/items/qquickgridview.cpp42
-rw-r--r--src/quick/items/qquickitem.cpp68
-rw-r--r--src/quick/items/qquickitemanimation.cpp2
-rw-r--r--src/quick/items/qquickitemview.cpp46
-rw-r--r--src/quick/items/qquicklistview.cpp72
-rw-r--r--src/quick/items/qquickmousearea.cpp2
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp8
-rw-r--r--src/quick/items/qquickmultipointtoucharea_p.h2
-rw-r--r--src/quick/items/qquickpathview.cpp30
-rw-r--r--src/quick/items/qquickpincharea.cpp20
-rw-r--r--src/quick/items/qquickpositioners.cpp4
-rw-r--r--src/quick/items/qquickrepeater.cpp18
-rw-r--r--src/quick/items/qquickshadereffect.cpp4
-rw-r--r--src/quick/items/qquickshadereffectmesh.cpp2
-rw-r--r--src/quick/items/qquickspriteengine.cpp36
-rw-r--r--src/quick/items/qquickspriteengine_p.h6
-rw-r--r--src/quick/items/qquickspritesequence.cpp2
-rw-r--r--src/quick/items/qquickstateoperations.cpp2
-rw-r--r--src/quick/items/qquicktableview.cpp4
-rw-r--r--src/quick/items/qquicktableview_p_p.h2
-rw-r--r--src/quick/items/qquicktext.cpp20
-rw-r--r--src/quick/items/qquicktextcontrol.cpp8
-rw-r--r--src/quick/items/qquicktextedit.cpp2
-rw-r--r--src/quick/items/qquicktextinput.cpp114
-rw-r--r--src/quick/items/qquicktextinput_p_p.h10
-rw-r--r--src/quick/items/qquicktextnode.cpp2
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp6
-rw-r--r--src/quick/items/qquickwindow.cpp16
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp2
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenodeupdater.cpp4
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture_p.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp14
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterialshader.cpp4
-rw-r--r--src/quick/scenegraph/coreapi/qsgrhivisualizer.cpp4
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp12
-rw-r--r--src/quick/scenegraph/qsgcontextplugin.cpp2
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode.cpp14
-rw-r--r--src/quick/scenegraph/qsgrhidistancefieldglyphcache.cpp2
-rw-r--r--src/quick/scenegraph/qsgrhidistancefieldglyphcache_p.h2
-rw-r--r--src/quick/scenegraph/qsgrhishadereffectnode.cpp16
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp2
-rw-r--r--src/quick/util/qquickanimation.cpp26
-rw-r--r--src/quick/util/qquickapplication.cpp4
-rw-r--r--src/quick/util/qquickdeliveryagent.cpp28
-rw-r--r--src/quick/util/qquickglobal.cpp2
-rw-r--r--src/quick/util/qquickpath.cpp44
-rw-r--r--src/quick/util/qquickpixmapcache.cpp12
-rw-r--r--src/quick/util/qquickpropertychanges.cpp10
-rw-r--r--src/quick/util/qquickshortcut.cpp4
-rw-r--r--src/quick/util/qquickstate.cpp8
-rw-r--r--src/quick/util/qquickstategroup.cpp28
-rw-r--r--src/quick/util/qquickstyledtext.cpp30
-rw-r--r--src/quick/util/qquicksvgparser.cpp2
-rw-r--r--src/quick/util/qquicktimeline.cpp2
-rw-r--r--src/quick/util/qquicktransition.cpp8
-rw-r--r--src/quick/util/qquickvaluetypes.cpp4
-rw-r--r--src/quickcontrols2impl/qquickimageselector.cpp12
-rw-r--r--src/quickcontrols2impl/qquickmnemoniclabel.cpp2
-rw-r--r--src/quickcontrols2impl/qquickninepatchimage.cpp16
-rw-r--r--src/quickcontrolstestutils/controlstestutils.cpp4
-rw-r--r--src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp2
-rw-r--r--src/quickdialogs2/quickdialogs2quickimpl/qquickfontdialogimpl.cpp6
-rw-r--r--src/quicklayouts/qquickgridlayoutengine_p.h2
-rw-r--r--src/quicklayouts/qquickstacklayout.cpp2
-rw-r--r--src/quickshapes/qquickshape.cpp4
-rw-r--r--src/quickshapes/qquickshapegenericrenderer.cpp10
-rw-r--r--src/quickshapes/qquickshapesoftwarerenderer.cpp4
-rw-r--r--src/quicktemplates2/accessible/qaccessiblequickpage.cpp2
-rw-r--r--src/quicktemplates2/qquickactiongroup.cpp2
-rw-r--r--src/quicktemplates2/qquickbuttongroup.cpp2
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp8
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp2
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp2
-rw-r--r--src/quicktemplates2/qquickmenu.cpp4
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp2
-rw-r--r--src/quicktemplates2/qquickpane.cpp4
-rw-r--r--src/quicktemplates2/qquickstackview.cpp24
-rw-r--r--src/quicktemplates2/qquickstackview_p.cpp4
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp2
-rw-r--r--src/quicktestutils/qml/testhttpserver.cpp10
-rw-r--r--src/quicktestutils/quick/viewtestutils.cpp30
-rw-r--r--src/quicktestutils/quick/visualtestutils.cpp4
-rw-r--r--src/quicktestutils/quick/visualtestutils_p.h6
251 files changed, 1224 insertions, 1224 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/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 ed7ebf9de3..2c9d93bc87 100644
--- a/src/labs/platform/qquicklabsplatformmenubar.cpp
+++ b/src/labs/platform/qquicklabsplatformmenubar.cpp
@@ -153,7 +153,7 @@ void QQuickLabsPlatformMenuBar::setWindow(QWindow *window)
*/
void QQuickLabsPlatformMenuBar::addMenu(QQuickLabsPlatformMenu *menu)
{
- insertMenu(m_menus.count(), menu);
+ insertMenu(m_menus.size(), menu);
}
/*!
@@ -256,7 +256,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)
@@ -280,7 +280,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 1db01a5e79..826da9a816 100644
--- a/src/labs/platform/widgets/qwidgetplatformmenu.cpp
+++ b/src/labs/platform/widgets/qwidgetplatformmenu.cpp
@@ -38,7 +38,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/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..3c42517908 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();
}
@@ -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];
}
@@ -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/qqmltranslation.cpp b/src/qml/common/qqmltranslation.cpp
index ed598f104a..6230bd93be 100644
--- a/src/qml/common/qqmltranslation.cpp
+++ b/src/qml/common/qqmltranslation.cpp
@@ -61,7 +61,7 @@ QString QQmlTranslation::contextFromQmlFilename(const QString &qmlFilename)
{
int lastSlash = qmlFilename.lastIndexOf(QLatin1Char('/'));
QStringView contextView = (lastSlash > -1)
- ? QStringView{ qmlFilename }.mid(lastSlash + 1, qmlFilename.length() - lastSlash - 5)
+ ? QStringView{ qmlFilename }.mid(lastSlash + 1, qmlFilename.size() - lastSlash - 5)
: QStringView();
return contextView.toString();
}
diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h
index 45ce45934e..d9cd4ce569 100644
--- a/src/qml/common/qv4compileddata_p.h
+++ b/src/qml/common/qv4compileddata_p.h
@@ -231,7 +231,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;
}
};
@@ -587,7 +587,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/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index 59db9bd43a..539d3a7a6e 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -456,9 +456,9 @@ bool IRBuilder::generateFromQml(const QString &code, const QString &url, Documen
bool IRBuilder::isSignalPropertyName(const QString &name)
{
- if (name.length() < 3) return false;
+ if (name.size() < 3) return false;
if (!name.startsWith(QLatin1String("on"))) return false;
- int ns = name.length();
+ int ns = name.size();
for (int i = 2; i < ns; ++i) {
const QChar curr = name.at(i);
if (curr.unicode() == '_') continue;
@@ -604,7 +604,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiArrayBinding *node)
memberList.append(member);
member = member->next;
}
- for (int i = memberList.count() - 1; i >= 0; --i) {
+ for (int i = memberList.size() - 1; i >= 0; --i) {
member = memberList.at(i);
QQmlJS::AST::UiObjectDefinition *def = QQmlJS::AST::cast<QQmlJS::AST::UiObjectDefinition*>(member->member);
@@ -732,7 +732,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiImport *node)
// Check for script qualifier clashes
bool isScript = import->type == QV4::CompiledData::Import::ImportScript;
- for (int ii = 0; ii < _imports.count(); ++ii) {
+ for (int ii = 0; ii < _imports.size(); ++ii) {
const QV4::CompiledData::Import *other = _imports.at(ii);
bool otherIsScript = other->type == QV4::CompiledData::Import::ImportScript;
@@ -1365,13 +1365,13 @@ bool IRBuilder::appendAlias(QQmlJS::AST::UiPublicMember *node)
COMPILE_EXCEPTION(rhsLoc, tr("Invalid alias reference. An alias reference must be specified as <id>, <id>.<property> or <id>.<value property>.<property>"));
}
- if (aliasReference.count() < 1 || aliasReference.count() > 3)
+ if (aliasReference.size() < 1 || aliasReference.size() > 3)
COMPILE_EXCEPTION(rhsLoc, tr("Invalid alias reference. An alias reference must be specified as <id>, <id>.<property> or <id>.<value property>.<property>"));
alias->setIdIndex(registerString(aliasReference.first()));
QString propertyValue = aliasReference.value(1);
- if (aliasReference.count() == 3)
+ if (aliasReference.size() == 3)
propertyValue += QLatin1Char('.') + aliasReference.at(2);
alias->propertyNameIndex = registerString(propertyValue);
@@ -1639,8 +1639,8 @@ void QmlUnitGenerator::generate(Document &output, const QV4::CompiledData::Depen
// No more new strings after this point, we're calculating offsets.
output.jsGenerator.stringTable.freeze();
- const uint importSize = uint(sizeof(QV4::CompiledData::Import)) * output.imports.count();
- const uint objectOffsetTableSize = output.objects.count() * uint(sizeof(quint32));
+ const uint importSize = uint(sizeof(QV4::CompiledData::Import)) * output.imports.size();
+ const uint objectOffsetTableSize = output.objects.size() * uint(sizeof(quint32));
QHash<const Object*, quint32> objectOffsets;
@@ -1668,9 +1668,9 @@ void QmlUnitGenerator::generate(Document &output, const QV4::CompiledData::Depen
memset(data, 0, totalSize);
QV4::CompiledData::QmlUnit *qmlUnit = reinterpret_cast<QV4::CompiledData::QmlUnit *>(data);
qmlUnit->offsetToImports = sizeof(*qmlUnit);
- qmlUnit->nImports = output.imports.count();
+ qmlUnit->nImports = output.imports.size();
qmlUnit->offsetToObjects = objectOffset;
- qmlUnit->nObjects = output.objects.count();
+ qmlUnit->nObjects = output.objects.size();
// write imports
char *importPtr = data + qmlUnit->offsetToImports;
@@ -1682,7 +1682,7 @@ void QmlUnitGenerator::generate(Document &output, const QV4::CompiledData::Depen
// write objects
quint32_le *objectTable = reinterpret_cast<quint32_le*>(data + qmlUnit->offsetToObjects);
- for (int i = 0; i < output.objects.count(); ++i) {
+ for (int i = 0; i < output.objects.size(); ++i) {
const Object *o = output.objects.at(i);
char * const objectPtr = data + objectOffsets.value(o);
*objectTable++ = objectOffsets.value(o);
@@ -1926,7 +1926,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(
_context = nullptr;
- for (int i = 0; i < functions.count(); ++i) {
+ for (int i = 0; i < functions.size(); ++i) {
const CompiledFunctionOrExpression &qmlFunction = functions.at(i);
QQmlJS::AST::Node *node = qmlFunction.node;
Q_ASSERT(node != document->program);
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 995038e95c..9b0efcba41 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -3257,7 +3257,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, AST::FormalPara
_context->name = name.isEmpty() ? currentExpr().result().name : name;
_module->functions.append(_context);
- _context->functionIndex = _module->functions.count() - 1;
+ _context->functionIndex = _module->functions.size() - 1;
Context *savedFunctionContext = _functionContext;
_functionContext = _context;
@@ -3266,7 +3266,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, AST::FormalPara
if (_context->contextType == ContextType::Global || _context->contextType == ContextType::ScriptImportedByQML) {
_module->blocks.append(_context);
- _context->blockIndex = _module->blocks.count() - 1;
+ _context->blockIndex = _module->blocks.size() - 1;
}
if (_module->debugMode) // allow the debugger to see overwritten arguments
_context->argumentsCanEscape = true;
@@ -3307,7 +3307,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, AST::FormalPara
// register the lexical scope for global code
if (!_context->parent && _context->requiresExecutionContext) {
_module->blocks.append(_context);
- _context->blockIndex = _module->blocks.count() - 1;
+ _context->blockIndex = _module->blocks.size() - 1;
}
TailCallBlocker maybeBlockTailCalls(this, _context->canHaveTailCalls());
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 2dad207087..1f4deeca97 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);
@@ -327,12 +327,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));
}
{
@@ -602,7 +602,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);
@@ -617,7 +617,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);
@@ -626,7 +626,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);
@@ -639,16 +639,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));
@@ -710,7 +710,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 d203059bd9..a8f9e6b454 100644
--- a/src/qml/compiler/qv4compilercontext.cpp
+++ b/src/qml/compiler/qv4compilercontext.cpp
@@ -148,7 +148,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;
@@ -181,7 +181,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) {
@@ -361,7 +361,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());
@@ -376,7 +376,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 1c235755fb..61042607c9 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -837,7 +837,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/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 6f00ae7b6e..cbab5a239a 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -339,7 +339,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 7934fe6779..2800590712 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -954,13 +954,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();
}
@@ -1862,11 +1862,11 @@ QV4::ReturnedValue ExecutionEngine::fromData(QMetaType metaType, const void *ptr
// 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))
@@ -2327,7 +2327,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 aa4a6bacd9..e6471e796d 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -705,7 +705,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/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h
index de9c0c7cd5..2f97c9ae6e 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 0a3033a567..c355e064d4 100644
--- a/src/qml/jsruntime/qv4executablecompilationunit.cpp
+++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp
@@ -935,7 +935,7 @@ QString ExecutableCompilationUnit::translateFrom(TranslationDataIndex index) con
const QString &path = fileName();
int lastSlash = path.lastIndexOf(QLatin1Char('/'));
QStringView context = (lastSlash > -1)
- ? QStringView{ path }.mid(lastSlash + 1, path.length() - lastSlash - 5)
+ ? 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 666bd3a0de..e03c85d382 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -114,7 +114,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 &param = parameters.at(i);
int duplicate = -1;
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index 5357b72477..32e93cedb4 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -29,7 +29,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) {
@@ -60,9 +60,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)) {
@@ -110,7 +110,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);
@@ -184,8 +184,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) {
@@ -378,7 +378,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 592e9079f1..4643195cfd 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -634,7 +634,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) {
@@ -884,7 +884,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 77325580d3..d1e9b97307 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -1130,7 +1130,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 ef8c8c76d6..e5e7e7b3cb 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1401,8 +1401,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());
@@ -2179,11 +2179,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 1b62717efc..acb9f0acfc 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -46,7 +46,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();
@@ -144,7 +144,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());
}
@@ -168,7 +168,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];
@@ -230,7 +230,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)) {
@@ -380,7 +380,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());
}
@@ -516,7 +516,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;
@@ -605,7 +605,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()));
@@ -657,7 +657,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);
@@ -784,7 +784,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 01ee03bddc..71446ca746 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -388,7 +388,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();
@@ -638,7 +638,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 614171503e..40d1f9bfaf 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 = 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 = 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();
- double pos = value.length();
+ double pos = value.size();
if (argc > 1)
pos = 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.0), double(value.length())));
+ index = value.indexOf(searchString, qMin(qMax(pos, 0.0), double(value.size())));
return Encode(index);
}
@@ -470,7 +470,7 @@ ReturnedValue StringPrototype::method_includes(const FunctionObject *b, const Va
const Value &posArg = argv[1];
pos = 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->length() + 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 717c59cb26..8e41dc8e3d 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -940,7 +940,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);
diff --git a/src/qml/parser/qqmljslexer.cpp b/src/qml/parser/qqmljslexer.cpp
index 4fbc5b106f..e0a20b00d2 100644
--- a/src/qml/parser/qqmljslexer.cpp
+++ b/src/qml/parser/qqmljslexer.cpp
@@ -68,7 +68,7 @@ void Lexer::setCode(const QString &code, int lineno, bool qmlMode,
Lexer::CodeContinuation codeContinuation)
{
if (codeContinuation == Lexer::CodeContinuation::Continue)
- _currentOffset += _code.length();
+ _currentOffset += _code.size();
else
_currentOffset = 0;
if (_engine)
@@ -85,7 +85,7 @@ void Lexer::setCode(const QString &code, int lineno, bool qmlMode,
_rawString = QStringView();
_codePtr = code.unicode();
- _endPtr = _codePtr + code.length();
+ _endPtr = _codePtr + code.size();
_tokenStartPtr = _codePtr;
if (lineno >= 0)
diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h
index 9beaffc2ae..ae61ca0c83 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;
}
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/qqmlbuiltinfunctions.cpp b/src/qml/qml/qqmlbuiltinfunctions.cpp
index b8c65a5d15..f18885b0cb 100644
--- a/src/qml/qml/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/qqmlbuiltinfunctions.cpp
@@ -1149,7 +1149,7 @@ QObject *QtObject::createQmlObject(const QString &qml, QObject *parent, const QU
QV4::ScopedObject qmlerror(scope);
QV4::ScopedString s(scope);
QV4::ScopedValue v(scope);
- for (int ii = 0; ii < errors.count(); ++ii) {
+ for (int ii = 0; ii < errors.size(); ++ii) {
const QQmlError &error = errors.at(ii);
errorstr += QLatin1String("\n ") + error.toString();
qmlerror = v4->newObject();
@@ -1225,7 +1225,7 @@ QObject *QtObject::createQmlObject(const QString &qml, QObject *parent, const QU
obj->setParent(parent);
QList<QQmlPrivate::AutoParentFunction> functions = QQmlMetaType::parentFunctions();
- for (int ii = 0; ii < functions.count(); ++ii) {
+ for (int ii = 0; ii < functions.size(); ++ii) {
if (QQmlPrivate::Parented == functions.at(ii)(obj, parent))
break;
}
@@ -1517,7 +1517,7 @@ static QString jsStack(QV4::ExecutionEngine *engine) {
QVector<QV4::StackFrame> stackTrace = engine->stackTrace(10);
- for (int i = 0; i < stackTrace.count(); i++) {
+ for (int i = 0; i < stackTrace.size(); i++) {
const QV4::StackFrame &frame = stackTrace.at(i);
QString stackFrame;
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index b980d0e3af..cfc3047356 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -349,7 +349,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)
@@ -1367,7 +1367,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;
@@ -1445,7 +1445,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_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 d02ec4c5a8..dda5897fd8 100644
--- a/src/qml/qml/qqmldatablob.cpp
+++ b/src/qml/qml/qqmldatablob.cpp
@@ -256,7 +256,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;
@@ -271,7 +271,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();
@@ -506,7 +506,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));
@@ -517,7 +517,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(),
@@ -536,7 +536,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;
@@ -579,7 +579,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/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 8f1a7b10b8..b62c2ecb31 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -306,12 +306,12 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in
auto ev = std::make_unique<QMetaCallEvent>(m.methodIndex(), 0, nullptr,
object, index,
- parameterTypes.count() + 1);
+ parameterTypes.size() + 1);
void **args = ev->args();
QMetaType *types = ev->types();
- for (int ii = 0; ii < parameterTypes.count(); ++ii) {
+ for (int ii = 0; ii < parameterTypes.size(); ++ii) {
const QByteArray &typeName = parameterTypes.at(ii);
if (typeName.endsWith('*'))
types[ii + 1] = QMetaType(QMetaType::VoidStar);
@@ -1385,7 +1385,7 @@ static void dumpwarning(const QQmlError &error)
static void dumpwarning(const QList<QQmlError> &errors)
{
- for (int ii = 0; ii < errors.count(); ++ii)
+ for (int ii = 0; ii < errors.size(); ++ii)
dumpwarning(errors.at(ii));
}
@@ -1764,7 +1764,7 @@ void QQmlEnginePrivate::executeRuntimeFunction(const QV4::ExecutableCompilationU
int argc, void **args, QMetaType *types)
{
Q_ASSERT(unit);
- Q_ASSERT((functionIndex >= 0) && (functionIndex < unit->runtimeFunctions.length()));
+ Q_ASSERT((functionIndex >= 0) && (functionIndex < unit->runtimeFunctions.size()));
Q_ASSERT(thisObject);
QQmlData *ddata = QQmlData::get(thisObject);
@@ -1831,15 +1831,15 @@ QQmlEnginePrivate::createInternalContext(const QQmlRefPointer<QV4::ExecutableCom
context->setImports(unit->typeNameCache);
context->initFromTypeCompilationUnit(unit, subComponentIndex);
- if (isComponentRoot && unit->dependentScripts.count()) {
+ if (isComponentRoot && unit->dependentScripts.size()) {
QV4::ExecutionEngine *v4 = v4engine();
Q_ASSERT(v4);
QV4::Scope scope(v4);
- QV4::ScopedObject scripts(scope, v4->newArrayObject(unit->dependentScripts.count()));
+ QV4::ScopedObject scripts(scope, v4->newArrayObject(unit->dependentScripts.size()));
context->setImportedScripts(QV4::PersistentValue(v4, scripts.asReturnedValue()));
QV4::ScopedValue v(scope);
- for (int i = 0; i < unit->dependentScripts.count(); ++i) {
+ for (int i = 0; i < unit->dependentScripts.size(); ++i) {
QQmlRefPointer<QQmlScriptData> s = unit->dependentScripts.at(i);
scripts->put(i, (v = s->scriptValueForContext(context)));
}
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp
index f15f7a474e..415f8748f5 100644
--- a/src/qml/qml/qqmlerror.cpp
+++ b/src/qml/qml/qqmlerror.cpp
@@ -294,13 +294,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 9711079d15..d28842a120 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;
}
@@ -1554,7 +1554,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));
}
};
@@ -1570,7 +1570,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));
}
};
@@ -1617,7 +1617,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 {
@@ -1651,7 +1651,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/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 039544b1f2..372cd7a9c4 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -352,7 +352,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;
@@ -414,7 +414,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 8dfab49978..1ee87713a6 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -328,7 +328,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)
@@ -396,7 +396,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\""));
@@ -1156,7 +1156,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);
}
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 &currentType = 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 bee89f0304..9796c57390 100644
--- a/src/qml/qml/qqmlpluginimporter.cpp
+++ b/src/qml/qml/qqmlpluginimporter.cpp
@@ -96,7 +96,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(
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 9f5703a3c3..8f1e32b573 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -245,7 +245,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()
@@ -261,7 +261,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?
@@ -317,7 +317,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
@@ -371,7 +371,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);
@@ -389,7 +389,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;
@@ -750,7 +750,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();
@@ -1545,7 +1545,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;
@@ -1891,7 +1891,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 c7eed14593..2b029a583c 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -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));
@@ -267,7 +267,7 @@ void QQmlPropertyCache::appendMethod(const QString &name, QQmlPropertyData::Flag
const QList<QByteArray> &names,
const QVector<QMetaType> &parameterTypes)
{
- int argumentCount = names.count();
+ int argumentCount = names.size();
QQmlPropertyData data;
data.setPropType(returnType);
@@ -743,7 +743,7 @@ QString QQmlPropertyCache::signalParameterStringForJS(QV4::ExecutionEngine *engi
const QSet<QString> &illegalNames = engine->illegalNames();
QString parameters;
- const qsizetype count = parameterNameList.count();
+ const qsizetype count = parameterNameList.size();
if (count > std::numeric_limits<quint16>::max())
*errorString = QCoreApplication::translate("QQmlRewrite", "Signal has an excessive number of parameters: %1").arg(count);
@@ -980,13 +980,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.count());
+ Q_ASSERT(methods.size() == methodIndexCache.count());
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;
@@ -1005,7 +1005,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;
@@ -1044,11 +1044,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..7677735f99 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -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));
@@ -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/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/qqmlscriptblob.cpp b/src/qml/qml/qqmlscriptblob.cpp
index 74003133c0..4ea3816ed4 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 43e6b53dab..1a6a8157d0 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 dd2fd62a52..57b5c15806 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);
@@ -855,7 +855,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;
@@ -872,7 +872,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;
@@ -890,11 +890,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;
}
@@ -915,7 +915,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 28d73d7cb1..dbf7717b72 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, &notInRevision);
@@ -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;
@@ -951,7 +951,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();
@@ -997,7 +997,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);
}
@@ -1416,7 +1416,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 5848620352..82fe5f23de 100644
--- a/src/qml/qml/qqmltypedata.cpp
+++ b/src/qml/qml/qqmltypedata.cpp
@@ -293,7 +293,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()) {
@@ -350,7 +350,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()) {
@@ -483,8 +483,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);
@@ -600,7 +600,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());
@@ -724,7 +724,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 4877a56a40..1780879755 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -1033,7 +1033,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) {
@@ -1046,7 +1046,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;
@@ -1132,7 +1132,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));
@@ -1169,7 +1169,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..35e6e72544 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()) {
diff --git a/src/qml/qml/qqmltypenamecache.cpp b/src/qml/qml/qqmltypenamecache.cpp
index 3823bf139f..7d3c81cfd7 100644
--- a/src/qml/qml/qqmltypenamecache.cpp
+++ b/src/qml/qml/qqmltypenamecache.cpp
@@ -7,7 +7,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);
@@ -26,7 +26,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/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 144c1a73b8..e9059e53dc 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -503,7 +503,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();
@@ -525,9 +525,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));
@@ -665,7 +665,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)
@@ -858,7 +858,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));
@@ -872,10 +872,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;
@@ -901,7 +901,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));
@@ -912,7 +912,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);
}
@@ -1137,7 +1137,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);
@@ -1201,7 +1201,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;
}
@@ -1446,7 +1446,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;
@@ -1479,7 +1479,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 522dc48c92..a01622f25f 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 c2fd8c9a03..b124c3bfec 100644
--- a/src/qmlcompiler/qqmljscodegenerator.cpp
+++ b/src/qmlcompiler/qqmljscodegenerator.cpp
@@ -103,7 +103,7 @@ QQmlJSAotFunction QQmlJSCodeGenerator::run(
auto &currentRegisterNames = 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);
@@ -2646,7 +2646,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/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index 1cc02abe25..ef7c5b86b2 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -124,7 +124,7 @@ static bool checkArgumentsObjectUseInSignalHandlers(const QmlIR::Document &doc,
continue;
const QString propName = doc.stringAt(binding->propertyNameIndex);
if (!propName.startsWith(QLatin1String("on"))
- || propName.length() < 3
+ || propName.size() < 3
|| !propName.at(2).isUpper())
continue;
auto compiledFunction = doc.jsModule.functions.value(object->runtimeFunctionIndices.at(binding->value.compiledScriptIndex));
@@ -289,7 +289,7 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName,
break;
}
- Q_ASSERT(quint32(functionsToCompile.length()) > binding->value.compiledScriptIndex);
+ Q_ASSERT(quint32(functionsToCompile.size()) > binding->value.compiledScriptIndex);
const auto &functionToCompile
= functionsToCompile[binding->value.compiledScriptIndex];
auto *parentNode = functionToCompile.parentNode;
@@ -326,7 +326,7 @@ bool qCompileQmlFile(QmlIR::Document &irDocument, const QString &inputFileName,
<< irDocument.stringAt(binding->propertyNameIndex);
result = aotCompiler->compileBinding(context, *binding, node);
} else if (const auto *function = bindingOrFunction.function()) {
- Q_ASSERT(quint32(functionsToCompile.length()) > function->index);
+ Q_ASSERT(quint32(functionsToCompile.size()) > function->index);
auto *node = functionsToCompile[function->index].node;
Q_ASSERT(node);
Q_ASSERT(contextMap.contains(node));
diff --git a/src/qmlcompiler/qqmljsfunctioninitializer.cpp b/src/qmlcompiler/qqmljsfunctioninitializer.cpp
index 30aada368e..d64778af63 100644
--- a/src/qmlcompiler/qqmljsfunctioninitializer.cpp
+++ b/src/qmlcompiler/qqmljsfunctioninitializer.cpp
@@ -87,7 +87,7 @@ void QQmlJSFunctionInitializer::populateSignature(
}
}
} else {
- for (qsizetype i = 0, end = arguments.length(); i != end; ++i) {
+ for (qsizetype i = 0, end = arguments.size(); i != end; ++i) {
const QQmlJS::AST::BoundName &argument = arguments[i];
if (argument.typeAnnotation) {
if (const auto type = m_typeResolver->typeFromAST(argument.typeAnnotation->type)) {
@@ -111,7 +111,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())));
@@ -166,7 +166,7 @@ QQmlJSCompilePass::Function QQmlJSFunctionInitializer::run(
if (method.methodType() == QQmlJSMetaMethod::Signal) {
function.isSignalHandler = true;
const auto argumentTypes = method.parameterTypes();
- for (qsizetype i = 0, end = argumentTypes.length(); i < end; ++i) {
+ for (qsizetype i = 0, end = argumentTypes.size(); i < end; ++i) {
const auto &type = argumentTypes[i];
if (type.isNull()) {
diagnose(u"Cannot resolve the argument type %1."_s
diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp
index 244b8119e9..d01fb78f5a 100644
--- a/src/qmlcompiler/qqmljsimporter.cpp
+++ b/src/qmlcompiler/qqmljsimporter.cpp
@@ -694,7 +694,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 64bfc042e3..695847c553 100644
--- a/src/qmlcompiler/qqmljsimportvisitor.cpp
+++ b/src/qmlcompiler/qqmljsimportvisitor.cpp
@@ -289,8 +289,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);
}
}
@@ -549,7 +549,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"),
qmlNonListProperty, it.value().constFirst()->sourceLocation());
@@ -781,7 +781,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) {
@@ -794,8 +794,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()
@@ -972,7 +972,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),
@@ -980,7 +980,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)
@@ -1274,7 +1274,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'\\') {
@@ -1288,7 +1288,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/qqmljslinter.cpp b/src/qmlcompiler/qqmljslinter.cpp
index 7936d8f5e0..150aa4cd87 100644
--- a/src/qmlcompiler/qqmljslinter.cpp
+++ b/src/qmlcompiler/qqmljslinter.cpp
@@ -311,7 +311,7 @@ void QQmlJSLinter::parseComments(QQmlJSLogger *logger,
return;
QSet<QString> currentlyDisabled;
- for (qsizetype i = 1; i <= lines.length(); i++) {
+ for (qsizetype i = 1; i <= lines.size(); i++) {
currentlyDisabled.unite(disablesPerLine[i]).subtract(enablesPerLine[i]);
currentlyDisabled.unite(oneLineDisablesPerLine[i]);
@@ -825,7 +825,7 @@ QQmlJSLinter::FixResult QQmlJSLinter::applyFixes(QString *fixedCode, bool silent
QString after = code.mid(cutLocation + fix.cutLocation.length);
code = before + fix.replacementString + after;
- offsetChange += fix.replacementString.length() - fix.cutLocation.length;
+ offsetChange += fix.replacementString.size() - fix.cutLocation.length;
}
QQmlJS::Engine engine;
diff --git a/src/qmlcompiler/qqmljsloadergenerator.cpp b/src/qmlcompiler/qqmljsloadergenerator.cpp
index 7582eadceb..6e9fabbf60 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 e6266c948b..c49ca97372 100644
--- a/src/qmlcompiler/qqmljslogger.cpp
+++ b/src/qmlcompiler/qqmljslogger.cpp
@@ -315,7 +315,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'));
@@ -370,9 +370,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 1a2f292262..0d7fed5197 100644
--- a/src/qmlcompiler/qqmljsmetatypes_p.h
+++ b/src/qmlcompiler/qqmljsmetatypes_p.h
@@ -162,7 +162,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 0cb21da694..f0b0c92cb2 100644
--- a/src/qmlcompiler/qqmljsscope.cpp
+++ b/src/qmlcompiler/qqmljsscope.cpp
@@ -406,10 +406,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 &paramType = 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 cfc997c6ce..a542175698 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);
@@ -821,7 +821,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;
}
@@ -1192,8 +1192,8 @@ void QQmlJSTypePropagator::propagateCall(
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'));
@@ -1215,7 +1215,7 @@ void QQmlJSTypePropagator::propagateCall(
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));
@@ -1231,7 +1231,7 @@ void QQmlJSTypePropagator::propagateCall(
bool QQmlJSTypePropagator::propagateTranslationMethod(
const QList<QQmlJSMetaMethod> &methods, int argc, int argv)
{
- if (methods.length() != 1)
+ if (methods.size() != 1)
return false;
const QQmlJSMetaMethod method = methods.front();
@@ -2314,12 +2314,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 407a5001d3..4f58cd3aed 100644
--- a/src/qmlcompiler/qqmljstyperesolver.cpp
+++ b/src/qmlcompiler/qqmljstyperesolver.cpp
@@ -74,13 +74,13 @@ 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);
auto arrayMethods = m_jsGlobalObject->methods(u"Array"_s);
- Q_ASSERT(arrayMethods.length() == 1);
+ Q_ASSERT(arrayMethods.size() == 1);
m_arrayType = arrayMethods[0].returnType();
Q_ASSERT(m_arrayType);
}
diff --git a/src/qmlcompiler/qqmljsutils.cpp b/src/qmlcompiler/qqmljsutils.cpp
index 548c86eb67..11df73c1f9 100644
--- a/src/qmlcompiler/qqmljsutils.cpp
+++ b/src/qmlcompiler/qqmljsutils.cpp
@@ -96,7 +96,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
@@ -114,14 +114,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;
@@ -130,7 +130,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;
@@ -138,7 +138,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 25e85ec1a5..4f6508b465 100644
--- a/src/qmlcompiler/qqmljsutils_p.h
+++ b/src/qmlcompiler/qqmljsutils_p.h
@@ -105,7 +105,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 77d4f553a6..6724f3d178 100644
--- a/src/qmldom/qqmldomastcreator.cpp
+++ b/src/qmldom/qqmldomastcreator.cpp
@@ -113,9 +113,9 @@ class QmlDomAstCreator final : public AST::Visitor
template<typename T>
StackEl &currentEl(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)
@@ -135,9 +135,9 @@ class QmlDomAstCreator final : public AST::Visitor
StackEl &currentQmlObjectOrComponentEl(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)
@@ -149,16 +149,16 @@ class QmlDomAstCreator final : public AST::Visitor
StackEl &currentNodeEl(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 &currentNode(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)
@@ -451,7 +451,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);
}
}
@@ -580,7 +580,7 @@ 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) {
@@ -620,7 +620,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();
@@ -807,7 +807,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/qqmldomcodeformatter.cpp b/src/qmldom/qqmldomcodeformatter.cpp
index 5088a28701..91828dfb9e 100644
--- a/src/qmldom/qqmldomcodeformatter.cpp
+++ b/src/qmldom/qqmldomcodeformatter.cpp
@@ -1148,7 +1148,7 @@ void FormatPartialStatus::recalculateWithIndent(int indent)
if (indent >= 0) {
indentOffset = 0;
int i = 0;
- while (i < line.length() && line.at(i).isSpace())
+ while (i < line.size() && line.at(i).isSpace())
++i;
indentOffset = indent - column(i);
}
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 dd9de347fe..e4f85fa3e3 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.cpp b/src/qmldom/qqmldomelements.cpp
index 012aef9acc..44c945ceba 100644
--- a/src/qmldom/qqmldomelements.cpp
+++ b/src/qmldom/qqmldomelements.cpp
@@ -119,7 +119,7 @@ bool Component::iterateDirectSubpaths(DomItem &self, DirectVisitor visitor)
DomItem Component::field(DomItem &self, QStringView name)
{
- switch (name.length()) {
+ switch (name.size()) {
case 4:
if (name == Fields::name)
return self.wrapField(Fields::name, m_name);
@@ -180,7 +180,7 @@ QList<QString> QmlComponent::subComponentsNames(DomItem &self) const
QList<QString> subNames;
for (QString cName : cNames)
if (cName.startsWith(myNameDot)
- && !QStringView(cName).mid(myNameDot.length()).contains(QLatin1Char('.'))
+ && !QStringView(cName).mid(myNameDot.size()).contains(QLatin1Char('.'))
&& !cName.isEmpty())
subNames.append(cName);
std::sort(subNames.begin(), subNames.end());
@@ -873,7 +873,7 @@ void QmlObject::writeOut(DomItem &self, OutWriter &ow, QString onTarget) const
const PropertyDefinition *pDefPtr = pDef.as<PropertyDefinition>();
Q_ASSERT(pDefPtr);
DomItem b;
- bool uniqueDeclarationWithThisName = pDefs.length() == 1;
+ bool uniqueDeclarationWithThisName = pDefs.size() == 1;
if (uniqueDeclarationWithThisName && !pDefPtr->isRequired)
bindings.key(pDef.name()).visitIndexes([&b, pDefPtr](DomItem &el) {
const Binding *elPtr = el.as<Binding>();
@@ -1218,7 +1218,7 @@ Export Export::fromString(Path source, QStringView exp, Path typePath, ErrorHand
int slashIdx = exp.indexOf(QLatin1Char('/'));
int spaceIdx = exp.indexOf(QLatin1Char(' '));
if (spaceIdx == -1)
- spaceIdx = exp.length();
+ spaceIdx = exp.size();
else
res.version = Version::fromString(exp.mid(spaceIdx + 1));
if (!res.version.isValid())
@@ -1613,17 +1613,17 @@ void ScriptExpression::setCode(QString code, QString preCode, QString postCode)
}
if (!preCode.isEmpty() || !postCode.isEmpty())
m_codeStr = preCode + code + postCode;
- m_code = QStringView(m_codeStr).mid(preCode.length(), code.length());
- m_preCode = QStringView(m_codeStr).mid(0, preCode.length());
- m_postCode = QStringView(m_codeStr).mid(preCode.length() + code.length(), postCode.length());
+ m_code = QStringView(m_codeStr).mid(preCode.size(), code.size());
+ m_preCode = QStringView(m_codeStr).mid(0, preCode.size());
+ m_postCode = QStringView(m_codeStr).mid(preCode.size() + code.size(), postCode.size());
m_engine = nullptr;
m_ast = nullptr;
m_localOffset = SourceLocation();
if (!m_code.isEmpty()) {
IndentInfo preChange(m_preCode, 4);
- m_localOffset.offset = m_preCode.length();
- m_localOffset.length = m_code.length();
- m_localOffset.startColumn = preChange.trailingString.length();
+ m_localOffset.offset = m_preCode.size();
+ m_localOffset.length = m_code.size();
+ m_localOffset.startColumn = preChange.trailingString.size();
m_localOffset.startLine = preChange.nNewlines;
m_engine = std::make_shared<QQmlJS::Engine>();
m_astComments = std::make_shared<AstComments>(m_engine);
@@ -1645,8 +1645,8 @@ void ScriptExpression::setCode(QString code, QString preCode, QString postCode)
m_ast = programPtr->statements;
}
if (!m_preCode.isEmpty())
- m_ast = firstNodeInRange(m_ast, m_preCode.length(),
- m_preCode.length() + m_code.length());
+ m_ast = firstNodeInRange(m_ast, m_preCode.size(),
+ m_preCode.size() + m_code.size());
if (m_expressionType != ExpressionType::FunctionBody) {
if (AST::StatementList *sList = AST::cast<AST::StatementList *>(m_ast)) {
if (!sList->next)
@@ -1918,7 +1918,7 @@ void EnumItem::writeOut(DomItem &self, OutWriter &ow) const
QmlUri QmlUri::fromString(const QString &str)
{
if (str.startsWith(u'"'))
- return fromDirectoryString(str.mid(1, str.length() - 2)
+ return fromDirectoryString(str.mid(1, str.size() - 2)
.replace(u"\\\""_s, u"\""_s)
.replace(u"\\\\"_s, u"\\"_s));
else
@@ -1934,7 +1934,7 @@ QmlUri QmlUri::fromUriString(const QString &str)
QmlUri QmlUri::fromDirectoryString(const QString &str)
{
QUrl url(str);
- if (url.isValid() && url.scheme().length() > 1)
+ if (url.isValid() && url.scheme().size() > 1)
return QmlUri(url);
if (!str.isEmpty()) {
QFileInfo path(str);
diff --git a/src/qmldom/qqmldomelements_p.h b/src/qmldom/qqmldomelements_p.h
index 63de812c3c..e00755dcb9 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 3f68ca9ab4..28a656b94d 100644
--- a/src/qmldom/qqmldomexternalitems_p.h
+++ b/src/qmldom/qqmldomexternalitems_p.h
@@ -288,7 +288,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()
@@ -315,7 +315,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);
}
@@ -385,7 +385,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.cpp b/src/qmldom/qqmldomitem.cpp
index 3ba79fbfc0..51a22cad81 100644
--- a/src/qmldom/qqmldomitem.cpp
+++ b/src/qmldom/qqmldomitem.cpp
@@ -1350,7 +1350,7 @@ bool DomItem::visitPrototypeChain(function_ref<bool(DomItem &)> visitor,
.withItem(*this)
.handle(h);
} else {
- if (protos.length() > 1) {
+ if (protos.size() > 1) {
QStringList protoPaths;
for (DomItem &p : protos)
protoPaths.append(p.canonicalPath().toString());
@@ -1646,7 +1646,7 @@ bool DomItem::visitLookup1(QString symbolName, function_ref<bool(DomItem &)> vis
LookupOptions opts, ErrorHandler h, QSet<quintptr> *visited,
QList<Path> *visitedRefs)
{
- bool typeLookupInQmlFile = symbolName.length() > 1 && symbolName.at(0).isUpper()
+ bool typeLookupInQmlFile = symbolName.size() > 1 && symbolName.at(0).isUpper()
&& fileObject().internalKind() == DomType::QmlFile;
if (typeLookupInQmlFile) {
// shortcut to lookup types (scope chain would find them too, but after looking
@@ -1737,7 +1737,7 @@ bool DomItem::visitLookup(QString target, function_ref<bool(DomItem &)> visitor,
case LookupType::Symbol:
case LookupType::Type: {
QStringList subpath = target.split(QChar::fromLatin1('.'));
- if (subpath.length() == 1) {
+ if (subpath.size() == 1) {
return visitLookup1(subpath.first(), visitor, opts, errorHandler, visited, visitedRefs);
} else {
return visitLookup1(
@@ -1746,16 +1746,16 @@ bool DomItem::visitLookup(QString target, function_ref<bool(DomItem &)> visitor,
QVector<ResolveToDo> lookupToDos({ ResolveToDo {
newIt, 1 } }); // invariant: always increase pathIndex to guarantee
// end even with only partial visited match
- QList<QSet<quintptr>> lookupVisited(subpath.length() + 1);
+ QList<QSet<quintptr>> lookupVisited(subpath.size() + 1);
while (!lookupToDos.isEmpty()) {
ResolveToDo tNow = lookupToDos.takeFirst();
auto vNow = qMakePair(tNow.item.id(), tNow.pathIndex);
DomItem subNow = tNow.item;
int iSubPath = tNow.pathIndex;
- Q_ASSERT(iSubPath < subpath.length());
+ Q_ASSERT(iSubPath < subpath.size());
QString subPathNow = subpath[iSubPath++];
DomItem scope = subNow.proceedToScope();
- if (iSubPath < subpath.length()) {
+ if (iSubPath < subpath.size()) {
if (vNow.first != 0) {
if (lookupVisited[vNow.second].contains(vNow.first))
continue;
@@ -3385,7 +3385,7 @@ MutableDomItem MutableDomItem::addPreComment(const Comment &comment, QString reg
MutableDomItem rC = field(Fields::comments);
if (auto rcPtr = rC.mutableAs<RegionComments>()) {
auto &preList = rcPtr->regionComments[regionName].preComments;
- idx = preList.length();
+ idx = preList.size();
preList.append(comment);
MutableDomItem res = path(Path::Field(Fields::comments)
.field(Fields::regionComments)
@@ -3404,7 +3404,7 @@ MutableDomItem MutableDomItem::addPostComment(const Comment &comment, QString re
MutableDomItem rC = field(Fields::comments);
if (auto rcPtr = rC.mutableAs<RegionComments>()) {
auto &postList = rcPtr->regionComments[regionName].postComments;
- idx = postList.length();
+ idx = postList.size();
postList.append(comment);
MutableDomItem res = path(Path::Field(Fields::comments)
.field(Fields::regionComments)
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 8d326d1614..6a816f73f2 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);
@@ -351,8 +351,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 79e89163bf..3ba7814189 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 d8e0de64a7..677a541346 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::make_shared<PathEls::PathData>(
+ return Path(0, components.size(), std::make_shared<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::make_shared<PathEls::PathData>(
- lastData->strData, lastData->components.mid(0, lastData->components.length() - endOffset), lastData->parent));
+ lastData->strData, lastData->components.mid(0, lastData->components.size() - endOffset), lastData->parent));
}
return Path(0, m_length, lastData);
}
diff --git a/src/qmldom/qqmldomscanner.cpp b/src/qmldom/qqmldomscanner.cpp
index a9f6f30a03..be5bd950b9 100644
--- a/src/qmldom/qqmldomscanner.cpp
+++ b/src/qmldom/qqmldomscanner.cpp
@@ -164,7 +164,7 @@ static void addLexToken(QList<Token> &tokens, int tokenKind, QQmlJS::Lexer &lexe
break;
}
// avoid newline (on multiline comments/strings)
- qsizetype len = lexer.code().length();
+ qsizetype len = lexer.code().size();
if (lexer.code().endsWith(u'\n'))
--len;
len -= lexer.tokenStartColumn() - 1;
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.cpp b/src/qmldom/qqmldomtop.cpp
index 6bf952f9b1..5dfe244547 100644
--- a/src/qmldom/qqmldomtop.cpp
+++ b/src/qmldom/qqmldomtop.cpp
@@ -198,13 +198,13 @@ bool DomUniverse::iterateDirectSubpaths(DomItem &self, DirectVisitor visitor)
return self.subListItem(List(
Path::Field(Fields::queue),
[q](DomItem &list, index_type i) {
- if (i >= 0 && i < q.length())
+ if (i >= 0 && i < q.size())
return list.subDataItem(PathEls::Index(i), q.at(i).toCbor(),
ConstantData::Options::FirstMapIsFields);
else
return DomItem();
},
- [q](DomItem &) { return index_type(q.length()); }, nullptr,
+ [q](DomItem &) { return index_type(q.size()); }, nullptr,
QLatin1String("ParsingTask")));
});
return cont;
@@ -1085,7 +1085,7 @@ bool DomEnvironment::iterateDirectSubpaths(DomItem &self, DirectVisitor visitor)
loadedLoadInfo = true;
loadsWithWork = m_loadsWithWork;
inProgress = m_inProgress;
- nAllLoadedCallbacks = m_allLoadedCallback.length();
+ nAllLoadedCallbacks = m_allLoadedCallback.size();
}
};
cont = cont
@@ -1095,14 +1095,14 @@ bool DomEnvironment::iterateDirectSubpaths(DomItem &self, DirectVisitor visitor)
return self.subListItem(List(
Path::Field(Fields::loadsWithWork),
[loadsWithWork](DomItem &list, index_type i) {
- if (i >= 0 && i < loadsWithWork.length())
+ if (i >= 0 && i < loadsWithWork.size())
return list.subDataItem(PathEls::Index(i),
loadsWithWork.at(i).toString());
else
return DomItem();
},
[loadsWithWork](DomItem &) {
- return index_type(loadsWithWork.length());
+ return index_type(loadsWithWork.size());
},
nullptr, QLatin1String("Path")));
});
@@ -1112,13 +1112,13 @@ bool DomEnvironment::iterateDirectSubpaths(DomItem &self, DirectVisitor visitor)
return self.subListItem(List(
Path::Field(Fields::inProgress),
[inProgress](DomItem &list, index_type i) {
- if (i >= 0 && i < inProgress.length())
+ if (i >= 0 && i < inProgress.size())
return list.subDataItem(PathEls::Index(i),
inProgress.at(i).toString());
else
return DomItem();
},
- [inProgress](DomItem &) { return index_type(inProgress.length()); },
+ [inProgress](DomItem &) { return index_type(inProgress.size()); },
nullptr, QLatin1String("Path")));
});
cont = cont && self.dvItemField(visitor, Fields::loadInfo, [&self, this]() {
@@ -1729,7 +1729,7 @@ QSet<QString> DomEnvironment::qmlDirPaths(DomItem &self, EnvLookup options) cons
const auto qmldirFiles = qmldirFilePaths(self, options);
for (const QString &p : qmldirFiles) {
if (p.endsWith(u"/qmldir")) {
- res.insert(p.left(p.length() - 7));
+ res.insert(p.left(p.size() - 7));
} else {
myErrors()
.warning(tr("Unexpected path not ending with qmldir in qmldirFilePaths: %1")
diff --git a/src/qmldom/qqmldomtop_p.h b/src/qmldom/qqmldomtop_p.h
index e92867360a..c077534165 100644
--- a/src/qmldom/qqmldomtop_p.h
+++ b/src/qmldom/qqmldomtop_p.h
@@ -573,7 +573,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
@@ -591,7 +591,7 @@ public:
int nCallbacks() const
{
QMutexLocker l(mutex());
- return m_endCallbacks.length();
+ return m_endCallbacks.size();
}
private:
diff --git a/src/qmldom/qqmldomtypesreader.cpp b/src/qmldom/qqmldomtypesreader.cpp
index f6c8eecdc4..461e28bd40 100644
--- a/src/qmldom/qqmldomtypesreader.cpp
+++ b/src/qmldom/qqmldomtypesreader.cpp
@@ -161,7 +161,7 @@ void QmltypesReader::insertComponent(const QQmlJSScope::Ptr &jsScope,
comp.setFileName(jsScope->filePath());
comp.setName(jsScope->internalName());
m_currentPath = m_currentPath.key(comp.name())
- .index(qmltypesFilePtr()->components().values(comp.name()).length());
+ .index(qmltypesFilePtr()->components().values(comp.name()).size());
incrementedPath = true;
prototype = jsScope->baseTypeName();
defaultPropertyName = jsScope->ownDefaultPropertyName();
@@ -188,7 +188,7 @@ void QmltypesReader::insertComponent(const QQmlJSScope::Ptr &jsScope,
.canonicalPath()
.field(Fields::components)
.key(comp.name())
- .index(qmltypesFilePtr()->components().values(comp.name()).length());
+ .index(qmltypesFilePtr()->components().values(comp.name()).size());
// emit & map objs
while (it != begin) {
diff --git a/src/qmlmodels/qqmladaptormodel.cpp b/src/qmlmodels/qqmladaptormodel.cpp
index e046509151..2ec24667b2 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,11 +332,11 @@ 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]
= QV4::ExecutionEngine::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] = QV4::ExecutionEngine::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);
@@ -497,12 +497,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 9ec34704a2..11d1e3632e 100644
--- a/src/qmlmodels/qqmldelegatemodel.cpp
+++ b/src/qmlmodels/qqmldelegatemodel.cpp
@@ -412,7 +412,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());
}
@@ -656,7 +656,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));
}
}
}
@@ -1083,7 +1083,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)
@@ -1093,7 +1093,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)
@@ -1489,7 +1489,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());
}
@@ -1516,7 +1516,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);
}
@@ -1524,7 +1524,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;
@@ -1542,7 +1542,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.
@@ -1620,7 +1620,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) {
@@ -1664,7 +1664,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);
}
@@ -1672,7 +1672,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;
@@ -1693,7 +1693,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
@@ -1730,7 +1730,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;
@@ -1753,7 +1753,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.
@@ -1853,7 +1853,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.
@@ -1974,7 +1974,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;
@@ -2060,7 +2060,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)
@@ -2081,7 +2081,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()");
@@ -2089,7 +2089,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(
@@ -2136,7 +2136,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);
@@ -2144,7 +2144,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)));
@@ -2449,7 +2449,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
@@ -3239,7 +3239,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));
@@ -3247,7 +3247,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)
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/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp
index 457c9b9e67..f5ea431035 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();
}
@@ -1674,10 +1674,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);
@@ -1875,7 +1875,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);
}
@@ -2175,7 +2175,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;
@@ -2183,7 +2183,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();
@@ -2202,7 +2202,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);
@@ -2223,7 +2223,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);
@@ -2241,7 +2241,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);
@@ -2360,7 +2360,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) {
@@ -2407,7 +2407,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;
@@ -2424,7 +2424,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();
}
/*!
@@ -2671,7 +2671,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 {
@@ -2797,7 +2797,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);
}
}
@@ -2825,7 +2825,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))
@@ -3028,7 +3028,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 810ea2cde8..dbe44674dd 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;
}
@@ -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++;
}
@@ -687,7 +687,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;
}
@@ -864,7 +864,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);
@@ -933,7 +933,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;
@@ -965,7 +965,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) {
@@ -978,9 +978,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..05a0b7a652 100644
--- a/src/qmlmodels/qquickpackage.cpp
+++ b/src/qmlmodels/qquickpackage.cpp
@@ -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 149b8bae3e..0d6638c8b1 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -167,8 +167,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;
}
@@ -663,7 +663,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/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp
index 9c8cc533aa..98ba0d41e7 100644
--- a/src/qmltest/quicktestresult.cpp
+++ b/src/qmltest/quicktestresult.cpp
@@ -682,7 +682,7 @@ bool QuickTestResult::measurementAccepted()
static QBenchmarkResult qMedian(const QList<QBenchmarkResult> &container)
{
- const int count = container.count();
+ const int count = container.size();
if (count == 0)
return QBenchmarkResult();
diff --git a/src/qmlworkerscript/qv4serialize.cpp b/src/qmlworkerscript/qv4serialize.cpp
index c0f34ab1fc..5f0d2da5c2 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 467bedd3bf..33610749c5 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 491cf1108c..b9354b0ac2 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/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 9e8306f7f0..c78f9bad8a 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -125,7 +125,7 @@ QQuickTransform::QQuickTransform(QQuickTransformPrivate &dd, QObject *parent)
QQuickTransform::~QQuickTransform()
{
Q_D(QQuickTransform);
- for (int ii = 0; ii < d->items.count(); ++ii) {
+ for (int ii = 0; ii < d->items.size(); ++ii) {
QQuickItemPrivate *p = QQuickItemPrivate::get(d->items.at(ii));
p->transforms.removeOne(this);
p->dirty(QQuickItemPrivate::Transform);
@@ -135,7 +135,7 @@ QQuickTransform::~QQuickTransform()
void QQuickTransform::update()
{
Q_D(QQuickTransform);
- for (int ii = 0; ii < d->items.count(); ++ii) {
+ for (int ii = 0; ii < d->items.size(); ++ii) {
QQuickItemPrivate *p = QQuickItemPrivate::get(d->items.at(ii));
p->dirty(QQuickItemPrivate::Transform);
}
@@ -149,7 +149,7 @@ QQuickContents::QQuickContents(QQuickItem *item)
QQuickContents::~QQuickContents()
{
QList<QQuickItem *> children = m_item->childItems();
- for (int i = 0; i < children.count(); ++i) {
+ for (int i = 0; i < children.size(); ++i) {
QQuickItem *child = children.at(i);
QQuickItemPrivate::get(child)->removeItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
}
@@ -174,7 +174,7 @@ bool QQuickContents::calcHeight(QQuickItem *changed)
qreal top = std::numeric_limits<qreal>::max();
qreal bottom = -std::numeric_limits<qreal>::max();
QList<QQuickItem *> children = m_item->childItems();
- for (int i = 0; i < children.count(); ++i) {
+ for (int i = 0; i < children.size(); ++i) {
QQuickItem *child = children.at(i);
qreal y = child->y();
if (y + child->height() > bottom)
@@ -209,7 +209,7 @@ bool QQuickContents::calcWidth(QQuickItem *changed)
qreal left = std::numeric_limits<qreal>::max();
qreal right = -std::numeric_limits<qreal>::max();
QList<QQuickItem *> children = m_item->childItems();
- for (int i = 0; i < children.count(); ++i) {
+ for (int i = 0; i < children.size(); ++i) {
QQuickItem *child = children.at(i);
qreal x = child->x();
if (x + child->width() > right)
@@ -230,7 +230,7 @@ void QQuickContents::complete()
QQuickItemPrivate::get(m_item)->addItemChangeListener(this, QQuickItemPrivate::Children);
QList<QQuickItem *> children = m_item->childItems();
- for (int i = 0; i < children.count(); ++i) {
+ for (int i = 0; i < children.size(); ++i) {
QQuickItem *child = children.at(i);
QQuickItemPrivate::get(child)->addItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
//###what about changes to visibility?
@@ -1252,7 +1252,7 @@ void QQuickKeysAttached::componentComplete()
#if QT_CONFIG(im)
Q_D(QQuickKeysAttached);
if (d->item) {
- for (int ii = 0; ii < d->targets.count(); ++ii) {
+ for (int ii = 0; ii < d->targets.size(); ++ii) {
QQuickItem *targetItem = d->targets.at(ii);
if (targetItem && (targetItem->flags() & QQuickItem::ItemAcceptsInputMethod)) {
d->item->setFlag(QQuickItem::ItemAcceptsInputMethod);
@@ -1275,7 +1275,7 @@ void QQuickKeysAttached::keyPressed(QKeyEvent *event, bool post)
// first process forwards
if (d->item && d->item->window()) {
d->inPress = true;
- for (int ii = 0; ii < d->targets.count(); ++ii) {
+ for (int ii = 0; ii < d->targets.size(); ++ii) {
QQuickItem *i = d->targets.at(ii);
if (i && i->isVisible()) {
event->accept();
@@ -1319,7 +1319,7 @@ void QQuickKeysAttached::keyReleased(QKeyEvent *event, bool post)
if (d->item && d->item->window()) {
d->inRelease = true;
- for (int ii = 0; ii < d->targets.count(); ++ii) {
+ for (int ii = 0; ii < d->targets.size(); ++ii) {
QQuickItem *i = d->targets.at(ii);
if (i && i->isVisible()) {
event->accept();
@@ -1347,7 +1347,7 @@ void QQuickKeysAttached::inputMethodEvent(QInputMethodEvent *event, bool post)
Q_D(QQuickKeysAttached);
if (post == m_processPost && d->item && !d->inIM && d->item->window()) {
d->inIM = true;
- for (int ii = 0; ii < d->targets.count(); ++ii) {
+ for (int ii = 0; ii < d->targets.size(); ++ii) {
QQuickItem *targetItem = d->targets.at(ii);
if (targetItem && targetItem->isVisible() && (targetItem->flags() & QQuickItem::ItemAcceptsInputMethod)) {
QCoreApplication::sendEvent(targetItem, event);
@@ -1367,7 +1367,7 @@ QVariant QQuickKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) const
{
Q_D(const QQuickKeysAttached);
if (d->item) {
- for (int ii = 0; ii < d->targets.count(); ++ii) {
+ for (int ii = 0; ii < d->targets.size(); ++ii) {
QQuickItem *i = d->targets.at(ii);
if (i && i->isVisible() && (i->flags() & QQuickItem::ItemAcceptsInputMethod) && i == d->imeItem) {
//### how robust is i == d->imeItem check?
@@ -1554,7 +1554,7 @@ void QQuickItemPrivate::setImplicitLayoutMirror(bool mirror, bool inherit)
if (isMirrorImplicit)
setLayoutMirror(inherit ? inheritedLayoutMirror : false);
- for (int i = 0; i < childItems.count(); ++i) {
+ for (int i = 0; i < childItems.size(); ++i) {
if (QQuickItem *child = qmlobject_cast<QQuickItem *>(childItems.at(i))) {
QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
childPrivate->setImplicitLayoutMirror(inheritedLayoutMirror, inheritMirrorFromParent);
@@ -2346,7 +2346,7 @@ QQuickItem::~QQuickItem()
remove themselves from our list of transforms when that list has already
been destroyed after ~QQuickItem() has run.
*/
- for (int ii = 0; ii < d->transforms.count(); ++ii) {
+ for (int ii = 0; ii < d->transforms.size(); ++ii) {
QQuickTransform *t = d->transforms.at(ii);
QQuickTransformPrivate *tp = QQuickTransformPrivate::get(t);
tp->items.removeOne(this);
@@ -2426,7 +2426,7 @@ QQuickItem *QQuickItemPrivate::nextTabChildItem(const QQuickItem *item, int star
return nullptr;
}
const QList<QQuickItem *> &children = item->childItems();
- const int count = children.count();
+ const int count = children.size();
if (start < 0 || start >= count) {
qWarning() << "QQuickItemPrivate::nextTabChildItem: Start index value out of range for item" << item;
return nullptr;
@@ -2447,7 +2447,7 @@ QQuickItem *QQuickItemPrivate::prevTabChildItem(const QQuickItem *item, int star
return nullptr;
}
const QList<QQuickItem *> &children = item->childItems();
- const int count = children.count();
+ const int count = children.size();
if (start == -1)
start = count - 1;
if (start < 0 || start >= count) {
@@ -2799,7 +2799,7 @@ void QQuickItem::stackBefore(const QQuickItem *sibling)
parentPrivate->dirty(QQuickItemPrivate::ChildrenStackingChanged);
parentPrivate->markSortedChildrenDirty(this);
- for (int ii = qMin(siblingIndex, myIndex); ii < parentPrivate->childItems.count(); ++ii)
+ for (int ii = qMin(siblingIndex, myIndex); ii < parentPrivate->childItems.size(); ++ii)
QQuickItemPrivate::get(parentPrivate->childItems.at(ii))->siblingOrderChanged();
}
@@ -2844,7 +2844,7 @@ void QQuickItem::stackAfter(const QQuickItem *sibling)
parentPrivate->dirty(QQuickItemPrivate::ChildrenStackingChanged);
parentPrivate->markSortedChildrenDirty(this);
- for (int ii = qMin(myIndex, siblingIndex + 1); ii < parentPrivate->childItems.count(); ++ii)
+ for (int ii = qMin(myIndex, siblingIndex + 1); ii < parentPrivate->childItems.size(); ++ii)
QQuickItemPrivate::get(parentPrivate->childItems.at(ii))->siblingOrderChanged();
}
@@ -2878,7 +2878,7 @@ QList<QQuickItem *> QQuickItemPrivate::paintOrderChildItems() const
// If none of the items have set Z then the paint order list is the same as
// the childItems list. This is by far the most common case.
bool haveZ = false;
- for (int i = 0; i < childItems.count(); ++i) {
+ for (int i = 0; i < childItems.size(); ++i) {
if (QQuickItemPrivate::get(childItems.at(i))->z() != 0.) {
haveZ = true;
break;
@@ -2982,7 +2982,7 @@ void QQuickItemPrivate::refWindow(QQuickWindow *c)
if (!parentItem)
QQuickWindowPrivate::get(window)->parentlessItems.insert(q);
- for (int ii = 0; ii < childItems.count(); ++ii) {
+ for (int ii = 0; ii < childItems.size(); ++ii) {
QQuickItem *child = childItems.at(ii);
QQuickItemPrivate::get(child)->refWindow(c);
}
@@ -3033,7 +3033,7 @@ void QQuickItemPrivate::derefWindow()
paintNode = nullptr;
- for (int ii = 0; ii < childItems.count(); ++ii) {
+ for (int ii = 0; ii < childItems.size(); ++ii) {
QQuickItem *child = childItems.at(ii);
QQuickItemPrivate::get(child)->derefWindow();
}
@@ -3086,7 +3086,7 @@ void QQuickItemPrivate::itemToParentTransform(QTransform &t) const
if (!transforms.isEmpty()) {
QMatrix4x4 m(t);
- for (int ii = transforms.count() - 1; ii >= 0; --ii)
+ for (int ii = transforms.size() - 1; ii >= 0; --ii)
transforms.at(ii)->applyTo(&m);
t = m.toTransform();
}
@@ -3376,7 +3376,7 @@ void QQuickItemPrivate::resources_clear(QQmlListProperty<QObject> *prop)
QQuickItem *QQuickItemPrivate::children_at(QQmlListProperty<QQuickItem> *prop, qsizetype index)
{
QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
- if (index >= p->childItems.count() || index < 0)
+ if (index >= p->childItems.size() || index < 0)
return nullptr;
else
return p->childItems.at(index);
@@ -3397,7 +3397,7 @@ void QQuickItemPrivate::children_append(QQmlListProperty<QQuickItem> *prop, QQui
qsizetype QQuickItemPrivate::children_count(QQmlListProperty<QQuickItem> *prop)
{
QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
- return p->childItems.count();
+ return p->childItems.size();
}
void QQuickItemPrivate::children_clear(QQmlListProperty<QQuickItem> *prop)
@@ -3412,7 +3412,7 @@ qsizetype QQuickItemPrivate::visibleChildren_count(QQmlListProperty<QQuickItem>
{
QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
qsizetype visibleCount = 0;
- qsizetype c = p->childItems.count();
+ qsizetype c = p->childItems.size();
while (c--) {
if (p->childItems.at(c)->isVisible()) visibleCount++;
}
@@ -3423,7 +3423,7 @@ qsizetype QQuickItemPrivate::visibleChildren_count(QQmlListProperty<QQuickItem>
QQuickItem *QQuickItemPrivate::visibleChildren_at(QQmlListProperty<QQuickItem> *prop, qsizetype index)
{
QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
- const qsizetype childCount = p->childItems.count();
+ const qsizetype childCount = p->childItems.size();
if (index >= childCount || index < 0)
return nullptr;
@@ -3440,7 +3440,7 @@ qsizetype QQuickItemPrivate::transform_count(QQmlListProperty<QQuickTransform> *
QQuickItem *that = static_cast<QQuickItem *>(prop->object);
QQuickItemPrivate *p = QQuickItemPrivate::get(that);
- return p->transforms.count();
+ return p->transforms.size();
}
void QQuickTransform::appendToItem(QQuickItem *item)
@@ -3495,7 +3495,7 @@ QQuickTransform *QQuickItemPrivate::transform_at(QQmlListProperty<QQuickTransfor
QQuickItem *that = static_cast<QQuickItem *>(prop->object);
QQuickItemPrivate *p = QQuickItemPrivate::get(that);
- if (idx < 0 || idx >= p->transforms.count())
+ if (idx < 0 || idx >= p->transforms.size())
return nullptr;
else
return p->transforms.at(idx);
@@ -3506,7 +3506,7 @@ void QQuickItemPrivate::transform_clear(QQmlListProperty<QQuickTransform> *prop)
QQuickItem *that = static_cast<QQuickItem *>(prop->object);
QQuickItemPrivate *p = QQuickItemPrivate::get(that);
- for (qsizetype ii = 0; ii < p->transforms.count(); ++ii) {
+ for (qsizetype ii = 0; ii < p->transforms.size(); ++ii) {
QQuickTransform *t = p->transforms.at(ii);
QQuickTransformPrivate *tp = QQuickTransformPrivate::get(t);
tp->items.removeOne(that);
@@ -4878,7 +4878,7 @@ QQuickItem *QQuickItem::nextItemInFocusChain(bool forward)
QQuickItem *QQuickItem::childAt(qreal x, qreal y) const
{
const QList<QQuickItem *> children = childItems();
- for (int i = children.count()-1; i >= 0; --i) {
+ for (int i = children.size()-1; i >= 0; --i) {
QQuickItem *child = children.at(i);
// Map coordinates to the child element's coordinate space
QPointF point = mapToItem(child, QPointF(x, y));
@@ -6382,7 +6382,7 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
agent->removeGrabber(q, true, true, true);
bool childVisibilityChanged = false;
- for (int ii = 0; ii < childItems.count(); ++ii)
+ for (int ii = 0; ii < childItems.size(); ++ii)
childVisibilityChanged |= QQuickItemPrivate::get(childItems.at(ii))->setEffectiveVisibleRecur(newEffectiveVisible);
itemChange(QQuickItem::ItemVisibleHasChanged, bool(effectiveVisible));
@@ -6433,7 +6433,7 @@ void QQuickItemPrivate::setEffectiveEnableRecur(QQuickItem *scope, bool newEffec
}
}
- for (int ii = 0; ii < childItems.count(); ++ii) {
+ for (int ii = 0; ii < childItems.size(); ++ii) {
QQuickItemPrivate::get(childItems.at(ii))->setEffectiveEnableRecur(
(flags & QQuickItem::ItemIsFocusScope) && scope ? q : scope, newEffectiveEnable);
}
@@ -6558,7 +6558,7 @@ void QQuickItemPrivate::recursiveRefFromEffectItem(int refs)
if (!refs)
return;
extra.value().recursiveEffectRefCount += refs;
- for (int ii = 0; ii < childItems.count(); ++ii) {
+ for (int ii = 0; ii < childItems.size(); ++ii) {
QQuickItem *child = childItems.at(ii);
QQuickItemPrivate::get(child)->recursiveRefFromEffectItem(refs);
}
@@ -7632,7 +7632,7 @@ void QQuickItem::setFocus(bool focus, Qt::FocusReason reason)
notifyListeners = true;
emit focusChanged(focus);
- QQuickDeliveryAgentPrivate::notifyFocusChangesRecur(changed.data(), changed.count() - 1, reason);
+ QQuickDeliveryAgentPrivate::notifyFocusChangesRecur(changed.data(), changed.size() - 1, reason);
}
} else {
QVarLengthArray<QQuickItem *, 20> changed;
@@ -7648,7 +7648,7 @@ void QQuickItem::setFocus(bool focus, Qt::FocusReason reason)
notifyListeners = true;
emit focusChanged(focus);
- QQuickDeliveryAgentPrivate::notifyFocusChangesRecur(changed.data(), changed.count() - 1, reason);
+ QQuickDeliveryAgentPrivate::notifyFocusChangesRecur(changed.data(), changed.size() - 1, reason);
}
if (notifyListeners)
d->notifyChangeListeners(QQuickItemPrivate::Focus, &QQuickItemChangeListener::itemFocusChanged, this, reason);
diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp
index 2a79908a3e..63299e4046 100644
--- a/src/quick/items/qquickitemanimation.cpp
+++ b/src/quick/items/qquickitemanimation.cpp
@@ -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);
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 9ea4624997..5972ffab9e 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 4c4db774e3..a7f0324551 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -1316,7 +1316,7 @@ void QQuickShaderEffectPrivate::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.
@@ -1414,7 +1414,7 @@ std::optional<int> QQuickShaderEffectPrivate::findMappedShaderVariableId(const Q
{
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..0aa7d632e1 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:
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.cpp b/src/quick/items/qquicktableview.cpp
index a1ea92a408..7bd21368b7 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -1159,7 +1159,7 @@ QString QQuickTableViewPrivate::tableLayoutToString() const
return QString(QLatin1String("table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9"))
.arg(leftColumn()).arg(topRow())
.arg(rightColumn()).arg(bottomRow())
- .arg(loadedItems.count())
+ .arg(loadedItems.size())
.arg(loadedTableOuterRect.x())
.arg(loadedTableOuterRect.y())
.arg(loadedTableOuterRect.width())
@@ -1174,7 +1174,7 @@ void QQuickTableViewPrivate::dumpTable() const
{ return lhs->index < rhs->index; });
qWarning() << QStringLiteral("******* TABLE DUMP *******");
- for (int i = 0; i < listCopy.count(); ++i)
+ for (int i = 0; i < listCopy.size(); ++i)
qWarning() << static_cast<FxTableItem *>(listCopy.at(i))->cell;
qWarning() << tableLayoutToString();
diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h
index 085e6008dd..7430173605 100644
--- a/src/quick/items/qquicktableview_p_p.h
+++ b/src/quick/items/qquicktableview_p_p.h
@@ -87,7 +87,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 cbc9f10f9e..5d6a869062 100644
--- a/src/quick/items/qquicktextcontrol.cpp
+++ b/src/quick/items/qquicktextcontrol.cpp
@@ -963,7 +963,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);
@@ -1272,7 +1272,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);
}
@@ -1344,7 +1344,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) {
@@ -1417,7 +1417,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 c035486eda..bd5e15c9dc 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 a45dae2215..af440d7bf7 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);
}
@@ -1807,7 +1807,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);
@@ -1821,7 +1821,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();
@@ -2046,7 +2046,7 @@ void QQuickTextInput::deselect()
void QQuickTextInput::selectAll()
{
Q_D(QQuickTextInput);
- d->setSelection(0, text().length());
+ d->setSelection(0, text().size());
}
/*!
@@ -2159,7 +2159,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;
@@ -2172,31 +2172,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;
@@ -2229,8 +2229,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);
@@ -2328,7 +2328,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)
@@ -2627,7 +2627,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();
}
@@ -2636,7 +2636,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)) {
@@ -2649,10 +2649,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;
@@ -2908,7 +2908,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;
@@ -2928,7 +2928,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)
@@ -3300,7 +3300,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);
@@ -3321,7 +3321,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;
}
@@ -3330,7 +3330,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)
@@ -3462,14 +3462,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)
@@ -3479,7 +3479,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;
@@ -3488,7 +3488,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) {
@@ -3499,9 +3499,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);
@@ -3522,7 +3522,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;
@@ -3650,7 +3650,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);
@@ -3715,7 +3715,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);
}
@@ -3724,7 +3724,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);
@@ -3780,16 +3780,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);
@@ -3813,7 +3813,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)),
@@ -3839,7 +3839,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) {
@@ -3909,13 +3909,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++;
@@ -3935,7 +3935,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;
@@ -4086,7 +4086,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) {
@@ -4121,7 +4121,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)
@@ -4144,7 +4144,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
}
@@ -4212,7 +4212,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;
@@ -4637,7 +4637,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 58f4966625..b13b325557 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)
@@ -1684,7 +1684,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;
@@ -1807,7 +1807,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();
}
@@ -1842,7 +1842,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));
}
@@ -1897,7 +1897,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))
@@ -1912,7 +1912,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))
@@ -1940,7 +1940,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..d55e719cb5 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalrectanglenode.cpp
@@ -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) {
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 cb2f518d1e..7bb05064bc 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -2893,11 +2893,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();
@@ -2984,7 +2984,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);
@@ -3467,7 +3467,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;
@@ -3809,7 +3809,7 @@ void Renderer::recordRenderPass(RenderPassContext *ctx)
QRhiCommandBuffer *cb = renderTarget().cb;
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);
@@ -3817,7 +3817,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);
@@ -3829,7 +3829,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 956cea253e..135c1035a5 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 b7e175b7c4..268f34d77b 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 2c1963dc18..46dd2d14e7 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 abd0f9c790..01a46a5618 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 aed2739c89..179aac856c 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 c32ca85a22..f8b52bd00c 100644
--- a/src/quick/scenegraph/qsgrhishadereffectnode.cpp
+++ b/src/quick/scenegraph/qsgrhishadereffectnode.cpp
@@ -35,11 +35,11 @@ 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());
static bool shaderEffectDebug = qEnvironmentVariableIntValue("QSG_RHI_SHADEREFFECT_DEBUG");
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) {
@@ -456,7 +456,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)
@@ -468,7 +468,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) {
@@ -568,7 +568,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;
@@ -827,7 +827,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) {
@@ -848,7 +848,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 bc5ec72690..58cb0ea0e2 100644
--- a/src/quick/scenegraph/qsgrhisupport.cpp
+++ b/src/quick/scenegraph/qsgrhisupport.cpp
@@ -845,7 +845,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..8d77a82a6e 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 << "...";
}
}
@@ -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()) {
@@ -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);
@@ -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);
diff --git a/src/quick/util/qquickapplication.cpp b/src/quick/util/qquickapplication.cpp
index ee3e15d15f..bc7d921132 100644
--- a/src/quick/util/qquickapplication.cpp
+++ b/src/quick/util/qquickapplication.cpp
@@ -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 8b2224614d..7a21605803 100644
--- a/src/quick/util/qquickdeliveryagent.cpp
+++ b/src/quick/util/qquickdeliveryagent.cpp
@@ -125,7 +125,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.
@@ -430,7 +430,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;
@@ -530,7 +530,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;
@@ -1067,7 +1067,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);
@@ -1199,7 +1199,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);
@@ -1604,7 +1604,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);
}
@@ -1881,7 +1881,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 ||
@@ -1905,8 +1905,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);
@@ -1962,7 +1962,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);
}
@@ -1982,7 +1982,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;
@@ -2025,7 +2025,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;
@@ -2297,7 +2297,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))
@@ -2346,7 +2346,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 fb7847c7d0..5f7a629234 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -73,7 +73,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));
}
}
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 97942f56b8..3244b78e78 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))
@@ -674,7 +674,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);
@@ -702,7 +702,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;
@@ -720,7 +720,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
;
}
@@ -1315,7 +1315,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()));
}
}
@@ -1329,7 +1329,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..384fdcde30 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,7 +263,7 @@ void QQuickStatePrivate::complete()
{
Q_Q(QQuickState);
- for (int ii = 0; ii < reverting.count(); ++ii) {
+ for (int ii = 0; ii < reverting.size(); ++ii) {
for (int jj = 0; jj < revertList.count(); ++jj) {
const QQuickRevertAction &revert = reverting.at(ii);
const QQuickSimpleAction &simple = revertList.at(jj);
@@ -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);
diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp
index 591a39a325..68caa6590d 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..fd19b287b1 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);
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/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp
index 723ba0f24c..2c21c12e98 100644
--- a/src/quick/util/qquickvaluetypes.cpp
+++ b/src/quick/util/qquickvaluetypes.cpp
@@ -173,10 +173,10 @@ QVariant createValueTypeFromNumberString(const QString &s)
QVarLengthArray<float, NumParams> parameters;
bool ok = true;
- for (qsizetype prev = 0, next = s.indexOf(u','), length = s.length(); ok && prev < length;) {
+ for (qsizetype prev = 0, next = s.indexOf(u','), length = s.size(); ok && prev < length;) {
parameters.append(s.mid(prev, next - prev).toFloat(&ok));
prev = next + 1;
- next = (parameters.length() == NumParams - 1) ? length : s.indexOf(u',', prev);
+ next = (parameters.size() == NumParams - 1) ? length : s.indexOf(u',', prev);
}
if (!ok)
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 cdd4708e30..48a892f812 100644
--- a/src/quickcontrols2impl/qquickninepatchimage.cpp
+++ b/src/quickcontrols2impl/qquickninepatchimage.cpp
@@ -228,7 +228,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 {
@@ -236,7 +236,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 {
@@ -262,26 +262,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 01823b4c45..588a207e88 100644
--- a/src/quickshapes/qquickshape.cpp
+++ b/src/quickshapes/qquickshape.cpp
@@ -901,7 +901,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();
}
@@ -1000,7 +1000,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/qquickshapegenericrenderer.cpp b/src/quickshapes/qquickshapegenericrenderer.cpp
index 4f32609d44..213c56348a 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();
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..d5bbc79371 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -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..6b576252b3 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;
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/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index d71054e972..606fd12c78 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -336,7 +336,7 @@ void QQuickMenuPrivate::itemSiblingOrderChanged(QQuickItem *)
QList<QQuickItem *> siblings = 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;
@@ -672,7 +672,7 @@ void QQuickMenuPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObj
qsizetype QQuickMenuPrivate::contentData_count(QQmlListProperty<QObject> *prop)
{
QQuickMenu *q = static_cast<QQuickMenu *>(prop->object);
- return QQuickMenuPrivate::get(q)->contentData.count();
+ return QQuickMenuPrivate::get(q)->contentData.size();
}
QObject *QQuickMenuPrivate::contentData_at(QQmlListProperty<QObject> *prop, qsizetype index)
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
index 8cf6e40f66..34702d2a00 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 817ae092ae..185df4d307 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 9249f4bfad..6cdd5a3e94 100644
--- a/src/quicktestutils/quick/viewtestutils.cpp
+++ b/src/quicktestutils/quick/viewtestutils.cpp
@@ -78,7 +78,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;
@@ -91,7 +91,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)
@@ -112,7 +112,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;
@@ -129,7 +129,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
@@ -174,15 +174,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();
}
@@ -196,8 +196,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();
}
@@ -239,7 +239,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();
@@ -275,11 +275,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));
}
@@ -336,7 +336,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)
@@ -344,7 +344,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;
}
@@ -395,7 +395,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 0a6da0a6c5..12da74d519 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;
}