From 1c6bf3e09ea9722717caedcfcceaaf3d607615cf Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 30 Sep 2022 14:09:04 +0200 Subject: [PATCH] Port from container::count() and length() to size() - V5 This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(, "count", "size"); renameMethod(, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev Reviewed-by: Qt CI Bot --- qmake/generators/mac/pbuilder_pbx.cpp | 26 +-- qmake/generators/makefile.cpp | 22 +- qmake/generators/metamakefile.cpp | 6 +- qmake/generators/projectgenerator.cpp | 18 +- qmake/generators/unix/unixmake2.cpp | 8 +- qmake/generators/win32/mingw_make.cpp | 4 +- .../generators/win32/msbuild_objectmodel.cpp | 12 +- qmake/generators/win32/msvc_objectmodel.cpp | 28 +-- qmake/generators/win32/msvc_vcproj.cpp | 14 +- qmake/generators/win32/winmakefile.cpp | 6 +- qmake/library/qmakebuiltins.cpp | 72 +++--- qmake/library/qmakeevaluator.cpp | 8 +- qmake/library/qmakeglobals.cpp | 4 +- qmake/library/qmakeparser.cpp | 4 +- qmake/option.cpp | 6 +- src/corelib/animation/qvariantanimation.cpp | 12 +- src/corelib/io/qdir.cpp | 2 +- src/corelib/io/qfileselector.cpp | 2 +- src/corelib/io/qfilesystemengine.cpp | 2 +- src/corelib/io/qsettings.cpp | 8 +- src/corelib/io/qstandardpaths_unix.cpp | 12 +- src/corelib/io/qtemporaryfile.cpp | 6 +- src/corelib/io/qurl.cpp | 2 +- src/corelib/io/qurlidna.cpp | 8 +- src/corelib/io/qurlquery.cpp | 2 +- src/corelib/itemmodels/qabstractitemmodel.cpp | 12 +- .../itemmodels/qabstractproxymodel.cpp | 2 +- .../qconcatenatetablesproxymodel.cpp | 2 +- .../itemmodels/qidentityproxymodel.cpp | 6 +- .../itemmodels/qitemselectionmodel.cpp | 64 +++--- .../itemmodels/qsortfilterproxymodel.cpp | 4 +- src/corelib/itemmodels/qstringlistmodel.cpp | 8 +- src/corelib/kernel/qcoreapplication.cpp | 6 +- src/corelib/kernel/qmetatype.cpp | 2 +- src/corelib/kernel/qobject.cpp | 4 +- src/corelib/kernel/qtimerinfo_unix.cpp | 6 +- src/corelib/mimetypes/qmimedatabase.cpp | 6 +- src/corelib/mimetypes/qmimeprovider.cpp | 2 +- src/corelib/serialization/qtextstream_p.h | 4 +- src/corelib/serialization/qxmlstream_p.h | 2 +- src/corelib/text/qchar.cpp | 6 +- src/corelib/text/qlocale.cpp | 6 +- src/corelib/text/qstring.cpp | 50 ++-- src/corelib/text/qstring.h | 20 +- src/corelib/text/qstringconverter.cpp | 14 +- src/corelib/text/qstringlist.cpp | 4 +- src/corelib/text/qtextboundaryfinder.cpp | 2 +- src/corelib/thread/qresultstore.h | 8 +- src/corelib/thread/qthreadstorage.cpp | 4 +- src/corelib/time/qdatetime.cpp | 2 +- src/corelib/time/qtimezone.cpp | 2 +- src/corelib/tools/qcommandlineparser.cpp | 4 +- src/corelib/tools/qeasingcurve.cpp | 2 +- src/corelib/tools/qset.h | 2 +- src/dbus/qdbusintegrator.cpp | 6 +- src/dbus/qdbusmetaobject.cpp | 6 +- src/dbus/qdbusutil.cpp | 12 +- src/gui/accessible/linux/atspiadaptor.cpp | 12 +- src/gui/accessible/qaccessible.cpp | 4 +- src/gui/accessible/qaccessibleobject.cpp | 6 +- src/gui/accessible/qplatformaccessibility.cpp | 4 +- src/gui/itemmodels/qfileinfogatherer.cpp | 6 +- src/gui/itemmodels/qfilesystemmodel.cpp | 14 +- src/gui/itemmodels/qstandarditemmodel.cpp | 18 +- src/gui/kernel/qguiapplication.cpp | 2 +- src/gui/kernel/qkeysequence.cpp | 6 +- src/gui/kernel/qsimpledrag.cpp | 2 +- src/gui/painting/qpageranges.cpp | 2 +- src/gui/painting/qpaintengine_raster.cpp | 2 +- src/gui/painting/qpolygon.cpp | 4 +- src/gui/painting/qregion.cpp | 2 +- src/gui/painting/qtransform.cpp | 2 +- src/gui/rhi/qrhivulkan.cpp | 8 +- src/gui/rhi/qshader.cpp | 4 +- src/gui/text/qcssparser.cpp | 12 +- src/gui/text/qfont.cpp | 2 +- src/gui/text/qtextengine.cpp | 12 +- src/gui/text/qtextformat.cpp | 4 +- src/gui/text/qtextformat_p.h | 2 +- src/gui/text/qtexthtmlparser.cpp | 10 +- src/gui/text/qtextlayout.cpp | 8 +- src/gui/text/qtextlist.cpp | 2 +- src/gui/text/qtextobject.cpp | 2 +- .../vulkan/qbasicvulkanplatforminstance.cpp | 4 +- src/network/access/qhttpheaderparser.cpp | 2 +- src/network/kernel/qauthenticator.cpp | 4 +- .../input/evdevtouch/qevdevtouchhandler.cpp | 2 +- .../kmsconvenience/qkmsdevice.cpp | 4 +- .../generic/tuiotouch/qtuiohandler.cpp | 6 +- src/plugins/platforms/xcb/qxcbclipboard.cpp | 2 +- .../platforms/xcb/qxcbsessionmanager.cpp | 2 +- .../printsupport/cups/qcupsprintersupport.cpp | 2 +- .../printsupport/cups/qppdprintdevice.cpp | 4 +- src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp | 4 +- src/printsupport/kernel/qcups.cpp | 2 +- src/sql/kernel/qsqlresult.cpp | 2 +- src/testlib/qpropertytesthelper_p.h | 18 +- src/testlib/qsignalspy.h | 4 +- src/testlib/qtestcase.cpp | 6 +- src/testlib/qtestevent.h | 4 +- src/tools/moc/main.cpp | 2 +- src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 6 +- src/tools/qlalr/cppgenerator.cpp | 2 +- src/tools/uic/cpp/cppwritedeclaration.cpp | 10 +- src/tools/uic/cpp/cppwriteinitialization.cpp | 4 +- src/widgets/accessible/complexwidgets.cpp | 2 +- src/widgets/accessible/itemviews.cpp | 8 +- src/widgets/accessible/qaccessiblewidget.cpp | 4 +- src/widgets/dialogs/qfiledialog.cpp | 22 +- src/widgets/dialogs/qwizard.cpp | 6 +- src/widgets/graphicsview/qgraphicsview.cpp | 4 +- src/widgets/itemviews/qabstractitemview.cpp | 8 +- src/widgets/itemviews/qcolumnview.cpp | 6 +- src/widgets/itemviews/qheaderview.cpp | 2 +- src/widgets/itemviews/qheaderview_p.h | 4 +- src/widgets/itemviews/qlistview.cpp | 6 +- src/widgets/itemviews/qlistwidget.cpp | 8 +- src/widgets/itemviews/qtableview.cpp | 2 +- src/widgets/itemviews/qtablewidget.cpp | 8 +- src/widgets/itemviews/qtreeview.cpp | 10 +- src/widgets/itemviews/qtreewidget.cpp | 30 +-- src/widgets/kernel/qapplication.cpp | 8 +- src/widgets/kernel/qwidgetrepaintmanager.cpp | 2 +- src/widgets/util/qcompleter.cpp | 12 +- src/widgets/widgets/qcombobox.cpp | 2 +- src/widgets/widgets/qdockwidget.cpp | 2 +- src/widgets/widgets/qfontcombobox.cpp | 2 +- .../qanimationgroup/tst_qanimationgroup.cpp | 6 +- .../tst_qparallelanimationgroup.cpp | 138 +++++------ .../tst_qpropertyanimation.cpp | 78 +++---- .../tst_qsequentialanimationgroup.cpp | 96 ++++---- tests/auto/corelib/io/qdebug/tst_qdebug.cpp | 2 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 34 +-- .../tst_qfilesystemwatcher.cpp | 46 ++-- .../qloggingcategory/tst_qloggingcategory.cpp | 4 +- .../corelib/io/qprocess/testDetached/main.cpp | 2 +- .../auto/corelib/io/qprocess/tst_qprocess.cpp | 66 +++--- .../tst_qprocessenvironment.cpp | 12 +- .../corelib/io/qsettings/tst_qsettings.cpp | 24 +- .../io/qstandardpaths/tst_qstandardpaths.cpp | 8 +- tests/auto/corelib/io/qurl/tst_qurl.cpp | 2 +- .../tst_qabstractitemmodel.cpp | 62 ++--- .../tst_qabstractproxymodel.cpp | 8 +- .../tst_qconcatenatetablesproxymodel.cpp | 92 ++++---- .../itemmodels/qitemmodel/tst_qitemmodel.cpp | 106 ++++----- .../tst_qitemselectionmodel.cpp | 148 ++++++------ .../tst_qsortfilterproxymodel.cpp | 214 +++++++++--------- ...sortfilterproxymodel_regularexpression.cpp | 4 +- .../qstringlistmodel/tst_qstringlistmodel.cpp | 2 +- .../tst_qtransposeproxymodel.cpp | 64 +++--- .../qcoreapplication/tst_qcoreapplication.cpp | 10 +- .../kernel/qeventloop/tst_qeventloop.cpp | 14 +- .../kernel/qmetaobject/tst_qmetaobject.cpp | 6 +- .../tst_qmetaobjectbuilder.cpp | 4 +- .../kernel/qproperty/tst_qproperty.cpp | 20 +- .../qsharedmemory/producerconsumer/main.cpp | 2 +- .../qsharedmemory/tst_qsharedmemory.cpp | 2 +- .../qsocketnotifier/tst_qsocketnotifier.cpp | 12 +- .../qsystemsemaphore/acquirerelease/main.cpp | 4 +- .../auto/corelib/kernel/qtimer/tst_qtimer.cpp | 34 +-- .../corelib/kernel/qvariant/tst_qvariant.cpp | 22 +- .../qmimedatabase/tst_qmimedatabase.cpp | 4 +- .../qpluginloader/tst_qpluginloader.cpp | 10 +- .../tst_qcborstreamwriter.cpp | 4 +- .../qxmlstream/tst_qxmlstream.cpp | 2 +- .../auto/corelib/text/qstring/tst_qstring.cpp | 6 +- .../text/qstringlist/tst_qstringlist.cpp | 4 +- .../text/qunicodetools/tst_qunicodetools.cpp | 2 +- .../corelib/thread/qfuture/tst_qfuture.cpp | 10 +- .../qfuturewatcher/tst_qfuturewatcher.cpp | 94 ++++---- .../corelib/time/qtimezone/tst_qtimezone.cpp | 10 +- .../tools/collections/tst_collections.cpp | 10 +- .../corelib/tools/qbitarray/tst_qbitarray.cpp | 5 +- .../tst_qcommandlineparser.cpp | 4 +- .../qcontiguouscache/tst_qcontiguouscache.cpp | 26 ++- .../tools/qeasingcurve/tst_qeasingcurve.cpp | 8 +- .../corelib/tools/qflatmap/tst_qflatmap.cpp | 4 +- tests/auto/corelib/tools/qhash/tst_qhash.cpp | 58 ++--- tests/auto/corelib/tools/qmap/tst_qmap.cpp | 58 ++--- .../corelib/tools/qtimeline/tst_qtimeline.cpp | 54 ++--- .../qdbusinterface/tst_qdbusinterface.cpp | 40 ++-- .../qdbuslocalcalls/tst_qdbuslocalcalls.cpp | 8 +- .../qdbuspendingcall/tst_qdbuspendingcall.cpp | 2 +- .../tst_qdbusservicewatcher.cpp | 56 ++--- .../qdbusxmlparser/tst_qdbusxmlparser.cpp | 12 +- tests/auto/gui/image/qmovie/tst_qmovie.cpp | 2 +- .../qfilesystemmodel/tst_qfilesystemmodel.cpp | 74 +++--- .../qstandarditem/tst_qstandarditem.cpp | 6 +- .../tst_qstandarditemmodel.cpp | 96 ++++---- tests/auto/gui/kernel/qaction/tst_qaction.cpp | 62 ++--- .../gui/kernel/qclipboard/tst_qclipboard.cpp | 48 ++-- .../qguiapplication/tst_qguiapplication.cpp | 64 +++--- .../kernel/qinputmethod/tst_qinputmethod.cpp | 6 +- tests/auto/gui/kernel/qscreen/tst_qscreen.cpp | 10 +- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 56 ++--- .../gui/painting/qpolygon/tst_qpolygon.cpp | 4 +- tests/auto/gui/rhi/qshader/tst_qshader.cpp | 10 +- .../gui/text/qcssparser/tst_qcssparser.cpp | 12 +- tests/auto/gui/text/qfont/tst_qfont.cpp | 8 +- .../text/qfontdatabase/tst_qfontdatabase.cpp | 10 +- tests/auto/gui/text/qrawfont/tst_qrawfont.cpp | 2 +- .../tst_qsyntaxhighlighter.cpp | 2 +- .../text/qtextdocument/tst_qtextdocument.cpp | 48 ++-- .../gui/text/qtextformat/tst_qtextformat.cpp | 6 +- .../gui/text/qtextlayout/tst_qtextlayout.cpp | 10 +- .../qdoublevalidator/tst_qdoublevalidator.cpp | 60 ++--- .../util/qintvalidator/tst_qintvalidator.cpp | 36 +-- .../tst_qregularexpressionvalidator.cpp | 4 +- .../gui/util/qundogroup/tst_qundogroup.cpp | 12 +- .../gui/util/qundostack/tst_qundostack.cpp | 36 +-- tests/auto/network/access/http2/tst_http2.cpp | 4 +- .../tst_qabstractnetworkcache.cpp | 6 +- .../tst_qhttpnetworkreply.cpp | 2 +- .../tst_qnetworkdiskcache.cpp | 18 +- .../qnetworkreply/tst_qnetworkreply.cpp | 210 ++++++++--------- .../kernel/qdnslookup/tst_qdnslookup.cpp | 8 +- .../tst_qnetworkinformation.cpp | 4 +- .../socket/qlocalsocket/tst_qlocalsocket.cpp | 68 +++--- .../socket/qtcpserver/tst_qtcpserver.cpp | 20 +- .../socket/qtcpsocket/tst_qtcpsocket.cpp | 26 +-- .../socket/qudpsocket/tst_qudpsocket.cpp | 28 +-- .../network/ssl/qsslserver/tst_qsslserver.cpp | 140 ++++++------ .../network/ssl/qsslsocket/tst_qsslsocket.cpp | 138 +++++------ .../qaccessibility/tst_qaccessibility.cpp | 12 +- .../tst_qprocess_and_guieventloop.cpp | 6 +- tests/auto/sql/kernel/qsql/tst_qsql.cpp | 4 +- .../sql/kernel/qsqldatabase/tst_databases.h | 4 +- .../kernel/qsqldatabase/tst_qsqldatabase.cpp | 8 +- .../sql/kernel/qsqldriver/tst_qsqldriver.cpp | 6 +- .../sql/kernel/qsqlquery/tst_qsqlquery.cpp | 2 +- .../sql/kernel/qsqlthread/tst_qsqlthread.cpp | 6 +- .../qsqlquerymodel/tst_qsqlquerymodel.cpp | 38 ++-- .../qsqltablemodel/tst_qsqltablemodel.cpp | 32 +-- .../testlib/qsignalspy/tst_qsignalspy.cpp | 52 ++--- .../auto/testlib/selftests/tst_selftests.cpp | 4 +- tests/auto/tools/moc/tst_moc.cpp | 10 +- tests/auto/tools/qmakelib/evaltest.cpp | 2 +- .../dialogs/qcolordialog/tst_qcolordialog.cpp | 2 +- .../widgets/dialogs/qdialog/tst_qdialog.cpp | 4 +- .../dialogs/qfiledialog/tst_qfiledialog.cpp | 88 +++---- .../dialogs/qfiledialog2/tst_qfiledialog2.cpp | 6 +- .../dialogs/qfontdialog/tst_qfontdialog.cpp | 2 +- .../dialogs/qmessagebox/tst_qmessagebox.cpp | 2 +- .../widgets/dialogs/qsidebar/tst_qsidebar.cpp | 4 +- .../widgets/dialogs/qwizard/tst_qwizard.cpp | 54 ++--- .../tst_qgraphicsanchorlayout1.cpp | 24 +- .../tst_qgraphicsgridlayout.cpp | 14 +- .../qgraphicsitem/tst_qgraphicsitem.cpp | 10 +- .../tst_qgraphicslinearlayout.cpp | 6 +- .../qgraphicsobject/tst_qgraphicsobject.cpp | 68 +++--- .../tst_qgraphicsproxywidget.cpp | 58 ++--- .../qgraphicsscene/tst_qgraphicsscene.cpp | 98 ++++---- .../qgraphicsview/tst_qgraphicsview.cpp | 8 +- .../qgraphicswidget/tst_qgraphicswidget.cpp | 22 +- .../tst_qabstractitemview.cpp | 74 +++--- .../itemviews/qcolumnview/tst_qcolumnview.cpp | 16 +- .../tst_qdatawidgetmapper.cpp | 18 +- .../itemviews/qheaderview/tst_qheaderview.cpp | 92 ++++---- .../qitemdelegate/tst_qitemdelegate.cpp | 20 +- .../itemviews/qlistview/tst_qlistview.cpp | 22 +- .../itemviews/qlistwidget/tst_qlistwidget.cpp | 78 +++---- .../itemviews/qtableview/tst_qtableview.cpp | 40 ++-- .../qtablewidget/tst_qtablewidget.cpp | 28 +-- .../itemviews/qtreeview/tst_qtreeview.cpp | 120 +++++----- .../itemviews/qtreewidget/tst_qtreewidget.cpp | 150 ++++++------ .../tst_qtreewidgetitemiterator.cpp | 2 +- .../widgets/kernel/qaction/tst_qaction.cpp | 50 ++-- .../kernel/qapplication/tst_qapplication.cpp | 120 +++++----- .../kernel/qboxlayout/tst_qboxlayout.cpp | 4 +- .../kernel/qgridlayout/tst_qgridlayout.cpp | 4 +- .../kernel/qshortcut/tst_qshortcut.cpp | 4 +- .../qstackedlayout/tst_qstackedlayout.cpp | 6 +- .../widgets/kernel/qwidget/tst_qwidget.cpp | 28 +-- .../qwidget_window/tst_qwidget_window.cpp | 8 +- .../qstylesheetstyle/tst_qstylesheetstyle.cpp | 2 +- .../util/qcompleter/tst_qcompleter.cpp | 22 +- .../qsystemtrayicon/tst_qsystemtrayicon.cpp | 2 +- .../qabstractbutton/tst_qabstractbutton.cpp | 36 +-- .../qabstractslider/tst_qabstractslider.cpp | 36 +-- .../widgets/qbuttongroup/tst_qbuttongroup.cpp | 40 ++-- .../qcalendarwidget/tst_qcalendarwidget.cpp | 2 +- .../widgets/qcheckbox/tst_qcheckbox.cpp | 4 +- .../widgets/qcombobox/tst_qcombobox.cpp | 94 ++++---- .../qdatetimeedit/tst_qdatetimeedit.cpp | 42 ++-- .../auto/widgets/widgets/qdial/tst_qdial.cpp | 16 +- .../qdialogbuttonbox/tst_qdialogbuttonbox.cpp | 22 +- .../widgets/qdockwidget/tst_qdockwidget.cpp | 128 +++++------ .../qdoublespinbox/tst_qdoublespinbox.cpp | 42 ++-- .../qfontcombobox/tst_qfontcombobox.cpp | 20 +- .../widgets/qgroupbox/tst_qgroupbox.cpp | 16 +- .../qkeysequenceedit/tst_qkeysequenceedit.cpp | 12 +- .../widgets/qlineedit/tst_qlineedit.cpp | 78 +++---- .../widgets/qmainwindow/tst_qmainwindow.cpp | 4 +- .../widgets/widgets/qmdiarea/tst_qmdiarea.cpp | 60 ++--- .../qmdisubwindow/tst_qmdisubwindow.cpp | 8 +- .../auto/widgets/widgets/qmenu/tst_qmenu.cpp | 6 +- .../widgets/widgets/qmenubar/tst_qmenubar.cpp | 20 +- .../qopenglwidget/tst_qopenglwidget.cpp | 14 +- .../qplaintextedit/tst_qplaintextedit.cpp | 48 ++-- .../widgets/qpushbutton/tst_qpushbutton.cpp | 28 +-- .../widgets/qscrollbar/tst_qscrollbar.cpp | 8 +- .../widgets/widgets/qspinbox/tst_qspinbox.cpp | 48 ++-- .../widgets/qsplitter/tst_qsplitter.cpp | 2 +- .../widgets/qstatusbar/tst_qstatusbar.cpp | 6 +- .../widgets/widgets/qtabbar/tst_qtabbar.cpp | 36 +-- .../widgets/qtabwidget/tst_qtabwidget.cpp | 30 +-- .../widgets/qtextbrowser/tst_qtextbrowser.cpp | 58 ++--- .../widgets/qtextedit/tst_qtextedit.cpp | 46 ++-- .../widgets/widgets/qtoolbar/tst_qtoolbar.cpp | 118 +++++----- .../widgets/qtoolbutton/tst_qtoolbutton.cpp | 38 ++-- tests/baseline/shared/paintcommands.cpp | 8 +- .../io/qprocess/tst_bench_qprocess.cpp | 4 +- .../qmimedatabase/tst_bench_qmimedatabase.cpp | 2 +- .../corelib/tools/qhash/outofline.cpp | 2 +- .../qgraphicslayout/tst_qgraphicslayout.cpp | 2 +- 315 files changed, 3464 insertions(+), 3461 deletions(-) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index f5f0d2619c..9e36cad887 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -87,7 +87,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) for(int pb_subdir = 0; pb_subdir < pb_subdirs.size(); ++pb_subdir) { ProjectBuilderSubDirs *pb = pb_subdirs[pb_subdir]; const ProStringList &subdirs = pb->project->values("SUBDIRS"); - for(int subdir = 0; subdir < subdirs.count(); subdir++) { + for(int subdir = 0; subdir < subdirs.size(); subdir++) { ProString tmpk = subdirs[subdir]; const ProKey fkey(tmpk + ".file"); if (!pb->project->isEmpty(fkey)) { @@ -329,7 +329,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) t << "\t\t\tprojectReferences = (\n"; { const ProStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS"); - for(int i = 0; i < qmake_subdirs.count(); i++) { + for(int i = 0; i < qmake_subdirs.size(); i++) { const ProString &subdir = qmake_subdirs[i]; t << "\t\t\t\t{\n" << "\t\t\t\t\t" << writeSettings("ProductGroup", keyFor(subdir + "_PRODUCTGROUP")) << ";\n" @@ -658,7 +658,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) const QStringList &files = fileFixify(sources.at(source).files(project), FileFixifyFromOutdir | FileFixifyAbsolute); - for(int f = 0; f < files.count(); ++f) { + for(int f = 0; f < files.size(); ++f) { QString file = files[f]; if(!sources.at(source).compilerName().isNull() && !verifyExtraCompiler(sources.at(source).compilerName(), file)) @@ -873,7 +873,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr }; for (int i = 0; libs[i]; i++) { tmp = project->values(libs[i]); - for(int x = 0; x < tmp.count();) { + for(int x = 0; x < tmp.size();) { bool libSuffixReplaced = false; bool remove = false; QString library, name; @@ -912,7 +912,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if(opt.size() > 2) { r = opt.mid(2).toQString(); } else { - if(x == tmp.count()-1) + if(x == tmp.size()-1) break; r = tmp[++x].toQString(); } @@ -921,12 +921,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) frameworkdirs.append(r); } } else if(opt == "-framework") { - if(x == tmp.count()-1) + if(x == tmp.size()-1) break; const ProString &framework = tmp[x+1]; ProStringList fdirs = frameworkdirs; fdirs << "/System/Library/Frameworks/" << "/Library/Frameworks/"; - for(int fdir = 0; fdir < fdirs.count(); fdir++) { + for(int fdir = 0; fdir < fdirs.size(); fdir++) { if(exists(fdirs[fdir] + QDir::separator() + framework + ".framework")) { remove = true; library = fdirs[fdir] + Option::dir_sep + framework + ".framework"; @@ -1008,12 +1008,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt << "SUBLIBS= "; // ### This is missing the parametrization found in unixmake2.cpp tmp = project->values("SUBLIBS"); - for(int i = 0; i < tmp.count(); i++) + for(int i = 0; i < tmp.size(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") << ' '; t << Qt::endl << Qt::endl; mkt << "sublibs: $(SUBLIBS)\n\n"; tmp = project->values("SUBLIBS"); - for(int i = 0; i < tmp.count(); i++) + for(int i = 0; i < tmp.size(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") + ":\n\t" << var(ProKey("MAKELIB" + tmp[i])) << Qt::endl << Qt::endl; mkt.flush(); @@ -1148,7 +1148,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) //all bundle data const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); - for(int i = 0; i < bundle_data.count(); i++) { + for(int i = 0; i < bundle_data.size(); i++) { ProStringList bundle_files; ProString path = project->first(ProKey(bundle_data[i] + ".path")); const bool isEmbeddedFramework = ((!osx && path == QLatin1String("Frameworks")) @@ -1158,7 +1158,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) //all files const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); - for(int file = 0; file < files.count(); file++) { + for(int file = 0; file < files.size(); file++) { QString fn = fileFixify(files[file].toQString(), FileFixifyAbsolute); QString name = fn.split(Option::dir_sep).back(); QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE_REF." + bundle_data[i] + "-" + fn); @@ -1684,7 +1684,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n"; tmp = project->values("QMAKE_PBX_VARS"); - for (int i = 0; i < tmp.count(); i++) { + for (int i = 0; i < tmp.size(); i++) { QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData())); if (val.isEmpty() && var == "TB") val = "/usr/bin/"; @@ -1888,7 +1888,7 @@ ProStringList ProjectBuilderMakefileGenerator::fixListForOutput(const ProStringList &l) { ProStringList ret; - for(int i = 0; i < l.count(); i++) + for(int i = 0; i < l.size(); i++) ret += fixForOutput(l[i].toQString()); return ret; } diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index f705a9bfee..60d96f13db 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -39,7 +39,7 @@ using namespace QMakeInternal; bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const { int argv0 = -1; - for(int i = 0; i < cmdline.count(); ++i) { + for(int i = 0; i < cmdline.size(); ++i) { if(!cmdline.at(i).contains('=')) { argv0 = i; break; @@ -238,7 +238,7 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString { ProStringList vpath; const ProValueMap &v = project->variables(); - for(int val_it = 0; val_it < l.count(); ) { + for(int val_it = 0; val_it < l.size(); ) { bool remove_file = false; ProString &val = l[val_it]; if(!val.isEmpty()) { @@ -304,7 +304,7 @@ MakefileGenerator::findFilesInVPATH(ProStringList l, uchar flags, const QString } else { l.removeAt(val_it); QString a; - for(int i = (int)files.count()-1; i >= 0; i--) { + for(int i = (int)files.size()-1; i >= 0; i--) { a = real_dir + files[i]; if(!(flags & VPATH_NoFixify)) a = fileFixify(a); @@ -468,12 +468,12 @@ MakefileGenerator::init() continue; } const ProStringList &tinn = v[innkey], &toutn = v[outnkey]; - if (tinn.length() != 1) { + if (tinn.size() != 1) { warn_msg(WarnLogic, "Substitute '%s.input' does not have exactly one value", sub.toLatin1().constData()); continue; } - if (toutn.length() != 1) { + if (toutn.size() != 1) { warn_msg(WarnLogic, "Substitute '%s.output' does not have exactly one value", sub.toLatin1().constData()); continue; @@ -639,7 +639,7 @@ MakefileGenerator::init() paths << compilers.at(x).variable_in; } paths << "INCLUDEPATH" << "QMAKE_INTERNAL_INCLUDED_FILES" << "PRECOMPILED_HEADER"; - for(int y = 0; y < paths.count(); y++) { + for(int y = 0; y < paths.size(); y++) { ProStringList &l = v[paths[y].toKey()]; for (ProStringList::Iterator it = l.begin(); it != l.end(); ++it) { if((*it).isEmpty()) @@ -827,7 +827,7 @@ MakefileGenerator::init() warn_msg(WarnLogic, "Dependency for [%s]: Not found %s", (*file_it).toLatin1().constData(), dep.toLatin1().constData()); } else { - for(int i = 0; i < files.count(); i++) + for(int i = 0; i < files.size(); i++) out_deps.append(dir + files[i]); } } @@ -1316,7 +1316,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild) inst << cmd; uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + filestr, FileFixifyAbsolute, false)))); } - for(int x = 0; x < files.count(); x++) { + for(int x = 0; x < files.size(); x++) { QString file = files[x]; uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + file, FileFixifyAbsolute, false)))); QFileInfo fi(fileInfo(dirstr + file)); @@ -1883,7 +1883,7 @@ void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCom return; QDir outDir(Option::output_dir); QStringList dep_cmd_deps = splitDeps(indeps, dep_lines); - for (int i = 0; i < dep_cmd_deps.count(); ++i) { + for (int i = 0; i < dep_cmd_deps.size(); ++i) { QString &file = dep_cmd_deps[i]; const QString absFile = outDir.absoluteFilePath(file); if (absFile == file) { @@ -2850,7 +2850,7 @@ MakefileGenerator::fixLibFlags(const ProKey &var) const ProStringList &in = project->values(var); ProStringList ret; - ret.reserve(in.length()); + ret.reserve(in.size()); for (const ProString &v : in) ret << fixLibFlag(v); return ret; @@ -3538,7 +3538,7 @@ MakefileGenerator::LinkerResponseFileInfo MakefileGenerator::maybeCreateLinkerRe // When using QMAKE_LINK_OBJECT_MAX, the number of object files (regardless of their path // length) decides whether to use a response file. This is far from being a useful // heuristic but let's keep this behavior for backwards compatibility. - if (linkerInputs.count() < threshold) + if (linkerInputs.size() < threshold) return {}; } else { // When using QMAKE_REPONSEFILE_THRESHOLD, try to determine the command line length of the diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index febb993ddd..c9235509f2 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -73,12 +73,12 @@ BuildsMetaMakefileGenerator::init() const ProStringList &builds = project->values("BUILDS"); bool use_single_build = builds.isEmpty(); - if(builds.count() > 1 && Option::output.fileName() == "-") { + if(builds.size() > 1 && Option::output.fileName() == "-") { use_single_build = true; warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS."); } if(!use_single_build) { - for(int i = 0; i < builds.count(); i++) { + for(int i = 0; i < builds.size(); i++) { ProString build = builds[i]; MakefileGenerator *makefile = processBuild(build); if(!makefile) @@ -91,7 +91,7 @@ BuildsMetaMakefileGenerator::init() } else { Build *b = new Build; b->name = name; - if(builds.count() != 1) + if(builds.size() != 1) b->build = build.toQString(); b->makefile = makefile; makefiles += b; diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index ede5df496f..96d7b26370 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -54,7 +54,7 @@ ProjectGenerator::init() dirs.prepend(qmake_getpwd()); } - for(int i = 0; i < dirs.count(); ++i) { + for(int i = 0; i < dirs.size(); ++i) { QString dir, regex, pd = dirs.at(i); bool add_depend = false; if(exists(pd)) { @@ -66,7 +66,7 @@ ProjectGenerator::init() dir += Option::dir_sep; if (Option::recursive) { QStringList files = QDir(dir).entryList(QDir::Files); - for (int i = 0; i < files.count(); i++) + for (int i = 0; i < files.size(); i++) dirs.append(dir + files[i] + QDir::separator() + builtin_regex); } regex = builtin_regex; @@ -92,11 +92,11 @@ ProjectGenerator::init() const QDir d(dir); if (Option::recursive) { QStringList entries = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot); - for (int i = 0; i < entries.count(); i++) + for (int i = 0; i < entries.size(); i++) dirs.append(dir + entries[i] + QDir::separator() + regex); } QStringList files = d.entryList(QDir::nameFiltersFromString(regex)); - for(int i = 0; i < (int)files.count(); i++) { + for(int i = 0; i < (int)files.size(); i++) { QString file = d.absoluteFilePath(files[i]); if (addFile(file)) { add_depend = true; @@ -116,7 +116,7 @@ ProjectGenerator::init() if(Option::projfile::do_pwd) knownDirs.prepend("."); const QString out_file = fileFixify(Option::output.fileName()); - for(int i = 0; i < knownDirs.count(); ++i) { + for(int i = 0; i < knownDirs.size(); ++i) { QString pd = knownDirs.at(i); if(exists(pd)) { QString newdir = pd; @@ -129,7 +129,7 @@ ProjectGenerator::init() subdirs.append(newdir); } else { QStringList profiles = QDir(newdir).entryList(QStringList("*" + Option::pro_ext), QDir::Files); - for(int i = 0; i < (int)profiles.count(); i++) { + for(int i = 0; i < (int)profiles.size(); i++) { QString nd = newdir; if(nd == ".") nd = ""; @@ -143,7 +143,7 @@ ProjectGenerator::init() } if (Option::recursive) { QStringList dirs = QDir(newdir).entryList(QDir::Dirs | QDir::NoDotAndDotDot); - for(int i = 0; i < (int)dirs.count(); i++) { + for(int i = 0; i < (int)dirs.size(); i++) { QString nd = fileFixify(newdir + QDir::separator() + dirs[i]); if (!knownDirs.contains(nd, Qt::CaseInsensitive)) knownDirs.append(nd); @@ -160,7 +160,7 @@ ProjectGenerator::init() QStringList files = QDir(dir).entryList(QDir::nameFiltersFromString(regx), QDir::Dirs | QDir::NoDotAndDotDot); ProStringList &subdirs = v["SUBDIRS"]; - for(int i = 0; i < (int)files.count(); i++) { + for(int i = 0; i < (int)files.size(); i++) { QString newdir(dir + files[i]); QFileInfo fi(fileInfo(newdir)); { @@ -170,7 +170,7 @@ ProjectGenerator::init() subdirs.append(newdir); } else { QStringList profiles = QDir(newdir).entryList(QStringList("*" + Option::pro_ext), QDir::Files); - for(int i = 0; i < (int)profiles.count(); i++) { + for(int i = 0; i < (int)profiles.size(); i++) { QString nd = newdir + QDir::separator() + files[i]; fileFixify(nd); if(files[i] != "." && files[i] != ".." && !subdirs.contains(nd, Qt::CaseInsensitive)) { diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 8532a90364..6bd1a8340e 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -852,7 +852,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) //copy other data if(!project->isEmpty("QMAKE_BUNDLE_DATA")) { const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); - for(int i = 0; i < bundle_data.count(); i++) { + for(int i = 0; i < bundle_data.size(); i++) { const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); QString path = bundle_dir; const ProKey pkey(bundle_data[i] + ".path"); @@ -872,7 +872,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } path += project->first(pkey).toQString(); path = Option::fixPathToTargetOS(path); - for(int file = 0; file < files.count(); file++) { + for(int file = 0; file < files.size(); file++) { QString fn = files.at(file).toQString(); QString src = fileFixify(fn, FileFixifyAbsolute); if (!QFile::exists(src)) @@ -1560,9 +1560,9 @@ bool UnixMakefileGenerator::writeObjectsPart(QTextStream &t, bool do_incremental if (!increment) t << "\\\n\t\t" << (*objit); } - if (incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! + if (incrs_out.size() == objs.size()) { //we just switched places, no real incrementals to be done! t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << Qt::endl; - } else if (!incrs_out.count()) { + } else if (!incrs_out.size()) { t << Qt::endl; } else { src_incremental = true; diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 630f054e41..7f798a2cc6 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -250,7 +250,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" << var("QMAKE_SHELL_NULL_DEVICE"); const ProString &objmax = project->first("QMAKE_LINK_OBJECT_MAX"); - if (objmax.isEmpty() || project->values("OBJECTS").count() < objmax.toInt()) { + if (objmax.isEmpty() || project->values("OBJECTS").size() < objmax.toInt()) { t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ; } else { t << "\n\t" << objectsLinkLine << " " ; @@ -273,7 +273,7 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) ProStringList rcIncPaths = project->values("RC_INCLUDEPATH"); rcIncPaths.prepend(fileInfo(rc_file).path()); QString incPathStr; - for (int i = 0; i < rcIncPaths.count(); ++i) { + for (int i = 0; i < rcIncPaths.size(); ++i) { const ProString &path = rcIncPaths.at(i); if (path.isEmpty()) continue; diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index ce4a80b6c8..7cbb44dde4 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -283,7 +283,7 @@ static QString commandLinesForOutput(QStringList commands) // As we want every sub-command to be error-checked (as is done by makefile-based // backends), we insert the checks ourselves, using the undocumented jump target. static QString errchk = QStringLiteral("if errorlevel 1 goto VCEnd"); - for (int i = commands.count() - 2; i >= 0; --i) { + for (int i = commands.size() - 2; i >= 0; --i) { if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive)) commands.insert(i + 1, errchk); } @@ -301,7 +301,7 @@ static QStringList unquote(const QStringList &values) { QStringList result; result.reserve(values.size()); - for (int i = 0; i < values.count(); ++i) + for (int i = 0; i < values.size(); ++i) result << unquote(values.at(i)); return result; } @@ -544,7 +544,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) [] (const VCFilter &filter) { return filter.Name; }); tempProj.ExtraCompilers.removeDuplicates(); - for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) + for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) addFilters(tempProj, xmlFilter, tempProj.ExtraCompilers.at(x)); xmlFilter << closetag(); @@ -559,7 +559,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) outputFilter(tempProj, xml, xmlFilter, "Deployment Files"); outputFilter(tempProj, xml, xmlFilter, "Distribution Files"); - for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) { outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x)); } @@ -774,7 +774,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) addFilters(tool, xmlFilter, "Deployment Files"); addFilters(tool, xmlFilter, "Distribution Files"); - for (int x = 0; x < tool.ExtraCompilers.count(); ++x) + for (int x = 0; x < tool.ExtraCompilers.size(); ++x) addFilters(tool, xmlFilter, tool.ExtraCompilers.at(x)); xmlFilter << closetag(); @@ -788,7 +788,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) outputFilter(tool, xml, xmlFilter, "Resource Files"); outputFilter(tool, xml, xmlFilter, "Deployment Files"); outputFilter(tool, xml, xmlFilter, "Distribution Files"); - for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tool.ExtraCompilers.size(); ++x) { outputFilter(tool, xml, xmlFilter, tool.ExtraCompilers.at(x)); } outputFilter(tool, xml, xmlFilter, "Root Files"); diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 660ac24af9..5878686828 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -1539,7 +1539,7 @@ bool VCLinkerTool::parseOption(const char* option) { QStringList both = QString(option+6).split(","); HeapReserveSize = both[0].toLongLong(); - if(both.count() == 2) + if(both.size() == 2) HeapCommitSize = both[1].toLongLong(); } break; @@ -1728,7 +1728,7 @@ bool VCLinkerTool::parseOption(const char* option) { QStringList both = QString(option+7).split(","); StackReserveSize = both[0].toLongLong(); - if(both.count() == 2) + if(both.size() == 2) StackCommitSize = both[1].toLongLong(); } break; @@ -2231,13 +2231,13 @@ void VCFilter::addFile(const VCFilterFile& fileInfo) void VCFilter::addFiles(const QStringList& fileList) { - for (int i = 0; i < fileList.count(); ++i) + for (int i = 0; i < fileList.size(); ++i) addFile(fileList.at(i)); } void VCFilter::addFiles(const ProStringList& fileList) { - for (int i = 0; i < fileList.count(); ++i) + for (int i = 0; i < fileList.size(); ++i) addFile(fileList.at(i).toQString()); } @@ -2342,7 +2342,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) CustomBuildTool.ToolPath.clear(); CustomBuildTool.ToolName = QLatin1String(_VCCustomBuildTool); - for (int x = 0; x < extraCompilers.count(); ++x) { + for (int x = 0; x < extraCompilers.size(); ++x) { const QString &extraCompilerName = extraCompilers.at(x); if (!Project->verifyExtraCompiler(extraCompilerName, inFile) && !hasBuiltIn) @@ -2387,7 +2387,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) configs.contains("dep_existing_only"), true /* checkCommandAvailability */); } - for (int i = 0; i < deps.count(); ++i) + for (int i = 0; i < deps.size(); ++i) deps[i] = Option::fixPathToTargetOS( Project->replaceExtraCompilerVariables( deps.at(i), inFile, out, MakefileGenerator::NoShell), @@ -2396,9 +2396,9 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) if (combined) { // Add dependencies for each file const ProStringList &tmp_in = Project->project->values(ProKey(extraCompilerName + ".input")); - for (int a = 0; a < tmp_in.count(); ++a) { + for (int a = 0; a < tmp_in.size(); ++a) { const ProStringList &files = Project->project->values(tmp_in.at(a).toKey()); - for (int b = 0; b < files.count(); ++b) { + for (int b = 0; b < files.size(); ++b) { QString file = files.at(b).toQString(); deps += Project->findDependencies(file); inputs += Option::fixPathToTargetOS(file, false); @@ -2432,7 +2432,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) } // Fixify paths - for (int i = 0; i < deps.count(); ++i) + for (int i = 0; i < deps.size(); ++i) deps[i] = Option::fixPathToTargetOS(deps[i], false); @@ -2450,7 +2450,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) deps += CustomBuildTool.AdditionalDependencies; // Make sure that all deps are only once QStringList uniqDeps; - for (int c = 0; c < deps.count(); ++c) { + for (int c = 0; c < deps.size(); ++c) { QString aDep = deps.at(c); if (!aDep.isEmpty()) uniqDeps << aDep; @@ -2496,7 +2496,7 @@ const VCFilter &VCProjectSingleConfig::filterByName(const QString &name) const const VCFilter &VCProjectSingleConfig::filterForExtraCompiler(const QString &compilerName) const { - for (int i = 0; i < ExtraCompilersFiles.count(); ++i) + for (int i = 0; i < ExtraCompilersFiles.size(); ++i) if (ExtraCompilersFiles.at(i).Name == compilerName) return ExtraCompilersFiles.at(i); @@ -2576,7 +2576,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) outputFilter(tempProj, xml, "Distribution Files"); QSet extraCompilersInProject; - for (int i = 0; i < tool.ExtraCompilersFiles.count(); ++i) { + for (int i = 0; i < tool.ExtraCompilersFiles.size(); ++i) { const QString &compilerName = tool.ExtraCompilersFiles.at(i).Name; if (!extraCompilersInProject.contains(compilerName)) { extraCompilersInProject += compilerName; @@ -2584,7 +2584,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) } } - for (int x = 0; x < tempProj.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tempProj.ExtraCompilers.size(); ++x) { outputFilter(tempProj, xml, tempProj.ExtraCompilers.at(x)); } outputFilter(tempProj, xml, "Root Files"); @@ -2628,7 +2628,7 @@ void VCProjectWriter::write(XmlOutput &xml, VCProject &tool) outputFilter(tool, xml, "Resource Files"); outputFilter(tool, xml, "Deployment Files"); outputFilter(tool, xml, "Distribution Files"); - for (int x = 0; x < tool.ExtraCompilers.count(); ++x) { + for (int x = 0; x < tool.ExtraCompilers.size(); ++x) { outputFilter(tool, xml, tool.ExtraCompilers.at(x)); } outputFilter(tool, xml, "Root Files"); diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 5dd1532d57..ac50253a44 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -152,7 +152,7 @@ bool VcprojGenerator::writeProjectMakefile() for (int i = 0; i < mergedProjects.size(); ++i) { VCProjectSingleConfig *singleProject = &(mergedProjects.at(i)->vcProject); mergedProject.SingleProjects += *singleProject; - for (int j = 0; j < singleProject->ExtraCompilersFiles.count(); ++j) { + for (int j = 0; j < singleProject->ExtraCompilersFiles.size(); ++j) { const QString &compilerName = singleProject->ExtraCompilersFiles.at(j).Name; if (!mergedProject.ExtraCompilers.contains(compilerName)) mergedProject.ExtraCompilers += compilerName; @@ -634,10 +634,10 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) bool VcprojGenerator::hasBuiltinCompiler(const QString &file) { // Source files - for (int i = 0; i < Option::cpp_ext.count(); ++i) + for (int i = 0; i < Option::cpp_ext.size(); ++i) if (file.endsWith(Option::cpp_ext.at(i))) return true; - for (int i = 0; i < Option::c_ext.count(); ++i) + for (int i = 0; i < Option::c_ext.size(); ++i) if (file.endsWith(Option::c_ext.at(i))) return true; if (file.endsWith(".rc") @@ -767,8 +767,8 @@ void VcprojGenerator::init() if (autogenPrecompSource) { precompSource = precompH + (pchIsCFile - ? (Option::c_ext.count() ? Option::c_ext.at(0) : QLatin1String(".c")) - : (Option::cpp_ext.count() ? Option::cpp_ext.at(0) : QLatin1String(".cpp"))); + ? (Option::c_ext.size() ? Option::c_ext.at(0) : QLatin1String(".c")) + : (Option::cpp_ext.size() ? Option::cpp_ext.at(0) : QLatin1String(".cpp"))); project->values("GENERATED_SOURCES") += precompSource; } else if (!precompSource.isEmpty()) { project->values("SOURCES") += precompSource; @@ -1553,7 +1553,7 @@ void VcprojGenerator::initExtraCompilerOutputs() } else if (!inputVars.isEmpty()) { // One output file per input const ProStringList &tmp_in = project->values(inputVars.first().toKey()); - for (int i = 0; i < tmp_in.count(); ++i) { + for (int i = 0; i < tmp_in.size(); ++i) { const QString &filename = tmp_in.at(i).toQString(); if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename)) extraCompile.addFile(Option::fixPathToTargetOS( @@ -1568,7 +1568,7 @@ void VcprojGenerator::initExtraCompilerOutputs() for (const ProString &inputVar : inputVars) { if (!otherFilters.contains(inputVar)) { const ProStringList &tmp_in = project->values(inputVar.toKey()); - for (int i = 0; i < tmp_in.count(); ++i) { + for (int i = 0; i < tmp_in.size(); ++i) { const QString &filename = tmp_in.at(i).toQString(); if (extraCompilerSources.contains(filename) && !otherFiltersContain(filename)) extraCompile.addFile(Option::fixPathToTargetOS( diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 5ae4d095c7..c8317389f5 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -174,9 +174,9 @@ bool Win32MakefileGenerator::processPrlFileBase(QString &origFile, QStringView o { if (MakefileGenerator::processPrlFileBase(origFile, origName, fixedBase, slashOff)) return true; - for (int off = fixedBase.length(); off > slashOff; off--) { + for (int off = fixedBase.size(); off > slashOff; off--) { if (!fixedBase.at(off - 1).isDigit()) { - if (off != fixedBase.length()) { + if (off != fixedBase.size()) { return MakefileGenerator::processPrlFileBase( origFile, origName, fixedBase.left(off), slashOff); } @@ -686,7 +686,7 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) const ProStringList rcIncPaths = project->values("RC_INCLUDEPATH"); QString incPathStr; - for (int i = 0; i < rcIncPaths.count(); ++i) { + for (int i = 0; i < rcIncPaths.size(); ++i) { const ProString &path = rcIncPaths.at(i); if (path.isEmpty()) continue; diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 1537648843..f885bb19c3 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -225,12 +225,12 @@ QMakeEvaluator::getMemberArgs(const ProKey &func, int srclen, const ProStringLis int *start, int *end) { *start = 0, *end = 0; - if (args.count() >= 2) { + if (args.size() >= 2) { bool ok = true; const ProString &start_str = args.at(1); *start = start_str.toInt(&ok); if (!ok) { - if (args.count() == 2) { + if (args.size() == 2) { int dotdot = start_str.indexOf(statics.strDotDot); if (dotdot != -1) { *start = start_str.left(dotdot).toInt(&ok); @@ -246,7 +246,7 @@ QMakeEvaluator::getMemberArgs(const ProKey &func, int srclen, const ProStringLis } } else { *end = *start; - if (args.count() == 3) + if (args.size() == 3) *end = args.at(2).toInt(&ok); if (!ok) { ProStringRoUser u1(func, m_tmp1); @@ -595,7 +595,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( var = args[0]; sep = args.at(1).toQString(); beg = args.at(2).toInt(); - if (args.count() == 4) + if (args.size() == 4) end = args.at(3).toInt(); } else { var = args[0]; @@ -630,7 +630,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( case E_SPRINTF: { ProStringRwUser u1(args.at(0), m_tmp1); QString tmp = u1.str(); - for (int i = 1; i < args.count(); ++i) + for (int i = 1; i < args.size(); ++i) tmp = tmp.arg(args.at(i).toQStringView()); ret << u1.extract(tmp); break; @@ -642,7 +642,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( bool zeropad = false; bool leftalign = false; enum { DefaultSign, PadSign, AlwaysSign } sign = DefaultSign; - if (args.count() >= 2) { + if (args.size() >= 2) { const auto opts = split_value_list(args.at(1).toQStringView()); for (const ProString &opt : opts) { if (opt.startsWith(QLatin1String("ibase="))) { @@ -722,11 +722,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( } case E_JOIN: { ProString glue, before, after; - if (args.count() >= 2) + if (args.size() >= 2) glue = args.at(1); - if (args.count() >= 3) + if (args.size() >= 3) before = args[2]; - if (args.count() == 4) + if (args.size() == 4) after = args[3]; const ProStringList &var = values(map(args.at(0))); if (!var.isEmpty()) { @@ -742,7 +742,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( } case E_SPLIT: { ProStringRoUser u1(m_tmp1); - const QString &sep = (args.count() == 2) ? u1.set(args.at(1)) : statics.field_sep; + const QString &sep = (args.size() == 2) ? u1.set(args.at(1)) : statics.field_sep; const auto vars = values(map(args.at(0))); for (const ProString &var : vars) { // FIXME: this is inconsistent with the "there are no empty strings" dogma. @@ -816,7 +816,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( bool blob = false; bool lines = false; bool singleLine = true; - if (args.count() > 1) { + if (args.size() > 1) { if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive)) singleLine = false; else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive)) @@ -883,7 +883,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( bool blob = false; bool lines = false; bool singleLine = true; - if (args.count() > 1) { + if (args.size() > 1) { if (!args.at(1).compare(QLatin1String("false"), Qt::CaseInsensitive)) singleLine = false; else if (!args.at(1).compare(QLatin1String("blob"), Qt::CaseInsensitive)) @@ -893,7 +893,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( } int exitCode; QByteArray bytes = getCommandOutput(args.at(0).toQString(), &exitCode); - if (args.count() > 2 && !args.at(2).isEmpty()) { + if (args.size() > 2 && !args.at(2).isEmpty()) { m_valuemapStack.top()[args.at(2).toKey()] = ProStringList(ProString(QString::number(exitCode))); } @@ -981,7 +981,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( case E_UPPER: case E_LOWER: case E_TITLE: - for (int i = 0; i < args.count(); ++i) { + for (int i = 0; i < args.size(); ++i) { ProStringRwUser u1(args.at(i), m_tmp1); QString rstr = u1.str(); if (func_t == E_UPPER) { @@ -996,7 +996,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( break; case E_FILES: { bool recursive = false; - if (args.count() == 2) + if (args.size() == 2) recursive = isTrue(args.at(1)); QStringList dirs; ProStringRoUser u1(args.at(0), m_tmp1); @@ -1022,7 +1022,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( evalError(fL1S("section(): Encountered invalid wildcard expression '%1'.").arg(pattern)); goto allfail; } - for (int d = 0; d < dirs.count(); d++) { + for (int d = 0; d < dirs.size(); d++) { QString dir = dirs[d]; QDir qdir(pfx + dir); for (int i = 0, count = int(qdir.count()); i < count; ++i) { @@ -1044,7 +1044,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( ProStringRoUser u1(args.at(0), m_tmp1); QString msg = m_option->expandEnvVars(u1.str()); bool decorate = true; - if (args.count() == 2) + if (args.size() == 2) decorate = isTrue(args.at(1)); if (decorate) { if (!msg.endsWith(QLatin1Char('?'))) @@ -1091,10 +1091,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( ProValueMap dependees; QMultiMap rootSet; ProStringList orgList = values(args.at(0).toKey()); - ProString prefix = args.count() < 2 ? ProString() : args.at(1); - ProString priosfx = args.count() < 4 ? ProString(".priority") : args.at(3); + ProString prefix = args.size() < 2 ? ProString() : args.at(1); + ProString priosfx = args.size() < 4 ? ProString(".priority") : args.at(3); populateDeps(orgList, prefix, - args.count() < 3 ? ProStringList(ProString(".depends")) + args.size() < 3 ? ProStringList(ProString(".depends")) : split_value_list(args.at(2).toQStringView()), priosfx, dependencies, dependees, rootSet); while (!rootSet.isEmpty()) { @@ -1131,7 +1131,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( case E_ABSOLUTE_PATH: { ProStringRwUser u1(args.at(0), m_tmp1); ProStringRwUser u2(m_tmp2); - QString baseDir = args.count() > 1 + QString baseDir = args.size() > 1 ? IoUtils::resolvePath(currentDirectory(), u2.set(args.at(1))) : currentDirectory(); QString rstr = u1.str().isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, u1.str()); @@ -1141,7 +1141,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( case E_RELATIVE_PATH: { ProStringRwUser u1(args.at(0), m_tmp1); ProStringRoUser u2(m_tmp2); - QString baseDir = args.count() > 1 + QString baseDir = args.size() > 1 ? IoUtils::resolvePath(currentDirectory(), u2.set(args.at(1))) : currentDirectory(); QString absArg = u1.str().isEmpty() ? baseDir : IoUtils::resolvePath(baseDir, u1.str()); @@ -1252,7 +1252,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList & enum { TargetStash, TargetCache, TargetSuper } target = TargetCache; enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet; ProKey srcvar; - if (args.count() >= 2) { + if (args.size() >= 2) { const auto opts = split_value_list(args.at(1).toQStringView()); for (const ProString &opt : opts) { if (opt == QLatin1String("transient")) { @@ -1272,7 +1272,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList & return ReturnFalse; } } - if (args.count() >= 3) { + if (args.size() >= 3) { srcvar = args.at(2).toKey(); } else if (mode != CacheSet) { evalError(fL1S("cache(): modes other than 'set' require a source variable.")); @@ -1367,7 +1367,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::testFunc_cache(const ProStringList & varstr += QLatin1String(" -="); else varstr += QLatin1String(" ="); - if (diffval.count() == 1) { + if (diffval.size() == 1) { varstr += QLatin1Char(' '); varstr += quoteValue(diffval.at(0)); } else if (!diffval.isEmpty()) { @@ -1425,7 +1425,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( switch (func_t) { case T_DEFINED: { const ProKey &var = args.at(0).toKey(); - if (args.count() > 1) { + if (args.size() > 1) { if (args[1] == QLatin1String("test")) { return returnBool(m_functionDefs.testFunctions.contains(var)); } else if (args[1] == QLatin1String("replace")) { @@ -1512,7 +1512,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( VisitReturn ok = evaluateFileInto(fn, &vars, LoadProOnly); if (ok != ReturnTrue) return ok; - if (args.count() == 2) + if (args.size() == 2) return returnBool(vars.contains(map(args.at(1)))); QRegularExpression regx; regx.setPatternOptions(QRegularExpression::DotMatchesEverythingOption); @@ -1562,7 +1562,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( m_current.pro->fileName(), m_current.line); } case T_CONFIG: { - if (args.count() == 1) + if (args.size() == 1) return returnBool(isActiveConfig(args.at(0).toQStringView())); const auto mutuals = args.at(1).toQStringView().split(QLatin1Char('|'), Qt::SkipEmptyParts); @@ -1589,7 +1589,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } } const ProStringList &l = values(map(args.at(0))); - if (args.count() == 2) { + if (args.size() == 2) { for (int i = 0; i < l.size(); ++i) { const ProString &val = l[i]; if (val == qry) @@ -1622,9 +1622,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return ReturnFalse; } case T_COUNT: { - int cnt = values(map(args.at(0))).count(); + int cnt = values(map(args.at(0))).size(); int val = args.at(1).toInt(); - if (args.count() == 3) { + if (args.size() == 3) { const ProString &comp = args.at(2); if (comp == QLatin1String(">") || comp == QLatin1String("greaterThan")) { return returnBool(cnt > val); @@ -1710,10 +1710,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( LoadFlags flags; if (m_cumulative) flags = LoadSilent; - if (args.count() >= 2) { + if (args.size() >= 2) { if (!args.at(1).isEmpty()) parseInto = args.at(1) + QLatin1Char('.'); - if (args.count() >= 3 && isTrue(args.at(2))) + if (args.size() >= 3 && isTrue(args.at(2))) flags = LoadSilent; } QString fn = filePathEnvArg0(args); @@ -1745,7 +1745,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return ok; } case T_LOAD: { - bool ignore_error = (args.count() == 2 && isTrue(args.at(1))); + bool ignore_error = (args.size() == 2 && isTrue(args.at(1))); VisitReturn ok = evaluateFeatureFile(m_option->expandEnvVars(args.at(0).toQString()), ignore_error); if (ok == ReturnFalse && ignore_error) @@ -1844,11 +1844,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( QIODevice::OpenMode mode = QIODevice::Truncate; QMakeVfs::VfsFlags flags = (m_cumulative ? QMakeVfs::VfsCumulative : QMakeVfs::VfsExact); QString contents; - if (args.count() >= 2) { + if (args.size() >= 2) { const ProStringList &vals = values(args.at(1).toKey()); if (!vals.isEmpty()) contents = vals.join(QLatin1Char('\n')) + QLatin1Char('\n'); - if (args.count() >= 3) { + if (args.size() >= 3) { const auto opts = split_value_list(args.at(2).toQStringView()); for (const ProString &opt : opts) { if (opt == QLatin1String("append")) { diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 5e54199419..d4cb8aad7a 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -256,7 +256,7 @@ ProStringList QMakeEvaluator::split_value_list(QStringView vals, int source) source = currentFileId(); const QChar *vals_data = vals.data(); - const int vals_len = vals.length(); + const int vals_len = vals.size(); char16_t quote = 0; bool hadWord = false; for (int x = 0; x < vals_len; x++) { @@ -801,7 +801,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop( } else { ProString val; do { - if (index >= list.count()) + if (index >= list.size()) goto do_break; val = list.at(index++); } while (val.isEmpty()); // stupid, but qmake is like that @@ -853,7 +853,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable( if (expandVariableReferences(tokPtr, sizeHint, &varVal, true) == ReturnError) return ReturnError; QStringView val = varVal.at(0).toQStringView(); - if (val.length() < 4 || val.at(0) != QLatin1Char('s')) { + if (val.size() < 4 || val.at(0) != QLatin1Char('s')) { evalError(fL1S("The ~= operator can handle only the s/// function.")); return ReturnTrue; } @@ -1545,7 +1545,7 @@ void QMakeEvaluator::updateFeaturePaths() feature_roots << (fb + features_concat); } - for (int i = 0; i < feature_roots.count(); ++i) + for (int i = 0; i < feature_roots.size(); ++i) if (!feature_roots.at(i).endsWith(QLatin1Char('/'))) feature_roots[i].append(QLatin1Char('/')); diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp index 91452aedb1..e05d33c7c9 100644 --- a/qmake/library/qmakeglobals.cpp +++ b/qmake/library/qmakeglobals.cpp @@ -89,7 +89,7 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( QMakeCmdLineParserState &state, QStringList &args, int *pos) { enum { ArgNone, ArgConfig, ArgSpec, ArgXSpec, ArgTmpl, ArgTmplPfx, ArgCache, ArgQtConf } argState = ArgNone; - for (; *pos < args.count(); (*pos)++) { + for (; *pos < args.size(); (*pos)++) { QString arg = args.at(*pos); switch (argState) { case ArgConfig: @@ -243,7 +243,7 @@ QStringList QMakeGlobals::splitPathList(const QString &val) const if (!val.isEmpty()) { QString cwd(QDir::currentPath()); const QStringList vals = val.split(dirlist_sep, Qt::SkipEmptyParts); - ret.reserve(vals.length()); + ret.reserve(vals.size()); for (const QString &it : vals) ret << IoUtils::resolvePath(cwd, it); } diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index ab1d290fb2..ade2b091fe 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -334,7 +334,7 @@ void QMakeParser::read(ProFile *pro, QStringView in, int line, SubGrammar gramma xprStack.reserve(10); const ushort *cur = (const ushort *)in.data(); - const ushort *inend = cur + in.length(); + const ushort *inend = cur + in.size(); m_canElse = false; freshLine: m_state = StNew; @@ -1246,7 +1246,7 @@ bool QMakeParser::resolveVariable(ushort *xprPtr, int tlen, int needSep, ushort // The string is typically longer than the variable reference, so we need // to ensure that there is enough space in the output buffer - as unlikely // as an overflow is to actually happen in practice. - int need = (in.length() - (cur - (const ushort *)in.constData()) + 2) * 5 + out.size(); + int need = (in.size() - (cur - (const ushort *)in.constData()) + 2) * 5 + out.size(); int tused = *tokPtr - (ushort *)tokBuff->constData(); int xused; int total; diff --git a/qmake/option.cpp b/qmake/option.cpp index a550a557d5..d2092f2257 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -96,7 +96,7 @@ static QString detectProjectFile(const QString &path, QString *singleProFileCand ret = candidate; } else { //last try.. QStringList profiles = dir.entryList(QStringList("*" + Option::pro_ext)); - if(profiles.count() == 1) + if(profiles.size() == 1) ret = dir.filePath(profiles.at(0)); } return ret; @@ -174,7 +174,7 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state) { enum { ArgNone, ArgOutput } argState = ArgNone; int x = 0; - while (x < args.count()) { + while (x < args.size()) { switch (argState) { case ArgOutput: Option::output.setFileName(args.at(x--)); @@ -390,7 +390,7 @@ Option::init(int argc, char **argv) } else if (opt == "-qtconf") { // Skip "-qtconf " and proceed. ++idx; - if (idx + 1 < args.length()) + if (idx + 1 < args.size()) ++idx; continue; } else { diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index cd9a01a138..cf84200f2a 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -156,7 +156,7 @@ void QVariantAnimationPrivate::convertValues(int t) { auto type = QMetaType(t); //this ensures that all the keyValues are of type t - for (int i = 0; i < keyValues.count(); ++i) { + for (int i = 0; i < keyValues.size(); ++i) { QVariantAnimation::KeyValue &pair = keyValues[i]; pair.second.convert(type); } @@ -190,7 +190,7 @@ void QVariantAnimationPrivate::updateInterpolator() void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/) { // can't interpolate if we don't have at least 2 values - if ((keyValues.count() + (defaultStartEndValue.isValid() ? 1 : 0)) < 2) + if ((keyValues.size() + (defaultStartEndValue.isValid() ? 1 : 0)) < 2) return; const qreal endProgress = (direction == QAbstractAnimation::Forward) ? qreal(1) : qreal(0); @@ -207,7 +207,7 @@ void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/) animationValueLessThan); if (it == keyValues.constBegin()) { //the item pointed to by it is the start element in the range - if (it->first == 0 && keyValues.count() > 1) { + if (it->first == 0 && keyValues.size() > 1) { currentInterval.start = *it; currentInterval.end = *(it+1); } else { @@ -216,7 +216,7 @@ void QVariantAnimationPrivate::recalculateCurrentInterval(bool force/*=false*/) } } else if (it == keyValues.constEnd()) { --it; //position the iterator on the last item - if (it->first == 1 && keyValues.count() > 1) { + if (it->first == 1 && keyValues.size() > 1) { //we have an end value (item with progress = 1) currentInterval.start = *(it-1); currentInterval.end = *it; @@ -405,7 +405,7 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun // to continue causes the app to crash on exit with a SEGV if (interpolators) { const auto locker = qt_scoped_lock(registeredInterpolatorsMutex); - if (interpolationType >= interpolators->count()) + if (interpolationType >= interpolators->size()) interpolators->resize(interpolationType + 1); interpolators->replace(interpolationType, func); } @@ -423,7 +423,7 @@ QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int in QInterpolatorVector *interpolators = registeredInterpolators(); const auto locker = qt_scoped_lock(registeredInterpolatorsMutex); QVariantAnimation::Interpolator ret = nullptr; - if (interpolationType < interpolators->count()) { + if (interpolationType < interpolators->size()) { ret = interpolators->at(interpolationType); if (ret) return ret; } diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index e58a310901..b54ae214b0 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1271,7 +1271,7 @@ qsizetype QDir::count(QT6_IMPL_NEW_OVERLOAD) const { Q_D(const QDir); d->initFileLists(*this); - return d->files.count(); + return d->files.size(); } /*! diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index e622f3af0d..7f5480c274 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -295,7 +295,7 @@ void QFileSelectorPrivate::updateSelectors() QLatin1Char pathSep(','); QStringList envSelectors = QString::fromLatin1(qgetenv("QT_FILE_SELECTORS")) .split(pathSep, Qt::SkipEmptyParts); - if (envSelectors.count()) + if (envSelectors.size()) sharedData->staticSelectors << envSelectors; if (!qEnvironmentVariableIsEmpty(env_override)) diff --git a/src/corelib/io/qfilesystemengine.cpp b/src/corelib/io/qfilesystemengine.cpp index b7cb5354b6..bedace4c79 100644 --- a/src/corelib/io/qfilesystemengine.cpp +++ b/src/corelib/io/qfilesystemengine.cpp @@ -119,7 +119,7 @@ static bool _q_resolveEntryAndCreateLegacyEngine_recursive(QFileSystemEntry &ent break; const QStringList &paths = QDir::searchPaths(filePath.left(prefixSeparator)); - for (qsizetype i = 0; i < paths.count(); i++) { + for (int i = 0; i < paths.size(); i++) { entry = QFileSystemEntry(QDir::cleanPath( paths.at(i) % u'/' % QStringView{filePath}.mid(prefixSeparator + 1))); // Recurse! diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index a44ae1a260..a9919fdfa8 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -343,7 +343,7 @@ void QSettingsPrivate::requestUpdate() QStringList QSettingsPrivate::variantListToStringList(const QVariantList &l) { QStringList result; - result.reserve(l.count()); + result.reserve(l.size()); for (auto v : l) result.append(variantToString(v)); return result; @@ -358,7 +358,7 @@ QVariant QSettingsPrivate::stringListToVariantList(const QStringList &l) if (str.startsWith(u'@')) { if (str.size() < 2 || str.at(1) != u'@') { QVariantList variantList; - variantList.reserve(l.count()); + variantList.reserve(l.size()); for (const auto &s : l) variantList.append(stringToVariant(s)); return variantList; @@ -1511,7 +1511,7 @@ bool QConfFileSettingsPrivate::readIniLine(QByteArrayView data, qsizetype &dataP qsizetype &lineStart, qsizetype &lineLen, qsizetype &equalsPos) { - qsizetype dataLen = data.length(); + qsizetype dataLen = data.size(); bool inQuotes = false; equalsPos = -1; @@ -1638,7 +1638,7 @@ bool QConfFileSettingsPrivate::readIniFile(QByteArrayView data, ++position; } - Q_ASSERT(lineStart == data.length()); + Q_ASSERT(lineStart == data.size()); FLUSH_CURRENT_SECTION(); return ok; diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index b94dd6a18d..339f3c565e 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -260,10 +260,10 @@ QString QStandardPaths::writableLocation(StandardLocation type) QRegularExpressionMatch match = exp.match(line); if (match.hasMatch() && match.capturedView(1) == key) { QStringView value = match.capturedView(2); - if (value.length() > 2 + if (value.size() > 2 && value.startsWith(u'\"') && value.endsWith(u'\"')) - value = value.mid(1, value.length() - 2); + value = value.mid(1, value.size() - 2); // value can start with $HOME if (value.startsWith("$HOME"_L1)) result = QDir::homePath() + value.mid(5); @@ -371,7 +371,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) break; case AppConfigLocation: dirs = xdgConfigDirs(); - for (int i = 0; i < dirs.count(); ++i) + for (int i = 0; i < dirs.size(); ++i) appendOrganizationAndApp(dirs[i]); break; case GenericDataLocation: @@ -379,19 +379,19 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) break; case ApplicationsLocation: dirs = xdgDataDirs(); - for (int i = 0; i < dirs.count(); ++i) + for (int i = 0; i < dirs.size(); ++i) dirs[i].append("/applications"_L1); break; case AppDataLocation: case AppLocalDataLocation: dirs = xdgDataDirs(); - for (int i = 0; i < dirs.count(); ++i) + for (int i = 0; i < dirs.size(); ++i) appendOrganizationAndApp(dirs[i]); break; case FontsLocation: dirs += QDir::homePath() + "/.fonts"_L1; dirs += xdgDataDirs(); - for (int i = 1; i < dirs.count(); ++i) + for (int i = 1; i < dirs.size(); ++i) dirs[i].append("/fonts"_L1); break; default: diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 8890f3dfad..86ad1439e3 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -75,7 +75,7 @@ QTemporaryFileName::QTemporaryFileName(const QString &templateName) .nativeFilePath(); // Find mask in native path - phPos = filename.length(); + phPos = filename.size(); phLength = 0; while (phPos != 0) { --phPos; @@ -109,8 +109,8 @@ QTemporaryFileName::QTemporaryFileName(const QString &templateName) QFileSystemEntry::NativePath QTemporaryFileName::generateNext() { Q_ASSERT(length != 0); - Q_ASSERT(pos < path.length()); - Q_ASSERT(length <= path.length() - pos); + Q_ASSERT(pos < path.size()); + Q_ASSERT(length <= path.size() - pos); Char *const placeholderStart = (Char *)path.data() + pos; Char *const placeholderEnd = placeholderStart + length; diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 4be07bcb0f..a3ff86b353 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -918,7 +918,7 @@ inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions o } // check if we need to remove trailing slashes if (options & QUrl::StripTrailingSlash) { - while (thePathView.length() > 1 && thePathView.endsWith(u'/')) + while (thePathView.size() > 1 && thePathView.endsWith(u'/')) thePathView.chop(1); } diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index c63a25125b..5fc6006ef4 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -73,11 +73,11 @@ Q_AUTOTEST_EXPORT void qt_punycodeEncoder(QStringView in, QString *output) // Do not try to encode strings that certainly will result in output // that is longer than allowable domain name label length. Note that // non-BMP codepoints are encoded as two QChars. - if (in.length() > MaxDomainLabelLength * 2) + if (in.size() > MaxDomainLabelLength * 2) return; - int outLen = output->length(); - output->resize(outLen + in.length()); + int outLen = output->size(); + output->resize(outLen + in.size()); QChar *d = output->data() + outLen; bool skipped = false; @@ -468,7 +468,7 @@ static QString mapDomainName(const QString &in, QUrl::AceProcessingOptions optio */ static bool validateAsciiLabel(QStringView label) { - if (label.length() > MaxDomainLabelLength) + if (label.size() > MaxDomainLabelLength) return false; if (label.first() == u'-' || label.last() == u'-') diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index 002ff5a38e..9b3015ecf0 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -630,7 +630,7 @@ QList > QUrlQuery::queryItems(QUrl::ComponentFormattingO QList > result; Map::const_iterator it = d->itemList.constBegin(); Map::const_iterator end = d->itemList.constEnd(); - result.reserve(d->itemList.count()); + result.reserve(d->itemList.size()); for ( ; it != end; ++it) result << qMakePair(d->recodeToUser(it->first, encoding), d->recodeToUser(it->second, encoding)); diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index bda8b47d4a..ecac010edb 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -2120,7 +2120,7 @@ QStringList QAbstractItemModel::mimeTypes() const */ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const { - if (indexes.count() <= 0) + if (indexes.size() <= 0) return nullptr; QStringList types = mimeTypes(); if (types.isEmpty()) @@ -2159,7 +2159,7 @@ bool QAbstractItemModel::canDropMimeData(const QMimeData *data, Qt::DropAction a return false; const QStringList modelTypes = mimeTypes(); - for (int i = 0; i < modelTypes.count(); ++i) { + for (int i = 0; i < modelTypes.size(); ++i) { if (data->hasFormat(modelTypes.at(i))) return true; } @@ -2516,7 +2516,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role, // iterates twice if wrapping for (int i = 0; (wrap && i < 2) || (!wrap && i < 1); ++i) { - for (int r = from; (r < to) && (allHits || result.count() < hits); ++r) { + for (int r = from; (r < to) && (allHits || result.size() < hits); ++r) { QModelIndex idx = index(r, column, p); if (!idx.isValid()) continue; @@ -2582,7 +2582,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role, if (hasChildren(parent)) { // search the hierarchy result += match(index(0, column, parent), role, (text.isEmpty() ? value : text), - (allHits ? -1 : hits - result.count()), flags); + (allHits ? -1 : hits - result.size()), flags); } } } @@ -3446,8 +3446,8 @@ void QAbstractItemModel::changePersistentIndexList(const QModelIndexList &from, if (d->persistent.indexes.isEmpty()) return; QList toBeReinserted; - toBeReinserted.reserve(to.count()); - for (int i = 0; i < from.count(); ++i) { + toBeReinserted.reserve(to.size()); + for (int i = 0; i < from.size(); ++i) { if (from.at(i) == to.at(i)) continue; const auto it = d->persistent.indexes.constFind(from.at(i)); diff --git a/src/corelib/itemmodels/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp index 99324a0cd5..023587e39a 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.cpp +++ b/src/corelib/itemmodels/qabstractproxymodel.cpp @@ -443,7 +443,7 @@ QMimeData* QAbstractProxyModel::mimeData(const QModelIndexList &indexes) const { Q_D(const QAbstractProxyModel); QModelIndexList list; - list.reserve(indexes.count()); + list.reserve(indexes.size()); for (const QModelIndex &index : indexes) list << mapToSource(index); return d->model->mimeData(list); diff --git a/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp index f2e74edf19..44cf28b47a 100644 --- a/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp +++ b/src/corelib/itemmodels/qconcatenatetablesproxymodel.cpp @@ -315,7 +315,7 @@ QMimeData *QConcatenateTablesProxyModel::mimeData(const QModelIndexList &indexes Q_ASSERT(checkIndex(firstIndex, CheckIndexOption::IndexIsValid)); const auto result = d->sourceModelForRow(firstIndex.row()); QModelIndexList sourceIndexes; - sourceIndexes.reserve(indexes.count()); + sourceIndexes.reserve(indexes.size()); for (const QModelIndex &index : indexes) { const QModelIndex sourceIndex = mapToSource(index); Q_ASSERT(sourceIndex.model() == result.sourceModel); // see documentation above diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp index b610298cbb..cc0730d769 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.cpp +++ b/src/corelib/itemmodels/qidentityproxymodel.cpp @@ -144,7 +144,7 @@ QItemSelection QIdentityProxyModel::mapSelectionFromSource(const QItemSelection& QItemSelection::const_iterator it = selection.constBegin(); const QItemSelection::const_iterator end = selection.constEnd(); - proxySelection.reserve(selection.count()); + proxySelection.reserve(selection.size()); for ( ; it != end; ++it) { Q_ASSERT(it->model() == d->model); const QItemSelectionRange range(mapFromSource(it->topLeft()), mapFromSource(it->bottomRight())); @@ -167,7 +167,7 @@ QItemSelection QIdentityProxyModel::mapSelectionToSource(const QItemSelection& s QItemSelection::const_iterator it = selection.constBegin(); const QItemSelection::const_iterator end = selection.constEnd(); - sourceSelection.reserve(selection.count()); + sourceSelection.reserve(selection.size()); for ( ; it != end; ++it) { Q_ASSERT(it->model() == this); const QItemSelectionRange range(mapToSource(it->topLeft()), mapToSource(it->bottomRight())); @@ -203,7 +203,7 @@ QModelIndexList QIdentityProxyModel::match(const QModelIndex& start, int role, c QModelIndexList::const_iterator it = sourceList.constBegin(); const QModelIndexList::const_iterator end = sourceList.constEnd(); QModelIndexList proxyList; - proxyList.reserve(sourceList.count()); + proxyList.reserve(sourceList.size()); for ( ; it != end; ++it) proxyList.append(mapFromSource(*it)); return proxyList; diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index ec98e3a1f7..0f3cbadca5 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -466,15 +466,15 @@ void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::Sel if (!range.isValid()) continue; newSelection.push_back(range); - for (int t = 0; t < count(); ++t) { + for (int t = 0; t < size(); ++t) { if (range.intersects(at(t))) intersections.append(at(t).intersected(range)); } } // Split the old (and new) ranges using the intersections - for (int i = 0; i < intersections.count(); ++i) { // for each intersection - for (int t = 0; t < count();) { // splitt each old range + for (int i = 0; i < intersections.size(); ++i) { // for each intersection + for (int t = 0; t < size();) { // splitt each old range if (at(t).intersects(intersections.at(i))) { split(at(t), intersections.at(i), this); removeAt(t); @@ -483,7 +483,7 @@ void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::Sel } } // only split newSelection if Toggle is specified - for (int n = 0; (command & QItemSelectionModel::Toggle) && n < newSelection.count();) { + for (int n = 0; (command & QItemSelectionModel::Toggle) && n < newSelection.size();) { if (newSelection.at(n).intersects(intersections.at(i))) { split(newSelection.at(n), intersections.at(i), &newSelection); newSelection.removeAt(n); @@ -613,7 +613,7 @@ QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection QItemSelection expanded; if (command & QItemSelectionModel::Rows) { - for (int i = 0; i < selection.count(); ++i) { + for (int i = 0; i < selection.size(); ++i) { QModelIndex parent = selection.at(i).parent(); int colCount = model->columnCount(parent); QModelIndex tl = model->index(selection.at(i).top(), 0, parent); @@ -623,7 +623,7 @@ QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection } } if (command & QItemSelectionModel::Columns) { - for (int i = 0; i < selection.count(); ++i) { + for (int i = 0; i < selection.size(); ++i) { QModelIndex parent = selection.at(i).parent(); int rowCount = model->rowCount(parent); QModelIndex tl = model->index(0, selection.at(i).left(), parent); @@ -838,7 +838,7 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged(const QListrowCount(parent); @@ -949,11 +949,11 @@ static QItemSelection mergeIndexes(const QList &indexes) // merge rows QItemSelection rowSpans; i = 0; - while (i < colSpans.count()) { + while (i < colSpans.size()) { QModelIndex tl = colSpans.at(i).topLeft(); QModelIndex br = colSpans.at(i).bottomRight(); QModelIndex prevTl = tl; - while (++i < colSpans.count()) { + while (++i < colSpans.size()) { QModelIndex nextTl = colSpans.at(i).topLeft(); QModelIndex nextBr = colSpans.at(i).bottomRight(); @@ -1362,7 +1362,7 @@ void QItemSelectionModel::reset() void QItemSelectionModel::clearSelection() { Q_D(QItemSelectionModel); - if (d->ranges.count() == 0 && d->currentSelection.count() == 0) + if (d->ranges.size() == 0 && d->currentSelection.size() == 0) return; select(QItemSelection(), Clear); @@ -1433,7 +1433,7 @@ bool QItemSelectionModel::isSelected(const QModelIndex &index) const } // check currentSelection - if (d->currentSelection.count()) { + if (d->currentSelection.size()) { if ((d->currentCommand & Deselect) && selected) selected = !d->currentSelection.contains(index); else if (d->currentCommand & Toggle) @@ -1468,8 +1468,8 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons return false; // return false if row exist in currentSelection (Deselect) - if (d->currentCommand & Deselect && d->currentSelection.count()) { - for (int i=0; icurrentSelection.count(); ++i) { + if (d->currentCommand & Deselect && d->currentSelection.size()) { + for (int i=0; icurrentSelection.size(); ++i) { if (d->currentSelection.at(i).parent() == parent && row >= d->currentSelection.at(i).top() && row <= d->currentSelection.at(i).bottom()) @@ -1478,11 +1478,11 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons } // return false if ranges in both currentSelection and ranges // intersect and have the same row contained - if (d->currentCommand & Toggle && d->currentSelection.count()) { - for (int i=0; icurrentSelection.count(); ++i) + if (d->currentCommand & Toggle && d->currentSelection.size()) { + for (int i=0; icurrentSelection.size(); ++i) if (d->currentSelection.at(i).top() <= row && d->currentSelection.at(i).bottom() >= row) - for (int j=0; jranges.count(); ++j) + for (int j=0; jranges.size(); ++j) if (d->ranges.at(j).top() <= row && d->ranges.at(j).bottom() >= row && d->currentSelection.at(i).intersected(d->ranges.at(j)).isValid()) return false; @@ -1497,7 +1497,7 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons // add ranges and currentSelection and check through them all QList::const_iterator it; QList joined = d->ranges; - if (d->currentSelection.count()) + if (d->currentSelection.size()) joined += d->currentSelection; for (int column = 0; column < colCount; ++column) { if (!isSelectable(row, column)) { @@ -1542,8 +1542,8 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent return false; // return false if column exist in currentSelection (Deselect) - if (d->currentCommand & Deselect && d->currentSelection.count()) { - for (int i = 0; i < d->currentSelection.count(); ++i) { + if (d->currentCommand & Deselect && d->currentSelection.size()) { + for (int i = 0; i < d->currentSelection.size(); ++i) { if (d->currentSelection.at(i).parent() == parent && column >= d->currentSelection.at(i).left() && column <= d->currentSelection.at(i).right()) @@ -1552,11 +1552,11 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent } // return false if ranges in both currentSelection and the selection model // intersect and have the same column contained - if (d->currentCommand & Toggle && d->currentSelection.count()) { - for (int i = 0; i < d->currentSelection.count(); ++i) { + if (d->currentCommand & Toggle && d->currentSelection.size()) { + for (int i = 0; i < d->currentSelection.size(); ++i) { if (d->currentSelection.at(i).left() <= column && d->currentSelection.at(i).right() >= column) { - for (int j = 0; j < d->ranges.count(); ++j) { + for (int j = 0; j < d->ranges.size(); ++j) { if (d->ranges.at(j).left() <= column && d->ranges.at(j).right() >= column && d->currentSelection.at(i).intersected(d->ranges.at(j)).isValid()) { return false; @@ -1575,7 +1575,7 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent // add ranges and currentSelection and check through them all QList::const_iterator it; QList joined = d->ranges; - if (d->currentSelection.count()) + if (d->currentSelection.size()) joined += d->currentSelection; for (int row = 0; row < rowCount; ++row) { if (!isSelectable(row, column)) { @@ -1759,7 +1759,7 @@ QModelIndexList QItemSelectionModel::selectedRows(int column) const QDuplicateTracker rowsSeen; const QItemSelection ranges = selection(); - for (int i = 0; i < ranges.count(); ++i) { + for (int i = 0; i < ranges.size(); ++i) { const QItemSelectionRange &range = ranges.at(i); QModelIndex parent = range.parent(); for (int row = range.top(); row <= range.bottom(); row++) { @@ -1788,7 +1788,7 @@ QModelIndexList QItemSelectionModel::selectedColumns(int row) const QDuplicateTracker columnsSeen; const QItemSelection ranges = selection(); - for (int i = 0; i < ranges.count(); ++i) { + for (int i = 0; i < ranges.size(); ++i) { const QItemSelectionRange &range = ranges.at(i); QModelIndex parent = range.parent(); for (int column = range.left(); column <= range.right(); column++) { @@ -1911,9 +1911,9 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio // remove equal ranges bool advance; - for (int o = 0; o < deselected.count(); ++o) { + for (int o = 0; o < deselected.size(); ++o) { advance = true; - for (int s = 0; s < selected.count() && o < deselected.count();) { + for (int s = 0; s < selected.size() && o < deselected.size();) { if (deselected.at(o) == selected.at(s)) { deselected.removeAt(o); selected.removeAt(s); @@ -1928,17 +1928,17 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio // find intersections QItemSelection intersections; - for (int o = 0; o < deselected.count(); ++o) { - for (int s = 0; s < selected.count(); ++s) { + for (int o = 0; o < deselected.size(); ++o) { + for (int s = 0; s < selected.size(); ++s) { if (deselected.at(o).intersects(selected.at(s))) intersections.append(deselected.at(o).intersected(selected.at(s))); } } // compare remaining ranges with intersections and split them to find deselected and selected - for (int i = 0; i < intersections.count(); ++i) { + for (int i = 0; i < intersections.size(); ++i) { // split deselected - for (int o = 0; o < deselected.count();) { + for (int o = 0; o < deselected.size();) { if (deselected.at(o).intersects(intersections.at(i))) { QItemSelection::split(deselected.at(o), intersections.at(i), &deselected); deselected.removeAt(o); @@ -1947,7 +1947,7 @@ void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelectio } } // split selected - for (int s = 0; s < selected.count();) { + for (int s = 0; s < selected.size();) { if (selected.at(s).intersects(intersections.at(i))) { QItemSelection::split(selected.at(s), intersections.at(i), &selected); selected.removeAt(s); diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index fa88ff0a96..d067edea05 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -1243,7 +1243,7 @@ void QSortFilterProxyModelPrivate::update_persistent_indexes( { Q_Q(QSortFilterProxyModel); QModelIndexList from, to; - const int numSourceIndexes = source_indexes.count(); + const int numSourceIndexes = source_indexes.size(); from.reserve(numSourceIndexes); to.reserve(numSourceIndexes); for (const auto &indexPair : source_indexes) { @@ -2313,7 +2313,7 @@ QMimeData *QSortFilterProxyModel::mimeData(const QModelIndexList &indexes) const { Q_D(const QSortFilterProxyModel); QModelIndexList source_indexes; - source_indexes.reserve(indexes.count()); + source_indexes.reserve(indexes.size()); for (const QModelIndex &idx : indexes) source_indexes << mapToSource(idx); return d->model->mimeData(source_indexes); diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index 8d409f46a0..002f500263 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -86,7 +86,7 @@ int QStringListModel::rowCount(const QModelIndex &parent) const if (parent.isValid()) return 0; - return lst.count(); + return lst.size(); } /*! @@ -94,7 +94,7 @@ int QStringListModel::rowCount(const QModelIndex &parent) const */ QModelIndex QStringListModel::sibling(int row, int column, const QModelIndex &idx) const { - if (!idx.isValid() || column != 0 || row >= lst.count() || row < 0) + if (!idx.isValid() || column != 0 || row >= lst.size() || row < 0) return QModelIndex(); return createIndex(row, 0); @@ -310,7 +310,7 @@ void QStringListModel::sort(int, Qt::SortOrder order) emit layoutAboutToBeChanged(QList(), VerticalSortHint); QList> list; - const int lstCount = lst.count(); + const int lstCount = lst.size(); list.reserve(lstCount); for (int i = 0; i < lstCount; ++i) list.append(QPair(lst.at(i), i)); @@ -329,7 +329,7 @@ void QStringListModel::sort(int, Qt::SortOrder order) QModelIndexList oldList = persistentIndexList(); QModelIndexList newList; - const int numOldIndexes = oldList.count(); + const int numOldIndexes = oldList.size(); newList.reserve(numOldIndexes); for (int i = 0; i < numOldIndexes; ++i) newList.append(index(forwarding.at(oldList.at(i).row()), 0)); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index c178380e52..04c7474803 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -787,7 +787,7 @@ void QCoreApplicationPrivate::init() // have been removed. Once the original list is exhausted we know all the remaining // items have been added. QStringList newPaths(q->libraryPaths()); - for (qsizetype i = manualPaths->length(), j = appPaths->length(); i > 0 || j > 0; qt_noop()) { + for (qsizetype i = manualPaths->size(), j = appPaths->size(); i > 0 || j > 0; qt_noop()) { if (--j < 0) { newPaths.prepend((*manualPaths)[--i]); } else if (--i < 0) { @@ -2144,12 +2144,12 @@ static void replacePercentN(QString *result, int n) qsizetype len = 0; while ((percentPos = result->indexOf(u'%', percentPos + len)) != -1) { len = 1; - if (percentPos + len == result->length()) + if (percentPos + len == result->size()) break; QString fmt; if (result->at(percentPos + len) == u'L') { ++len; - if (percentPos + len == result->length()) + if (percentPos + len == result->size()) break; fmt = "%L1"_L1; } else { diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index c55d7d6911..e490aca0e0 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1180,7 +1180,7 @@ static const struct : QMetaTypeModuleHelper #endif QMETATYPE_CONVERTER(QString, QByteArray, result = QString::fromUtf8(source); return true;); QMETATYPE_CONVERTER(QString, QStringList, - return (source.count() == 1) ? (result = source.at(0), true) : false; + return (source.size() == 1) ? (result = source.at(0), true) : false; ); #ifndef QT_BOOTSTRAPPED QMETATYPE_CONVERTER(QString, QUrl, result = source.toString(); return true;); diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 6d7079e47f..895f7b40ae 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2155,7 +2155,7 @@ void QObjectPrivate::deleteChildren() // delete children objects // don't use qDeleteAll as the destructor of the child might // delete siblings - for (int i = 0; i < children.count(); ++i) { + for (int i = 0; i < children.size(); ++i) { currentChildBeingDeleted = children.at(i); children[i] = nullptr; delete currentChildBeingDeleted; @@ -3684,7 +3684,7 @@ void QMetaObject::connectSlotsByName(QObject *o) // ...we check each object in our list, ... bool foundIt = false; - for (int j = 0; j < list.count(); ++j) { + for (int j = 0; j < list.size(); ++j) { const QObject *co = list.at(j); const QByteArray coName = co->objectName().toLatin1(); diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp index 4c9eeb4468..8f701adc62 100644 --- a/src/corelib/kernel/qtimerinfo_unix.cpp +++ b/src/corelib/kernel/qtimerinfo_unix.cpp @@ -474,7 +474,7 @@ void QTimerInfoList::registerTimer(int timerId, qint64 interval, Qt::TimerType t bool QTimerInfoList::unregisterTimer(int timerId) { // set timer inactive - for (int i = 0; i < count(); ++i) { + for (int i = 0; i < size(); ++i) { QTimerInfo *t = at(i); if (t->id == timerId) { // found it @@ -495,7 +495,7 @@ bool QTimerInfoList::unregisterTimers(QObject *object) { if (isEmpty()) return false; - for (int i = 0; i < count(); ++i) { + for (int i = 0; i < size(); ++i) { QTimerInfo *t = at(i); if (t->obj == object) { // object found @@ -515,7 +515,7 @@ bool QTimerInfoList::unregisterTimers(QObject *object) QList QTimerInfoList::registeredTimers(QObject *object) const { QList list; - for (int i = 0; i < count(); ++i) { + for (int i = 0; i < size(); ++i) { const QTimerInfo * const t = at(i); if (t->obj == object) { list << QAbstractEventDispatcher::TimerInfo(t->id, diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp index fbd16102fc..3aad45792e 100644 --- a/src/corelib/mimetypes/qmimedatabase.cpp +++ b/src/corelib/mimetypes/qmimedatabase.cpp @@ -357,7 +357,7 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa // Pass 1) Try to match on the file name QMimeGlobMatchResult candidatesByName = findByFileName(fileName); - if (candidatesByName.m_allMatchingMimeTypes.count() == 1) { + if (candidatesByName.m_allMatchingMimeTypes.size() == 1) { const QMimeType mime = mimeTypeForName(candidatesByName.m_matchingMimeTypes.at(0)); if (mime.isValid()) return mime; @@ -399,7 +399,7 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa } } - if (candidatesByName.m_allMatchingMimeTypes.count() > 1) { + if (candidatesByName.m_allMatchingMimeTypes.size() > 1) { candidatesByName.m_matchingMimeTypes.sort(); // make it deterministic const QMimeType mime = mimeTypeForName(candidatesByName.m_matchingMimeTypes.at(0)); if (mime.isValid()) @@ -652,7 +652,7 @@ QList QMimeDatabase::mimeTypesForFileName(const QString &fileName) co const QStringList matches = d->mimeTypeForFileName(fileName); QList mimes; - mimes.reserve(matches.count()); + mimes.reserve(matches.size()); for (const QString &mime : matches) mimes.append(d->mimeTypeForName(mime)); return mimes; diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index c1533dd459..ac27d365ac 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -700,7 +700,7 @@ void QMimeXMLProvider::ensureLoaded() const QString packageDir = m_directory + QStringLiteral("/packages"); QDir dir(packageDir); const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot); - allFiles.reserve(files.count()); + allFiles.reserve(files.size()); for (const QString &xmlFile : files) allFiles.append(packageDir + u'/' + xmlFile); diff --git a/src/corelib/serialization/qtextstream_p.h b/src/corelib/serialization/qtextstream_p.h index c5967845f9..909b75d0de 100644 --- a/src/corelib/serialization/qtextstream_p.h +++ b/src/corelib/serialization/qtextstream_p.h @@ -139,14 +139,14 @@ public: NumberParsingStatus getNumber(qulonglong *l); bool getReal(double *f); - inline void write(QStringView data) { write(data.begin(), data.length()); } + inline void write(QStringView data) { write(data.begin(), data.size()); } inline void write(QChar ch); void write(const QChar *data, qsizetype len); void write(QLatin1StringView data); void writePadding(qsizetype len); inline void putString(QStringView string, bool number = false) { - putString(string.constData(), string.length(), number); + putString(string.constData(), string.size(), number); } void putString(const QChar *data, qsizetype len, bool number = false); void putString(QLatin1StringView data, bool number = false); diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h index 8e523f9c67..1fd69a2c1f 100644 --- a/src/corelib/serialization/qxmlstream_p.h +++ b/src/corelib/serialization/qxmlstream_p.h @@ -42,7 +42,7 @@ public: { } XmlStringRef(const QString *string) - : XmlStringRef(string, 0, string->length()) + : XmlStringRef(string, 0, string->size()) { } diff --git a/src/corelib/text/qchar.cpp b/src/corelib/text/qchar.cpp index a9cf306dd9..272de292c5 100644 --- a/src/corelib/text/qchar.cpp +++ b/src/corelib/text/qchar.cpp @@ -2061,7 +2061,7 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo enum { NFQC_YES = 0, NFQC_NO = 1, NFQC_MAYBE = 3 }; const ushort *string = reinterpret_cast(str->constData()); - qsizetype length = str->length(); + qsizetype length = str->size(); // this avoids one out of bounds check in the loop while (length > from && QChar::isHighSurrogate(string[length - 1])) @@ -2104,8 +2104,8 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo *lastStable = pos; } - if (length != str->length()) // low surrogate parts at the end of text - *lastStable = str->length() - 1; + if (length != str->size()) // low surrogate parts at the end of text + *lastStable = str->size() - 1; return true; } diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 031ba74fac..bd41f7ea5b 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -555,7 +555,7 @@ static bool isScript(QStringView tag) static const QString allScripts = QString::fromLatin1(reinterpret_cast(script_code_list), sizeof(script_code_list) - 1); - return tag.length() == 4 && allScripts.indexOf(tag) % 4 == 0; + return tag.size() == 4 && allScripts.indexOf(tag) % 4 == 0; } bool qt_splitLocaleName(QStringView name, QStringView *lang, QStringView *script, QStringView *land) @@ -4014,7 +4014,7 @@ bool QLocaleData::validateChars(QStringView str, NumberMode numMode, QByteArray int decDigits, QLocale::NumberOptions number_options) const { buff->clear(); - buff->reserve(str.length()); + buff->reserve(str.size()); enum { Whole, Fractional, Exponent } state = Whole; const bool scientific = numMode == DoubleScientificMode; @@ -4110,7 +4110,7 @@ double QLocaleData::stringToDouble(QStringView str, bool *ok, } int processed = 0; bool nonNullOk = false; - double d = qt_asciiToDouble(buff.constData(), buff.length() - 1, nonNullOk, processed); + double d = qt_asciiToDouble(buff.constData(), buff.size() - 1, nonNullOk, processed); if (ok != nullptr) *ok = nonNullOk; return d; diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 2372a5cb0b..79ab557e81 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -2718,9 +2718,9 @@ void QString::resize(qsizetype size) void QString::resize(qsizetype newSize, QChar fillChar) { - const qsizetype oldSize = length(); + const qsizetype oldSize = size(); resize(newSize); - const qsizetype difference = length() - oldSize; + const qsizetype difference = size() - oldSize; if (difference > 0) std::fill_n(d.data() + oldSize, difference, fillChar.unicode()); } @@ -4188,7 +4188,7 @@ QString &QString::replace(QChar c, QLatin1StringView after, Qt::CaseSensitivity */ qsizetype QString::indexOf(const QString &str, qsizetype from, Qt::CaseSensitivity cs) const { - return QtPrivate::findString(QStringView(unicode(), length()), from, QStringView(str.unicode(), str.size()), cs); + return QtPrivate::findString(QStringView(unicode(), size()), from, QStringView(str.unicode(), str.size()), cs); } /*! @@ -4242,7 +4242,7 @@ qsizetype QString::indexOf(QLatin1StringView str, qsizetype from, Qt::CaseSensit */ qsizetype QString::indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const { - return qFindChar(QStringView(unicode(), length()), ch, from, cs); + return qFindChar(QStringView(unicode(), size()), ch, from, cs); } /*! @@ -4506,7 +4506,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) } // add the last part of the after string - len = afterView.length() - lastEnd; + len = afterView.size() - lastEnd; if (len > 0) { chunks << afterView.mid(lastEnd, len); newLength += len; @@ -4516,9 +4516,9 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) } // 3. trailing string after the last match - if (copyView.length() > lastEnd) { + if (copyView.size() > lastEnd) { chunks << copyView.mid(lastEnd); - newLength += copyView.length() - lastEnd; + newLength += copyView.size() - lastEnd; } // 4. assemble the chunks together @@ -4526,7 +4526,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) qsizetype i = 0; QChar *uc = data(); for (const QStringView &chunk : std::as_const(chunks)) { - qsizetype len = chunk.length(); + qsizetype len = chunk.size(); memcpy(uc + i, chunk.constData(), len * sizeof(QChar)); i += len; } @@ -4889,7 +4889,7 @@ static QString extractSections(const QList §ions, qsizetyp qsizetype skip = 0; for (qsizetype k = 0; k < sectionsSize; ++k) { const qt_section_chunk §ion = sections.at(k); - if (section.length == section.string.length()) + if (section.length == section.string.size()) skip++; } if (start < 0) @@ -4905,7 +4905,7 @@ static QString extractSections(const QList §ions, qsizetyp qsizetype first_i = start, last_i = end; for (qsizetype i = 0; x <= end && i < sectionsSize; ++i) { const qt_section_chunk §ion = sections.at(i); - const bool empty = (section.length == section.string.length()); + const bool empty = (section.length == section.string.size()); if (x >= start) { if (x == start) first_i = i; @@ -4964,7 +4964,7 @@ QString QString::section(const QRegularExpression &re, qsizetype start, qsizetyp sep.setPatternOptions(sep.patternOptions() | QRegularExpression::CaseInsensitiveOption); QList sections; - qsizetype n = length(), m = 0, last_m = 0, last_len = 0; + qsizetype n = size(), m = 0, last_m = 0, last_len = 0; QRegularExpressionMatchIterator iterator = sep.globalMatch(*this); while (iterator.hasNext()) { QRegularExpressionMatch match = iterator.next(); @@ -5321,7 +5321,7 @@ static QByteArray qt_convert_to_latin1(QStringView string) if (Q_UNLIKELY(string.isNull())) return QByteArray(); - QByteArray ba(string.length(), Qt::Uninitialized); + QByteArray ba(string.size(), Qt::Uninitialized); // since we own the only copy, we're going to const_cast the constData; // that avoids an unnecessary call to detach() and expansion code that will never get used @@ -5490,7 +5490,7 @@ QList QString::toUcs4() const static QList qt_convert_to_ucs4(QStringView string) { - QList v(string.length()); + QList v(string.size()); uint *a = const_cast(v.constData()); QStringIterator it(string); while (it.hasNext()) @@ -6445,7 +6445,7 @@ int QLatin1StringView::compare_helper(const QChar *data1, qsizetype length1, QLa */ int QString::localeAwareCompare(const QString &other) const { - return localeAwareCompare_helper(constData(), length(), other.constData(), other.size()); + return localeAwareCompare_helper(constData(), size(), other.constData(), other.size()); } /*! @@ -6561,7 +6561,7 @@ const ushort *QString::utf16() const QString QString::leftJustified(qsizetype width, QChar fill, bool truncate) const { QString result; - qsizetype len = length(); + qsizetype len = size(); qsizetype padlen = width - len; if (padlen > 0) { result.resize(len+padlen); @@ -6600,7 +6600,7 @@ QString QString::leftJustified(qsizetype width, QChar fill, bool truncate) const QString QString::rightJustified(qsizetype width, QChar fill, bool truncate) const { QString result; - qsizetype len = length(); + qsizetype len = size(); qsizetype padlen = width - len; if (padlen > 0) { result.resize(len+padlen); @@ -7933,7 +7933,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar:: // check if it's fully ASCII first, because then we have no work auto start = reinterpret_cast(data->constData()); const char16_t *p = start + from; - if (isAscii_helper(p, p + data->length() - from)) + if (isAscii_helper(p, p + data->size() - from)) return; if (p > start + from) from = p - start - 1; // need one before the non-ASCII to perform NFC @@ -8119,9 +8119,9 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, qsizetyp // Negative field-width for right-padding, positive for left-padding: const qsizetype abs_field_width = qAbs(field_width); const qsizetype result_len = - s.length() - d.escape_len - + (d.occurrences - d.locale_occurrences) * qMax(abs_field_width, arg.length()) - + d.locale_occurrences * qMax(abs_field_width, larg.length()); + s.size() - d.escape_len + + (d.occurrences - d.locale_occurrences) * qMax(abs_field_width, arg.size()) + + d.locale_occurrences * qMax(abs_field_width, larg.size()); QString result(result_len, Qt::Uninitialized); QChar *rc = const_cast(result.unicode()); @@ -8164,15 +8164,15 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, qsizetyp rc += escape_start - text_start; const QStringView use = localize ? larg : arg; - const qsizetype pad_chars = abs_field_width - use.length(); + const qsizetype pad_chars = abs_field_width - use.size(); // (If negative, relevant loops are no-ops: no need to check.) if (field_width > 0) { // left padded rc = std::fill_n(rc, pad_chars, fillChar); } - memcpy(rc, use.data(), use.length() * sizeof(QChar)); - rc += use.length(); + memcpy(rc, use.data(), use.size() * sizeof(QChar)); + rc += use.size(); if (field_width < 0) { // right padded rc = std::fill_n(rc, pad_chars, fillChar); @@ -10956,7 +10956,7 @@ qsizetype QtPrivate::count(QStringView haystack, const QRegularExpression &re) } qsizetype count = 0; qsizetype index = -1; - qsizetype len = haystack.length(); + qsizetype len = haystack.size(); while (index <= len - 1) { QRegularExpressionMatch match = re.matchView(haystack, index + 1); if (!match.hasMatch()) @@ -10983,7 +10983,7 @@ qsizetype QtPrivate::count(QStringView haystack, const QRegularExpression &re) QString QString::toHtmlEscaped() const { QString rich; - const qsizetype len = length(); + const qsizetype len = size(); rich.reserve(qsizetype(len * 1.1)); for (QChar ch : *this) { if (ch == u'<') diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 9c67558edd..300b54feb6 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -679,19 +679,19 @@ public: QString &insert(qsizetype i, QChar c); QString &insert(qsizetype i, const QChar *uc, qsizetype len); inline QString &insert(qsizetype i, const QString &s) { return insert(i, s.constData(), s.size()); } - inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.length()); } + inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.size()); } QString &insert(qsizetype i, QLatin1StringView s); QString &append(QChar c); QString &append(const QChar *uc, qsizetype len); QString &append(const QString &s); - inline QString &append(QStringView v) { return append(v.data(), v.length()); } + inline QString &append(QStringView v) { return append(v.data(), v.size()); } QString &append(QLatin1StringView s); inline QString &prepend(QChar c) { return insert(0, c); } inline QString &prepend(const QChar *uc, qsizetype len) { return insert(0, uc, len); } inline QString &prepend(const QString &s) { return insert(0, s); } - inline QString &prepend(QStringView v) { return prepend(v.data(), v.length()); } + inline QString &prepend(QStringView v) { return prepend(v.data(), v.size()); } inline QString &prepend(QLatin1StringView s) { return insert(0, s); } inline QString &operator+=(QChar c) { return append(c); } @@ -1193,7 +1193,7 @@ QString QLatin1StringView::toString() const { return *this; } // QString QStringView::toString() const -{ return Q_ASSERT(size() == length()), QString(data(), length()); } +{ return Q_ASSERT(size() == size()), QString(data(), size()); } qint64 QStringView::toLongLong(bool *ok, int base) const { return QString::toIntegral_helper(*this, ok, base); } @@ -1483,7 +1483,7 @@ inline QString QString::fromStdString(const std::string &s) inline std::wstring QString::toStdWString() const { std::wstring str; - str.resize(length()); + str.resize(size()); str.resize(toWCharArray(str.data())); return str; } @@ -1495,16 +1495,16 @@ inline QString QString::fromStdU16String(const std::u16string &s) { return fromUtf16(s.data(), qsizetype(s.size())); } inline std::u16string QString::toStdU16String() const -{ return std::u16string(reinterpret_cast(data()), length()); } +{ return std::u16string(reinterpret_cast(data()), size()); } inline QString QString::fromStdU32String(const std::u32string &s) { return fromUcs4(s.data(), qsizetype(s.size())); } inline std::u32string QString::toStdU32String() const { - std::u32string u32str(length(), char32_t(0)); + std::u32string u32str(size(), char32_t(0)); qsizetype len = toUcs4_helper(reinterpret_cast(constData()), - length(), reinterpret_cast(&u32str[0])); + size(), reinterpret_cast(&u32str[0])); u32str.resize(len); return u32str; } @@ -1521,9 +1521,9 @@ inline int QString::compare(QStringView s, Qt::CaseSensitivity cs) const noexcep { return -s.compare(*this, cs); } inline int QString::localeAwareCompare(QStringView s) const -{ return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); } +{ return localeAwareCompare_helper(constData(), size(), s.constData(), s.size()); } inline int QString::localeAwareCompare(QStringView s1, QStringView s2) -{ return localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); } +{ return localeAwareCompare_helper(s1.constData(), s1.size(), s2.constData(), s2.size()); } inline int QStringView::localeAwareCompare(QStringView other) const { return QString::localeAwareCompare(*this, other); } diff --git a/src/corelib/text/qstringconverter.cpp b/src/corelib/text/qstringconverter.cpp index a0e0173cbb..bdba20de3a 100644 --- a/src/corelib/text/qstringconverter.cpp +++ b/src/corelib/text/qstringconverter.cpp @@ -504,7 +504,7 @@ char *QUtf8::convertFromUnicode(char *out, QStringView in, QStringConverter::Sta { Q_ASSERT(state); const QChar *uc = in.data(); - qsizetype len = in.length(); + qsizetype len = in.size(); if (!len) return out; @@ -915,13 +915,13 @@ char *QUtf16::convertFromUnicode(char *out, QStringView in, QStringConverter::St out += 2; } if (endian == BigEndianness) - qToBigEndian(in.data(), in.length(), out); + qToBigEndian(in.data(), in.size(), out); else - qToLittleEndian(in.data(), in.length(), out); + qToLittleEndian(in.data(), in.size(), out); state->remainingChars = 0; state->internalState |= HeaderDone; - return out + 2*in.length(); + return out + 2*in.size(); } QString QUtf16::convertToUnicode(QByteArrayView in, QStringConverter::State *state, DataEndianness endian) @@ -1051,7 +1051,7 @@ char *QUtf32::convertFromUnicode(char *out, QStringView in, QStringConverter::St } const QChar *uc = in.data(); - const QChar *end = in.data() + in.length(); + const QChar *end = in.data() + in.size(); QChar ch; char32_t ucs4; if (state->remainingChars == 1) { @@ -1489,7 +1489,7 @@ static char *toLatin1(char *out, QStringView in, QStringConverter::State *state) const char replacement = (state && state->flags & QStringConverter::Flag::ConvertInvalidToNull) ? 0 : '?'; qsizetype invalid = 0; - for (qsizetype i = 0; i < in.length(); ++i) { + for (qsizetype i = 0; i < in.size(); ++i) { if (in[i] > QChar(0xff)) { *out = replacement; ++invalid; @@ -1765,7 +1765,7 @@ struct QStringConverterICU : QStringConverter auto source = reinterpret_cast(in.data()); auto sourceLimit = reinterpret_cast(in.data() + in.size()); - qsizetype length = UCNV_GET_MAX_BYTES_FOR_STRING(in.length(), ucnv_getMaxCharSize(icu_conv)); + qsizetype length = UCNV_GET_MAX_BYTES_FOR_STRING(in.size(), ucnv_getMaxCharSize(icu_conv)); char *target = out; char *targetLimit = out + length; diff --git a/src/corelib/text/qstringlist.cpp b/src/corelib/text/qstringlist.cpp index 8eb730ee02..2c0dc77a5a 100644 --- a/src/corelib/text/qstringlist.cpp +++ b/src/corelib/text/qstringlist.cpp @@ -387,7 +387,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, QStringView befo QStringView after, Qt::CaseSensitivity cs) { for (qsizetype i = 0; i < that->size(); ++i) - (*that)[i].replace(before.data(), before.length(), after.data(), after.length(), cs); + (*that)[i].replace(before.data(), before.size(), after.data(), after.size(), cs); } #if QT_CONFIG(regularexpression) @@ -492,7 +492,7 @@ QString QtPrivate::QStringList_join(const QStringList &list, QLatin1StringView s */ QString QtPrivate::QStringList_join(const QStringList *that, QStringView sep) { - return QStringList_join(that, sep.data(), sep.length()); + return QStringList_join(that, sep.data(), sep.size()); } /*! diff --git a/src/corelib/text/qtextboundaryfinder.cpp b/src/corelib/text/qtextboundaryfinder.cpp index 937f88b252..8f20967a1d 100644 --- a/src/corelib/text/qtextboundaryfinder.cpp +++ b/src/corelib/text/qtextboundaryfinder.cpp @@ -20,7 +20,7 @@ static void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharA case QTextBoundaryFinder::Line: options |= QUnicodeTools::LineBreaks; break; default: break; } - QUnicodeTools::initCharAttributes(str, scriptItems.data(), scriptItems.count(), attributes, options); + QUnicodeTools::initCharAttributes(str, scriptItems.data(), scriptItems.size(), attributes, options); } /*! diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h index 6d4259e279..af559b7a96 100644 --- a/src/corelib/thread/qresultstore.h +++ b/src/corelib/thread/qresultstore.h @@ -164,23 +164,23 @@ public: if (containsValidResultItem(index)) // reject if already present return -1; - return addResults(index, new QList(*results), results->count(), results->count()); + return addResults(index, new QList(*results), results->size(), results->size()); } template int addResults(int index, const QList *results, int totalCount) { // reject if results are empty, and nothing is filtered away - if ((m_filterMode == false || results->count() == totalCount) && results->empty()) + if ((m_filterMode == false || results->size() == totalCount) && results->empty()) return -1; if (containsValidResultItem(index)) // reject if already present return -1; - if (m_filterMode == true && results->count() != totalCount && 0 == results->count()) + if (m_filterMode == true && results->size() != totalCount && 0 == results->size()) return addResults(index, nullptr, 0, totalCount); - return addResults(index, new QList(*results), results->count(), totalCount); + return addResults(index, new QList(*results), results->size(), totalCount); } int addCanceledResult(int index) diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index 0386e47102..c2029fe1b3 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -55,11 +55,11 @@ QThreadStorageData::QThreadStorageData(void (*func)(void *)) DEBUG_MSG("QThreadStorageData: Allocated id %d, destructor %p cannot be stored", id, func); return; } - for (id = 0; id < destr->count(); id++) { + for (id = 0; id < destr->size(); id++) { if (destr->at(id) == nullptr) break; } - if (id == destr->count()) { + if (id == destr->size()) { destr->append(func); } else { (*destr)[id] = func; diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 21f252a70d..35f01c8022 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -123,7 +123,7 @@ static ParsedRfcDateTime rfcDateImpl(QStringView s) QDate date; const auto isShortName = [](QStringView name) { - return (name.length() == 3 && name[0].isUpper() + return (name.size() == 3 && name[0].isUpper() && name[1].isLower() && name[2].isLower()); }; diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp index 298e477719..c7838953ad 100644 --- a/src/corelib/time/qtimezone.cpp +++ b/src/corelib/time/qtimezone.cpp @@ -751,7 +751,7 @@ QTimeZone::OffsetDataList QTimeZone::transitions(const QDateTime &fromDateTime, if (hasTransitions()) { const QTimeZonePrivate::DataList plist = d->transitions(fromDateTime.toMSecsSinceEpoch(), toDateTime.toMSecsSinceEpoch()); - list.reserve(plist.count()); + list.reserve(plist.size()); for (const QTimeZonePrivate::Data &pdata : plist) list.append(QTimeZonePrivate::toOffsetData(pdata)); } diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 03074f4f32..f63b0c5c59 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -500,9 +500,9 @@ QString QCommandLineParser::errorText() const { if (!d->errorText.isEmpty()) return d->errorText; - if (d->unknownOptionNames.count() == 1) + if (d->unknownOptionNames.size() == 1) return tr("Unknown option '%1'.").arg(d->unknownOptionNames.first()); - if (d->unknownOptionNames.count() > 1) + if (d->unknownOptionNames.size() > 1) return tr("Unknown options: %1.").arg(d->unknownOptionNames.join(QStringLiteral(", "))); return QString(); } diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 40041a9ff3..d8b3367de3 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1274,7 +1274,7 @@ void QEasingCurve::addCubicBezierSegment(const QPointF & c1, const QPointF & c2, QList static inline tcbToBezier(const TCBPoints &tcbPoints) { - const int count = tcbPoints.count(); + const int count = tcbPoints.size(); QList bezierPoints; bezierPoints.reserve(3 * (count - 1)); diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index a59670ccca..cdd9ceda20 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -151,7 +151,7 @@ public: // more Qt typedef iterator Iterator; typedef const_iterator ConstIterator; - inline qsizetype count() const { return q_hash.count(); } + inline qsizetype count() const { return q_hash.size(); } inline iterator insert(const T &value) { return q_hash.insert(value, QHashDummyValue()); } inline iterator insert(T &&value) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index fbf0c0d4fb..8b190b8e5f 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -327,7 +327,7 @@ static QByteArray buildMatchRule(const QString &service, // add the argument string-matching now if (!argMatch.args.isEmpty()) { const QString keyValue = "arg%1='%2',"_L1; - for (int i = 0; i < argMatch.args.count(); ++i) + for (int i = 0; i < argMatch.args.size(); ++i) if (!argMatch.args.at(i).isNull()) result += keyValue.arg(i).arg(argMatch.args.at(i)); } @@ -945,7 +945,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q outputArgs.reserve(numMetaTypes - i + 1); QVariant arg{QMetaType(metaTypes[0])}; outputArgs.append( arg ); - params[0] = const_cast(outputArgs.at( outputArgs.count() - 1 ).constData()); + params[0] = const_cast(outputArgs.at( outputArgs.size() - 1 ).constData()); } else { outputArgs.reserve(numMetaTypes - i); } @@ -953,7 +953,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q for ( ; i < numMetaTypes; ++i) { QVariant arg{QMetaType(metaTypes[i])}; outputArgs.append( arg ); - params.append(const_cast(outputArgs.at( outputArgs.count() - 1 ).constData())); + params.append(const_cast(outputArgs.at( outputArgs.size() - 1 ).constData())); } // make call: diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 2cb6e97f22..054bc448e6 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -221,7 +221,7 @@ void QDBusMetaObjectGenerator::parseMethods() bool ok = true; // build the input argument list - for (qsizetype i = 0; i < m.inputArgs.count(); ++i) { + for (qsizetype i = 0; i < m.inputArgs.size(); ++i) { const QDBusIntrospection::Argument &arg = m.inputArgs.at(i); Type type = findType(arg.type.toLatin1(), m.annotations, "In", i); @@ -240,7 +240,7 @@ void QDBusMetaObjectGenerator::parseMethods() if (!ok) continue; // build the output argument list: - for (qsizetype i = 0; i < m.outputArgs.count(); ++i) { + for (qsizetype i = 0; i < m.outputArgs.size(); ++i) { const QDBusIntrospection::Argument &arg = m.outputArgs.at(i); Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i); @@ -297,7 +297,7 @@ void QDBusMetaObjectGenerator::parseSignals() bool ok = true; // build the output argument list - for (qsizetype i = 0; i < s.outputArgs.count(); ++i) { + for (qsizetype i = 0; i < s.outputArgs.size(); ++i) { const QDBusIntrospection::Argument &arg = s.outputArgs.at(i); Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i); diff --git a/src/dbus/qdbusutil.cpp b/src/dbus/qdbusutil.cpp index 7390e8d7a4..eb5aab4fd6 100644 --- a/src/dbus/qdbusutil.cpp +++ b/src/dbus/qdbusutil.cpp @@ -306,7 +306,7 @@ namespace QDBusUtil return false; // can't be valid if it's empty const QChar *c = part.data(); - for (int i = 0; i < part.length(); ++i) + for (int i = 0; i < part.size(); ++i) if (!isValidCharacterNoDash(c[i])) return false; @@ -358,7 +358,7 @@ namespace QDBusUtil */ bool isValidUniqueConnectionName(QStringView connName) { - if (connName.isEmpty() || connName.length() > DBUS_MAXIMUM_NAME_LENGTH || + if (connName.isEmpty() || connName.size() > DBUS_MAXIMUM_NAME_LENGTH || !connName.startsWith(u':')) return false; @@ -371,7 +371,7 @@ namespace QDBusUtil return false; const QChar* c = part.data(); - for (int j = 0; j < part.length(); ++j) + for (int j = 0; j < part.size(); ++j) if (!isValidCharacter(c[j])) return false; } @@ -419,7 +419,7 @@ namespace QDBusUtil const QChar *c = part.data(); if (isValidNumber(c[0])) return false; - for (int j = 0; j < part.length(); ++j) + for (int j = 0; j < part.size(); ++j) if (!isValidCharacter(c[j])) return false; } @@ -435,13 +435,13 @@ namespace QDBusUtil */ bool isValidMemberName(QStringView memberName) { - if (memberName.isEmpty() || memberName.length() > DBUS_MAXIMUM_NAME_LENGTH) + if (memberName.isEmpty() || memberName.size() > DBUS_MAXIMUM_NAME_LENGTH) return false; const QChar* c = memberName.data(); if (isValidNumber(c[0])) return false; - for (int j = 0; j < memberName.length(); ++j) + for (int j = 0; j < memberName.size(); ++j) if (!isValidCharacterNoDash(c[j])) return false; return true; diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp index c6e339b4bb..e650a59151 100644 --- a/src/gui/accessible/linux/atspiadaptor.cpp +++ b/src/gui/accessible/linux/atspiadaptor.cpp @@ -1811,12 +1811,12 @@ QRect AtSpiAdaptor::getExtents(QAccessibleInterface *interface, uint coordType) bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) { if (function == "GetNActions"_L1) { - int count = QAccessibleBridgeUtils::effectiveActionNames(interface).count(); + int count = QAccessibleBridgeUtils::effectiveActionNames(interface).size(); sendReply(connection, message, QVariant::fromValue(QDBusVariant(QVariant::fromValue(count)))); } else if (function == "DoAction"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); - if (index < 0 || index >= actionNames.count()) + if (index < 0 || index >= actionNames.size()) return false; const QString actionName = actionNames.at(index); bool success = QAccessibleBridgeUtils::performEffectiveAction(interface, actionName); @@ -1826,13 +1826,13 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin } else if (function == "GetName"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); - if (index < 0 || index >= actionNames.count()) + if (index < 0 || index >= actionNames.size()) return false; sendReply(connection, message, actionNames.at(index)); } else if (function == "GetDescription"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); - if (index < 0 || index >= actionNames.count()) + if (index < 0 || index >= actionNames.size()) return false; QString description; if (QAccessibleActionInterface *actionIface = interface->actionInterface()) @@ -1843,7 +1843,7 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin } else if (function == "GetKeyBinding"_L1) { int index = message.arguments().at(0).toInt(); const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(interface); - if (index < 0 || index >= actionNames.count()) + if (index < 0 || index >= actionNames.size()) return false; QStringList keyBindings; if (QAccessibleActionInterface *actionIface = interface->actionInterface()) @@ -1853,7 +1853,7 @@ bool AtSpiAdaptor::actionInterface(QAccessibleInterface *interface, const QStrin if (!acc.isEmpty()) keyBindings.append(acc); } - if (keyBindings.length() > 0) + if (keyBindings.size() > 0) sendReply(connection, message, keyBindings.join(u';')); else sendReply(connection, message, QString()); diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 233231c797..e54738e075 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -670,7 +670,7 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object) const QString cn = QLatin1StringView(mo->className()); // Check if the class has a InterfaceFactory installed. - for (int i = qAccessibleFactories()->count(); i > 0; --i) { + for (int i = qAccessibleFactories()->size(); i > 0; --i) { InterfaceFactory factory = qAccessibleFactories()->at(i - 1); if (QAccessibleInterface *iface = factory(cn, object)) { QAccessibleCache::instance()->insert(object, iface); @@ -787,7 +787,7 @@ bool QAccessible::isActive() */ void QAccessible::setActive(bool active) { - for (int i = 0; i < qAccessibleActivationObservers()->count() ;++i) + for (int i = 0; i < qAccessibleActivationObservers()->size() ;++i) qAccessibleActivationObservers()->at(i)->accessibilityActiveChanged(active); } diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index af9d3aa0fc..61d3a90632 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -124,7 +124,7 @@ static QObjectList topLevelObjects() { QObjectList list; const QWindowList tlw(QGuiApplication::topLevelWindows()); - for (int i = 0; i < tlw.count(); ++i) { + for (int i = 0; i < tlw.size(); ++i) { QWindow *w = tlw.at(i); if (w->type() != Qt::Popup && w->type() != Qt::Desktop) { if (QAccessibleInterface *root = w->accessibleRoot()) { @@ -140,7 +140,7 @@ static QObjectList topLevelObjects() /*! \reimp */ int QAccessibleApplication::childCount() const { - return topLevelObjects().count(); + return topLevelObjects().size(); } /*! \reimp */ @@ -160,7 +160,7 @@ QAccessibleInterface *QAccessibleApplication::parent() const QAccessibleInterface *QAccessibleApplication::child(int index) const { const QObjectList tlo(topLevelObjects()); - if (index >= 0 && index < tlo.count()) + if (index >= 0 && index < tlo.size()) return QAccessible::queryAccessibleInterface(tlo.at(index)); return nullptr; } diff --git a/src/gui/accessible/qplatformaccessibility.cpp b/src/gui/accessible/qplatformaccessibility.cpp index 92936c74e6..ae7635ff7c 100644 --- a/src/gui/accessible/qplatformaccessibility.cpp +++ b/src/gui/accessible/qplatformaccessibility.cpp @@ -50,7 +50,7 @@ void QPlatformAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) if (!bridges() || bridges()->isEmpty()) return; - for (int i = 0; i < bridges()->count(); ++i) + for (int i = 0; i < bridges()->size(); ++i) bridges()->at(i)->notifyAccessibilityUpdate(event); } @@ -63,7 +63,7 @@ void QPlatformAccessibility::setRootObject(QObject *o) if (!o) return; - for (int i = 0; i < bridges()->count(); ++i) { + for (int i = 0; i < bridges()->size(); ++i) { QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(o); bridges()->at(i)->setRootObject(iface); } diff --git a/src/gui/itemmodels/qfileinfogatherer.cpp b/src/gui/itemmodels/qfileinfogatherer.cpp index f7c36b4ca8..1b88b3e018 100644 --- a/src/gui/itemmodels/qfileinfogatherer.cpp +++ b/src/gui/itemmodels/qfileinfogatherer.cpp @@ -344,13 +344,13 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil if (files.isEmpty()) { infoList = QDir::drives(); } else { - infoList.reserve(files.count()); + infoList.reserve(files.size()); for (const auto &file : files) infoList << QFileInfo(file); } QList> updatedFiles; - updatedFiles.reserve(infoList.count()); - for (int i = infoList.count() - 1; i >= 0; --i) { + updatedFiles.reserve(infoList.size()); + for (int i = infoList.size() - 1; i >= 0; --i) { QFileInfo driveInfo = infoList.at(i); driveInfo.stat(); QString driveName = translateDriveName(driveInfo); diff --git a/src/gui/itemmodels/qfilesystemmodel.cpp b/src/gui/itemmodels/qfilesystemmodel.cpp index 44278f86be..d44e89fde0 100644 --- a/src/gui/itemmodels/qfilesystemmodel.cpp +++ b/src/gui/itemmodels/qfilesystemmodel.cpp @@ -394,12 +394,12 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS QFileSystemModelPrivate::QFileSystemNode *parent = node(index); - for (int i = 0; i < pathElements.count(); ++i) { + for (int i = 0; i < pathElements.size(); ++i) { QString element = pathElements.at(i); if (i != 0) elementPath.append(separator); elementPath.append(element); - if (i == pathElements.count() - 1) + if (i == pathElements.size() - 1) elementPath.append(trailingSeparator); #ifdef Q_OS_WIN // On Windows, "filename " and "filename" are equivalent and @@ -1106,7 +1106,7 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order) emit layoutAboutToBeChanged(); QModelIndexList oldList = persistentIndexList(); QList> oldNodes; - const int nodeCount = oldList.count(); + const int nodeCount = oldList.size(); oldNodes.reserve(nodeCount); for (int i = 0; i < nodeCount; ++i) { const QModelIndex &oldNode = oldList.at(i); @@ -1752,7 +1752,7 @@ void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, cons if ((iterator == newFiles.end()) || (i.value()->fileName < *iterator)) toRemove.append(i.value()->fileName); } - for (int i = 0 ; i < toRemove.count() ; ++i ) + for (int i = 0 ; i < toRemove.size() ; ++i ) removeNode(parentNode, toRemove[i]); } @@ -1844,7 +1844,7 @@ void QFileSystemModelPrivate::addVisibleFiles(QFileSystemNode *parentNode, const QModelIndex parent = index(parentNode); bool indexHidden = isHiddenByFilter(parentNode, parent); if (!indexHidden) { - q->beginInsertRows(parent, parentNode->visibleChildren.size() , parentNode->visibleChildren.size() + newFiles.count() - 1); + q->beginInsertRows(parent, parentNode->visibleChildren.size() , parentNode->visibleChildren.size() + newFiles.size() - 1); } if (parentNode->dirtyChildrenIndex == -1) @@ -1974,11 +1974,11 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, max = QString();*/ } - if (newFiles.count() > 0) { + if (newFiles.size() > 0) { addVisibleFiles(parentNode, newFiles); } - if (newFiles.count() > 0 || (sortColumn != 0 && rowsToUpdate.size() > 0)) { + if (newFiles.size() > 0 || (sortColumn != 0 && rowsToUpdate.size() > 0)) { forceSort = true; delayedSort(); } diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 8a21190e49..0920398610 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -2529,9 +2529,9 @@ QStandardItem *QStandardItemModel::verticalHeaderItem(int row) const void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels) { Q_D(QStandardItemModel); - if (columnCount() < labels.count()) - setColumnCount(labels.count()); - for (int i = 0; i < labels.count(); ++i) { + if (columnCount() < labels.size()) + setColumnCount(labels.size()); + for (int i = 0; i < labels.size(); ++i) { QStandardItem *item = horizontalHeaderItem(i); if (!item) { item = d->createItem(); @@ -2552,9 +2552,9 @@ void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels) void QStandardItemModel::setVerticalHeaderLabels(const QStringList &labels) { Q_D(QStandardItemModel); - if (rowCount() < labels.count()) - setRowCount(labels.count()); - for (int i = 0; i < labels.count(); ++i) { + if (rowCount() < labels.size()) + setRowCount(labels.size()); + for (int i = 0; i < labels.size(); ++i) { QStandardItem *item = verticalHeaderItem(i); if (!item) { item = d->createItem(); @@ -3112,9 +3112,9 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const QSet itemsSet; QStack stack; - itemsSet.reserve(indexes.count()); - stack.reserve(indexes.count()); - for (int i = 0; i < indexes.count(); ++i) { + itemsSet.reserve(indexes.size()); + stack.reserve(indexes.size()); + for (int i = 0; i < indexes.size(); ++i) { if (QStandardItem *item = itemFromIndex(indexes.at(i))) { itemsSet << item; stack.push(item); diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 646c705148..36030cac42 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -883,7 +883,7 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking if (modalWindowList.isEmpty() || windowNeverBlocked(window)) return false; - for (int i = 0; i < modalWindowList.count(); ++i) { + for (int i = 0; i < modalWindowList.size(); ++i) { QWindow *modalWindow = modalWindowList.at(i); // A window is not blocked by another modal window if the two are diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 338ec08357..7085e65ae4 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1129,7 +1129,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma // except for a single '+' at the end of the string. // Only '+' can have length 1. - if (sub.length() == 1) { + if (sub.size() == 1) { // Make sure we only encounter a single '+' at the end of the accel if (accel.lastIndexOf(u'+') != accel.size()-1) return Qt::Key_unknown; @@ -1157,7 +1157,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma accelRef = accelRef.mid(p + 1); int fnum = 0; - if (accelRef.length() == 1) { + if (accelRef.size() == 1) { #if defined(Q_OS_MACOS) int qtKey = qtkeyForMacSymbol(accelRef.at(0)); if (qtKey != -1) { @@ -1554,7 +1554,7 @@ QList QKeySequence::listFromString(const QString &str, SequenceFor QList result; const QStringList strings = str.split("; "_L1); - result.reserve(strings.count()); + result.reserve(strings.size()); for (const QString &string : strings) { result << fromString(string, format); } diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index ceec540784..77cbfd2b96 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -35,7 +35,7 @@ Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd") static QWindow* topLevelAt(const QPoint &pos) { QWindowList list = QGuiApplication::topLevelWindows(); - for (int i = list.count()-1; i >= 0; --i) { + for (int i = list.size()-1; i >= 0; --i) { QWindow *w = list.at(i); if (w->isVisible() && w->handle() && w->geometry().contains(pos) && !qobject_cast(w)) return w; diff --git a/src/gui/painting/qpageranges.cpp b/src/gui/painting/qpageranges.cpp index 2c4d5cca6c..500673b22f 100644 --- a/src/gui/painting/qpageranges.cpp +++ b/src/gui/painting/qpageranges.cpp @@ -162,7 +162,7 @@ QPageRanges QPageRanges::fromString(const QString &ranges) if (item.contains(u'-')) { const QStringList rangeItems = item.split(u'-'); - if (rangeItems.count() != 2) + if (rangeItems.size() != 2) return QPageRanges(); bool ok; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index f3dc7588f9..66123eee7d 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -4278,7 +4278,7 @@ protected: void QGradientCache::generateGradientColorTable(const QGradient& gradient, QRgba64 *colorTable, int size, int opacity) const { const QGradientStops stops = gradient.stops(); - int stopCount = stops.count(); + int stopCount = stops.size(); Q_ASSERT(stopCount > 0); bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation); diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 99d67599ed..a3a89d7504 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -421,7 +421,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a) { QDebugStateSaver saver(dbg); dbg.nospace() << "QPolygon("; - for (int i = 0; i < a.count(); ++i) + for (int i = 0; i < a.size(); ++i) dbg.nospace() << a.at(i); dbg.nospace() << ')'; return dbg; @@ -742,7 +742,7 @@ QDebug operator<<(QDebug dbg, const QPolygonF &a) { QDebugStateSaver saver(dbg); dbg.nospace() << "QPolygonF("; - for (int i = 0; i < a.count(); ++i) + for (int i = 0; i < a.size(); ++i) dbg.nospace() << a.at(i); dbg.nospace() << ')'; return dbg; diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index fc403f60b1..457c2cc259 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3818,7 +3818,7 @@ QRegion::QRegion(const QRect &r, RegionType t) QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule) { - if (a.count() > 2) { + if (a.size() > 2) { QRegionPrivate *qt_rgn = PolygonRegion(a.constData(), a.size(), fillRule == Qt::WindingFill ? WindingRule : EvenOddRule); if (qt_rgn) { diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 8aecf16729..6c49cd35ea 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -1760,7 +1760,7 @@ QPolygon QTransform::mapToPolygon(const QRect &rect) const */ bool QTransform::squareToQuad(const QPolygonF &quad, QTransform &trans) { - if (quad.count() != 4) + if (quad.size() != 4) return false; qreal dx0 = quad[0].x(); diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 01c0b40294..9ed7f89b2a 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -478,7 +478,7 @@ bool QRhiVulkan::create(QRhi::Flags flags) for (const VkExtensionProperties &p : std::as_const(extProps)) devExts.append({ p.extensionName, p.specVersion }); } - qCDebug(QRHI_LOG_INFO, "%d device extensions available", int(devExts.count())); + qCDebug(QRHI_LOG_INFO, "%d device extensions available", int(devExts.size())); QList requestedDevExts; requestedDevExts.append("VK_KHR_swapchain"); @@ -1759,7 +1759,7 @@ QRhi::FrameOpResult QRhiVulkan::beginFrame(QRhiSwapChain *swapChain, QRhi::Begin // when profiling is enabled, pick a free query (pair) from the pool int timestampQueryIdx = -1; if (hasGpuFrameTimeCallback() && swapChainD->bufferCount > 1) { // no timestamps if not having at least 2 frames in flight - for (int i = 0; i < timestampQueryPoolMap.count(); ++i) { + for (int i = 0; i < timestampQueryPoolMap.size(); ++i) { if (!timestampQueryPoolMap.testBit(i)) { timestampQueryPoolMap.setBit(i); timestampQueryIdx = i * 2; @@ -3245,9 +3245,9 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat cmd.args.copyBufferToImage.src = utexD->stagingBuffers[currentFrameSlot]; cmd.args.copyBufferToImage.dst = utexD->image; cmd.args.copyBufferToImage.dstLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; - cmd.args.copyBufferToImage.count = copyInfos.count(); + cmd.args.copyBufferToImage.count = copyInfos.size(); cmd.args.copyBufferToImage.bufferImageCopyIndex = cbD->pools.bufferImageCopy.size(); - cbD->pools.bufferImageCopy.append(copyInfos.constData(), copyInfos.count()); + cbD->pools.bufferImageCopy.append(copyInfos.constData(), copyInfos.size()); // no reuse of staging, this is intentional QRhiVulkan::DeferredReleaseEntry e; diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp index 47fc598a81..85a0271272 100644 --- a/src/gui/rhi/qshader.cpp +++ b/src/gui/rhi/qshader.cpp @@ -388,7 +388,7 @@ QByteArray QShader::serialized() const const QShaderKey &k(it.key()); writeShaderKey(&ds, k); const NativeResourceBindingMap &map(it.value()); - ds << int(map.count()); + ds << int(map.size()); for (auto mapIt = map.cbegin(), mapItEnd = map.cend(); mapIt != mapItEnd; ++mapIt) { ds << mapIt.key(); ds << mapIt.value().first; @@ -400,7 +400,7 @@ QByteArray QShader::serialized() const const QShaderKey &k(it.key()); writeShaderKey(&ds, k); const SeparateToCombinedImageSamplerMappingList &list(it.value()); - ds << int(list.count()); + ds << int(list.size()); for (auto listIt = list.cbegin(), listItEnd = list.cend(); listIt != listItEnd; ++listIt) { ds << listIt->combinedSamplerName; ds << listIt->textureBinding; diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 98293d436c..2f3c04dc54 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -697,7 +697,7 @@ static ColorData parseColorValue(QCss::Value v) return ColorData(); QStringList lst = v.variant.toStringList(); - if (lst.count() != 2) + if (lst.size() != 2) return ColorData(); const QString &identifier = lst.at(0); @@ -794,7 +794,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal) return BrushData(); QStringList lst = v.variant.toStringList(); - if (lst.count() != 2) + if (lst.size() != 2) return BrushData(); QStringList gradFuncs; @@ -1617,7 +1617,7 @@ QRect Declaration::rectValue() const if (v.type != Value::Function) return QRect(); const QStringList func = v.variant.toStringList(); - if (func.count() != 2 || func.at(0).compare("rect"_L1) != 0) + if (func.size() != 2 || func.at(0).compare("rect"_L1) != 0) return QRect(); const auto args = QStringView{func[1]}.split(u' ', Qt::SkipEmptyParts); if (args.size() != 4) @@ -1863,7 +1863,7 @@ int Selector::specificity() const val += 1; val += (sel.pseudos.size() + sel.attributeSelectors.size()) * 0x10; - val += sel.ids.count() * 0x100; + val += sel.ids.size() * 0x100; } return val; } @@ -2128,7 +2128,7 @@ QList StyleSelector::styleRulesForNode(NodePtr node) if (!styleSheet.idIndex.isEmpty()) { QStringList ids = nodeIds(node); - for (int i = 0; i < ids.count(); i++) { + for (int i = 0; i < ids.size(); i++) { const QString &key = ids.at(i); QMultiHash::const_iterator it = styleSheet.idIndex.constFind(key); while (it != styleSheet.idIndex.constEnd() && it.key() == key) { @@ -2139,7 +2139,7 @@ QList StyleSelector::styleRulesForNode(NodePtr node) } if (!styleSheet.nameIndex.isEmpty()) { QStringList names = nodeNames(node); - for (int i = 0; i < names.count(); i++) { + for (int i = 0; i < names.size(); i++) { QString name = names.at(i); if (nameCaseSensitivity == Qt::CaseInsensitive) name = std::move(name).toLower(); diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 3ff73baf92..2b649a7dd8 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -179,7 +179,7 @@ static QStringList splitIntoFamilies(const QString &family) auto str = list.at(i).trimmed(); if ((str.startsWith(u'"') && str.endsWith(u'"')) || (str.startsWith(u'\'') && str.endsWith(u'\''))) { - str = str.mid(1, str.length() - 2); + str = str.mid(1, str.size() - 2); } familyList << str.toString(); } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 27284d8d5a..35d6048594 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1904,9 +1904,9 @@ void QTextEngine::itemize() const { QUnicodeTools::ScriptItemArray scriptItems; QUnicodeTools::initScripts(layoutData->string, &scriptItems); - for (int i = 0; i < scriptItems.length(); ++i) { + for (int i = 0; i < scriptItems.size(); ++i) { const auto &item = scriptItems.at(i); - int end = i < scriptItems.length() - 1 ? scriptItems.at(i + 1).position : length; + int end = i < scriptItems.size() - 1 ? scriptItems.at(i + 1).position : length; for (int j = item.position; j < end; ++j) analysis[j].script = item.script; } @@ -3171,7 +3171,7 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const if (tabSpec.type == QTextOption::RightTab || tabSpec.type == QTextOption::CenterTab) { // find next tab to calculate the width required. tab = QFixed::fromReal(tabSpec.position); - for (int i=item + 1; i < layoutData->items.count(); i++) { + for (int i=item + 1; i < layoutData->items.size(); i++) { const QScriptItem &item = layoutData->items[i]; if (item.analysis.flags == QScriptAnalysis::TabOrObject) { // found it. tabSectionEnd = item.position; @@ -3186,7 +3186,7 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const if (tabSectionEnd > si.position) { QFixed length; // Calculate the length of text between this tab and the tabSectionEnd - for (int i=item; i < layoutData->items.count(); i++) { + for (int i=item; i < layoutData->items.size(); i++) { const QScriptItem &item = layoutData->items.at(i); if (item.position > tabSectionEnd || item.position <= si.position) continue; @@ -3258,7 +3258,7 @@ void QTextEngine::resolveFormats() const QTextFormatCollection *collection = formatCollection(); - QList resolvedFormats(layoutData->items.count()); + QList resolvedFormats(layoutData->items.size()); QVarLengthArray formatsSortedByStart; formatsSortedByStart.reserve(specialData->formats.size()); @@ -3276,7 +3276,7 @@ void QTextEngine::resolveFormats() const const int *startIt = formatsSortedByStart.constBegin(); const int *endIt = formatsSortedByEnd.constBegin(); - for (int i = 0; i < layoutData->items.count(); ++i) { + for (int i = 0; i < layoutData->items.size(); ++i) { const QScriptItem *si = &layoutData->items.at(i); int end = si->position + length(si); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 56b9e82be0..508d472062 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3988,7 +3988,7 @@ int QTextFormatCollection::createObjectIndex(const QTextFormat &f) QTextFormat QTextFormatCollection::format(int idx) const { - if (idx < 0 || idx >= formats.count()) + if (idx < 0 || idx >= formats.size()) return QTextFormat(); return formats.at(idx); @@ -3997,7 +3997,7 @@ QTextFormat QTextFormatCollection::format(int idx) const void QTextFormatCollection::setDefaultFont(const QFont &f) { defaultFnt = f; - for (int i = 0; i < formats.count(); ++i) + for (int i = 0; i < formats.size(); ++i) if (formats.at(i).d) formats[i].d->resolveFont(defaultFnt); } diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h index fac7082c1d..1bd9120513 100644 --- a/src/gui/text/qtextformat_p.h +++ b/src/gui/text/qtextformat_p.h @@ -55,7 +55,7 @@ public: inline QTextImageFormat imageFormat(int index) const { return format(index).toImageFormat(); } - inline int numFormats() const { return formats.count(); } + inline int numFormats() const { return formats.size(); } typedef QList FormatVector; diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 995f5d3502..55c64bb256 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -771,7 +771,7 @@ QString QTextHtmlParser::parseEntity(QStringView entity) if (!resolved.isNull()) return QString(resolved); - if (entity.length() > 1 && entity.at(0) == u'#') { + if (entity.size() > 1 && entity.at(0) == u'#') { entity = entity.mid(1); // removing leading # int base = 10; @@ -1029,7 +1029,7 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent // set element specific attributes switch (id) { case Html_a: - for (int i = 0; i < attributes.count(); i += 2) { + for (int i = 0; i < attributes.size(); i += 2) { const QString key = attributes.at(i); if (key.compare("href"_L1, Qt::CaseInsensitive) == 0 && !attributes.at(i + 1).isEmpty()) { @@ -1575,12 +1575,12 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) QString linkHref; QString linkType; - if (attributes.count() % 2 == 1) + if (attributes.size() % 2 == 1) return; QTextHtmlParserNode *node = nodes.last(); - for (int i = 0; i < attributes.count(); i += 2) { + for (int i = 0; i < attributes.size(); i += 2) { QString key = attributes.at(i); QString value = attributes.at(i + 1); @@ -1942,7 +1942,7 @@ QList standardDeclarationForNode(const QTextHtmlParserNode &n case Html_u: { bool needsUnderline = (node.id == Html_u) ? true : false; if (node.id == Html_a) { - for (int i = 0; i < node.attributes.count(); i += 2) { + for (int i = 0; i < node.attributes.size(); i += 2) { const QString key = node.attributes.at(i); if (key.compare("href"_L1, Qt::CaseInsensitive) == 0 && !node.attributes.at(i + 1).isEmpty()) { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 286722fc4c..14cd773834 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1323,7 +1323,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition int neighborItem = itm; if (neighborItem > 0 && si->position == realCursorPosition) --neighborItem; - else if (neighborItem < d->layoutData->items.count() - 1 && si->position + si->num_glyphs == realCursorPosition) + else if (neighborItem < d->layoutData->items.size() - 1 && si->position + si->num_glyphs == realCursorPosition) ++neighborItem; const bool onBoundary = neighborItem != itm && si->analysis.bidiLevel != d->layoutData->items[neighborItem].analysis.bidiLevel; @@ -2215,7 +2215,7 @@ int QTextLine::textStart() const int QTextLine::textLength() const { if (eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators - && eng->block.isValid() && index == eng->lines.count()-1) { + && eng->block.isValid() && index == eng->lines.size()-1) { return eng->lines.at(index).length - 1; } return eng->lines.at(index).length + eng->lines.at(index).trailingSpaces; @@ -2900,7 +2900,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const int neighborItem = itm; if (neighborItem > 0 && scriptItem->position == pos) --neighborItem; - else if (neighborItem < eng->layoutData->items.count() - 1 && scriptItem->position + scriptItem->num_glyphs == pos) + else if (neighborItem < eng->layoutData->items.size() - 1 && scriptItem->position + scriptItem->num_glyphs == pos) ++neighborItem; const bool onBoundary = neighborItem != itm && scriptItem->analysis.bidiLevel != eng->layoutData->items[neighborItem].analysis.bidiLevel; // If we are, prioritise the neighbor item that has the same direction as the engine @@ -3217,7 +3217,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const // character between lines is a space and we want // to position the cursor to the left of that // character. - if (index < eng->lines.count() - 1) + if (index < eng->lines.size() - 1) pos = qMin(eng->previousLogicalPosition(pos), pos); return pos; diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index 2b178b70c9..8b4b308d0c 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -86,7 +86,7 @@ QTextList::~QTextList() int QTextList::count() const { Q_D(const QTextList); - return d->blocks.count(); + return d->blocks.size(); } /*! diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 1a201969f0..8d3195dce6 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -165,7 +165,7 @@ QTextDocument *QTextObject::document() const void QTextBlockGroupPrivate::markBlocksDirty() { - for (int i = 0; i < blocks.count(); ++i) { + for (int i = 0; i < blocks.size(); ++i) { const QTextBlock &block = blocks.at(i); pieceTable->documentChange(block.position(), block.length()); } diff --git a/src/gui/vulkan/qbasicvulkanplatforminstance.cpp b/src/gui/vulkan/qbasicvulkanplatforminstance.cpp index a674d71592..31e27cdac5 100644 --- a/src/gui/vulkan/qbasicvulkanplatforminstance.cpp +++ b/src/gui/vulkan/qbasicvulkanplatforminstance.cpp @@ -243,13 +243,13 @@ void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const // No clever stuff with QSet and friends: the order for layers matters // and the user-provided order must be kept. - for (int i = 0; i < m_enabledLayers.count(); ++i) { + for (int i = 0; i < m_enabledLayers.size(); ++i) { const QByteArray &layerName(m_enabledLayers[i]); if (!m_supportedLayers.contains(layerName)) m_enabledLayers.removeAt(i--); } qDebug(lcPlatVk) << "Enabling Vulkan instance layers:" << m_enabledLayers; - for (int i = 0; i < m_enabledExtensions.count(); ++i) { + for (int i = 0; i < m_enabledExtensions.size(); ++i) { const QByteArray &extName(m_enabledExtensions[i]); if (!m_supportedExtensions.contains(extName)) m_enabledExtensions.removeAt(i--); diff --git a/src/network/access/qhttpheaderparser.cpp b/src/network/access/qhttpheaderparser.cpp index 558f8dbd5c..489defa8d8 100644 --- a/src/network/access/qhttpheaderparser.cpp +++ b/src/network/access/qhttpheaderparser.cpp @@ -102,7 +102,7 @@ bool QHttpHeaderParser::parseStatus(QByteArrayView status) static const int spacePos = 8; static const char httpMagic[] = "HTTP/"; - if (status.length() < minLength + if (status.size() < minLength || !status.startsWith(httpMagic) || status.at(dotPos) != '.' || status.at(spacePos) != ' ') { diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 9e5f48c456..91660cf2f7 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -657,7 +657,7 @@ QAuthenticatorPrivate::parseDigestAuthenticationChallenge(QByteArrayView challen QHash options; // parse the challenge const char *d = challenge.data(); - const char *end = d + challenge.length(); + const char *end = d + challenge.size(); while (d < end) { while (d < end && (*d == ' ' || *d == '\n' || *d == '\r')) ++d; @@ -1759,7 +1759,7 @@ static QByteArray qGssapiContinue(QAuthenticatorPrivate *ctx, QByteArrayView cha if (!challenge.isEmpty()) { inBuf.value = const_cast(challenge.data()); - inBuf.length = challenge.length(); + inBuf.length = challenge.size(); } majStat = gss_init_sec_context(&minStat, diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index b2ad52ba8d..09375393a8 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -181,7 +181,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const int rotationAngle = 0; bool invertx = false; bool inverty = false; - for (int i = 0; i < args.count(); ++i) { + for (int i = 0; i < args.size(); ++i) { if (args.at(i).startsWith("rotate"_L1)) { QString rotateArg = args.at(i).section(u'=', 1, 1); bool ok; diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp index 7643122926..89b6df605b 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp +++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp @@ -200,7 +200,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) { const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray(); const QByteArrayList vposComp = vpos.split(','); - if (vposComp.count() == 2) + if (vposComp.size() == 2) vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt()); } if (userConnectorConfig.value(QStringLiteral("primary")).toBool()) @@ -478,7 +478,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, const QStringList crtcPlanePairs = val.split(u':'); for (const QString &crtcPlanePair : crtcPlanePairs) { const QStringList values = crtcPlanePair.split(u','); - if (values.count() == 2 && uint(values[0].toInt()) == output.crtc_id) { + if (values.size() == 2 && uint(values[0].toInt()) == output.crtc_id) { uint planeId = values[1].toInt(); for (QKmsPlane &kmsplane : m_planes) { if (kmsplane.id == planeId) { diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp index 145352973d..a304963669 100644 --- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp +++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp @@ -39,7 +39,7 @@ QTuioHandler::QTuioHandler(const QString &specification) bool invertx = false; bool inverty = false; - for (int i = 0; i < args.count(); ++i) { + for (int i = 0; i < args.size(); ++i) { if (args.at(i).startsWith("udp=")) { QString portString = args.at(i).section('=', 1, 1); portNumber = portString.toInt(); @@ -326,7 +326,7 @@ void QTuioHandler::process2DCurFseq(const QOscMessage &message) Q_UNUSED(message); // TODO: do we need to do anything with the frame id? QWindow *win = QGuiApplication::focusWindow(); - if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery) + if (!win && QGuiApplication::topLevelWindows().size() > 0 && forceDelivery) win = QGuiApplication::topLevelWindows().at(0); if (!win) @@ -499,7 +499,7 @@ void QTuioHandler::process2DObjFseq(const QOscMessage &message) Q_UNUSED(message); // TODO: do we need to do anything with the frame id? QWindow *win = QGuiApplication::focusWindow(); - if (!win && QGuiApplication::topLevelWindows().length() > 0 && forceDelivery) + if (!win && QGuiApplication::topLevelWindows().size() > 0 && forceDelivery) win = QGuiApplication::topLevelWindows().at(0); if (!win) diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index 6c15d7c142..7c3a9d0741 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -56,7 +56,7 @@ protected: if (isEmpty()) return QStringList(); - if (!formatList.count()) { + if (!formatList.size()) { QXcbClipboardMime *that = const_cast(this); // get the list of targets from the current clipboard owner - we do this // once so that multiple calls to this function don't require multiple diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index 3d1229044c..b4e28ab831 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -108,7 +108,7 @@ static void sm_setProperty(const QString &name, const QString &value) static void sm_setProperty(const QString &name, const QStringList &value) { - SmPropValue *prop = new SmPropValue[value.count()]; + SmPropValue *prop = new SmPropValue[value.size()]; int count = 0; QList vl; vl.reserve(value.size()); diff --git a/src/plugins/printsupport/cups/qcupsprintersupport.cpp b/src/plugins/printsupport/cups/qcupsprintersupport.cpp index 539cd55c54..40381097d2 100644 --- a/src/plugins/printsupport/cups/qcupsprintersupport.cpp +++ b/src/plugins/printsupport/cups/qcupsprintersupport.cpp @@ -57,7 +57,7 @@ static const char *getPasswordCB(const char */*prompt*/, http_t *http, const cha QString resourceString = QString::fromLocal8Bit(resource); if (resourceString.startsWith(QStringLiteral("/printers/"))) - resourceString = resourceString.mid(QStringLiteral("/printers/").length()); + resourceString = resourceString.mid(QStringLiteral("/printers/").size()); QLabel *label = new QLabel(); if (hostname == QStringLiteral("localhost")) { diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp index 487b02784e..95813c90fa 100644 --- a/src/plugins/printsupport/cups/qppdprintdevice.cpp +++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp @@ -428,7 +428,7 @@ bool QPpdPrintDevice::setProperty(QPrintDevice::PrintDevicePropertyKey key, cons { if (key == PDPK_PpdOption) { const QStringList values = value.toStringList(); - if (values.count() == 2) { + if (values.size() == 2) { ppdMarkOption(m_ppd, values[0].toLatin1(), values[1].toLatin1()); return true; } @@ -441,7 +441,7 @@ bool QPpdPrintDevice::isFeatureAvailable(QPrintDevice::PrintDevicePropertyKey ke { if (key == PDPK_PpdChoiceIsInstallableConflict) { const QStringList values = params.toStringList(); - if (values.count() == 2) + if (values.size() == 2) return ppdInstallableConflict(m_ppd, values[0].toLatin1(), values[1].toLatin1()); } diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index 301e45d2c9..6812addae1 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -779,7 +779,7 @@ void QSQLiteDriver::close() for (QSQLiteResult *result : std::as_const(d->results)) result->d_func()->finalize(); - if (d->access && (d->notificationid.count() > 0)) { + if (d->access && (d->notificationid.size() > 0)) { d->notificationid.clear(); sqlite3_update_hook(d->access, nullptr, nullptr); } @@ -990,7 +990,7 @@ bool QSQLiteDriver::subscribeToNotification(const QString &name) //sqlite supports only one notification callback, so only the first is registered d->notificationid << name; - if (d->notificationid.count() == 1) + if (d->notificationid.size() == 1) sqlite3_update_hook(d->access, &handle_sqlite_callback, reinterpret_cast (this)); return true; diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp index f4d3263f48..051b1a8552 100644 --- a/src/printsupport/kernel/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -196,7 +196,7 @@ QCUPSSupport::JobSheets QCUPSSupport::parseJobSheets(const QString &jobSheets) JobSheets result; const QStringList parts = jobSheets.split(u','); - if (parts.count() == 2) { + if (parts.size() == 2) { result.startBannerPage = stringToBannerPage(parts[0]); result.endBannerPage = stringToBannerPage(parts[1]); } diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 56d5edb39f..642aea5461 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -630,7 +630,7 @@ bool QSqlResult::exec() int i; QVariant val; QString holder; - for (i = d->holders.count() - 1; i >= 0; --i) { + for (i = d->holders.size() - 1; i >= 0; --i) { holder = d->holders.at(i).holderName; val = d->values.value(d->indexes.value(holder).value(0,-1)); QSqlField f(""_L1, val.metaType()); diff --git a/src/testlib/qpropertytesthelper_p.h b/src/testlib/qpropertytesthelper_p.h index b5bd8d2583..f2cb82cdd7 100644 --- a/src/testlib/qpropertytesthelper_p.h +++ b/src/testlib/qpropertytesthelper_p.h @@ -129,7 +129,7 @@ void testReadWritePropertyBasics( testedObj.property(propertyName).template value(), initial, comparator, represent); if (spy) - QCOMPARE(spy->count(), 1); + QCOMPARE(spy->size(), 1); QUntypedBindable bindable = metaProperty.bindable(&instance); @@ -148,7 +148,7 @@ void testReadWritePropertyBasics( QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent); QPROPERTY_TEST_COMPARISON_HELPER(propObserverLambda.value(), changed, comparator, represent); if (spy) - QCOMPARE(spy->count(), 2); + QCOMPARE(spy->size(), 2); // Bind object's property to other property QProperty propSetter(initial); @@ -162,7 +162,7 @@ void testReadWritePropertyBasics( QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), initial, comparator, represent); QPROPERTY_TEST_COMPARISON_HELPER(propObserverLambda.value(), initial, comparator, represent); if (spy) - QCOMPARE(spy->count(), 3); + QCOMPARE(spy->size(), 3); // Count notifications triggered; should only happen on actual change. int updateCount = 0; @@ -177,7 +177,7 @@ void testReadWritePropertyBasics( QPROPERTY_TEST_COMPARISON_HELPER(propObserverLambda.value(), changed, comparator, represent); QCOMPARE(updateCount, 1); if (spy) - QCOMPARE(spy->count(), 4); + QCOMPARE(spy->size(), 4); // Test that manually setting the value (even the same one) breaks the // binding. @@ -188,7 +188,7 @@ void testReadWritePropertyBasics( // value didn't change -> the signal should not be emitted if (spy) - QCOMPARE(spy->count(), 4); + QCOMPARE(spy->size(), 4); } /*! @@ -287,7 +287,7 @@ void testWriteOncePropertyBasics( represent); QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent); if (spy) - QCOMPARE(spy->count(), 1); + QCOMPARE(spy->size(), 1); // Attempt to set back the 'prior' value and verify that it has no effect testedObj.setProperty(propertyName, QVariant::fromValue(prior)); @@ -296,7 +296,7 @@ void testWriteOncePropertyBasics( represent); QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent); if (spy) - QCOMPARE(spy->count(), 1); + QCOMPARE(spy->size(), 1); if (bindingPreservedOnWrite) QVERIFY(bindable.hasBinding()); else @@ -386,7 +386,7 @@ void testReadOnlyPropertyBasics( testedObj.property(propertyName).template value(), initial, comparator, represent); if (spy) - QCOMPARE(spy->count(), 0); + QCOMPARE(spy->size(), 0); QProperty propObserver; propObserver.setBinding(bindable.makeBinding()); @@ -402,7 +402,7 @@ void testReadOnlyPropertyBasics( QPROPERTY_TEST_COMPARISON_HELPER(propObserver.value(), changed, comparator, represent); if (spy) - QCOMPARE(spy->count(), 1); + QCOMPARE(spy->size(), 1); } } // namespace QTestPrivate diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h index 7c85311856..61192cd9e8 100644 --- a/src/testlib/qsignalspy.h +++ b/src/testlib/qsignalspy.h @@ -97,11 +97,11 @@ public: bool wait(int timeout = 5000) { Q_ASSERT(!m_waiting); - const qsizetype origCount = count(); + const qsizetype origCount = size(); m_waiting = true; m_loop.enterLoopMSecs(timeout); m_waiting = false; - return count() > origCount; + return size() > origCount; } int qt_metacall(QMetaObject::Call call, int methodId, void **a) override diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 347008fe02..335b72f1fb 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -655,7 +655,7 @@ static void qPrintDataTags(FILE *stream) // Print all tag combinations: if (gTable->dataCount() == 0) { - if (localTags.count() == 0) { + if (localTags.size() == 0) { // No tags at all, so just print the test function: fprintf(stream, "%s %s\n", currTestMetaObj->className(), slot); } else { @@ -667,7 +667,7 @@ static void qPrintDataTags(FILE *stream) } } else { for (int j = 0; j < gTable->dataCount(); ++j) { - if (localTags.count() == 0) { + if (localTags.size() == 0) { // Only global tags, so print the current one: fprintf( stream, "%s %s __global__ %s\n", @@ -2431,7 +2431,7 @@ QTest::TestEntryFunction QTest::qGetTestCaseEntryFunction(const QString& name) */ int QTest::qExec(QObject *testObject, const QStringList &arguments) { - const int argc = arguments.count(); + const int argc = arguments.size(); QVarLengthArray argv(argc); QList args; diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h index 80745ed9bf..8f092cf8c9 100644 --- a/src/testlib/qtestevent.h +++ b/src/testlib/qtestevent.h @@ -132,7 +132,7 @@ class QTestEventList: public QList public: inline QTestEventList() {} inline QTestEventList(const QTestEventList &other): QList() - { for (int i = 0; i < other.count(); ++i) append(other.at(i)->clone()); } + { for (int i = 0; i < other.size(); ++i) append(other.at(i)->clone()); } inline ~QTestEventList() { clear(); } inline void clear() @@ -182,7 +182,7 @@ public: #ifdef QT_WIDGETS_LIB inline void simulate(QWidget *w) { - for (int i = 0; i < count(); ++i) + for (int i = 0; i < size(); ++i) at(i)->simulate(w); } #endif diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 71b9757ebc..eb359f4dbb 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -330,7 +330,7 @@ int runMoc(int argc, char **argv) if (parser.isSet(collectOption)) return collectJson(files, output, hasOptionFiles); - if (files.count() > 1) { + if (files.size() > 1) { error(qPrintable("Too many input files specified: '"_L1 + files.join("' '"_L1) + u'\'')); parser.showHelp(1); } else if (!files.isEmpty()) { diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 08e3fcf066..03742d4fed 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -333,7 +333,7 @@ static std::deque s_customTypes; static void parseCmdLine(QStringList &arguments) { flags = 0; - for (qsizetype i = 0; i < arguments.count(); ++i) { + for (qsizetype i = 0; i < arguments.size(); ++i) { const QString arg = arguments.at(i); if (arg == "--help"_L1) @@ -373,7 +373,7 @@ static void parseCmdLine(QStringList &arguments) break; case 't': - if (arguments.count() < i + 2) { + if (arguments.size() < i + 2) { printf("-t expects a type=dbustype argument\n"); exit(1); } else { @@ -394,7 +394,7 @@ static void parseCmdLine(QStringList &arguments) break; case 'o': - if (arguments.count() < i + 2 || arguments.at(i + 1).startsWith(u'-')) { + if (arguments.size() < i + 2 || arguments.at(i + 1).startsWith(u'-')) { printf("-o expects a filename\n"); exit(1); } diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp index 5cea80b378..51e151b4fb 100644 --- a/src/tools/qlalr/cppgenerator.cpp +++ b/src/tools/qlalr/cppgenerator.cpp @@ -214,7 +214,7 @@ void CppGenerator::operator () () } auto rule = grammar.rules.begin(); - for (int i = 0; i < used_rules.count (); ++i, ++rule) + for (int i = 0; i < used_rules.size(); ++i, ++rule) { if (! used_rules.testBit (i)) { diff --git a/src/tools/uic/cpp/cppwritedeclaration.cpp b/src/tools/uic/cpp/cppwritedeclaration.cpp index f11b2233c6..910c4e2ee2 100644 --- a/src/tools/uic/cpp/cppwritedeclaration.cpp +++ b/src/tools/uic/cpp/cppwritedeclaration.cpp @@ -55,7 +55,7 @@ void WriteDeclaration::acceptUI(DomUI *node) exportMacro.append(u' '); QStringList namespaceList = qualifiedClassName.split("::"_L1); - if (namespaceList.count()) { + if (namespaceList.size()) { className = namespaceList.last(); namespaceList.removeLast(); } @@ -65,7 +65,7 @@ void WriteDeclaration::acceptUI(DomUI *node) // is a User using Qt-in-namespace having his own classes not in a namespace. // In this case the generated Ui helper classes will also end up in // the Qt namespace (which is harmless, but not "pretty") - const bool needsMacro = namespaceList.count() == 0 + const bool needsMacro = namespaceList.size() == 0 || namespaceList[0] == "qdesigner_internal"_L1; if (needsMacro) @@ -73,7 +73,7 @@ void WriteDeclaration::acceptUI(DomUI *node) openNameSpaces(namespaceList, m_output); - if (namespaceList.count()) + if (namespaceList.size()) m_output << "\n"; m_output << "class " << exportMacro << m_option.prefix << className << "\n" @@ -98,7 +98,7 @@ void WriteDeclaration::acceptUI(DomUI *node) closeNameSpaces(namespaceList, m_output); - if (namespaceList.count()) + if (namespaceList.size()) m_output << "\n"; if (m_option.generateNamespace && !m_option.prefix.isEmpty()) { @@ -110,7 +110,7 @@ void WriteDeclaration::acceptUI(DomUI *node) closeNameSpaces(namespaceList, m_output); - if (namespaceList.count()) + if (namespaceList.size()) m_output << "\n"; } diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 24ca25e8ee..d87e56d20f 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -977,7 +977,7 @@ void WriteInitialization::writePropertyList(const QString &varName, if (value.isEmpty()) return; const QStringList list = value.split(u','); - const int count = list.count(); + const int count = list.size(); for (int i = 0; i < count; i++) { if (list.at(i) != defaultValue) { m_output << m_indent << varName << language::derefPointer << setFunction @@ -2329,7 +2329,7 @@ void WriteInitialization::initializeTreeWidget(DomWidget *w) QString tempName = disableSorting(w, varName); const auto items = initializeTreeWidgetItems(w->elementItem()); - for (int i = 0; i < items.count(); i++) { + for (int i = 0; i < items.size(); i++) { Item *itm = items[i]; itm->writeSetupUi(varName); QString parentPath; diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 7d165cadd1..ac8ec224b9 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -420,7 +420,7 @@ QAccessibleInterface *QAccessibleAbstractScrollArea::child(int index) const int QAccessibleAbstractScrollArea::childCount() const { - return accessibleChildren().count(); + return accessibleChildren().size(); } int QAccessibleAbstractScrollArea::indexOfChild(const QAccessibleInterface *child) const diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index 79a7228369..073f373d03 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -154,21 +154,21 @@ int QAccessibleTable::selectedCellCount() const { if (!view()->selectionModel()) return 0; - return view()->selectionModel()->selectedIndexes().count(); + return view()->selectionModel()->selectedIndexes().size(); } int QAccessibleTable::selectedColumnCount() const { if (!view()->selectionModel()) return 0; - return view()->selectionModel()->selectedColumns().count(); + return view()->selectionModel()->selectedColumns().size(); } int QAccessibleTable::selectedRowCount() const { if (!view()->selectionModel()) return 0; - return view()->selectionModel()->selectedRows().count(); + return view()->selectionModel()->selectedRows().size(); } QString QAccessibleTable::rowDescription(int row) const @@ -1024,7 +1024,7 @@ void QAccessibleTableCell::unselectCell() //one cell is selected it cannot be unselected by the user if ((selectionMode != QAbstractItemView::MultiSelection) && (selectionMode != QAbstractItemView::ExtendedSelection) - && (view->selectionModel()->selectedIndexes().count() <= 1)) + && (view->selectionModel()->selectedIndexes().size() <= 1)) return; view->selectionModel()->select(m_index, QItemSelectionModel::Deselect); diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 2dd7e035df..13f7eca898 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -299,14 +299,14 @@ QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRel if (match & QAccessible::Controlled) { QObjectList allReceivers; QObject *connectionObject = object(); - for (int sig = 0; sig < d->primarySignals.count(); ++sig) { + for (int sig = 0; sig < d->primarySignals.size(); ++sig) { const QObjectList receivers = connectionObject->d_func()->receiverList(d->primarySignals.at(sig).toLatin1()); allReceivers += receivers; } allReceivers.removeAll(object()); //### The object might connect to itself internally - for (int i = 0; i < allReceivers.count(); ++i) { + for (int i = 0; i < allReceivers.size(); ++i) { const QAccessible::Relation rel = QAccessible::Controlled; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(allReceivers.at(i)); if (iface) diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index d85a2a8b0e..d301eaa7ea 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -673,7 +673,7 @@ void QFileDialogPrivate::emitFilesSelected(const QStringList &files) { Q_Q(QFileDialog); emit q->filesSelected(files); - if (files.count() == 1) + if (files.size() == 1) emit q->fileSelected(files.first()); } @@ -1352,7 +1352,7 @@ QStringList qt_strip_filters(const QStringList &filters) #if QT_CONFIG(regularexpression) QStringList strippedFilters; static const QRegularExpression r(QString::fromLatin1(QPlatformFileDialogHelper::filterRegExp)); - const int numFilters = filters.count(); + const int numFilters = filters.size(); strippedFilters.reserve(numFilters); for (int i = 0; i < numFilters; ++i) { QString filterName; @@ -1391,7 +1391,7 @@ void QFileDialog::setNameFilters(const QStringList &filters) { Q_D(QFileDialog); QStringList cleanedFilters; - const int numFilters = filters.count(); + const int numFilters = filters.size(); cleanedFilters.reserve(numFilters); for (int i = 0; i < numFilters; ++i) { cleanedFilters << filters[i].simplified(); @@ -3544,7 +3544,7 @@ void QFileDialogPrivate::_q_deleteCurrent() return; QModelIndexList list = qFileDialogUi->listView->selectionModel()->selectedRows(); - for (int i = list.count() - 1; i >= 0; --i) { + for (int i = list.size() - 1; i >= 0; --i) { QPersistentModelIndex index = list.at(i); if (index == qFileDialogUi->listView->rootIndex()) continue; @@ -3600,7 +3600,7 @@ void QFileDialogPrivate::_q_autoCompleteFileName(const QString &text) } const QStringList multipleFiles = typedFiles(); - if (multipleFiles.count() > 0) { + if (multipleFiles.size() > 0) { QModelIndexList oldFiles = qFileDialogUi->listView->selectionModel()->selectedRows(); QList newFiles; for (const auto &file : multipleFiles) { @@ -3808,7 +3808,7 @@ void QFileDialogPrivate::_q_useNameFilter(int index) QStringList newNameFilters = QPlatformFileDialogHelper::cleanFilterList(nameFilter); if (q_func()->acceptMode() == QFileDialog::AcceptSave) { QString newNameFilterExtension; - if (newNameFilters.count() > 0) + if (newNameFilters.size() > 0) newNameFilterExtension = QFileInfo(newNameFilters.at(0)).suffix(); QString fileName = lineEdit()->text(); @@ -3843,8 +3843,8 @@ void QFileDialogPrivate::_q_selectionChanged() continue; allFiles.append(index.data().toString()); } - if (allFiles.count() > 1) - for (qsizetype i = 0; i < allFiles.count(); ++i) { + if (allFiles.size() > 1) + for (qsizetype i = 0; i < allFiles.size(); ++i) { allFiles.replace(i, QString(u'"' + allFiles.at(i) + u'"')); } @@ -4012,7 +4012,7 @@ void QFileDialogComboBox::showPopup() // append history QList urls; - for (int i = 0; i < m_history.count(); ++i) { + for (int i = 0; i < m_history.size(); ++i) { QUrl path = QUrl::fromLocalFile(m_history.at(i)); if (!urls.contains(path)) urls.prepend(path); @@ -4220,7 +4220,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const #else bool startsFromRoot = pathCopy[0] == sep; #endif - if (parts.count() == 1 || (parts.count() > 1 && !startsFromRoot)) { + if (parts.size() == 1 || (parts.size() > 1 && !startsFromRoot)) { const QFileSystemModel *dirModel; if (proxyModel) dirModel = qobject_cast(proxyModel->sourceModel()); @@ -4233,7 +4233,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const #endif if (currentLocation.contains(sep) && path != currentLocation) { QStringList currentLocationList = splitPath(currentLocation); - while (!currentLocationList.isEmpty() && parts.count() > 0 && parts.at(0) == ".."_L1) { + while (!currentLocationList.isEmpty() && parts.size() > 0 && parts.at(0) == ".."_L1) { parts.removeFirst(); currentLocationList.removeLast(); } diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index d54b65a173..7cb2831411 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -2267,11 +2267,11 @@ void QWizard::removePage(int id) QWizardPage *removedPage = nullptr; // update startItem accordingly - if (d->pageMap.count() > 0) { // only if we have any pages + if (d->pageMap.size() > 0) { // only if we have any pages if (d->start == id) { const int firstId = d->pageMap.constBegin().key(); if (firstId == id) { - if (d->pageMap.count() > 1) + if (d->pageMap.size() > 1) d->start = (++d->pageMap.constBegin()).key(); // secondId else d->start = -1; // removing the last page @@ -2395,7 +2395,7 @@ void QWizard::setStartId(int theid) Q_D(QWizard); int newStart = theid; if (theid == -1) - newStart = d->pageMap.count() ? d->pageMap.constBegin().key() : -1; + newStart = d->pageMap.size() ? d->pageMap.constBegin().key() : -1; if (d->start == newStart) { d->startSetByUser = theid != -1; diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index fb49983bbf..f7dab4724b 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -2413,7 +2413,7 @@ QPolygonF QGraphicsView::mapToScene(const QRect &rect) const QPolygonF QGraphicsView::mapToScene(const QPolygon &polygon) const { QPolygonF poly; - poly.reserve(polygon.count()); + poly.reserve(polygon.size()); for (const QPoint &point : polygon) poly << mapToScene(point); return poly; @@ -2509,7 +2509,7 @@ QPolygon QGraphicsView::mapFromScene(const QRectF &rect) const QPolygon QGraphicsView::mapFromScene(const QPolygonF &polygon) const { QPolygon poly; - poly.reserve(polygon.count()); + poly.reserve(polygon.size()); for (const QPointF &point : polygon) poly << mapFromScene(point); return poly; diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index e0334de6f0..7a7b5c4753 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2829,10 +2829,10 @@ void QAbstractItemView::updateEditorGeometries() //we hide and release the editor outside of the loop because it might change the focus and try //to change the editors hashes. - for (int i = 0; i < editorsToHide.count(); ++i) { + for (int i = 0; i < editorsToHide.size(); ++i) { editorsToHide.at(i)->hide(); } - for (int i = 0; i < editorsToRelease.count(); ++i) { + for (int i = 0; i < editorsToRelease.size(); ++i) { d->releaseEditor(editorsToRelease.at(i)); } } @@ -3793,7 +3793,7 @@ void QAbstractItemView::startDrag(Qt::DropActions supportedActions) { Q_D(QAbstractItemView); QModelIndexList indexes = d->selectedDraggableIndexes(); - if (indexes.count() > 0) { + if (indexes.size() > 0) { QMimeData *data = d->model->mimeData(indexes); if (!data) return; @@ -4636,7 +4636,7 @@ QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QStyleOptionViewItem option; q->initViewItemOption(&option); option.state |= QStyle::State_Selected; - for (int j = 0; j < paintPairs.count(); ++j) { + for (int j = 0; j < paintPairs.size(); ++j) { option.rect = paintPairs.at(j).rect.translated(-r->topLeft()); const QModelIndex ¤t = paintPairs.at(j).index; adjustViewOptionsForIndex(&option, current); diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp index 551645cb3d..040bddb311 100644 --- a/src/widgets/itemviews/qcolumnview.cpp +++ b/src/widgets/itemviews/qcolumnview.cpp @@ -420,7 +420,7 @@ int QColumnView::verticalOffset() const */ QRegion QColumnView::visualRegionForSelection(const QItemSelection &selection) const { - int ranges = selection.count(); + int ranges = selection.size(); if (ranges == 0) return QRect(); @@ -984,9 +984,9 @@ void QColumnView::selectAll() QModelIndexList indexList = selectionModel()->selectedIndexes(); QModelIndex parent = rootIndex(); QItemSelection selection; - if (indexList.count() >= 1) + if (indexList.size() >= 1) parent = indexList.at(0).parent(); - if (indexList.count() == 1) { + if (indexList.size() == 1) { parent = indexList.at(0); if (!model()->hasChildren(parent)) parent = parent.parent(); diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index e231345437..b5b0f17f4a 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3453,7 +3453,7 @@ void QHeaderView::initStyleOption(QStyleOptionFrame *option) const bool QHeaderViewPrivate::isSectionSelected(int section) const { int i = section * 2; - if (i < 0 || i >= sectionSelected.count()) + if (i < 0 || i >= sectionSelected.size()) return false; if (sectionSelected.testBit(i)) // if the value was cached return sectionSelected.testBit(i + 1); diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h index 16b98b3ae3..c599aeff8d 100644 --- a/src/widgets/itemviews/qheaderview_p.h +++ b/src/widgets/itemviews/qheaderview_p.h @@ -120,7 +120,7 @@ public: inline void prepareSectionSelected() { if (!selectionModel || !selectionModel->hasSelection()) sectionSelected.clear(); - else if (sectionSelected.count() != sectionCount() * 2) + else if (sectionSelected.size() != sectionCount() * 2) sectionSelected.fill(false, sectionCount() * 2); else sectionSelected.fill(false); } @@ -332,7 +332,7 @@ public: void setHiddenSectionsFromBitVector(const QBitArray §ionHidden) { SectionItem *sectionData = sectionItems.data(); - for (int i = 0; i < sectionHidden.count(); ++i) + for (int i = 0; i < sectionHidden.size(); ++i) sectionData[i].isHidden = sectionHidden.at(i); } diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 359f6da0bd..3ce159e185 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -2885,7 +2885,7 @@ bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions) // plus adding viewitems to the draggedItems list. // We need these items to draw the drag items QModelIndexList indexes = dd->selectionModel->selectedIndexes(); - if (indexes.count() > 0 ) { + if (indexes.size() > 0 ) { if (viewport()->acceptDrops()) { QModelIndexList::ConstIterator it = indexes.constBegin(); for (; it != indexes.constEnd(); ++it) @@ -3140,7 +3140,7 @@ void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info) segPosition = topLeft.x(); } - if (moved.count() != items.size()) + if (moved.size() != items.size()) moved.resize(items.size()); QRect rect(QPoint(), topLeft); @@ -3335,7 +3335,7 @@ void QIconModeViewBase::moveItem(int index, const QPoint &dest) contentsSize = (QRect(QPoint(0, 0), contentsSize)|QRect(dest, rect.size())).size(); // mark the item as moved - if (moved.count() != items.size()) + if (moved.size() != items.size()) moved.resize(items.size()); moved.setBit(index, true); } diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 68f4a547f9..cc0ccf84da 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -91,7 +91,7 @@ void QListModel::insert(int row, QListWidgetItem *item) void QListModel::insert(int row, const QStringList &labels) { - const int count = labels.count(); + const int count = labels.size(); if (count <= 0) return; QListWidget *view = qobject_cast(QObject::parent()); @@ -376,7 +376,7 @@ void QListModel::ensureSorted(int column, Qt::SortOrder order, int start, int en else if (oldRow > otherRow && newRow <= otherRow) ++sorting[j].second; } - for (int k = 0; k < newPersistentIndexes.count(); ++k) { + for (int k = 0; k < newPersistentIndexes.size(); ++k) { QModelIndex pi = newPersistentIndexes.at(k); int oldPersistentRow = pi.row(); int newPersistentRow = oldPersistentRow; @@ -444,7 +444,7 @@ QMimeData *QListModel::internalMimeData() const QMimeData *QListModel::mimeData(const QModelIndexList &indexes) const { QList itemlist; - const int indexesCount = indexes.count(); + const int indexesCount = indexes.size(); itemlist.reserve(indexesCount); for (int i = 0; i < indexesCount; ++i) itemlist << at(indexes.at(i).row()); @@ -1760,7 +1760,7 @@ QList QListWidget::selectedItems() const Q_D(const QListWidget); QModelIndexList indexes = selectionModel()->selectedIndexes(); QList items; - const int numIndexes = indexes.count(); + const int numIndexes = indexes.size(); items.reserve(numIndexes); for (int i = 0; i < numIndexes; ++i) items.append(d->listModel()->at(indexes.at(i).row())); diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 3cd93f9337..cfde93a477 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -2197,7 +2197,7 @@ QModelIndexList QTableView::selectedIndexes() const QModelIndexList modelSelected; if (d->selectionModel) modelSelected = d->selectionModel->selectedIndexes(); - for (int i = 0; i < modelSelected.count(); ++i) { + for (int i = 0; i < modelSelected.size(); ++i) { QModelIndex index = modelSelected.at(i); if (!isIndexHidden(index) && index.parent() == d->root) viewSelected.append(index); diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index d646cae406..67886be94f 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -809,7 +809,7 @@ QMimeData *QTableModel::internalMimeData() const QMimeData *QTableModel::mimeData(const QModelIndexList &indexes) const { QList items; - const int indexesCount = indexes.count(); + const int indexesCount = indexes.size(); items.reserve(indexesCount); for (int i = 0; i < indexesCount; ++i) items << item(indexes.at(i)); @@ -2087,7 +2087,7 @@ void QTableWidget::setVerticalHeaderLabels(const QStringList &labels) Q_D(QTableWidget); QTableModel *model = d->tableModel(); QTableWidgetItem *item = nullptr; - for (int i = 0; i < model->rowCount() && i < labels.count(); ++i) { + for (int i = 0; i < model->rowCount() && i < labels.size(); ++i) { item = model->verticalHeaderItem(i); if (!item) { item = model->createItem(); @@ -2105,7 +2105,7 @@ void QTableWidget::setHorizontalHeaderLabels(const QStringList &labels) Q_D(QTableWidget); QTableModel *model = d->tableModel(); QTableWidgetItem *item = nullptr; - for (int i = 0; i < model->columnCount() && i < labels.count(); ++i) { + for (int i = 0; i < model->columnCount() && i < labels.size(); ++i) { item = model->horizontalHeaderItem(i); if (!item) { item = model->createItem(); @@ -2697,7 +2697,7 @@ void QTableWidget::dropEvent(QDropEvent *event) { } QList taken; - const int indexesCount = indexes.count(); + const int indexesCount = indexes.size(); taken.reserve(indexesCount); for (const auto &index : indexes) taken.append(takeItem(index.row(), index.column())); diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 6cf05c411f..065c42d6b7 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1037,7 +1037,7 @@ void QTreeView::keyboardSearch(const QString &search) if (searchFrom.parent() == start.parent()) searchFrom = start; QModelIndexList match = d->model->match(searchFrom, Qt::DisplayRole, searchString); - if (match.count()) { + if (match.size()) { int hitIndex = d->viewIndex(match.at(0)); if (hitIndex >= 0 && hitIndex < startIndex) bestAbove = bestAbove == -1 ? hitIndex : qMin(hitIndex, bestAbove); @@ -1556,11 +1556,11 @@ void QTreeViewPrivate::calcLogicalIndices( } } - itemPositions->resize(logicalIndices->count()); - for (int currentLogicalSection = 0; currentLogicalSection < logicalIndices->count(); ++currentLogicalSection) { + itemPositions->resize(logicalIndices->size()); + for (int currentLogicalSection = 0; currentLogicalSection < logicalIndices->size(); ++currentLogicalSection) { const int headerSection = logicalIndices->at(currentLogicalSection); // determine the viewItemPosition depending on the position of column 0 - int nextLogicalSection = currentLogicalSection + 1 >= logicalIndices->count() + int nextLogicalSection = currentLogicalSection + 1 >= logicalIndices->size() ? logicalIndexAfterRight : logicalIndices->at(currentLogicalSection + 1); int prevLogicalSection = currentLogicalSection - 1 < 0 @@ -2409,7 +2409,7 @@ QModelIndexList QTreeView::selectedIndexes() const QModelIndexList modelSelected; if (selectionModel()) modelSelected = selectionModel()->selectedIndexes(); - for (int i = 0; i < modelSelected.count(); ++i) { + for (int i = 0; i < modelSelected.size(); ++i) { // check that neither the parents nor the index is hidden before we add QModelIndex index = modelSelected.at(i); while (index.isValid() && !isIndexHidden(index)) diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 3fe843895c..3fa8a7e1b9 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -627,7 +627,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order, else if (oldRow > otherRow && newRow <= otherRow) ++sorting[j].second; } - for (int k = 0; k < newPersistentIndexes.count(); ++k) { + for (int k = 0; k < newPersistentIndexes.size(); ++k) { QModelIndex pi = newPersistentIndexes.at(k); if (pi.parent() != parent) continue; @@ -827,7 +827,7 @@ void QTreeModel::sortItems(QList *items, int column, Qt::SortO return; // store the original order of indexes - QList> sorting(items->count()); + QList> sorting(items->size()); for (int i = 0; i < sorting.size(); ++i) { sorting[i].first = items->at(i); sorting[i].second = i; @@ -1396,7 +1396,7 @@ QTreeWidgetItem::QTreeWidgetItem(int type) : rtti(type), d(new QTreeWidgetItemPr QTreeWidgetItem::QTreeWidgetItem(const QStringList &strings, int type) : rtti(type), d(new QTreeWidgetItemPrivate(this)) { - for (int i = 0; i < strings.count(); ++i) + for (int i = 0; i < strings.size(); ++i) setText(i, strings.at(i)); } @@ -1432,7 +1432,7 @@ QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *treeview, int type) QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *treeview, const QStringList &strings, int type) : rtti(type), d(new QTreeWidgetItemPrivate(this)) { - for (int i = 0; i < strings.count(); ++i) + for (int i = 0; i < strings.size(); ++i) setText(i, strings.at(i)); // do not set this->view here otherwise insertChild() will fail if (QTreeModel *model = treeModel(treeview)) { @@ -1481,7 +1481,7 @@ QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, int type) QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, const QStringList &strings, int type) : rtti(type), d(new QTreeWidgetItemPrivate(this)) { - for (int i = 0; i < strings.count(); ++i) + for (int i = 0; i < strings.size(); ++i) setText(i, strings.at(i)); if (parent) parent->addChild(this); @@ -1755,8 +1755,8 @@ void QTreeWidgetItem::setData(int column, int role, const QVariant &value) else values.resize(column + 1); } - if (d->display.count() <= column) { - for (int i = d->display.count() - 1; i < column - 1; ++i) + if (d->display.size() <= column) { + for (int i = d->display.size() - 1; i < column - 1; ++i) d->display.append(QVariant()); d->display.append(value); } else if (d->display[column] != value) { @@ -1823,7 +1823,7 @@ QVariant QTreeWidgetItem::data(int column, int role) const switch (role) { case Qt::EditRole: case Qt::DisplayRole: - if (column >= 0 && column < d->display.count()) + if (column >= 0 && column < d->display.size()) return d->display.at(column); break; case Qt::CheckStateRole: @@ -2375,13 +2375,13 @@ void QTreeWidgetPrivate::_q_selectionChanged(const QItemSelection &selected, con QModelIndexList indices = selected.indexes(); int i; QTreeModel *m = treeModel(); - for (i = 0; i < indices.count(); ++i) { + for (i = 0; i < indices.size(); ++i) { QTreeWidgetItem *item = m->item(indices.at(i)); item->d->selected = true; } indices = deselected.indexes(); - for (i = 0; i < indices.count(); ++i) { + for (i = 0; i < indices.size(); ++i) { QTreeWidgetItem *item = m->item(indices.at(i)); item->d->selected = false; } @@ -2806,10 +2806,10 @@ void QTreeWidget::setHeaderItem(QTreeWidgetItem *item) void QTreeWidget::setHeaderLabels(const QStringList &labels) { Q_D(QTreeWidget); - if (columnCount() < labels.count()) - setColumnCount(labels.count()); + if (columnCount() < labels.size()) + setColumnCount(labels.size()); QTreeWidgetItem *item = d->treeModel()->headerItem; - for (int i = 0; i < labels.count(); ++i) + for (int i = 0; i < labels.size(); ++i) item->setText(i, labels.at(i)); } @@ -3052,8 +3052,8 @@ QList QTreeWidget::selectedItems() const Q_D(const QTreeWidget); const QModelIndexList indexes = selectionModel()->selectedIndexes(); QList items; - items.reserve(indexes.count()); - QDuplicateTracker seen(indexes.count()); + items.reserve(indexes.size()); + QDuplicateTracker seen(indexes.size()); for (const auto &index : indexes) { QTreeWidgetItem *item = d->item(index); if (item->isHidden() || seen.hasSeen(item)) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 854d638abb..13897e1218 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3330,7 +3330,7 @@ void QApplicationPrivate::closePopup(QWidget *popup) qt_popup_down = nullptr; } - if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup + if (QApplicationPrivate::popupWidgets->size() == 0) { // this was the last popup delete QApplicationPrivate::popupWidgets; QApplicationPrivate::popupWidgets = nullptr; qt_popup_down_closed = false; @@ -3375,7 +3375,7 @@ void QApplicationPrivate::closePopup(QWidget *popup) // can become nullptr due to setFocus() above if (QApplicationPrivate::popupWidgets && - QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard + QApplicationPrivate::popupWidgets->size() == 1) // grab mouse/keyboard grabForPopup(aw); } @@ -3390,7 +3390,7 @@ void QApplicationPrivate::openPopup(QWidget *popup) popupWidgets = new QWidgetList; popupWidgets->append(popup); // add to end of list - if (QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard + if (QApplicationPrivate::popupWidgets->size() == 1) // grab mouse/keyboard grabForPopup(popup); // popups are not focus-handled by the window system (the first @@ -3398,7 +3398,7 @@ void QApplicationPrivate::openPopup(QWidget *popup) // new popup gets the focus if (popup->focusWidget()) { popup->focusWidget()->setFocus(Qt::PopupFocusReason); - } else if (popupWidgets->count() == 1) { // this was the first popup + } else if (popupWidgets->size() == 1) { // this was the first popup if (QWidget *fw = QApplication::focusWidget()) { QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason); QCoreApplication::sendEvent(fw, &e); diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index e83f9d4bb2..cf16d2a005 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -302,7 +302,7 @@ void QWidgetRepaintManager::removeDirtyWidget(QWidget *w) needsFlushWidgets.removeAll(w); QWidgetPrivate *wd = w->d_func(); - const int n = wd->children.count(); + const int n = wd->children.size(); for (int i = 0; i < n; ++i) { if (QWidget *child = qobject_cast(wd->children.at(i))) removeDirtyWidget(child); diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index abf3566e1c..1b519bf4c5 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -326,7 +326,7 @@ int QCompletionModel::rowCount(const QModelIndex &parent) const if (showAll) { // Show all items below current parent, even if we have no valid matches - if (engine->curParts.count() != 1 && !engine->matchCount() + if (engine->curParts.size() != 1 && !engine->matchCount() && !engine->curParent.isValid()) return 0; return d->model->rowCount(engine->curParent); @@ -411,7 +411,7 @@ void QCompletionEngine::filter(const QStringList& parts) return; QModelIndex parent; - for (int i = 0; i < curParts.count() - 1; i++) { + for (int i = 0; i < curParts.size() - 1; i++) { QString part = curParts.at(i); int emi = filter(part, parent, -1).exactMatchIndex; if (emi == -1) @@ -432,7 +432,7 @@ void QCompletionEngine::filter(const QStringList& parts) QMatchData QCompletionEngine::filterHistory() { QAbstractItemModel *source = c->proxy->sourceModel(); - if (curParts.count() <= 1 || c->proxy->showAll || !source) + if (curParts.size() <= 1 || c->proxy->showAll || !source) return QMatchData(); #if QT_CONFIG(filesystemmodel) @@ -516,7 +516,7 @@ void QCompletionEngine::saveInCache(QString part, const QModelIndex& parent, con QMap::iterator it1 = cache.begin(); while (it1 != cache.end()) { CacheItem& ci = it1.value(); - int sz = ci.count()/2; + int sz = ci.size()/2; QMap::iterator it2 = ci.begin(); int i = 0; while (it2 != ci.end() && i < sz) { @@ -524,7 +524,7 @@ void QCompletionEngine::saveInCache(QString part, const QModelIndex& parent, con it2 = ci.erase(it2); i++; } - if (ci.count() == 0) { + if (ci.size() == 0) { it1 = cache.erase(it1); } else { ++it1; @@ -1811,7 +1811,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const } while (idx.isValid()); #if !defined(Q_OS_WIN) - if (list.count() == 1) // only the separator or some other text + if (list.size() == 1) // only the separator or some other text return list[0]; list[0].clear() ; // the join below will provide the separator #endif diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index b3a2531c18..331764efa8 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2289,7 +2289,7 @@ void QComboBox::insertItems(int index, const QStringList &list) if (list.isEmpty()) return; index = qBound(0, index, count()); - int insertCount = qMin(d->maxCount - index, list.count()); + int insertCount = qMin(d->maxCount - index, list.size()); if (insertCount <= 0) return; // For the common case where we are using the built in QStandardItemModel diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 0fbda907a1..0c2777698a 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1577,7 +1577,7 @@ bool QDockWidget::event(QEvent *event) bool onTop = false; if (win != nullptr) { const QObjectList &siblings = win->children(); - onTop = siblings.count() > 0 && siblings.last() == (QObject*)this; + onTop = siblings.size() > 0 && siblings.last() == (QObject*)this; } #if QT_CONFIG(tabbar) if (!isFloating() && layout != nullptr && onTop) diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index 036d470f9f..a7f31995e1 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -317,7 +317,7 @@ void QFontComboBoxPrivate::_q_updateModel() } result += list.at(i); if (list.at(i) == fi.family() || list.at(i).startsWith(fi.family() + " ["_L1)) - offset = result.count() - 1; + offset = result.size() - 1; } list = result; diff --git a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp index 162f8ea9fc..af84961531 100644 --- a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp +++ b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp @@ -109,7 +109,7 @@ void tst_QAnimationGroup::emptyGroup() QCOMPARE(group.state(), QAnimationGroup::Stopped); group.start(); - QCOMPARE(groupStateChangedSpy.count(), 2); + QCOMPARE(groupStateChangedSpy.size(), 2); QCOMPARE(qvariant_cast(groupStateChangedSpy.at(0).first()), QAnimationGroup::Running); @@ -121,7 +121,7 @@ void tst_QAnimationGroup::emptyGroup() QTest::ignoreMessage(QtWarningMsg, "QAbstractAnimation::pause: Cannot pause a stopped animation"); group.pause(); - QCOMPARE(groupStateChangedSpy.count(), 2); + QCOMPARE(groupStateChangedSpy.size(), 2); QCOMPARE(group.state(), QAnimationGroup::Stopped); group.start(); @@ -135,7 +135,7 @@ void tst_QAnimationGroup::emptyGroup() group.stop(); - QCOMPARE(groupStateChangedSpy.count(), 4); + QCOMPARE(groupStateChangedSpy.size(), 4); QCOMPARE(group.state(), QAnimationGroup::Stopped); } diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index 6d73725cff..3c5d9ed3a9 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -234,38 +234,38 @@ void tst_QParallelAnimationGroup::stateChanged() //first; let's start forward group.start(); //all the animations should be started - QCOMPARE(spy1.count(), 1); + QCOMPARE(spy1.size(), 1); QCOMPARE(qvariant_cast(spy1.last().first()), TestAnimation::Running); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); QCOMPARE(qvariant_cast(spy2.last().first()), TestAnimation::Running); - QCOMPARE(spy3.count(), 1); + QCOMPARE(spy3.size(), 1); QCOMPARE(qvariant_cast(spy3.last().first()), TestAnimation::Running); - QCOMPARE(spy4.count(), 1); + QCOMPARE(spy4.size(), 1); QCOMPARE(qvariant_cast(spy4.last().first()), TestAnimation::Running); group.setCurrentTime(1500); //anim1 should be finished QCOMPARE(group.state(), QAnimationGroup::Running); - QCOMPARE(spy1.count(), 2); + QCOMPARE(spy1.size(), 2); QCOMPARE(qvariant_cast(spy1.last().first()), TestAnimation::Stopped); - QCOMPARE(spy2.count(), 1); //no change - QCOMPARE(spy3.count(), 1); //no change - QCOMPARE(spy4.count(), 1); //no change + QCOMPARE(spy2.size(), 1); //no change + QCOMPARE(spy3.size(), 1); //no change + QCOMPARE(spy4.size(), 1); //no change group.setCurrentTime(2500); //anim2 should be finished QCOMPARE(group.state(), QAnimationGroup::Running); - QCOMPARE(spy1.count(), 2); //no change - QCOMPARE(spy2.count(), 2); + QCOMPARE(spy1.size(), 2); //no change + QCOMPARE(spy2.size(), 2); QCOMPARE(qvariant_cast(spy2.last().first()), TestAnimation::Stopped); - QCOMPARE(spy3.count(), 1); //no change - QCOMPARE(spy4.count(), 1); //no change + QCOMPARE(spy3.size(), 1); //no change + QCOMPARE(spy4.size(), 1); //no change group.setCurrentTime(3500); //everything should be finished QCOMPARE(group.state(), QAnimationGroup::Stopped); - QCOMPARE(spy1.count(), 2); //no change - QCOMPARE(spy2.count(), 2); //no change - QCOMPARE(spy3.count(), 2); + QCOMPARE(spy1.size(), 2); //no change + QCOMPARE(spy2.size(), 2); //no change + QCOMPARE(spy3.size(), 2); QCOMPARE(qvariant_cast(spy3.last().first()), TestAnimation::Stopped); - QCOMPARE(spy4.count(), 2); + QCOMPARE(spy4.size(), 2); QCOMPARE(qvariant_cast(spy4.last().first()), TestAnimation::Stopped); //cleanup @@ -280,38 +280,38 @@ void tst_QParallelAnimationGroup::stateChanged() //only anim3 and anim4 should be started QCOMPARE(group.state(), QAnimationGroup::Running); - QCOMPARE(spy1.count(), 0); - QCOMPARE(spy2.count(), 0); - QCOMPARE(spy3.count(), 1); + QCOMPARE(spy1.size(), 0); + QCOMPARE(spy2.size(), 0); + QCOMPARE(spy3.size(), 1); QCOMPARE(qvariant_cast(spy3.last().first()), TestAnimation::Running); - QCOMPARE(spy4.count(), 1); + QCOMPARE(spy4.size(), 1); QCOMPARE(qvariant_cast(spy4.last().first()), TestAnimation::Running); group.setCurrentTime(1500); //anim2 should be started QCOMPARE(group.state(), QAnimationGroup::Running); - QCOMPARE(spy1.count(), 0); //no change - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy1.size(), 0); //no change + QCOMPARE(spy2.size(), 1); QCOMPARE(qvariant_cast(spy2.last().first()), TestAnimation::Running); - QCOMPARE(spy3.count(), 1); //no change - QCOMPARE(spy4.count(), 1); //no change + QCOMPARE(spy3.size(), 1); //no change + QCOMPARE(spy4.size(), 1); //no change group.setCurrentTime(500); //anim1 is finally also started QCOMPARE(group.state(), QAnimationGroup::Running); - QCOMPARE(spy1.count(), 1); + QCOMPARE(spy1.size(), 1); QCOMPARE(qvariant_cast(spy1.last().first()), TestAnimation::Running); - QCOMPARE(spy2.count(), 1); //no change - QCOMPARE(spy3.count(), 1); //no change - QCOMPARE(spy4.count(), 1); //no change + QCOMPARE(spy2.size(), 1); //no change + QCOMPARE(spy3.size(), 1); //no change + QCOMPARE(spy4.size(), 1); //no change group.setCurrentTime(0); //everything should be stopped QCOMPARE(group.state(), QAnimationGroup::Stopped); - QCOMPARE(spy1.count(), 2); + QCOMPARE(spy1.size(), 2); QCOMPARE(qvariant_cast(spy1.last().first()), TestAnimation::Stopped); - QCOMPARE(spy2.count(), 2); + QCOMPARE(spy2.size(), 2); QCOMPARE(qvariant_cast(spy2.last().first()), TestAnimation::Stopped); - QCOMPARE(spy3.count(), 2); + QCOMPARE(spy3.size(), 2); QCOMPARE(qvariant_cast(spy3.last().first()), TestAnimation::Stopped); - QCOMPARE(spy4.count(), 2); + QCOMPARE(spy4.size(), 2); QCOMPARE(qvariant_cast(spy4.last().first()), TestAnimation::Stopped); } @@ -405,8 +405,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup() QVERIFY(groupStateChangedSpy.isValid()); QVERIFY(childStateChangedSpy.isValid()); - QCOMPARE(groupStateChangedSpy.count(), 0); - QCOMPARE(childStateChangedSpy.count(), 0); + QCOMPARE(groupStateChangedSpy.size(), 0); + QCOMPARE(childStateChangedSpy.size(), 0); QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(anim.state(), QAnimationGroup::Stopped); @@ -417,8 +417,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup() QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(anim.state(), QAnimationGroup::Running); - QCOMPARE(groupStateChangedSpy.count(), 1); - QCOMPARE(childStateChangedSpy.count(), 1); + QCOMPARE(groupStateChangedSpy.size(), 1); + QCOMPARE(childStateChangedSpy.size(), 1); QCOMPARE(qvariant_cast(groupStateChangedSpy.at(0).first()), QAnimationGroup::Running); @@ -428,8 +428,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup() // starting directly a running child will not have any effect anim.start(); - QCOMPARE(groupStateChangedSpy.count(), 1); - QCOMPARE(childStateChangedSpy.count(), 1); + QCOMPARE(groupStateChangedSpy.size(), 1); + QCOMPARE(childStateChangedSpy.size(), 1); anim.pause(); @@ -572,8 +572,8 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild() QVERIFY(stateChangedSpy1.isValid()); QVERIFY(stateChangedSpy2.isValid()); - QCOMPARE(stateChangedSpy1.count(), 0); - QCOMPARE(stateChangedSpy2.count(), 0); + QCOMPARE(stateChangedSpy1.size(), 0); + QCOMPARE(stateChangedSpy2.size(), 0); QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(anim1.state(), QAnimationGroup::Stopped); QCOMPARE(anim2.state(), QAnimationGroup::Stopped); @@ -598,13 +598,13 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild() group.start(); - QCOMPARE(stateChangedSpy1.count(), 3); + QCOMPARE(stateChangedSpy1.size(), 3); QCOMPARE(qvariant_cast(stateChangedSpy1.at(1).first()), QAnimationGroup::Stopped); QCOMPARE(qvariant_cast(stateChangedSpy1.at(2).first()), QAnimationGroup::Running); - QCOMPARE(stateChangedSpy2.count(), 4); + QCOMPARE(stateChangedSpy2.size(), 4); QCOMPARE(qvariant_cast(stateChangedSpy2.at(2).first()), QAnimationGroup::Stopped); QCOMPARE(qvariant_cast(stateChangedSpy2.at(3).first()), @@ -655,22 +655,22 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation() group.addAnimation(&anim1); group.addAnimation(&anim2); group.addAnimation(&anim3); - QCOMPARE(stateChangedSpy1.count(), 0); + QCOMPARE(stateChangedSpy1.size(), 0); group.start(); - QCOMPARE(stateChangedSpy1.count(), 2); - QCOMPARE(finishedSpy1.count(), 1); + QCOMPARE(stateChangedSpy1.size(), 2); + QCOMPARE(finishedSpy1.size(), 1); QCOMPARE(qvariant_cast(stateChangedSpy1.at(0).first()), QAnimationGroup::Running); QCOMPARE(qvariant_cast(stateChangedSpy1.at(1).first()), QAnimationGroup::Stopped); - QCOMPARE(stateChangedSpy2.count(), 1); - QCOMPARE(finishedSpy2.count(), 0); + QCOMPARE(stateChangedSpy2.size(), 1); + QCOMPARE(finishedSpy2.size(), 0); QCOMPARE(qvariant_cast(stateChangedSpy1.at(0).first()), QAnimationGroup::Running); - QCOMPARE(stateChangedSpy3.count(), 1); - QCOMPARE(finishedSpy3.count(), 0); + QCOMPARE(stateChangedSpy3.size(), 1); + QCOMPARE(finishedSpy3.size(), 0); QCOMPARE(qvariant_cast(stateChangedSpy3.at(0).first()), QAnimationGroup::Running); @@ -688,21 +688,21 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation() stateChangedSpy3.clear(); group.start(); - QCOMPARE(stateChangedSpy1.count(), 2); - QCOMPARE(stateChangedSpy2.count(), 1); - QCOMPARE(stateChangedSpy3.count(), 1); + QCOMPARE(stateChangedSpy1.size(), 2); + QCOMPARE(stateChangedSpy2.size(), 1); + QCOMPARE(stateChangedSpy3.size(), 1); group.setCurrentTime(50); - QCOMPARE(stateChangedSpy1.count(), 2); - QCOMPARE(stateChangedSpy2.count(), 1); - QCOMPARE(stateChangedSpy3.count(), 2); + QCOMPARE(stateChangedSpy1.size(), 2); + QCOMPARE(stateChangedSpy2.size(), 1); + QCOMPARE(stateChangedSpy3.size(), 2); group.setCurrentTime(150); - QCOMPARE(stateChangedSpy1.count(), 4); - QCOMPARE(stateChangedSpy2.count(), 3); - QCOMPARE(stateChangedSpy3.count(), 4); + QCOMPARE(stateChangedSpy1.size(), 4); + QCOMPARE(stateChangedSpy2.size(), 3); + QCOMPARE(stateChangedSpy3.size(), 4); group.setCurrentTime(50); - QCOMPARE(stateChangedSpy1.count(), 6); - QCOMPARE(stateChangedSpy2.count(), 5); - QCOMPARE(stateChangedSpy3.count(), 6); + QCOMPARE(stateChangedSpy1.size(), 6); + QCOMPARE(stateChangedSpy2.size(), 5); + QCOMPARE(stateChangedSpy3.size(), 6); } @@ -734,7 +734,7 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations() group.start(); - QCOMPARE(stateChangedSpy.count(), 2); + QCOMPARE(stateChangedSpy.size(), 2); QCOMPARE(qvariant_cast(stateChangedSpy.at(0).first()), QAnimationGroup::Running); QCOMPARE(qvariant_cast(stateChangedSpy.at(1).first()), @@ -943,7 +943,7 @@ void tst_QParallelAnimationGroup::pauseResume() QTest::qWait(100); QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(anim->state(), QAnimationGroup::Running); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); const int currentTime = group.currentLoopTime(); QCOMPARE(anim->currentLoopTime(), currentTime); @@ -953,7 +953,7 @@ void tst_QParallelAnimationGroup::pauseResume() QCOMPARE(group.currentLoopTime(), currentTime); QCOMPARE(anim->state(), QAnimationGroup::Paused); QCOMPARE(anim->currentLoopTime(), currentTime); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); group.resume(); @@ -961,21 +961,21 @@ void tst_QParallelAnimationGroup::pauseResume() QCOMPARE(group.currentLoopTime(), currentTime); QCOMPARE(anim->state(), QAnimationGroup::Running); QCOMPARE(anim->currentLoopTime(), currentTime); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); group.stop(); spy.clear(); new TestAnimation2(500, &group); group.start(); - QCOMPARE(spy.count(), 1); //the animation should have been started + QCOMPARE(spy.size(), 1); //the animation should have been started QCOMPARE(qvariant_cast(spy.last().first()), TestAnimation::Running); group.setCurrentTime(250); //end of first animation - QCOMPARE(spy.count(), 2); //the animation should have been stopped + QCOMPARE(spy.size(), 2); //the animation should have been stopped QCOMPARE(qvariant_cast(spy.last().first()), TestAnimation::Stopped); group.pause(); - QCOMPARE(spy.count(), 2); //this shouldn't have changed + QCOMPARE(spy.size(), 2); //this shouldn't have changed group.resume(); - QCOMPARE(spy.count(), 2); //this shouldn't have changed + QCOMPARE(spy.size(), 2); //this shouldn't have changed } // This is a regression test for QTBUG-8910, where a crash occurred when the diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index a5eff80e49..d739164a10 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -283,9 +283,9 @@ void tst_QPropertyAnimation::statesAndSignals() anim->setCurrentTime(1); anim->setCurrentTime(100); - QCOMPARE(finishedSpy.count(), 0); - QCOMPARE(runningSpy.count(), 0); - QCOMPARE(currentLoopSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); + QCOMPARE(runningSpy.size(), 0); + QCOMPARE(currentLoopSpy.size(), 0); QCOMPARE(anim->state(), QAnimationGroup::Stopped); anim->setLoopCount(3); @@ -294,26 +294,26 @@ void tst_QPropertyAnimation::statesAndSignals() if (uncontrolled) QSKIP("Uncontrolled animations don't handle looping"); - QCOMPARE(currentLoopSpy.count(), 1); + QCOMPARE(currentLoopSpy.size(), 1); QCOMPARE(anim->currentLoop(), 1); anim->setCurrentTime(0); - QCOMPARE(currentLoopSpy.count(), 2); + QCOMPARE(currentLoopSpy.size(), 2); QCOMPARE(anim->currentLoop(), 0); anim->start(); QCOMPARE(anim->state(), QAnimationGroup::Running); - QCOMPARE(runningSpy.count(), 1); //anim must have started + QCOMPARE(runningSpy.size(), 1); //anim must have started QCOMPARE(anim->currentLoop(), 0); runningSpy.clear(); anim->stop(); QCOMPARE(anim->state(), QAnimationGroup::Stopped); - QCOMPARE(runningSpy.count(), 1); //anim must have stopped - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(runningSpy.size(), 1); //anim must have stopped + QCOMPARE(finishedSpy.size(), 0); QCOMPARE(anim->currentLoopTime(), 0); QCOMPARE(anim->currentLoop(), 0); - QCOMPARE(currentLoopSpy.count(), 2); + QCOMPARE(currentLoopSpy.size(), 2); runningSpy.clear(); { @@ -321,30 +321,30 @@ void tst_QPropertyAnimation::statesAndSignals() anim->start(); timeDriver.wait(1000); QCOMPARE(anim->state(), QAnimationGroup::Stopped); - QCOMPARE(runningSpy.count(), 2); //started and stopped again + QCOMPARE(runningSpy.size(), 2); //started and stopped again runningSpy.clear(); - QCOMPARE(finishedSpy.count(), 1); + QCOMPARE(finishedSpy.size(), 1); QCOMPARE(anim->currentLoopTime(), 100); QCOMPARE(anim->currentLoop(), 2); - QCOMPARE(currentLoopSpy.count(), 4); + QCOMPARE(currentLoopSpy.size(), 4); anim->start(); // auto-rewinds QCOMPARE(anim->state(), QAnimationGroup::Running); QCOMPARE(anim->currentTime(), 0); QCOMPARE(anim->currentLoop(), 0); - QCOMPARE(currentLoopSpy.count(), 5); - QCOMPARE(runningSpy.count(), 1); // anim has started - QCOMPARE(finishedSpy.count(), 1); + QCOMPARE(currentLoopSpy.size(), 5); + QCOMPARE(runningSpy.size(), 1); // anim has started + QCOMPARE(finishedSpy.size(), 1); QCOMPARE(anim->currentLoop(), 0); runningSpy.clear(); timeDriver.wait(1000); - QCOMPARE(currentLoopSpy.count(), 7); + QCOMPARE(currentLoopSpy.size(), 7); QCOMPARE(anim->state(), QAnimationGroup::Stopped); QCOMPARE(anim->currentLoop(), 2); - QCOMPARE(runningSpy.count(), 1); // anim has stopped - QCOMPARE(finishedSpy.count(), 2); + QCOMPARE(runningSpy.size(), 1); // anim has stopped + QCOMPARE(finishedSpy.size(), 2); QCOMPARE(anim->currentLoopTime(), 100); } } @@ -364,8 +364,8 @@ void tst_QPropertyAnimation::deletion1() anim->setEndValue(20); anim->setDuration(200); anim->start(); - QCOMPARE(runningSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(runningSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); QVERIFY(anim); QCOMPARE(anim->state(), QAnimationGroup::Running); @@ -375,8 +375,8 @@ void tst_QPropertyAnimation::deletion1() timeDriver.wait(150); QVERIFY(anim); //The animation should not have been deleted QCOMPARE(anim->state(), QAnimationGroup::Stopped); - QCOMPARE(runningSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 1); + QCOMPARE(runningSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 1); anim->start(QVariantAnimation::DeleteWhenStopped); QVERIFY(anim); @@ -385,8 +385,8 @@ void tst_QPropertyAnimation::deletion1() QVERIFY(anim); QCOMPARE(anim->state(), QAnimationGroup::Running); timeDriver.wait(150); - QCOMPARE(runningSpy.count(), 4); - QCOMPARE(finishedSpy.count(), 2); + QCOMPARE(runningSpy.size(), 4); + QCOMPARE(finishedSpy.size(), 2); QVERIFY(!anim); //The animation must have been deleted delete object; } @@ -417,8 +417,8 @@ void tst_QPropertyAnimation::deletion2() QVERIFY(anim); QCOMPARE(anim->state(), QAnimationGroup::Running); - QCOMPARE(runningSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(runningSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); //we can't call deletaLater directly because the delete would only happen in the next loop of _this_ event loop QTimer::singleShot(0, object, SLOT(deleteLater())); @@ -451,11 +451,11 @@ void tst_QPropertyAnimation::deletion3() timeDriver.wait(50); QCOMPARE(anim->state(), QAnimationGroup::Running); - QCOMPARE(runningSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(runningSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 0); delete anim; - QCOMPARE(runningSpy.count(), 2); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(runningSpy.size(), 2); + QCOMPARE(finishedSpy.size(), 0); } void tst_QPropertyAnimation::duration0() @@ -547,7 +547,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning() QVERIFY(runningSpy.isValid()); anim->start(QVariantAnimation::DeleteWhenStopped); timeDriver.wait(anim->duration()); - QCOMPARE(runningSpy.count(), 2); //started and then stopped + QCOMPARE(runningSpy.size(), 2); //started and then stopped QVERIFY(!anim); } { @@ -559,7 +559,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning() timeDriver.wait(anim->duration()/2); QPointer anim2 = new QPropertyAnimation(&o, "ole"); anim2->setEndValue(100); - QCOMPARE(runningSpy.count(), 1); + QCOMPARE(runningSpy.size(), 1); QCOMPARE(anim->state(), QVariantAnimation::Running); //anim2 will interrupt anim1 @@ -908,7 +908,7 @@ void tst_QPropertyAnimation::zeroDurationStart() anim.start(); //the animation stops immediately QCOMPARE(anim.state(), QAbstractAnimation::Stopped); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); //let's check the first state change const QVariantList firstChange = spy.first(); @@ -1193,8 +1193,8 @@ void tst_QPropertyAnimation::valueChanged() QCOMPARE(anim.currentTime(), anim.duration()); //let's check that the values go forward - QCOMPARE(spy.count(), 6); //we should have got everything from 0 to 5 - for (int i = 0; i < spy.count(); ++i) { + QCOMPARE(spy.size(), 6); //we should have got everything from 0 to 5 + for (int i = 0; i < spy.size(); ++i) { QCOMPARE(qvariant_cast(spy.at(i).first()).toInt(), i); } } @@ -1324,15 +1324,15 @@ void tst_QPropertyAnimation::zeroLoopCount() QCOMPARE(anim->state(), QAnimationGroup::Stopped); QCOMPARE(anim->currentValue().toInt(), 0); - QCOMPARE(runningSpy.count(), 0); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(runningSpy.size(), 0); + QCOMPARE(finishedSpy.size(), 0); anim->start(); QCOMPARE(anim->state(), QAnimationGroup::Stopped); QCOMPARE(anim->currentValue().toInt(), 0); - QCOMPARE(runningSpy.count(), 0); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(runningSpy.size(), 0); + QCOMPARE(finishedSpy.size(), 0); } diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index 61be0d00f5..e6e8731378 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -551,8 +551,8 @@ using StateList = QList; static bool compareStates(const QSignalSpy& spy, const StateList &expectedStates) { bool equals = true; - for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) { - if (i >= spy.count() || i >= expectedStates.count()) { + for (int i = 0; i < qMax(expectedStates.size(), spy.size()); ++i) { + if (i >= spy.size() || i >= expectedStates.size()) { equals = false; break; } @@ -567,14 +567,14 @@ static bool compareStates(const QSignalSpy& spy, const StateList &expectedStates if (!equals) { const char *stateStrings[] = {"Stopped", "Paused", "Running"}; QString e,a; - for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) { - if (i < expectedStates.count()) { + for (int i = 0; i < qMax(expectedStates.size(), spy.size()); ++i) { + if (i < expectedStates.size()) { int exp = int(expectedStates.at(i)); if (!e.isEmpty()) e += QLatin1String(", "); e += QLatin1String(stateStrings[exp]); } - if (i < spy.count()) { + if (i < spy.size()) { QList args = spy.at(i); QAbstractAnimation::State actual = qvariant_cast(args.value(1)); if (!a.isEmpty()) @@ -589,7 +589,7 @@ static bool compareStates(const QSignalSpy& spy, const StateList &expectedStates } qDebug("\n" "expected (count == %zd): %s\n" - "actual (count == %zd): %s\n", size_t(expectedStates.count()), qPrintable(e), size_t(spy.count()), qPrintable(a)); + "actual (count == %zd): %s\n", size_t(expectedStates.size()), qPrintable(e), size_t(spy.size()), qPrintable(a)); } return equals; } @@ -636,8 +636,8 @@ void tst_QSequentialAnimationGroup::pauseAndResume() QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped); QCOMPARE(a3_s_o1->state(), QAnimationGroup::Paused); - QCOMPARE(a1StateChangedSpy.count(), 5); // Running,Paused,Stopped,Running,Stopped - QCOMPARE(seqStateChangedSpy.count(), 2); // Running,Paused + QCOMPARE(a1StateChangedSpy.size(), 5); // Running,Paused,Stopped,Running,Stopped + QCOMPARE(seqStateChangedSpy.size(), 2); // Running,Paused QVERIFY(compareStates(a1StateChangedSpy, (StateList() << QAbstractAnimation::Running << QAbstractAnimation::Paused @@ -678,7 +678,7 @@ void tst_QSequentialAnimationGroup::pauseAndResume() QCOMPARE(a3_s_o1->currentLoop(), 0); QVERIFY(a3_s_o1->currentLoopTime() >= 1); - QCOMPARE(seqStateChangedSpy.count(), 3); // Running,Paused,Running + QCOMPARE(seqStateChangedSpy.size(), 3); // Running,Paused,Running QCOMPARE(qvariant_cast(seqStateChangedSpy.at(2).first()), QAnimationGroup::Running); @@ -699,13 +699,13 @@ void tst_QSequentialAnimationGroup::pauseAndResume() QCOMPARE(a3_s_o1->currentLoop(), 0); QVERIFY(a3_s_o1->currentLoopTime() >= 1); - QCOMPARE(seqStateChangedSpy.count(), 4); // Running,Paused,Running,Paused + QCOMPARE(seqStateChangedSpy.size(), 4); // Running,Paused,Running,Paused QCOMPARE(qvariant_cast(seqStateChangedSpy.at(3).first()), QAnimationGroup::Paused); group.stop(); - QCOMPARE(seqStateChangedSpy.count(), 5); // Running,Paused,Running,Paused,Stopped + QCOMPARE(seqStateChangedSpy.size(), 5); // Running,Paused,Running,Paused,Stopped QCOMPARE(qvariant_cast(seqStateChangedSpy.at(4).first()), QAnimationGroup::Stopped); } @@ -749,7 +749,7 @@ void tst_QSequentialAnimationGroup::restart() QTRY_COMPARE(group.state(), QAnimationGroup::Stopped); for (int i = 0; i < 3; i++) { - QCOMPARE(animsStateChanged[i]->count(), 4); + QCOMPARE(animsStateChanged[i]->size(), 4); QCOMPARE(qvariant_cast(animsStateChanged[i]->at(0).first()), QAnimationGroup::Running); QCOMPARE(qvariant_cast(animsStateChanged[i]->at(1).first()), @@ -760,22 +760,22 @@ void tst_QSequentialAnimationGroup::restart() QAnimationGroup::Stopped); } - QCOMPARE(seqStateChangedSpy.count(), 2); + QCOMPARE(seqStateChangedSpy.size(), 2); QCOMPARE(qvariant_cast(seqStateChangedSpy.at(0).first()), QAnimationGroup::Running); QCOMPARE(qvariant_cast(seqStateChangedSpy.at(1).first()), QAnimationGroup::Stopped); - QCOMPARE(seqCurrentAnimChangedSpy.count(), 6); - for(int i=0; i(anims[i%3]), qvariant_cast(seqCurrentAnimChangedSpy.at(i).at(0))); group.start(); - QCOMPARE(animsStateChanged[0]->count(), 5); - QCOMPARE(animsStateChanged[1]->count(), 4); - QCOMPARE(animsStateChanged[2]->count(), 4); - QCOMPARE(seqStateChangedSpy.count(), 3); + QCOMPARE(animsStateChanged[0]->size(), 5); + QCOMPARE(animsStateChanged[1]->size(), 4); + QCOMPARE(animsStateChanged[2]->size(), 4); + QCOMPARE(seqStateChangedSpy.size(), 3); } void tst_QSequentialAnimationGroup::looping() @@ -831,21 +831,21 @@ void tst_QSequentialAnimationGroup::looping() QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped); QCOMPARE(a3_s_o1->state(), QAnimationGroup::Paused); - QCOMPARE(a1Spy.count(), 5); // Running,Paused,Stopped,Running,Stopped + QCOMPARE(a1Spy.size(), 5); // Running,Paused,Stopped,Running,Stopped QVERIFY(compareStates(a1Spy, (StateList() << QAbstractAnimation::Running << QAbstractAnimation::Paused << QAbstractAnimation::Stopped << QAbstractAnimation::Running << QAbstractAnimation::Stopped))); - QCOMPARE(a2Spy.count(), 4); // Running,Stopped,Running,Stopped + QCOMPARE(a2Spy.size(), 4); // Running,Stopped,Running,Stopped QVERIFY(compareStates(a3Spy, (StateList() << QAbstractAnimation::Running << QAbstractAnimation::Stopped << QAbstractAnimation::Running << QAbstractAnimation::Paused))); - QCOMPARE(seqSpy.count(), 2); // Running,Paused - QCOMPARE(groupSpy.count(), 2); // Running,Paused + QCOMPARE(seqSpy.size(), 2); // Running,Paused + QCOMPARE(groupSpy.size(), 2); // Running,Paused // Looping, current time = duration + 1 group.setCurrentTime(group.duration() + 1); @@ -866,8 +866,8 @@ void tst_QSequentialAnimationGroup::looping() QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped); QCOMPARE(a3_s_o1->state(), QAnimationGroup::Stopped); - QCOMPARE(a1Spy.count(), 7); // Running,Paused,Stopped,Running,Stopped,Running,Stopped - QCOMPARE(a2Spy.count(), 4); // Running, Stopped, Running, Stopped + QCOMPARE(a1Spy.size(), 7); // Running,Paused,Stopped,Running,Stopped,Running,Stopped + QCOMPARE(a2Spy.size(), 4); // Running, Stopped, Running, Stopped QVERIFY(compareStates(a3Spy, (StateList() << QAbstractAnimation::Running << QAbstractAnimation::Stopped << QAbstractAnimation::Running @@ -878,7 +878,7 @@ void tst_QSequentialAnimationGroup::looping() << QAbstractAnimation::Stopped << QAbstractAnimation::Running << QAbstractAnimation::Paused))); - QCOMPARE(groupSpy.count(), 2); + QCOMPARE(groupSpy.size(), 2); } void tst_QSequentialAnimationGroup::startDelay() @@ -1077,8 +1077,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup() QVERIFY(groupStateChangedSpy.isValid()); QVERIFY(childStateChangedSpy.isValid()); - QCOMPARE(groupStateChangedSpy.count(), 0); - QCOMPARE(childStateChangedSpy.count(), 0); + QCOMPARE(groupStateChangedSpy.size(), 0); + QCOMPARE(childStateChangedSpy.size(), 0); QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(anim.state(), QAnimationGroup::Stopped); @@ -1089,8 +1089,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup() QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(anim.state(), QAnimationGroup::Running); - QCOMPARE(groupStateChangedSpy.count(), 1); - QCOMPARE(childStateChangedSpy.count(), 1); + QCOMPARE(groupStateChangedSpy.size(), 1); + QCOMPARE(childStateChangedSpy.size(), 1); QCOMPARE(qvariant_cast(groupStateChangedSpy.at(0).first()), QAnimationGroup::Running); @@ -1100,8 +1100,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup() // starting directly a running child will not have any effect anim.start(); - QCOMPARE(groupStateChangedSpy.count(), 1); - QCOMPARE(childStateChangedSpy.count(), 1); + QCOMPARE(groupStateChangedSpy.size(), 1); + QCOMPARE(childStateChangedSpy.size(), 1); anim.pause(); @@ -1244,8 +1244,8 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild() QVERIFY(stateChangedSpy1.isValid()); QVERIFY(stateChangedSpy2.isValid()); - QCOMPARE(stateChangedSpy1.count(), 0); - QCOMPARE(stateChangedSpy2.count(), 0); + QCOMPARE(stateChangedSpy1.size(), 0); + QCOMPARE(stateChangedSpy2.size(), 0); QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(anim1->state(), QAnimationGroup::Stopped); QCOMPARE(anim2->state(), QAnimationGroup::Stopped); @@ -1283,7 +1283,7 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild() QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(anim2->state(), QAnimationGroup::Running); - QCOMPARE(stateChangedSpy2.count(), 4); + QCOMPARE(stateChangedSpy2.size(), 4); QCOMPARE(qvariant_cast(stateChangedSpy2.at(2).first()), QAnimationGroup::Stopped); QCOMPARE(qvariant_cast(stateChangedSpy2.at(3).first()), @@ -1323,7 +1323,7 @@ void tst_QSequentialAnimationGroup::zeroDurationAnimation() group.setLoopCount(2); group.start(); - QCOMPARE(stateChangedSpy.count(), 2); + QCOMPARE(stateChangedSpy.size(), 2); QCOMPARE(qvariant_cast(stateChangedSpy.at(0).first()), QAnimationGroup::Running); QCOMPARE(qvariant_cast(stateChangedSpy.at(1).first()), @@ -1400,7 +1400,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation() const int actualDuration = notTimeDriven.currentLoopTime(); QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(group.currentLoopTime(), actualDuration); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); //2nd case: // lets make sure the seeking will work again @@ -1416,29 +1416,29 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation() //3rd case: //now let's add a perfectly defined animation at the end - QCOMPARE(animStateChangedSpy.count(), 0); + QCOMPARE(animStateChangedSpy.size(), 0); group.start(); QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(notTimeDriven.state(), QAnimationGroup::Running); QCOMPARE(group.currentLoopTime(), 0); QCOMPARE(notTimeDriven.currentLoopTime(), 0); - QCOMPARE(animStateChangedSpy.count(), 0); + QCOMPARE(animStateChangedSpy.size(), 0); QTest::qWait(300); //wait for the end of notTimeDriven QTRY_COMPARE(notTimeDriven.state(), QAnimationGroup::Stopped); QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(anim.state(), QAnimationGroup::Running); QCOMPARE(group.currentAnimation(), static_cast(&anim)); - QCOMPARE(animStateChangedSpy.count(), 1); + QCOMPARE(animStateChangedSpy.size(), 1); QTest::qWait(300); //wait for the end of anim QTRY_COMPARE(anim.state(), QAnimationGroup::Stopped); QCOMPARE(anim.currentLoopTime(), anim.duration()); //we should simply be at the end - QCOMPARE(spy.count(), 1); - QCOMPARE(animStateChangedSpy.count(), 2); + QCOMPARE(spy.size(), 1); + QCOMPARE(animStateChangedSpy.size(), 2); QCOMPARE(group.currentLoopTime(), notTimeDriven.currentLoopTime() + anim.currentLoopTime()); } @@ -1623,7 +1623,7 @@ void tst_QSequentialAnimationGroup::pauseResume() QTest::qWait(100); QTRY_COMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(anim->state(), QAnimationGroup::Running); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); const int currentTime = group.currentLoopTime(); QCOMPARE(anim->currentLoopTime(), currentTime); @@ -1633,7 +1633,7 @@ void tst_QSequentialAnimationGroup::pauseResume() QCOMPARE(group.currentLoopTime(), currentTime); QCOMPARE(anim->state(), QAnimationGroup::Paused); QCOMPARE(anim->currentLoopTime(), currentTime); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); group.resume(); @@ -1641,7 +1641,7 @@ void tst_QSequentialAnimationGroup::pauseResume() QCOMPARE(group.currentLoopTime(), currentTime); QCOMPARE(anim->state(), QAnimationGroup::Running); QCOMPARE(anim->currentLoopTime(), currentTime); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QSequentialAnimationGroup::bindings() @@ -1667,18 +1667,18 @@ void tst_QSequentialAnimationGroup::bindings() group.setCurrentTime(int(totalDuration * 0.5 / 3)); QCOMPARE(currentAnim.value(), anim1.get()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); group.setCurrentTime(int(totalDuration * 1.5 / 3)); QCOMPARE(currentAnim.value(), anim2.get()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // change to other style of formulating a binding to test both currentAnim.setBinding(group.bindableCurrentAnimation().makeBinding()); group.setCurrentTime(int(totalDuration * 2.5 / 3)); QCOMPARE(currentAnim.value(), anim3.get()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // currentAnimation is read-only. Binding it to something should have no effect QProperty leader; diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index 989f5fcde8..077bc58259 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -1102,7 +1102,7 @@ void tst_QDebug::threadSafety() const s_sema.release(numThreads); sync.waitForFinished(); QMutexLocker lock(&s_mutex); - QCOMPARE(s_messages.count(), numThreads); + QCOMPARE(s_messages.size(), numThreads); for (int i = 0; i < numThreads; ++i) { QCOMPARE(s_messages.at(i), QStringLiteral("doDebug")); } diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 0c6014cc82..65a7daaf7d 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -521,12 +521,12 @@ void tst_QDir::removeRecursively_data() << tmpdir + "two/three" << "relative"; QDir dir; - for (int i = 0; i < dirs.count(); ++i) + for (int i = 0; i < dirs.size(); ++i) dir.mkpath(dirs.at(i)); QStringList files; files << tmpdir + "one/file"; files << tmpdir + "two/three/file"; - for (int i = 0; i < files.count(); ++i) { + for (int i = 0; i < files.size(); ++i) { QFile file(files.at(i)); QVERIFY(file.open(QIODevice::WriteOnly)); file.write("Hello"); @@ -1045,7 +1045,7 @@ void tst_QDir::entryListSimple() QDir dir(dirName); QStringList actual = dir.entryList(); - QVERIFY2(actual.count() >= countMin, msgEntryListFailed(actual.count(), countMin, dirName).constData()); + QVERIFY2(actual.size() >= countMin, msgEntryListFailed(actual.size(), countMin, dirName).constData()); } void tst_QDir::entryListWithSymLinks() @@ -1254,11 +1254,11 @@ void tst_QDir::setNameFilters() dir.setNameFilters(nameFilters); QStringList actual = dir.entryList(); - int max = qMin(actual.count(), expected.count()); + int max = qMin(actual.size(), expected.size()); for (int i=0; i=0;--i) { QCOMPARE(dir2[i], entries.at(i)); @@ -2477,7 +2477,7 @@ void tst_QDir::stdfilesystem() QCOMPARE(entries, QStringList() << "subdir2" << "subdir1"); QCOMPARE(filteredDir.sorting(), QDir::SortFlag::Reversed); QCOMPARE(filteredDir.filter(), QDir::Filter::Dirs); - QCOMPARE(filteredDir.nameFilters().length(), 1); + QCOMPARE(filteredDir.nameFilters().size(), 1); QCOMPARE(filteredDir.nameFilters().first(), "subdir*"); } #else diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 361daf8dc7..5acab6e473 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -147,7 +147,7 @@ void tst_QFileSystemWatcher::basicTest() testFile.close(); // waiting max 5 seconds for notification for file modification to trigger - QTRY_COMPARE(changedSpy.count(), 1); + QTRY_COMPARE(changedSpy.size(), 1); QCOMPARE(changedSpy.at(0).size(), 1); QString fileName = changedSpy.at(0).at(0).toString(); @@ -165,7 +165,7 @@ void tst_QFileSystemWatcher::basicTest() timer.start(5000); eventLoop.exec(); - QCOMPARE(changedSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); // readd the file watch with a relative path const QString relativeTestFileName = QDir::current().relativeFilePath(testFile.fileName()); @@ -175,7 +175,7 @@ void tst_QFileSystemWatcher::basicTest() testFile.write(QByteArray("hello multiverse!")); testFile.close(); - QTRY_VERIFY(changedSpy.count() > 0); + QTRY_VERIFY(changedSpy.size() > 0); QVERIFY(watcher.removePath(relativeTestFileName)); @@ -191,7 +191,7 @@ void tst_QFileSystemWatcher::basicTest() #if !defined(Q_OS_QNX) // waiting max 5 seconds for notification for file permission modification to trigger - QTRY_COMPARE(changedSpy.count(), 1); + QTRY_COMPARE(changedSpy.size(), 1); QCOMPARE(changedSpy.at(0).size(), 1); fileName = changedSpy.at(0).at(0).toString(); @@ -209,7 +209,7 @@ void tst_QFileSystemWatcher::basicTest() timer.start(5000); eventLoop.exec(); - QCOMPARE(changedSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); // readd the file watch QVERIFY(watcher.addPath(testFile.fileName())); @@ -220,7 +220,7 @@ void tst_QFileSystemWatcher::basicTest() // waiting max 5 seconds for notification for file removal to trigger // > 0 && < 3 because some platforms may emit two changes // XXX: which platforms? (QTBUG-23370) - QTRY_VERIFY(changedSpy.count() > 0 && changedSpy.count() < 3); + QTRY_VERIFY(changedSpy.size() > 0 && changedSpy.size() < 3); QCOMPARE(changedSpy.at(0).size(), 1); fileName = changedSpy.at(0).at(0).toString(); @@ -237,7 +237,7 @@ void tst_QFileSystemWatcher::basicTest() timer.start(5000); eventLoop.exec(); - QCOMPARE(changedSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); QVERIFY(testFile.remove()); } @@ -301,7 +301,7 @@ void tst_QFileSystemWatcher::watchDirectory() timer.start(5000); eventLoop.exec(); - QCOMPARE(changedSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); QVERIFY(watcher.addPaths(testDirs).isEmpty()); @@ -321,8 +321,8 @@ void tst_QFileSystemWatcher::watchDirectory() signalCounter[testDirName] = 0; // waiting max 5 seconds for notification for directory removal to trigger - QTRY_COMPARE(changedSpy.count(), testDirs.size() * 2); - for (int i = 0; i < changedSpy.count(); i++) { + QTRY_COMPARE(changedSpy.size(), testDirs.size() * 2); + for (int i = 0; i < changedSpy.size(); i++) { const auto &signal = changedSpy.at(i); QCOMPARE(signal.size(), 1); @@ -352,7 +352,7 @@ void tst_QFileSystemWatcher::watchDirectory() timer.start(5000); eventLoop.exec(); - QCOMPARE(changedSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); for (const auto &testDirName : testDirs) QVERIFY(temporaryDir.rmdir(testDirName)); @@ -364,12 +364,12 @@ void tst_QFileSystemWatcher::addPath() QFileSystemWatcher watcher; QString home = QDir::homePath(); QVERIFY(watcher.addPath(home)); - QCOMPARE(watcher.directories().count(), 1); + QCOMPARE(watcher.directories().size(), 1); QCOMPARE(watcher.directories().first(), home); // second watch on an already-watched path should fail QVERIFY(!watcher.addPath(home)); - QCOMPARE(watcher.directories().count(), 1); + QCOMPARE(watcher.directories().size(), 1); // With empty string QTest::ignoreMessage(QtWarningMsg, "QFileSystemWatcher::addPath: path is empty"); @@ -382,9 +382,9 @@ void tst_QFileSystemWatcher::removePath() QString home = QDir::homePath(); QVERIFY(watcher.addPath(home)); QVERIFY(watcher.removePath(home)); - QCOMPARE(watcher.directories().count(), 0); + QCOMPARE(watcher.directories().size(), 0); QVERIFY(!watcher.removePath(home)); - QCOMPARE(watcher.directories().count(), 0); + QCOMPARE(watcher.directories().size(), 0); // With empty string QTest::ignoreMessage(QtWarningMsg, "QFileSystemWatcher::removePath: path is empty"); @@ -397,7 +397,7 @@ void tst_QFileSystemWatcher::addPaths() QStringList paths; paths << QDir::homePath() << QDir::tempPath(); QCOMPARE(watcher.addPaths(paths), QStringList()); - QCOMPARE(watcher.directories().count(), 2); + QCOMPARE(watcher.directories().size(), 2); // With empty list paths.clear(); @@ -465,9 +465,9 @@ void tst_QFileSystemWatcher::removePaths() QStringList paths; paths << QDir::homePath() << QDir::tempPath(); QCOMPARE(watcher.addPaths(paths), QStringList()); - QCOMPARE(watcher.directories().count(), 2); + QCOMPARE(watcher.directories().size(), 2); QCOMPARE(watcher.removePaths(paths), QStringList()); - QCOMPARE(watcher.directories().count(), 0); + QCOMPARE(watcher.directories().size(), 0); //With empty list paths.clear(); @@ -556,7 +556,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() QTest::qWait(2000); #endif - QTRY_VERIFY(fileChangedSpy.count() > 0); + QTRY_VERIFY(fileChangedSpy.size() > 0); QVERIFY2(dirChangedSpy.count() == 0, dirChangedSpy.receivedFilesMessage()); fileChangedSpy.clear(); @@ -567,7 +567,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() timer.start(3000); eventLoop.exec(); - int fileChangedSpyCount = fileChangedSpy.count(); + int fileChangedSpyCount = fileChangedSpy.size(); #ifdef Q_OS_WIN if (fileChangedSpyCount != 0) QEXPECT_FAIL("", "See QTBUG-30943", Continue); @@ -579,7 +579,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() QVERIFY(QFile::remove(testFileName)); - QTRY_VERIFY(fileChangedSpy.count() > 0); + QTRY_VERIFY(fileChangedSpy.size() > 0); QTRY_COMPARE(dirChangedSpy.count(), 1); fileChangedSpy.clear(); @@ -591,7 +591,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() timer.start(3000); eventLoop.exec(); - QCOMPARE(fileChangedSpy.count(), 0); + QCOMPARE(fileChangedSpy.size(), 0); QCOMPARE(dirChangedSpy.count(), 1); // QTBUG-61792, removal should succeed (bug on Windows which uses one change @@ -694,7 +694,7 @@ void tst_QFileSystemWatcher::QTBUG2331() // remove directory, we should get one change signal, and we should no longer // be watching the directory. QVERIFY(temporaryDirectory.remove()); - QTRY_COMPARE(changedSpy.count(), 1); + QTRY_COMPARE(changedSpy.size(), 1); QCOMPARE(watcher.directories(), QStringList()); } #endif // QT_BUILD_INTERNAL diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp index a2363eedfc..d2bfdb54ca 100644 --- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp +++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp @@ -78,7 +78,7 @@ public: { QString ret; QTextStream out(&ret); - for (int a = 0; a < _configitemEntryOrder.count(); a++) { + for (int a = 0; a < _configitemEntryOrder.size(); a++) { out << _configitemEntryOrder[a] << " = " << _values.value(_configitemEntryOrder[a]) << Qt::endl; @@ -903,7 +903,7 @@ private slots: buf = QStringLiteral("Digia.Berlin.Office.com.debug: Berlin \"from Thread 2\" :false"); compareagainst.append(cleanLogLine(buf)); - for (int i = 0; i < threadtest.count(); i++) { + for (int i = 0; i < threadtest.size(); i++) { if (!compareagainst.contains(cleanLogLine(threadtest[i]))){ fprintf(stdout, "%s\r\n", threadtest[i].toLatin1().constData()); QVERIFY2(false, "Multithread log is not complete!"); diff --git a/tests/auto/corelib/io/qprocess/testDetached/main.cpp b/tests/auto/corelib/io/qprocess/testDetached/main.cpp index 57d39f4f13..4282621f0b 100644 --- a/tests/auto/corelib/io/qprocess/testDetached/main.cpp +++ b/tests/auto/corelib/io/qprocess/testDetached/main.cpp @@ -41,7 +41,7 @@ struct Args static Args parseArguments(const QStringList &args) { Args result; - if (args.count() < 2) { + if (args.size() < 2) { result.exitCode = 128; result.errorMessage = "Usage: testDetached [--out-channel={stdout|stderr}] filename.txt\n"; return result; diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 331567b178..4506e18f8b 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -244,7 +244,7 @@ void tst_QProcess::simpleStart() process.reset(); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); QCOMPARE(qvariant_cast(spy.at(0).at(0)), QProcess::Starting); QCOMPARE(qvariant_cast(spy.at(1).at(0)), QProcess::Running); QCOMPARE(qvariant_cast(spy.at(2).at(0)), QProcess::NotRunning); @@ -379,10 +379,10 @@ void tst_QProcess::crashTest() QVERIFY(process->waitForFinished(30000)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).at(0).constData()), QProcess::Crashed); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); QCOMPARE(*static_cast(spy2.at(0).at(1).constData()), QProcess::CrashExit); QCOMPARE(process->exitStatus(), QProcess::CrashExit); @@ -390,7 +390,7 @@ void tst_QProcess::crashTest() // delete process; process.reset(); - QCOMPARE(stateSpy.count(), 3); + QCOMPARE(stateSpy.size(), 3); QCOMPARE(qvariant_cast(stateSpy.at(0).at(0)), QProcess::Starting); QCOMPARE(qvariant_cast(stateSpy.at(1).at(0)), QProcess::Running); QCOMPARE(qvariant_cast(stateSpy.at(2).at(0)), QProcess::NotRunning); @@ -417,10 +417,10 @@ void tst_QProcess::crashTest2() if (QTestEventLoop::instance().timeout()) QFAIL("Failed to detect crash : operation timed out"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).at(0).constData()), QProcess::Crashed); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); QCOMPARE(*static_cast(spy2.at(0).at(1).constData()), QProcess::CrashExit); QCOMPARE(process.exitStatus(), QProcess::CrashExit); @@ -526,9 +526,9 @@ void tst_QProcess::echoTest2() break; } - QVERIFY(spy0.count() > 0); - QVERIFY(spy1.count() > 0); - QVERIFY(spy2.count() > 0); + QVERIFY(spy0.size() > 0); + QVERIFY(spy1.size() > 0); + QVERIFY(spy2.size() > 0); QCOMPARE(process.readAllStandardOutput(), QByteArray("Hello")); QCOMPARE(process.readAllStandardError(), QByteArray("Hello")); @@ -629,8 +629,8 @@ void tst_QProcess::exitStatus() QFETCH(QStringList, processList); QFETCH(QList, exitStatus); - QCOMPARE(exitStatus.size(), processList.count()); - for (int i = 0; i < processList.count(); ++i) { + QCOMPARE(exitStatus.size(), processList.size()); + for (int i = 0; i < processList.size(); ++i) { process.start(processList.at(i)); QVERIFY(process.waitForStarted(5000)); QVERIFY(process.waitForFinished(30000)); @@ -683,7 +683,7 @@ void tst_QProcess::readTimeoutAndThenCrash() QVERIFY(process.waitForFinished(5000)); QCOMPARE(process.state(), QProcess::NotRunning); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).at(0).constData()), QProcess::Crashed); } @@ -860,7 +860,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() proc.start("testProcessEcho/testProcessEcho"); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); proc.write("A"); @@ -868,7 +868,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() if (QTestEventLoop::instance().timeout()) QFAIL("Operation timed out"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTestEventLoop::instance().enterLoop(1); QVERIFY(QTestEventLoop::instance().timeout()); @@ -1280,7 +1280,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot() QTestEventLoop::instance().enterLoop(30); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); process.disconnect(); QVERIFY(process.waitForFinished(5000)); @@ -1316,7 +1316,7 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot() QTestEventLoop::instance().enterLoop(30); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); process.write("", 1); process.disconnect(); QVERIFY(process.waitForFinished()); @@ -1506,7 +1506,7 @@ void tst_QProcess::failToStart() for (int j = 0; j < 8; ++j) { for (int i = 0; i < attempts; ++i) { - QCOMPARE(errorSpy.count(), j * attempts + i); + QCOMPARE(errorSpy.size(), j * attempts + i); process.start("/blurp"); switch (j) { @@ -1530,12 +1530,12 @@ void tst_QProcess::failToStart() } QCOMPARE(process.error(), QProcess::FailedToStart); - QCOMPARE(errorSpy.count(), j * attempts + i + 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(errorSpy.size(), j * attempts + i + 1); + QCOMPARE(finishedSpy.size(), 0); int it = j * attempts + i + 1; - QCOMPARE(stateSpy.count(), it * 2); + QCOMPARE(stateSpy.size(), it * 2); QCOMPARE(qvariant_cast(stateSpy.at(it * 2 - 2).at(0)), QProcess::Starting); QCOMPARE(qvariant_cast(stateSpy.at(it * 2 - 1).at(0)), QProcess::NotRunning); } @@ -1559,8 +1559,8 @@ void tst_QProcess::failToStartWithWait() process.waitForStarted(); QCOMPARE(process.error(), QProcess::FailedToStart); - QCOMPARE(errorSpy.count(), i + 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(errorSpy.size(), i + 1); + QCOMPARE(finishedSpy.size(), 0); } } @@ -1586,8 +1586,8 @@ void tst_QProcess::failToStartWithEventLoop() loop.exec(); QCOMPARE(process.error(), QProcess::FailedToStart); - QCOMPARE(errorSpy.count(), i + 1); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(errorSpy.size(), i + 1); + QCOMPARE(finishedSpy.size(), 0); } } @@ -1619,7 +1619,7 @@ void tst_QProcess::failToStartEmptyArgs() }; QVERIFY(!process.waitForStarted()); - QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorSpy.size(), 1); QCOMPARE(process.error(), QProcess::FailedToStart); } @@ -1858,9 +1858,9 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QVERIFY(!process.waitForReadyRead()); // used to crash process.start("doesntexist"); QVERIFY(!process.waitForReadyRead()); - QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorSpy.size(), 1); QCOMPARE(errorSpy.at(0).at(0).toInt(), 0); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); } void tst_QProcess::setStandardInputFile() @@ -2315,7 +2315,7 @@ void tst_QProcess::invalidProgramString() process.start(programString); QCOMPARE(process.error(), QProcess::FailedToStart); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(!QProcess::startDetached(programString)); } @@ -2334,8 +2334,8 @@ void tst_QProcess::onlyOneStartedSignal() process.start("testProcessNormal/testProcessNormal"); QVERIFY(process.waitForStarted(5000)); QVERIFY(process.waitForFinished(5000)); - QCOMPARE(spyStarted.count(), 1); - QCOMPARE(spyFinished.count(), 1); + QCOMPARE(spyStarted.size(), 1); + QCOMPARE(spyFinished.size(), 1); spyStarted.clear(); spyFinished.clear(); @@ -2344,8 +2344,8 @@ void tst_QProcess::onlyOneStartedSignal() QVERIFY(process.waitForFinished(5000)); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); - QCOMPARE(spyStarted.count(), 1); - QCOMPARE(spyFinished.count(), 1); + QCOMPARE(spyStarted.size(), 1); + QCOMPARE(spyFinished.size(), 1); } class BlockOnReadStdOut : public QObject @@ -2595,7 +2595,7 @@ void tst_QProcess::startFromCurrentWorkingDir() } QCOMPARE(process.waitForStarted(), success); - QCOMPARE(errorSpy.count(), int(!success)); + QCOMPARE(errorSpy.size(), int(!success)); if (success) { QVERIFY(process.waitForFinished()); } else { diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp index 32a12c30bd..9bf8508697 100644 --- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp +++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp @@ -130,7 +130,7 @@ void tst_QProcessEnvironment::toStringList() e.insert("FOO", "bar"); QStringList result = e.toStringList(); QVERIFY(!result.isEmpty()); - QCOMPARE(result.length(), 1); + QCOMPARE(result.size(), 1); QCOMPARE(result.at(0), QString("FOO=bar")); e.clear(); @@ -142,7 +142,7 @@ void tst_QProcessEnvironment::toStringList() e.insert("A", "bc"); e.insert("HELLO", "World"); result = e.toStringList(); - QCOMPARE(result.length(), 4); + QCOMPARE(result.size(), 4); // order is not specified, so use contains() QVERIFY(result.contains("FOO=bar")); @@ -159,7 +159,7 @@ void tst_QProcessEnvironment::keys() e.insert("FOO", "bar"); QStringList result = e.keys(); - QCOMPARE(result.length(), 1); + QCOMPARE(result.size(), 1); QCOMPARE(result.at(0), QString("FOO")); e.clear(); @@ -171,7 +171,7 @@ void tst_QProcessEnvironment::keys() e.insert("A", "bc"); e.insert("HELLO", "World"); result = e.keys(); - QCOMPARE(result.length(), 4); + QCOMPARE(result.size(), 4); // order is not specified, so use contains() QVERIFY(result.contains("FOO")); @@ -194,7 +194,7 @@ void tst_QProcessEnvironment::insertEnv() e.insert(e2); QStringList keys = e.keys(); - QCOMPARE(keys.length(), 5); + QCOMPARE(keys.size(), 5); QCOMPARE(e.value("FOO"), QString("bar")); QCOMPARE(e.value("A"), QString("bc")); @@ -244,7 +244,7 @@ void tst_QProcessEnvironment::caseSensitivity() QCOMPARE(e.value("foo"), QString("bar")); QStringList list = e.toStringList(); - QCOMPARE(list.length(), 2); + QCOMPARE(list.size(), 2); QVERIFY(list.contains("foo=bar")); QVERIFY(list.contains("FOO=baz")); #endif diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index b168dd96c3..753d3f8b8a 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -550,7 +550,7 @@ void tst_QSettings::ctor() QCOMPARE(settings1.value("alpha/beta/geometry/width").toInt(), 3); QCOMPARE(settings1.value("alpha/beta/geometry/height").toInt(), 4); QCOMPARE(settings1.value("alpha/gamma/splitter").toInt(), 5); - QCOMPARE(settings1.allKeys().count(), 6); + QCOMPARE(settings1.allKeys().size(), 6); QCOMPARE(settings2.value("alpha/beta/geometry").toInt(), -7); QCOMPARE(settings2.value("alpha/beta/geometry/x").toInt(), 1); @@ -558,7 +558,7 @@ void tst_QSettings::ctor() QCOMPARE(settings2.value("alpha/beta/geometry/width").toInt(), 3); QCOMPARE(settings2.value("alpha/beta/geometry/height").toInt(), 4); QCOMPARE(settings2.value("alpha/gamma/splitter").toInt(), 5); - QCOMPARE(settings2.allKeys().count(), 6); + QCOMPARE(settings2.allKeys().size(), 6); } { @@ -569,7 +569,7 @@ void tst_QSettings::ctor() QCOMPARE(settings1.value("alpha/beta/geometry/width").toInt(), 3); QCOMPARE(settings1.value("alpha/beta/geometry/height").toInt(), 4); QCOMPARE(settings1.value("alpha/gamma/splitter").toInt(), 5); - QCOMPARE(settings1.allKeys().count(), 6); + QCOMPARE(settings1.allKeys().size(), 6); } { @@ -1731,12 +1731,12 @@ void tst_QSettings::sync() QCOMPARE(settings2.value("moo/beta/geometry/width").toInt(), 3); QCOMPARE(settings2.value("moo/beta/geometry/height").toInt(), 4); QCOMPARE(settings2.value("moo/gamma/splitter").toInt(), 5); - QCOMPARE(settings2.allKeys().count(), 11); + QCOMPARE(settings2.allKeys().size(), 11); // Now, software.org.ini no longer exists, this is same as another app // clearing all settings. settings1.sync(); - QCOMPARE(settings1.allKeys().count(), 0); + QCOMPARE(settings1.allKeys().size(), 0); // Now "some other app" will change software.org.ini QVERIFY(QFile::rename((userConfDir + "other.software.org.ini").toLatin1(), @@ -1754,7 +1754,7 @@ void tst_QSettings::sync() QCOMPARE(settings1.value("moo/beta/geometry/width").toInt(), 3); QCOMPARE(settings1.value("moo/beta/geometry/height").toInt(), 4); QCOMPARE(settings1.value("moo/gamma/splitter").toInt(), 5); - QCOMPARE(settings1.allKeys().count(), 11); + QCOMPARE(settings1.allKeys().size(), 11); } void tst_QSettings::syncNonWriteableDir() @@ -2441,17 +2441,17 @@ void tst_QSettings::testArrays() QCOMPARE(settings1.value("ene").toInt(), 2); QCOMPARE(settings1.value("due").toInt(), 3); QCOMPARE(settings1.value("rike").toInt(), 4); - QCOMPARE(settings1.allKeys().count(), 3); + QCOMPARE(settings1.allKeys().size(), 3); settings1.setArrayIndex(1); QCOMPARE(settings1.value("ene").toInt(), 5); QCOMPARE(settings1.value("due").toInt(), 6); QCOMPARE(settings1.value("rike").toInt(), 7); - QCOMPARE(settings1.allKeys().count(), 3); + QCOMPARE(settings1.allKeys().size(), 3); settings1.setArrayIndex(2); QCOMPARE(settings1.value("ene").toInt(), 8); QCOMPARE(settings1.value("due").toInt(), 9); QCOMPARE(settings1.value("rike").toInt(), 10); - QCOMPARE(settings1.allKeys().count(), 3); + QCOMPARE(settings1.allKeys().size(), 3); settings1.endArray(); settings1.endGroup(); @@ -2501,17 +2501,17 @@ void tst_QSettings::testArrays() QCOMPARE(settings1.value("ene").toInt(), 2); QCOMPARE(settings1.value("due").toInt(), 3); QCOMPARE(settings1.value("rike").toInt(), 4); - QCOMPARE(settings1.allKeys().count(), 3); + QCOMPARE(settings1.allKeys().size(), 3); settings1.setArrayIndex(1); QCOMPARE(settings1.value("ene").toInt(), 5); QCOMPARE(settings1.value("due").toInt(), 6); QCOMPARE(settings1.value("rike").toInt(), 7); - QCOMPARE(settings1.allKeys().count(), 3); + QCOMPARE(settings1.allKeys().size(), 3); settings1.setArrayIndex(2); QCOMPARE(settings1.value("ene").toInt(), 8); QCOMPARE(settings1.value("due").toInt(), 9); QCOMPARE(settings1.value("rike").toInt(), 10); - QCOMPARE(settings1.allKeys().count(), 3); + QCOMPARE(settings1.allKeys().size(), 3); settings1.endArray(); settings1.endGroup(); diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index b2bb14180e..8f96f1d49b 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -147,12 +147,12 @@ void tst_qstandardpaths::testDefaultLocations() QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation), expectedConfHome); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation), expectedConfHome); const QStringList confDirs = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation); - QCOMPARE(confDirs.count(), 2); + QCOMPARE(confDirs.size(), 2); QVERIFY(confDirs.contains(expectedConfHome)); QCOMPARE(QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation), confDirs); const QStringList genericDataDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); - QCOMPARE(genericDataDirs.count(), 3); + QCOMPARE(genericDataDirs.size(), 3); const QString expectedDataHome = QDir::homePath() + QString::fromLatin1("/.local/share"); QCOMPARE(genericDataDirs.at(0), expectedDataHome); QCOMPARE(genericDataDirs.at(1), QString::fromLatin1("/usr/local/share")); @@ -260,7 +260,7 @@ void tst_qstandardpaths::testLocateAll() #ifdef Q_XDG_PLATFORM setCustomLocations(); const QStringList appsDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "applications", QStandardPaths::LocateDirectory); - QCOMPARE(appsDirs.count(), 0); // they don't exist yet + QCOMPARE(appsDirs.size(), 0); // they don't exist yet const QStringList expectedAppsDirs = QStringList() << m_localAppDir + QLatin1String("/applications") << m_globalAppDir + QLatin1String("/applications"); QDir().mkdir(expectedAppsDirs.at(0)); @@ -301,7 +301,7 @@ void tst_qstandardpaths::testDataLocation() const QString expectedAppDataDir = QDir::homePath() + QString::fromLatin1("/.local/share/Qt/QtTest"); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), expectedAppDataDir); const QStringList appDataDirs = QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation); - QCOMPARE(appDataDirs.count(), 3); + QCOMPARE(appDataDirs.size(), 3); QCOMPARE(appDataDirs.at(0), expectedAppDataDir); QCOMPARE(appDataDirs.at(1), QString::fromLatin1("/usr/local/share/Qt/QtTest")); QCOMPARE(appDataDirs.at(2), QString::fromLatin1("/usr/share/Qt/QtTest")); diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index ead6afca8e..59cbba9bca 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -1090,7 +1090,7 @@ void tst_QUrl::toAndFromStringList() QFETCH(QStringList, strings); const QList urls = QUrl::fromStringList(strings); - QCOMPARE(urls.size(), strings.count()); + QCOMPARE(urls.size(), strings.size()); const QStringList converted = QUrl::toStringList(urls); QCOMPARE(converted, strings); } diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index 817c550c6e..ddeb9da649 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -418,7 +418,7 @@ void tst_QAbstractItemModel::match() QModelIndex start = model.index(0, 0, QModelIndex()); QVERIFY(start.isValid()); QModelIndexList res = model.match(start, Qt::DisplayRole, QVariant("1"), 3); - QCOMPARE(res.count(), 1); + QCOMPARE(res.size(), 1); QModelIndex idx = model.index(1, 0, QModelIndex()); bool areEqual = (idx == res.first()); QVERIFY(areEqual); @@ -429,42 +429,42 @@ void tst_QAbstractItemModel::match() model.setData(model.index(3, 0, QModelIndex()), "boar", Qt::DisplayRole); res = model.match(start, Qt::DisplayRole, QVariant("dog"), -1, Qt::MatchExactly); - QCOMPARE(res.count(), 1); + QCOMPARE(res.size(), 1); res = model.match(start, Qt::DisplayRole, QVariant("a"), -1, Qt::MatchContains); - QCOMPARE(res.count(), 3); + QCOMPARE(res.size(), 3); res = model.match(start, Qt::DisplayRole, QVariant("b"), -1, Qt::MatchStartsWith); - QCOMPARE(res.count(), 2); + QCOMPARE(res.size(), 2); res = model.match(start, Qt::DisplayRole, QVariant("t"), -1, Qt::MatchEndsWith); - QCOMPARE(res.count(), 2); + QCOMPARE(res.size(), 2); res = model.match(start, Qt::DisplayRole, QVariant("*a*"), -1, Qt::MatchWildcard); - QCOMPARE(res.count(), 3); + QCOMPARE(res.size(), 3); res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1, Qt::MatchRegularExpression); - QCOMPARE(res.count(), 2); + QCOMPARE(res.size(), 2); res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1, Qt::MatchRegularExpression | Qt::MatchCaseSensitive); - QCOMPARE(res.count(), 0); + QCOMPARE(res.size(), 0); res = model.match(start, Qt::DisplayRole, QVariant("BOAR"), -1, Qt::MatchFixedString); - QCOMPARE(res.count(), 1); + QCOMPARE(res.size(), 1); res = model.match(start, Qt::DisplayRole, QVariant("bat"), -1, Qt::MatchFixedString | Qt::MatchCaseSensitive); - QCOMPARE(res.count(), 1); + QCOMPARE(res.size(), 1); res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1, Qt::MatchRegularExpression); - QCOMPARE(res.count(), 2); + QCOMPARE(res.size(), 2); res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1, Qt::MatchRegularExpression | Qt::MatchCaseSensitive); - QCOMPARE(res.count(), 0); + QCOMPARE(res.size(), 0); res = model.match(start, Qt::DisplayRole, QVariant(QRegularExpression(".*O.*")), -1, Qt::MatchRegularExpression); - QCOMPARE(res.count(), 0); + QCOMPARE(res.size(), 0); res = model.match(start, Qt::DisplayRole, QVariant(QRegularExpression(".*O.*", QRegularExpression::CaseInsensitiveOption)), -1, Qt::MatchRegularExpression); - QCOMPARE(res.count(), 2); + QCOMPARE(res.size(), 2); // Ensure that the case sensitivity is properly ignored when passing a // QRegularExpression object. @@ -474,7 +474,7 @@ void tst_QAbstractItemModel::match() QRegularExpression::CaseInsensitiveOption)), -1, Qt::MatchRegularExpression | Qt::MatchCaseSensitive); - QCOMPARE(res.count(), 2); + QCOMPARE(res.size(), 2); } typedef QPair Position; @@ -757,7 +757,7 @@ void tst_QAbstractItemModel::dropMimeData() // get the mimeData from the "selected" indexes QModelIndexList selectedIndexes; - for (int i = 0; i < selection.count(); ++i) + for (int i = 0; i < selection.size(); ++i) selectedIndexes << src.index(selection.at(i).first, selection.at(i).second, QModelIndex()); QMimeData *md = src.mimeData(selectedIndexes); // do the drop @@ -828,8 +828,8 @@ void tst_QAbstractItemModel::removeRows() QVERIFY(rowsRemovedSpy.isValid()); QCOMPARE(model.removeRows(6, 4), true); - QCOMPARE(rowsAboutToBeRemovedSpy.count(), 1); - QCOMPARE(rowsRemovedSpy.count(), 1); + QCOMPARE(rowsAboutToBeRemovedSpy.size(), 1); + QCOMPARE(rowsRemovedSpy.size(), 1); } void tst_QAbstractItemModel::removeColumns() @@ -843,8 +843,8 @@ void tst_QAbstractItemModel::removeColumns() QVERIFY(columnsRemovedSpy.isValid()); QCOMPARE(model.removeColumns(6, 4), true); - QCOMPARE(columnsAboutToBeRemovedSpy.count(), 1); - QCOMPARE(columnsRemovedSpy.count(), 1); + QCOMPARE(columnsAboutToBeRemovedSpy.size(), 1); + QCOMPARE(columnsRemovedSpy.size(), 1); } void tst_QAbstractItemModel::insertRows() @@ -858,8 +858,8 @@ void tst_QAbstractItemModel::insertRows() QVERIFY(rowsInsertedSpy.isValid()); QCOMPARE(model.insertRows(6, 4), true); - QCOMPARE(rowsAboutToBeInsertedSpy.count(), 1); - QCOMPARE(rowsInsertedSpy.count(), 1); + QCOMPARE(rowsAboutToBeInsertedSpy.size(), 1); + QCOMPARE(rowsInsertedSpy.size(), 1); } void tst_QAbstractItemModel::insertColumns() @@ -873,8 +873,8 @@ void tst_QAbstractItemModel::insertColumns() QVERIFY(columnsInsertedSpy.isValid()); QCOMPARE(model.insertColumns(6, 4), true); - QCOMPARE(columnsAboutToBeInsertedSpy.count(), 1); - QCOMPARE(columnsInsertedSpy.count(), 1); + QCOMPARE(columnsAboutToBeInsertedSpy.size(), 1); + QCOMPARE(columnsInsertedSpy.size(), 1); } void tst_QAbstractItemModel::moveRows() @@ -888,8 +888,8 @@ void tst_QAbstractItemModel::moveRows() QVERIFY(rowsMovedSpy.isValid()); QCOMPARE(model.moveRows(QModelIndex(), 6, 4, QModelIndex(), 1), true); - QCOMPARE(rowsAboutToBeMovedSpy.count(), 1); - QCOMPARE(rowsMovedSpy.count(), 1); + QCOMPARE(rowsAboutToBeMovedSpy.size(), 1); + QCOMPARE(rowsMovedSpy.size(), 1); } void tst_QAbstractItemModel::moveColumns() @@ -903,12 +903,12 @@ void tst_QAbstractItemModel::moveColumns() QVERIFY(columnsMovedSpy.isValid()); QCOMPARE(model.moveColumns(QModelIndex(), 6, 4, QModelIndex(), 1), true); - QCOMPARE(columnsAboutToBeMovedSpy.count(), 1); - QCOMPARE(columnsMovedSpy.count(), 1); + QCOMPARE(columnsAboutToBeMovedSpy.size(), 1); + QCOMPARE(columnsMovedSpy.size(), 1); QCOMPARE(model.moveColumn(QModelIndex(), 4, QModelIndex(), 1), true); - QCOMPARE(columnsAboutToBeMovedSpy.count(), 2); - QCOMPARE(columnsMovedSpy.count(), 2); + QCOMPARE(columnsAboutToBeMovedSpy.size(), 2); + QCOMPARE(columnsMovedSpy.size(), 2); } void tst_QAbstractItemModel::reset() @@ -918,7 +918,7 @@ void tst_QAbstractItemModel::reset() QSignalSpy resetSpy(&model, &QtTestModel::modelReset); QVERIFY(resetSpy.isValid()); model.reset(); - QCOMPARE(resetSpy.count(), 1); + QCOMPARE(resetSpy.size(), 1); } void tst_QAbstractItemModel::complexChangesWithPersistent() diff --git a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp index 1ca4d60f10..3bea468e5b 100644 --- a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp @@ -225,7 +225,7 @@ void tst_QAbstractProxyModel::headerDataInBounds() QCOMPARE(proxy.rowCount(), 1); QCOMPARE(proxy.columnCount(), 5); - QCOMPARE(headerDataChangedSpy.count(), 1); + QCOMPARE(headerDataChangedSpy.size(), 1); QCOMPARE(headerDataChangedSpy[0][0].value(), Qt::Horizontal); QCOMPARE(headerDataChangedSpy[0][1].value(), 0); QCOMPARE(headerDataChangedSpy[0][2].value(), 4); @@ -244,7 +244,7 @@ void tst_QAbstractProxyModel::headerDataInBounds() }); QCOMPARE(proxy.rowCount(), 2); QCOMPARE(proxy.columnCount(), 5); - QCOMPARE(headerDataChangedSpy.count(), 1); + QCOMPARE(headerDataChangedSpy.size(), 1); for (int i = 0; i < proxy.columnCount(); ++i) { QString expected = QString("Col%1").arg(proxy.columnCount() - i); @@ -255,7 +255,7 @@ void tst_QAbstractProxyModel::headerDataInBounds() QCOMPARE(proxy.rowCount(), 1); QCOMPARE(proxy.columnCount(), 5); - QCOMPARE(headerDataChangedSpy.count(), 1); + QCOMPARE(headerDataChangedSpy.size(), 1); for (int i = 0; i < proxy.columnCount(); ++i) { QString expected = QString("Col%1").arg(proxy.columnCount() - i); @@ -266,7 +266,7 @@ void tst_QAbstractProxyModel::headerDataInBounds() QCOMPARE(proxy.rowCount(), 0); QCOMPARE(proxy.columnCount(), 5); - QCOMPARE(headerDataChangedSpy.count(), 2); + QCOMPARE(headerDataChangedSpy.size(), 2); QCOMPARE(headerDataChangedSpy[1][0].value(), Qt::Horizontal); QCOMPARE(headerDataChangedSpy[1][1].value(), 0); QCOMPARE(headerDataChangedSpy[1][2].value(), 4); diff --git a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp index 9990aaf2ed..45d734d9e8 100644 --- a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp @@ -46,9 +46,9 @@ static QString rowSpyToText(const QSignalSpy &spy) if (!spy.isValid()) return QStringLiteral("THE SIGNALSPY IS INVALID!"); QString str; - for (int i = 0; i < spy.count(); ++i) { + for (int i = 0; i < spy.size(); ++i) { str += spy.at(i).at(1).toString() + QLatin1Char(',') + spy.at(i).at(2).toString(); - if (i + 1 < spy.count()) + if (i + 1 < spy.size()) str += QLatin1Char(';'); } return str; @@ -149,8 +149,8 @@ void tst_QConcatenateTablesProxyModel::shouldAggregateThenRemoveTwoEmptyModelsCo // Then the proxy should still be empty (and no signals emitted) QCOMPARE(pm.rowCount(), 0); QCOMPARE(pm.columnCount(), 0); - QCOMPARE(rowATBISpy.count(), 0); - QCOMPARE(rowInsertedSpy.count(), 0); + QCOMPARE(rowATBISpy.size(), 0); + QCOMPARE(rowInsertedSpy.size(), 0); // When removing the empty models pm.removeSourceModel(&i1); @@ -159,8 +159,8 @@ void tst_QConcatenateTablesProxyModel::shouldAggregateThenRemoveTwoEmptyModelsCo // Then the proxy should still be empty (and no signals emitted) QCOMPARE(pm.rowCount(), 0); QCOMPARE(pm.columnCount(), 0); - QCOMPARE(rowATBRSpy.count(), 0); - QCOMPARE(rowRemovedSpy.count(), 0); + QCOMPARE(rowATBRSpy.size(), 0); + QCOMPARE(rowRemovedSpy.size(), 0); } void tst_QConcatenateTablesProxyModel::shouldAggregateTwoEmptyModelsWhichThenGetFilled() @@ -205,14 +205,14 @@ void tst_QConcatenateTablesProxyModel::shouldHandleDataChanged() mod.item(0, 0)->setData("a", Qt::EditRole); // Then the change should be notified to the proxy - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); QCOMPARE(dataChangedSpy.at(0).at(0).toModelIndex(), pm.index(0, 0)); QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("aBC")); // Same test with the other model mod2.item(0, 2)->setData("f", Qt::EditRole); - QCOMPARE(dataChangedSpy.count(), 2); + QCOMPARE(dataChangedSpy.size(), 2); QCOMPARE(dataChangedSpy.at(1).at(0).toModelIndex(), pm.index(1, 2)); QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEf")); } @@ -230,14 +230,14 @@ void tst_QConcatenateTablesProxyModel::shouldHandleSetData() pm.setData(pm.index(0, 0), "a"); // Then the change should be notified to the proxy - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); QCOMPARE(dataChangedSpy.at(0).at(0).toModelIndex(), pm.index(0, 0)); QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("aBC")); // Same test with the other model pm.setData(pm.index(1, 2), "f"); - QCOMPARE(dataChangedSpy.count(), 2); + QCOMPARE(dataChangedSpy.size(), 2); QCOMPARE(dataChangedSpy.at(1).at(0).toModelIndex(), pm.index(1, 2)); QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEf")); } @@ -256,7 +256,7 @@ void tst_QConcatenateTablesProxyModel::shouldHandleSetItemData() std::make_pair(Qt::UserRole, 88) }); // Then the change should be notified to the proxy - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); QCOMPARE(dataChangedSpy.at(0).at(0).toModelIndex(), pm.index(0, 0)); QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("XBC")); QCOMPARE(pm.index(0, 0).data(Qt::UserRole).toInt(), 88); @@ -265,7 +265,7 @@ void tst_QConcatenateTablesProxyModel::shouldHandleSetItemData() pm.setItemData(pm.index(1, 2), QMap{ std::make_pair(Qt::DisplayRole, QStringLiteral("Y")), std::make_pair(Qt::UserRole, 89) }); - QCOMPARE(dataChangedSpy.count(), 2); + QCOMPARE(dataChangedSpy.size(), 2); QCOMPARE(dataChangedSpy.at(1).at(0).toModelIndex(), pm.index(1, 2)); QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEY")); QCOMPARE(pm.index(1, 2).data(Qt::UserRole).toInt(), 89); @@ -302,10 +302,10 @@ void tst_QConcatenateTablesProxyModel::shouldHandleRowInsertionAndRemoval() mod2.removeRow(0); // Then the proxy should notify its users and show changes - QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.size(), 1); QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 1); QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 1); - QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.size(), 1); QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 1); QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 1); QCOMPARE(pm.rowCount(), 2); @@ -318,10 +318,10 @@ void tst_QConcatenateTablesProxyModel::shouldHandleRowInsertionAndRemoval() mod2.removeRow(0); // Then the proxy should notify its users and show changes - QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.size(), 1); QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 1); QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 1); - QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.size(), 1); QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 1); QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 1); QCOMPARE(pm.rowCount(), 1); @@ -357,10 +357,10 @@ void tst_QConcatenateTablesProxyModel::shouldAggregateAnotherModelThenRemoveMode pm.removeSourceModel(&mod3); // Then the proxy should notify its users about the row removed - QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.size(), 1); QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 2); QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 3); - QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.size(), 1); QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 2); QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 3); QCOMPARE(pm.rowCount(), 2); @@ -371,10 +371,10 @@ void tst_QConcatenateTablesProxyModel::shouldAggregateAnotherModelThenRemoveMode rowATBRSpy.clear(); rowRemovedSpy.clear(); pm.removeSourceModel(&mod2); - QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.size(), 1); QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 1); QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 1); - QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.size(), 1); QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 1); QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 1); QCOMPARE(pm.rowCount(), 1); @@ -384,10 +384,10 @@ void tst_QConcatenateTablesProxyModel::shouldAggregateAnotherModelThenRemoveMode rowATBRSpy.clear(); rowRemovedSpy.clear(); pm.removeSourceModel(&mod); - QCOMPARE(rowATBRSpy.count(), 1); + QCOMPARE(rowATBRSpy.size(), 1); QCOMPARE(rowATBRSpy.at(0).at(1).toInt(), 0); QCOMPARE(rowATBRSpy.at(0).at(2).toInt(), 0); - QCOMPARE(rowRemovedSpy.count(), 1); + QCOMPARE(rowRemovedSpy.size(), 1); QCOMPARE(rowRemovedSpy.at(0).at(1).toInt(), 0); QCOMPARE(rowRemovedSpy.at(0).at(2).toInt(), 0); QCOMPARE(pm.rowCount(), 0); @@ -423,11 +423,11 @@ void tst_QConcatenateTablesProxyModel::shouldUseSmallestColumnCount() // Test setData in an ignored column (QTBUG-91253) QSignalSpy dataChangedSpy(&pm, SIGNAL(dataChanged(QModelIndex,QModelIndex))); mod.setData(mod.index(0, 1), "b"); - QCOMPARE(dataChangedSpy.count(), 0); + QCOMPARE(dataChangedSpy.size(), 0); // Test dataChanged across all columns, some visible, some ignored mod.dataChanged(mod.index(0, 0), mod.index(0, 2)); - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); QCOMPARE(dataChangedSpy.at(0).at(0).toModelIndex(), pm.index(0, 0)); QCOMPARE(dataChangedSpy.at(0).at(1).toModelIndex(), pm.index(0, 0)); } @@ -517,8 +517,8 @@ void tst_QConcatenateTablesProxyModel::shouldPropagateLayoutChanged() QItemSelectionModel selection(&pm); selection.select(pm.index(1, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows); const QModelIndexList lst = selection.selectedIndexes(); - QCOMPARE(lst.count(), 3); - for (int col = 0; col < lst.count(); ++col) { + QCOMPARE(lst.size(), 3); + for (int col = 0; col < lst.size(); ++col) { QCOMPARE(lst.at(col).row(), 1); QCOMPARE(lst.at(col).column(), col); } @@ -533,13 +533,13 @@ void tst_QConcatenateTablesProxyModel::shouldPropagateLayoutChanged() QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("456")); QCOMPARE(extractRowTexts(&pm, 2), QStringLiteral("123")); - QCOMPARE(layoutATBCSpy.count(), 1); - QCOMPARE(layoutChangedSpy.count(), 1); + QCOMPARE(layoutATBCSpy.size(), 1); + QCOMPARE(layoutChangedSpy.size(), 1); // And the selection should be updated accordingly (it became row 2) const QModelIndexList lstAfter = selection.selectedIndexes(); - QCOMPARE(lstAfter.count(), 3); - for (int col = 0; col < lstAfter.count(); ++col) { + QCOMPARE(lstAfter.size(), 3); + for (int col = 0; col < lstAfter.size(); ++col) { QCOMPARE(lstAfter.at(col).row(), 2); QCOMPARE(lstAfter.at(col).column(), col); } @@ -574,14 +574,14 @@ void tst_QConcatenateTablesProxyModel::shouldReactToModelReset() // Then the proxy should emit the reset signals, and show the new data QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("ABC")); QCOMPARE(extractRowTexts(&pm, 1), QStringLiteral("DEF")); - QCOMPARE(rowATBRSpy.count(), 0); - QCOMPARE(rowRemovedSpy.count(), 0); - QCOMPARE(rowATBISpy.count(), 0); - QCOMPARE(rowInsertedSpy.count(), 0); - QCOMPARE(colATBRSpy.count(), 0); - QCOMPARE(colRemovedSpy.count(), 0); - QCOMPARE(modelATBResetSpy.count(), 1); - QCOMPARE(modelResetSpy.count(), 1); + QCOMPARE(rowATBRSpy.size(), 0); + QCOMPARE(rowRemovedSpy.size(), 0); + QCOMPARE(rowATBISpy.size(), 0); + QCOMPARE(rowInsertedSpy.size(), 0); + QCOMPARE(colATBRSpy.size(), 0); + QCOMPARE(colRemovedSpy.size(), 0); + QCOMPARE(modelATBResetSpy.size(), 1); + QCOMPARE(modelResetSpy.size(), 1); } void tst_QConcatenateTablesProxyModel::shouldUpdateColumnsOnModelReset() @@ -616,14 +616,14 @@ void tst_QConcatenateTablesProxyModel::shouldUpdateColumnsOnModelReset() qsfpm.setSourceModel(&mod2Columns); // Then the proxy should reset, and show the new data - QCOMPARE(modelATBResetSpy.count(), 1); - QCOMPARE(modelResetSpy.count(), 1); - QCOMPARE(rowATBRSpy.count(), 0); - QCOMPARE(rowRemovedSpy.count(), 0); - QCOMPARE(rowATBISpy.count(), 0); - QCOMPARE(rowInsertedSpy.count(), 0); - QCOMPARE(colATBRSpy.count(), 0); - QCOMPARE(colRemovedSpy.count(), 0); + QCOMPARE(modelATBResetSpy.size(), 1); + QCOMPARE(modelResetSpy.size(), 1); + QCOMPARE(rowATBRSpy.size(), 0); + QCOMPARE(rowRemovedSpy.size(), 0); + QCOMPARE(rowATBISpy.size(), 0); + QCOMPARE(rowInsertedSpy.size(), 0); + QCOMPARE(colATBRSpy.size(), 0); + QCOMPARE(colRemovedSpy.size(), 0); QCOMPARE(pm.rowCount(), 2); QCOMPARE(extractRowTexts(&pm, 0), QStringLiteral("WX")); diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp index 1ce10c46aa..e5470fc3d1 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp @@ -587,7 +587,7 @@ void tst_QItemModel::setData() QVERIFY(currentModel); QSignalSpy spy(currentModel, &QAbstractItemModel::dataChanged); QVERIFY(spy.isValid()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QFETCH(bool, isEmpty); if (isEmpty) @@ -611,7 +611,7 @@ void tst_QItemModel::setData() // Changing the text shouldn't change the layout, parent, pointer etc. QModelIndex changedIndex = currentModel->index(0, 0, topIndex); QCOMPARE(changedIndex, index); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QItemModel::setHeaderData_data() @@ -661,7 +661,7 @@ void tst_QItemModel::setHeaderData() ++signalCount; } } - QCOMPARE(spy.count(), signalCount); + QCOMPARE(spy.size(), signalCount); } void tst_QItemModel::sort_data() @@ -692,7 +692,7 @@ void tst_QItemModel::sort() for (int i=-1; i < 10; ++i){ currentModel->sort(i); if (index != currentModel->index(0, 0, topIndex)){ - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); index = currentModel->index(0, 0, topIndex); spy.clear(); } @@ -858,7 +858,7 @@ void tst_QItemModel::remove() if (shouldSucceed && dyingIndex.isValid()) QCOMPARE(dyingIndex.row(), start + 1); - if (rowsAboutToBeRemovedSpy.count() > 0){ + if (rowsAboutToBeRemovedSpy.size() > 0){ QList arguments = rowsAboutToBeRemovedSpy.at(0); QModelIndex parent = (qvariant_cast(arguments.at(0))); int first = arguments.at(1).toInt(); @@ -868,7 +868,7 @@ void tst_QItemModel::remove() QVERIFY(parentOfRemoved == parent); } - if (rowsRemovedSpy.count() > 0){ + if (rowsRemovedSpy.size() > 0){ QList arguments = rowsRemovedSpy.at(0); QModelIndex parent = (qvariant_cast(arguments.at(0))); int first = arguments.at(1).toInt(); @@ -879,26 +879,26 @@ void tst_QItemModel::remove() } // Only the row signals should have been emitted - if (modelResetSpy.count() >= 1 || modelLayoutChangedSpy.count() >=1 ){ - QCOMPARE(columnsAboutToBeRemovedSpy.count(), 0); - QCOMPARE(rowsAboutToBeRemovedSpy.count(), 0); - QCOMPARE(columnsRemovedSpy.count(), 0); - QCOMPARE(rowsRemovedSpy.count(), 0); + if (modelResetSpy.size() >= 1 || modelLayoutChangedSpy.size() >=1 ){ + QCOMPARE(columnsAboutToBeRemovedSpy.size(), 0); + QCOMPARE(rowsAboutToBeRemovedSpy.size(), 0); + QCOMPARE(columnsRemovedSpy.size(), 0); + QCOMPARE(rowsRemovedSpy.size(), 0); } else { - QCOMPARE(columnsAboutToBeRemovedSpy.count(), 0); - QCOMPARE(rowsAboutToBeRemovedSpy.count(), numberOfRowsAboutToBeRemovedSignals); - QCOMPARE(columnsRemovedSpy.count(), 0); - QCOMPARE(rowsRemovedSpy.count(), numberOfRowsRemovedSignals); + QCOMPARE(columnsAboutToBeRemovedSpy.size(), 0); + QCOMPARE(rowsAboutToBeRemovedSpy.size(), numberOfRowsAboutToBeRemovedSignals); + QCOMPARE(columnsRemovedSpy.size(), 0); + QCOMPARE(rowsRemovedSpy.size(), numberOfRowsRemovedSignals); } // The row count should only change *after* rowsAboutToBeRemoved has been emitted if (shouldSucceed) { - if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0){ + if (modelResetSpy.size() == 0 && modelLayoutChangedSpy.size() == 0){ QCOMPARE(afterAboutToRemoveRowCount, beforeRemoveRowCount); QCOMPARE(afterRemoveRowCount, beforeRemoveRowCount-count-(numberOfRowsRemovedSignals-1)); } - if (modelResetSpy.count() == 0 ) + if (modelResetSpy.size() == 0 ) QCOMPARE(currentModel->rowCount(parentOfRemoved), beforeRemoveRowCount-count-(numberOfRowsRemovedSignals-1)); } else { @@ -913,7 +913,7 @@ void tst_QItemModel::remove() disconnect(currentModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(slot_rowsRemoved(QModelIndex))); modelResetSpy.clear(); - QCOMPARE(modelResetSpy.count(), 0); + QCOMPARE(modelResetSpy.size(), 0); // // Test remove column @@ -928,26 +928,26 @@ void tst_QItemModel::remove() if (currentModel->removeColumns(start, count, parentOfRemoved)) { currentModel->submit(); // Didn't reset the rows, so they should still be at the same value - if (modelResetSpy.count() >= 1 || modelLayoutChangedSpy.count() >= 1){ - QCOMPARE(columnsAboutToBeRemovedSpy.count(), 0); + if (modelResetSpy.size() >= 1 || modelLayoutChangedSpy.size() >= 1){ + QCOMPARE(columnsAboutToBeRemovedSpy.size(), 0); //QCOMPARE(rowsAboutToBeRemovedSpy.count(), numberOfRowsAboutToBeRemovedSignals); - QCOMPARE(columnsRemovedSpy.count(), 0); + QCOMPARE(columnsRemovedSpy.size(), 0); //QCOMPARE(rowsRemovedSpy.count(), numberOfRowsRemovedSignals); } else { - QCOMPARE(columnsAboutToBeRemovedSpy.count(), numberOfColumnsAboutToBeRemovedSignals); - QCOMPARE(rowsAboutToBeRemovedSpy.count(), numberOfRowsAboutToBeRemovedSignals); - QCOMPARE(columnsRemovedSpy.count(), numberOfColumnsRemovedSignals); - QCOMPARE(rowsRemovedSpy.count(), numberOfRowsRemovedSignals); + QCOMPARE(columnsAboutToBeRemovedSpy.size(), numberOfColumnsAboutToBeRemovedSignals); + QCOMPARE(rowsAboutToBeRemovedSpy.size(), numberOfRowsAboutToBeRemovedSignals); + QCOMPARE(columnsRemovedSpy.size(), numberOfColumnsRemovedSignals); + QCOMPARE(rowsRemovedSpy.size(), numberOfRowsRemovedSignals); } // The column count should only change *after* rowsAboutToBeRemoved has been emitted if (shouldSucceed) { - if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0){ + if (modelResetSpy.size() == 0 && modelLayoutChangedSpy.size() == 0){ QCOMPARE(afterAboutToRemoveColumnCount, beforeRemoveColumnCount); QCOMPARE(afterRemoveColumnCount, beforeRemoveColumnCount-count-(numberOfColumnsRemovedSignals-1)); } - if (modelResetSpy.count() == 0) + if (modelResetSpy.size() == 0) QCOMPARE(currentModel->columnCount(parentOfRemoved), beforeRemoveColumnCount-count-(numberOfColumnsRemovedSignals-1)); } else @@ -958,7 +958,7 @@ void tst_QItemModel::remove() disconnect(currentModel, SIGNAL(columnsRemoved(QModelIndex,int,int)), this, SLOT(slot_columnsRemoved(QModelIndex))); - if (columnsAboutToBeRemovedSpy.count() > 0){ + if (columnsAboutToBeRemovedSpy.size() > 0){ QList arguments = columnsAboutToBeRemovedSpy.at(0); QModelIndex parent = (qvariant_cast(arguments.at(0))); int first = arguments.at(1).toInt(); @@ -968,7 +968,7 @@ void tst_QItemModel::remove() QVERIFY(parentOfRemoved == parent); } - if (columnsRemovedSpy.count() > 0){ + if (columnsRemovedSpy.size() > 0){ QList arguments = columnsRemovedSpy.at(0); QModelIndex parent = (qvariant_cast(arguments.at(0))); int first = arguments.at(1).toInt(); @@ -1197,7 +1197,7 @@ void tst_QItemModel::insert() QCOMPARE(currentModel->insertRows(start, count, parentOfInserted), shouldSucceed); currentModel->submit(); - if (rowsAboutToBeInsertedSpy.count() > 0){ + if (rowsAboutToBeInsertedSpy.size() > 0){ QList arguments = rowsAboutToBeInsertedSpy.at(0); QModelIndex parent = (qvariant_cast(arguments.at(0))); int first = arguments.at(1).toInt(); @@ -1207,7 +1207,7 @@ void tst_QItemModel::insert() QVERIFY(parentOfInserted == parent); } - if (rowsInsertedSpy.count() > 0){ + if (rowsInsertedSpy.size() > 0){ QList arguments = rowsInsertedSpy.at(0); QModelIndex parent = (qvariant_cast(arguments.at(0))); int first = arguments.at(1).toInt(); @@ -1218,25 +1218,25 @@ void tst_QItemModel::insert() } // Only the row signals should have been emitted - if (modelResetSpy.count() >= 1 || modelLayoutChangedSpy.count() >= 1) { - QCOMPARE(columnsAboutToBeInsertedSpy.count(), 0); - QCOMPARE(rowsAboutToBeInsertedSpy.count(), 0); - QCOMPARE(columnsInsertedSpy.count(), 0); - QCOMPARE(rowsInsertedSpy.count(), 0); + if (modelResetSpy.size() >= 1 || modelLayoutChangedSpy.size() >= 1) { + QCOMPARE(columnsAboutToBeInsertedSpy.size(), 0); + QCOMPARE(rowsAboutToBeInsertedSpy.size(), 0); + QCOMPARE(columnsInsertedSpy.size(), 0); + QCOMPARE(rowsInsertedSpy.size(), 0); } else { - QCOMPARE(columnsAboutToBeInsertedSpy.count(), 0); - QCOMPARE(rowsAboutToBeInsertedSpy.count(), numberOfRowsAboutToBeInsertedSignals); - QCOMPARE(columnsInsertedSpy.count(), 0); - QCOMPARE(rowsInsertedSpy.count(), numberOfRowsInsertedSignals); + QCOMPARE(columnsAboutToBeInsertedSpy.size(), 0); + QCOMPARE(rowsAboutToBeInsertedSpy.size(), numberOfRowsAboutToBeInsertedSignals); + QCOMPARE(columnsInsertedSpy.size(), 0); + QCOMPARE(rowsInsertedSpy.size(), numberOfRowsInsertedSignals); } // The row count should only change *after* rowsAboutToBeInserted has been emitted if (shouldSucceed) { - if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0) { + if (modelResetSpy.size() == 0 && modelLayoutChangedSpy.size() == 0) { QCOMPARE(afterAboutToInsertRowCount, beforeInsertRowCount); QCOMPARE(afterInsertRowCount, beforeInsertRowCount+count+(numberOfRowsInsertedSignals-1)); } - if (modelResetSpy.count() == 0) + if (modelResetSpy.size() == 0) QCOMPARE(currentModel->rowCount(parentOfInserted), beforeInsertRowCount+count+(numberOfRowsInsertedSignals-1)); } else { @@ -1264,27 +1264,27 @@ void tst_QItemModel::insert() // Some models don't let you insert the column, only row if (currentModel->insertColumns(start, count, parentOfInserted)) { currentModel->submit(); - if (modelResetSpy.count() >= 1 || modelLayoutChangedSpy.count() >= 1) { + if (modelResetSpy.size() >= 1 || modelLayoutChangedSpy.size() >= 1) { // Didn't reset the rows, so they should still be at the same value - QCOMPARE(columnsAboutToBeInsertedSpy.count(), 0); + QCOMPARE(columnsAboutToBeInsertedSpy.size(), 0); //QCOMPARE(rowsAboutToBeInsertedSpy.count(), numberOfRowsAboutToBeInsertedSignals); - QCOMPARE(columnsInsertedSpy.count(), 0); + QCOMPARE(columnsInsertedSpy.size(), 0); //QCOMPARE(rowsInsertedSpy.count(), numberOfRowsInsertedSignals); } else { // Didn't reset the rows, so they should still be at the same value - QCOMPARE(columnsAboutToBeInsertedSpy.count(), numberOfColumnsAboutToBeInsertedSignals); - QCOMPARE(rowsAboutToBeInsertedSpy.count(), numberOfRowsAboutToBeInsertedSignals); - QCOMPARE(columnsInsertedSpy.count(), numberOfColumnsInsertedSignals); - QCOMPARE(rowsInsertedSpy.count(), numberOfRowsInsertedSignals); + QCOMPARE(columnsAboutToBeInsertedSpy.size(), numberOfColumnsAboutToBeInsertedSignals); + QCOMPARE(rowsAboutToBeInsertedSpy.size(), numberOfRowsAboutToBeInsertedSignals); + QCOMPARE(columnsInsertedSpy.size(), numberOfColumnsInsertedSignals); + QCOMPARE(rowsInsertedSpy.size(), numberOfRowsInsertedSignals); } // The column count should only change *after* rowsAboutToBeInserted has been emitted if (shouldSucceed) { - if (modelResetSpy.count() == 0 && modelLayoutChangedSpy.count() == 0) { + if (modelResetSpy.size() == 0 && modelLayoutChangedSpy.size() == 0) { QCOMPARE(afterAboutToInsertColumnCount, beforeInsertColumnCount); QCOMPARE(afterInsertColumnCount, beforeInsertColumnCount+count+(numberOfColumnsInsertedSignals-1)); } - if (modelResetSpy.count() == 0) + if (modelResetSpy.size() == 0) QCOMPARE(currentModel->columnCount(parentOfInserted), beforeInsertColumnCount+count+(numberOfColumnsInsertedSignals-1)); } else @@ -1295,7 +1295,7 @@ void tst_QItemModel::insert() disconnect(currentModel, SIGNAL(columnsInserted(QModelIndex,int,int)), this, SLOT(slot_columnsInserted(QModelIndex))); - if (columnsAboutToBeInsertedSpy.count() > 0){ + if (columnsAboutToBeInsertedSpy.size() > 0){ QList arguments = columnsAboutToBeInsertedSpy.at(0); QModelIndex parent = (qvariant_cast(arguments.at(0))); int first = arguments.at(1).toInt(); @@ -1305,7 +1305,7 @@ void tst_QItemModel::insert() QVERIFY(parentOfInserted == parent); } - if (columnsInsertedSpy.count() > 0){ + if (columnsInsertedSpy.size() > 0){ QList arguments = columnsInsertedSpy.at(0); QModelIndex parent = (qvariant_cast(arguments.at(0))); int first = arguments.at(1).toInt(); diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index 8438ac24fa..2d09b01c26 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -141,8 +141,8 @@ QDataStream &operator>>(QDataStream &s, QModelIndex &output) QDataStream &operator<<(QDataStream &s, const QModelIndexList &input) { - s << input.count(); - for (int i=0; iselect(indexList.at(i), (QItemSelectionModel::SelectionFlags)commandList.at(i)); } // test that we have selected items @@ -292,7 +292,7 @@ void tst_QItemSelectionModel::clearAndSelect() { // populate selectionmodel selection->select(model->index(1, 1, QModelIndex()), QItemSelectionModel::Select); - QCOMPARE(selection->selectedIndexes().count(), 1); + QCOMPARE(selection->selectedIndexes().size(), 1); QVERIFY(selection->hasSelection()); // ClearAndSelect with empty selection @@ -310,26 +310,26 @@ void tst_QItemSelectionModel::toggleSelection() //and hasSelection returns the correct value selection->clearSelection(); - QCOMPARE(selection->selectedIndexes().count(), 0); + QCOMPARE(selection->selectedIndexes().size(), 0); QVERIFY(selection->hasSelection()==false); QModelIndex index=model->index(1, 1, QModelIndex()); // populate selectionmodel selection->select(index, QItemSelectionModel::Toggle); - QCOMPARE(selection->selectedIndexes().count(), 1); + QCOMPARE(selection->selectedIndexes().size(), 1); QVERIFY(selection->hasSelection()==true); selection->select(index, QItemSelectionModel::Toggle); - QCOMPARE(selection->selectedIndexes().count(), 0); + QCOMPARE(selection->selectedIndexes().size(), 0); QVERIFY(selection->hasSelection()==false); // populate selectionmodel with rows selection->select(index, QItemSelectionModel::Toggle | QItemSelectionModel::Rows); - QCOMPARE(selection->selectedIndexes().count(), model->columnCount()); + QCOMPARE(selection->selectedIndexes().size(), model->columnCount()); QVERIFY(selection->hasSelection()==true); selection->select(index, QItemSelectionModel::Toggle | QItemSelectionModel::Rows); - QCOMPARE(selection->selectedIndexes().count(), 0); + QCOMPARE(selection->selectedIndexes().size(), 0); QVERIFY(selection->hasSelection()==false); } @@ -1221,7 +1221,7 @@ void tst_QItemSelectionModel::select() int lastCommand = 0; // do selections - for (int i = 0; iselect(QItemSelection(indexList.at(2*i), indexList.at(2*i+1)), (QItemSelectionModel::SelectionFlags)commandList.at(i)); @@ -1238,13 +1238,13 @@ void tst_QItemSelectionModel::select() QVERIFY(selection->hasSelection()!=selectedList.isEmpty()); // test that the number of indices are as expected - QVERIFY2(selectedList.count() == expectedList.count(), + QVERIFY2(selectedList.size() == expectedList.size(), QString("expected indices: %1 actual indices: %2") - .arg(expectedList.count()) - .arg(selectedList.count()).toLatin1()); + .arg(expectedList.size()) + .arg(selectedList.size()).toLatin1()); // test existence of each index - for (int i=0; iisSelected(idx) == selectedList.contains(idx), QString("isSelected(index: %1, %2) does not match selectedIndexes()") @@ -1263,7 +1263,7 @@ void tst_QItemSelectionModel::select() //for now we assume Rows/Columns flag is the same for all commands, therefore we just check lastCommand // test that isRowSelected agrees if (lastCommand & QItemSelectionModel::Rows) { - for (int i=0; iisRowSelected(selectedList.at(i).row(), model->parent(selectedList.at(i))), QString("isRowSelected(row: %1) does not match selectedIndexes()") @@ -1272,7 +1272,7 @@ void tst_QItemSelectionModel::select() // test that isColumnSelected agrees if (lastCommand & QItemSelectionModel::Columns) { - for (int i=0; iisColumnSelected(selectedList.at(i).column(), model->parent(selectedList.at(i))), QString("isColumnSelected(column: %1) does not match selectedIndexes()") @@ -1456,8 +1456,8 @@ void tst_QItemSelectionModel::persistentselections() QCOMPARE(model->columnCount(QModelIndex()), 5); // do selections - for (int i=0; iindex(indexList.at(i).first, indexList.at(i).second, QModelIndex()); @@ -1478,18 +1478,18 @@ void tst_QItemSelectionModel::persistentselections() QVERIFY(selection->hasSelection()); // insert/delete row and/or columns - if (insertRows.count() > 1) + if (insertRows.size() > 1) model->insertRows(insertRows.at(0), insertRows.at(1), QModelIndex()); - if (insertColumns.count() > 1) + if (insertColumns.size() > 1) model->insertColumns(insertColumns.at(0), insertColumns.at(1), QModelIndex()); - if (deleteRows.count() > 1) + if (deleteRows.size() > 1) model->removeRows(deleteRows.at(0), deleteRows.at(1), QModelIndex()); - if (deleteColumns.count() > 1) + if (deleteColumns.size() > 1) model->removeColumns(deleteColumns.at(0), deleteColumns.at(1), QModelIndex()); // check that the selected items are the correct number and indexes QModelIndexList selectedList = selection->selectedIndexes(); - QCOMPARE(selectedList.count(), expectedList.count()); + QCOMPARE(selectedList.size(), expectedList.size()); for (const auto &pair : expectedList) { QModelIndex index = model->index(pair.first, pair.second, QModelIndex()); QVERIFY(selectedList.contains(index)); @@ -1515,7 +1515,7 @@ void tst_QItemSelectionModel::resetModel() selectionModel->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); model.reset(); @@ -1524,7 +1524,7 @@ void tst_QItemSelectionModel::resetModel() selectionModel->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(1).size(), 2); // make sure we don't get an "old selection" QCOMPARE(spy.at(1).at(1).userType(), qMetaTypeId()); @@ -1580,14 +1580,14 @@ void tst_QItemSelectionModel::removeRows() QModelIndex br = model.index(selectBottom, selectRight); selections.select(QItemSelection(tl, br), QItemSelectionModel::ClearAndSelect); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(selections.isSelected(tl)); QVERIFY(selections.isSelected(br)); QVERIFY(selections.hasSelection()); model.removeRows(removeTop, removeBottom - removeTop + 1); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); tl = model.index(expectedTop, expectedLeft); br = model.index(expectedBottom, expectedRight); QVERIFY(selections.isSelected(tl)); @@ -1643,14 +1643,14 @@ void tst_QItemSelectionModel::removeColumns() QModelIndex br = model.index(selectBottom, selectRight); selections.select(QItemSelection(tl, br), QItemSelectionModel::ClearAndSelect); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(selections.isSelected(tl)); QVERIFY(selections.isSelected(br)); QVERIFY(selections.hasSelection()); model.removeColumns(removeLeft, removeRight - removeLeft + 1); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); tl = model.index(expectedTop, expectedLeft); br = model.index(expectedBottom, expectedRight); QVERIFY(selections.isSelected(tl)); @@ -1721,7 +1721,7 @@ void tst_QItemSelectionModel::modelLayoutChanged() QFETCH(int, sortColumn); QFETCH(IntPairPairList, expectedSelectedRanges); - MyStandardItemModel model(items.at(0).size(), items.count()); + MyStandardItemModel model(items.at(0).size(), items.size()); // initialize model data for (int i = 0; i < model.rowCount(); ++i) { for (int j = 0; j < model.columnCount(); ++j) { @@ -1746,10 +1746,10 @@ void tst_QItemSelectionModel::modelLayoutChanged() // verify that selection is as expected QItemSelection selection = selectionModel.selection(); - QCOMPARE(selection.count(), expectedSelectedRanges.count()); + QCOMPARE(selection.size(), expectedSelectedRanges.size()); QCOMPARE(selectionModel.hasSelection(), !expectedSelectedRanges.isEmpty()); - for (int i = 0; i < expectedSelectedRanges.count(); ++i) { + for (int i = 0; i < expectedSelectedRanges.size(); ++i) { IntPairPair expectedRange = expectedSelectedRanges.at(i); IntPair expectedTl = expectedRange.first; IntPair expectedBr = expectedRange.second; @@ -1803,21 +1803,21 @@ void tst_QItemSelectionModel::selectedRows() MyStandardItemModel model(rowCount, columnCount); QItemSelectionModel selectionModel(&model); - for (int i = 0; i < selectRows.count(); ++i) + for (int i = 0; i < selectRows.size(); ++i) selectionModel.select(model.index(selectRows.at(i), 0), QItemSelectionModel::Select |QItemSelectionModel::Rows); - for (int j = 0; j < selectRows.count(); ++j) + for (int j = 0; j < selectRows.size(); ++j) QVERIFY(selectionModel.isRowSelected(expectedRows.at(j), QModelIndex())); - for (int k = 0; k < selectRows.count(); ++k) + for (int k = 0; k < selectRows.size(); ++k) QVERIFY(!selectionModel.isRowSelected(unexpectedRows.at(k), QModelIndex())); QModelIndexList selectedRowIndexes = selectionModel.selectedRows(column); - QCOMPARE(selectedRowIndexes.count(), expectedRows.count()); + QCOMPARE(selectedRowIndexes.size(), expectedRows.size()); std::sort(selectedRowIndexes.begin(), selectedRowIndexes.end()); - for (int l = 0; l < selectedRowIndexes.count(); ++l) { + for (int l = 0; l < selectedRowIndexes.size(); ++l) { QCOMPARE(selectedRowIndexes.at(l).row(), expectedRows.at(l)); QCOMPARE(selectedRowIndexes.at(l).column(), column); } @@ -1863,21 +1863,21 @@ void tst_QItemSelectionModel::selectedColumns() MyStandardItemModel model(rowCount, columnCount); QItemSelectionModel selectionModel(&model); - for (int i = 0; i < selectColumns.count(); ++i) + for (int i = 0; i < selectColumns.size(); ++i) selectionModel.select(model.index(0, selectColumns.at(i)), QItemSelectionModel::Select |QItemSelectionModel::Columns); - for (int j = 0; j < selectColumns.count(); ++j) + for (int j = 0; j < selectColumns.size(); ++j) QVERIFY(selectionModel.isColumnSelected(expectedColumns.at(j), QModelIndex())); - for (int k = 0; k < selectColumns.count(); ++k) + for (int k = 0; k < selectColumns.size(); ++k) QVERIFY(!selectionModel.isColumnSelected(unexpectedColumns.at(k), QModelIndex())); QModelIndexList selectedColumnIndexes = selectionModel.selectedColumns(row); - QCOMPARE(selectedColumnIndexes.count(), expectedColumns.count()); + QCOMPARE(selectedColumnIndexes.size(), expectedColumns.size()); std::sort(selectedColumnIndexes.begin(), selectedColumnIndexes.end()); - for (int l = 0; l < selectedColumnIndexes.count(); ++l) { + for (int l = 0; l < selectedColumnIndexes.size(); ++l) { QCOMPARE(selectedColumnIndexes.at(l).column(), expectedColumns.at(l)); QCOMPARE(selectedColumnIndexes.at(l).row(), row); } @@ -1908,18 +1908,18 @@ void tst_QItemSelectionModel::setCurrentIndex() treemodel->index(0, 0, treemodel->index(1, 0)), QItemSelectionModel::SelectCurrent); - QCOMPARE(currentSpy.count(), 1); - QCOMPARE(rowSpy.count(), 1); - QCOMPARE(columnSpy.count(), 1); + QCOMPARE(currentSpy.size(), 1); + QCOMPARE(rowSpy.size(), 1); + QCOMPARE(columnSpy.size(), 1); // Select another row in the same parent selectionModel.setCurrentIndex( treemodel->index(1, 0, treemodel->index(1, 0)), QItemSelectionModel::SelectCurrent); - QCOMPARE(currentSpy.count(), 2); - QCOMPARE(rowSpy.count(), 2); - QCOMPARE(columnSpy.count(), 1); + QCOMPARE(currentSpy.size(), 2); + QCOMPARE(rowSpy.size(), 2); + QCOMPARE(columnSpy.size(), 1); } void tst_QItemSelectionModel::splitOnInsert() @@ -2043,14 +2043,14 @@ void tst_QItemSelectionModel::unselectable() } QItemSelectionModel selectionModel(&model); selectionModel.select(QItemSelection(model.index(0, 0), model.index(9, 0)), QItemSelectionModel::Select); - QCOMPARE(selectionModel.selectedIndexes().count(), 10); - QCOMPARE(selectionModel.selectedRows().count(), 10); + QCOMPARE(selectionModel.selectedIndexes().size(), 10); + QCOMPARE(selectionModel.selectedRows().size(), 10); QVERIFY(selectionModel.hasSelection()); for (int j = 0; j < 10; ++j) model.item(j)->setFlags({ }); QVERIFY(!selectionModel.hasSelection()); - QCOMPARE(selectionModel.selectedIndexes().count(), 0); - QCOMPARE(selectionModel.selectedRows().count(), 0); + QCOMPARE(selectionModel.selectedIndexes().size(), 0); + QCOMPARE(selectionModel.selectedRows().size(), 0); } void tst_QItemSelectionModel::selectedIndexes() @@ -2064,8 +2064,8 @@ void tst_QItemSelectionModel::selectedIndexes() //we select the 1st row selectionModel.select(selection, QItemSelectionModel::Rows | QItemSelectionModel::Select); - QCOMPARE(selectionModel.selectedRows().count(), 1); - QCOMPARE(selectionModel.selectedIndexes().count(), model.columnCount()); + QCOMPARE(selectionModel.selectedRows().size(), 1); + QCOMPARE(selectionModel.selectedIndexes().size(), model.columnCount()); } @@ -2103,14 +2103,14 @@ void tst_QItemSelectionModel::layoutChanged() QtTestTableModel model(1,1); QItemSelectionModel selectionModel(&model); selectionModel.select(model.index(0,0), QItemSelectionModel::Select); - QCOMPARE(selectionModel.selectedIndexes().count() , 1); + QCOMPARE(selectionModel.selectedIndexes().size() , 1); emit model.layoutAboutToBeChanged(); model.row_count = 5; emit model.layoutChanged(); //The selection should not change. - QCOMPARE(selectionModel.selectedIndexes().count() , 1); + QCOMPARE(selectionModel.selectedIndexes().size() , 1); QCOMPARE(selectionModel.selectedIndexes().first() , model.index(0,0)); } @@ -2190,7 +2190,7 @@ void tst_QItemSelectionModel::isRowSelected() model.setData(model.index(0,0), 0, Qt::UserRole - 1); QItemSelectionModel sel(&model); sel.select( QItemSelection(model.index(0,0), model.index(0, 1)), QItemSelectionModel::Select); - QCOMPARE(sel.selectedIndexes().count(), 1); + QCOMPARE(sel.selectedIndexes().size(), 1); QVERIFY(sel.isRowSelected(0, QModelIndex())); } @@ -2215,7 +2215,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal() QSignalSpy deselectSpy(&selectionModel, &QItemSelectionModel::selectionChanged); QVERIFY(deselectSpy.isValid()); model.removeRows(0, 1, root); - QCOMPARE(deselectSpy.count(), 1); + QCOMPARE(deselectSpy.size(), 1); // More testing stress for the patch. model.clear(); @@ -2244,7 +2244,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal() QVERIFY(selectionModel.selection().contains(sel2)); deselectSpy.clear(); model.removeRow(0, model.index(0, 0)); - QCOMPARE(deselectSpy.count(), 1); + QCOMPARE(deselectSpy.size(), 1); QVERIFY(!selectionModel.selection().contains(sel)); QVERIFY(selectionModel.selection().contains(sel2)); } @@ -2266,7 +2266,7 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected1() selection.select(QItemSelection(indexList.first(), indexList.last()), QItemSelectionModel::Select); //let's check the selection hasn't changed - QCOMPARE(selection.selectedIndexes().count(), indexList.size()); + QCOMPARE(selection.selectedIndexes().size(), indexList.size()); for (const auto &index : indexList) QVERIFY(selection.isSelected(index)); @@ -2274,7 +2274,7 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected1() QCOMPARE(proxy.rowCount(), 3); //let's check the selection hasn't changed - QCOMPARE(selection.selectedIndexes().count(), indexList.size()); + QCOMPARE(selection.selectedIndexes().size(), indexList.size()); for (const auto &index : indexList) QVERIFY(selection.isSelected(index)); } @@ -2323,7 +2323,7 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected2() QCOMPARE(proxy.rowCount(), int(cNumRows)); //let's check the selection hasn't changed - QCOMPARE(selection.selectedIndexes().count(), indexList.size()); + QCOMPARE(selection.selectedIndexes().size(), indexList.size()); for (const auto &index : indexList) QVERIFY(selection.isSelected(index)); } @@ -2347,11 +2347,11 @@ void tst_QItemSelectionModel::layoutChangedTreeSelection() selModel.select(sub23.index(), QItemSelectionModel::Select); QModelIndexList list = selModel.selectedIndexes(); - QCOMPARE(list.count(), 4); + QCOMPARE(list.size(), 4); model.sort(0); //this will provoke a relayout - QCOMPARE(selModel.selectedIndexes().count(), 4); + QCOMPARE(selModel.selectedIndexes().size(), 4); } class RemovalObserver : public QObject @@ -2410,7 +2410,7 @@ void tst_QItemSelectionModel::setModel() QStringListModel model(QStringList() << "Blah" << "Blah" << "Blah"); sel.setModel(&model); QCOMPARE(sel.model(), &model); - QCOMPARE(modelChangedSpy.count(), 1); + QCOMPARE(modelChangedSpy.size(), 1); sel.select(model.index(0), QItemSelectionModel::Select); QVERIFY(!sel.selection().isEmpty()); sel.setModel(0); @@ -2777,7 +2777,7 @@ void tst_QItemSelectionModel::QTBUG58851() QVERIFY(selections.isSelected(i)); } proxy.sort(1, Qt::DescendingOrder); - QCOMPARE(selections.selectedIndexes().count(), (int)expectedSelectedIndexes.size()); + QCOMPARE(selections.selectedIndexes().size(), (int)expectedSelectedIndexes.size()); for (const QPersistentModelIndex &i : expectedSelectedIndexes) { QVERIFY(selections.isSelected(i)); } @@ -2851,12 +2851,12 @@ void tst_QItemSelectionModel::QTBUG18001() QItemSelectionModel selectionModel(&model); - for (int i = 0; i < indexesToSelect.count(); ++i) { + for (int i = 0; i < indexesToSelect.size(); ++i) { QModelIndex idx = model.index( indexesToSelect.at(i).first, indexesToSelect.at(i).second ); selectionModel.select(idx, QItemSelectionModel::SelectionFlag(selectionCommands.at(i))); } - for (int i = 0; i < expectedSelectedRows.count(); ++i) { + for (int i = 0; i < expectedSelectedRows.size(); ++i) { const bool expected = expectedSelectedRows.at(i); const bool actual = selectionModel.isRowSelected(i, QModelIndex()); QByteArray description = QByteArray("Row ") + QByteArray::number(i) @@ -2865,7 +2865,7 @@ void tst_QItemSelectionModel::QTBUG18001() QVERIFY2(expected == actual, description.data()); } - for (int i = 0; i < expectedSelectedColums.count(); ++i) { + for (int i = 0; i < expectedSelectedColums.size(); ++i) { const bool expected = expectedSelectedColums.at(i); const bool actual = selectionModel.isColumnSelected(i, QModelIndex()); QByteArray description = QByteArray("Col ") + QByteArray::number(i) @@ -2888,7 +2888,7 @@ void tst_QItemSelectionModel::QTBUG93305() QModelIndex index = model->index(1, 0, QModelIndex()); selection->select(index, QItemSelectionModel::ClearAndSelect); QVERIFY(selection->hasSelection()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // removing row 0 does not change which cells are selected, but it // does change the row number of the selected cells. Thus it changes @@ -2899,7 +2899,7 @@ void tst_QItemSelectionModel::QTBUG93305() // delete row 0 model->removeRows(0, 1, QModelIndex()); QVERIFY(selection->hasSelection()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); // inserting a row before the first row again does not change which cells // are selected, but does change the row number of the selected cells. @@ -2909,12 +2909,12 @@ void tst_QItemSelectionModel::QTBUG93305() // insert row 0 again model->insertRows(0, 1, QModelIndex()); QVERIFY(selection->hasSelection()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); // test for inserting multiple (6) rows model->insertRows(0, 6, QModelIndex()); QVERIFY(selection->hasSelection()); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); } QTEST_MAIN(tst_QItemSelectionModel) diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index d89c1fe004..43651a8d7a 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -216,16 +216,16 @@ void tst_QSortFilterProxyModel::sort() // prepare model QStandardItem *root = m_model->invisibleRootItem (); QList items; - for (int i = 0; i < initial.count(); ++i) { + for (int i = 0; i < initial.size(); ++i) { items.append(new QStandardItem(initial.at(i))); } root->insertRows(0, items); - QCOMPARE(m_model->rowCount(QModelIndex()), initial.count()); + QCOMPARE(m_model->rowCount(QModelIndex()), initial.size()); QCOMPARE(m_model->columnCount(QModelIndex()), 1); // make sure the proxy is unsorted QCOMPARE(m_proxy->columnCount(QModelIndex()), 1); - QCOMPARE(m_proxy->rowCount(QModelIndex()), initial.count()); + QCOMPARE(m_proxy->rowCount(QModelIndex()), initial.size()); for (int row = 0; row < m_proxy->rowCount(QModelIndex()); ++row) { QModelIndex index = m_proxy->index(row, 0, QModelIndex()); QCOMPARE(m_proxy->data(index, Qt::DisplayRole).toString(), initial.at(row)); @@ -413,10 +413,10 @@ void tst_QSortFilterProxyModel::insertRows() QFETCH(QStringList, insert); QFETCH(int, position); // prepare model - m_model->insertRows(0, initial.count(), QModelIndex()); + m_model->insertRows(0, initial.size(), QModelIndex()); //m_model->insertColumns(0, 1, QModelIndex()); QCOMPARE(m_model->columnCount(QModelIndex()), 1); - QCOMPARE(m_model->rowCount(QModelIndex()), initial.count()); + QCOMPARE(m_model->rowCount(QModelIndex()), initial.size()); for (int row = 0; row < m_model->rowCount(QModelIndex()); ++row) { QModelIndex index = m_model->index(row, 0, QModelIndex()); m_model->setData(index, initial.at(row), Qt::DisplayRole); @@ -433,12 +433,12 @@ void tst_QSortFilterProxyModel::insertRows() } // insert the row - m_proxy->insertRows(position, insert.count(), QModelIndex()); - QCOMPARE(m_model->rowCount(QModelIndex()), expected.count()); - QCOMPARE(m_proxy->rowCount(QModelIndex()), expected.count()); + m_proxy->insertRows(position, insert.size(), QModelIndex()); + QCOMPARE(m_model->rowCount(QModelIndex()), expected.size()); + QCOMPARE(m_proxy->rowCount(QModelIndex()), expected.size()); // set the data for the inserted row - for (int i = 0; i < insert.count(); ++i) { + for (int i = 0; i < insert.size(); ++i) { QModelIndex index = m_proxy->index(position + i, 0, QModelIndex()); m_proxy->setData(index, insert.at(i), Qt::DisplayRole); } @@ -827,8 +827,8 @@ void tst_QSortFilterProxyModel::removeRows() // remove the rows QCOMPARE(proxy.removeRows(position, count, QModelIndex()), success); - QCOMPARE(model.rowCount(QModelIndex()), expectedSource.count()); - QCOMPARE(proxy.rowCount(QModelIndex()), expectedProxy.count()); + QCOMPARE(model.rowCount(QModelIndex()), expectedSource.size()); + QCOMPARE(proxy.rowCount(QModelIndex()), expectedProxy.size()); // make sure the model is correct after remove for (int row = 0; row < model.rowCount(QModelIndex()); ++row) @@ -1073,8 +1073,8 @@ void tst_QSortFilterProxyModel::removeColumns() // remove the columns QCOMPARE(proxy.removeColumns(position, count, QModelIndex()), success); - QCOMPARE(model.columnCount(QModelIndex()), expectedSource.count()); - QCOMPARE(proxy.columnCount(QModelIndex()), expectedProxy.count()); + QCOMPARE(model.columnCount(QModelIndex()), expectedSource.size()); + QCOMPARE(proxy.columnCount(QModelIndex()), expectedProxy.size()); // make sure the model is correct after remove for (int col = 0; col < model.columnCount(QModelIndex()); ++col) @@ -1124,9 +1124,9 @@ void tst_QSortFilterProxyModel::filterColumns() QFETCH(QStringList, initial); QFETCH(bool, data); // prepare model - m_model->setColumnCount(initial.count()); + m_model->setColumnCount(initial.size()); m_model->setRowCount(1); - QCOMPARE(m_model->columnCount(QModelIndex()), initial.count()); + QCOMPARE(m_model->columnCount(QModelIndex()), initial.size()); QCOMPARE(m_model->rowCount(QModelIndex()), 1); // set data QCOMPARE(m_model->rowCount(QModelIndex()), 1); @@ -1203,8 +1203,8 @@ void tst_QSortFilterProxyModel::filter() QFETCH(QStringList, expected); // prepare model - QVERIFY(m_model->insertRows(0, initial.count(), QModelIndex())); - QCOMPARE(m_model->rowCount(QModelIndex()), initial.count()); + QVERIFY(m_model->insertRows(0, initial.size(), QModelIndex())); + QCOMPARE(m_model->rowCount(QModelIndex()), initial.size()); // set data QCOMPARE(m_model->columnCount(QModelIndex()), 1); for (int row = 0; row < m_model->rowCount(QModelIndex()); ++row) { @@ -1214,7 +1214,7 @@ void tst_QSortFilterProxyModel::filter() setupFilter(m_proxy, pattern); // make sure the proxy is unfiltered QCOMPARE(m_proxy->columnCount(QModelIndex()), 1); - QCOMPARE(m_proxy->rowCount(QModelIndex()), expected.count()); + QCOMPARE(m_proxy->rowCount(QModelIndex()), expected.size()); // make sure the model is unchanged for (int row = 0; row < m_model->rowCount(QModelIndex()); ++row) { QModelIndex index = m_model->index(row, 0, QModelIndex()); @@ -1262,7 +1262,7 @@ void tst_QSortFilterProxyModel::buildHierarchy(const QStringList &l, QAbstractIt QStack row_stack; QModelIndex parent; QStack parent_stack; - for (int i = 0; i < l.count(); ++i) { + for (int i = 0; i < l.size(); ++i) { QString token = l.at(i); if (token == QLatin1String("<")) { // start table ++ind; @@ -1292,7 +1292,7 @@ void tst_QSortFilterProxyModel::checkHierarchy(const QStringList &l, const QAbst QStack row_stack; QModelIndex parent; QStack parent_stack; - for (int i = 0; i < l.count(); ++i) { + for (int i = 0; i < l.size(); ++i) { QString token = l.at(i); if (token == QLatin1String("<")) { // start table ++indent; @@ -1402,9 +1402,9 @@ void tst_QSortFilterProxyModel::filterCurrent() QVERIFY(spy.isValid()); view.setCurrentIndex(proxy.index(0, 0)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); setupFilter(&proxy, QLatin1String("^B")); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QSortFilterProxyModel::filter_qtbug30662() @@ -1472,7 +1472,7 @@ void tst_QSortFilterProxyModel::changeSourceLayoutFilteredOut() // Filter everything out setupFilter(&proxy, QLatin1String("c")); - QCOMPARE(removeSpy.count(), 1); + QCOMPARE(removeSpy.size(), 1); QCOMPARE(0, proxy.rowCount()); // change layout of source model @@ -1482,7 +1482,7 @@ void tst_QSortFilterProxyModel::changeSourceLayoutFilteredOut() // Remove filter; we expect an insert setupFilter(&proxy, ""); - QCOMPARE(insertSpy.count(), 1); + QCOMPARE(insertSpy.size(), 1); QCOMPARE(beforeSortFilter, proxy.rowCount()); } @@ -1561,9 +1561,9 @@ void tst_QSortFilterProxyModel::removeSourceRows() proxy.setSourceModel(&model); model.insertColumns(0, 1); - model.insertRows(0, sourceItems.count()); + model.insertRows(0, sourceItems.size()); - for (int i = 0; i < sourceItems.count(); ++i) { + for (int i = 0; i < sourceItems.size(); ++i) { QModelIndex sindex = model.index(i, 0, QModelIndex()); model.setData(sindex, sourceItems.at(i), Qt::DisplayRole); QModelIndex pindex = proxy.index(i, 0, QModelIndex()); @@ -1586,16 +1586,16 @@ void tst_QSortFilterProxyModel::removeSourceRows() model.removeRows(start, count, QModelIndex()); - QCOMPARE(aboutToRemoveSpy.count(), expectedRemovedProxyIntervals.count()); - for (int i = 0; i < aboutToRemoveSpy.count(); ++i) { + QCOMPARE(aboutToRemoveSpy.size(), expectedRemovedProxyIntervals.size()); + for (int i = 0; i < aboutToRemoveSpy.size(); ++i) { const auto &args = aboutToRemoveSpy.at(i); QCOMPARE(args.at(1).userType(), QMetaType::Int); QCOMPARE(args.at(2).userType(), QMetaType::Int); QCOMPARE(args.at(1).toInt(), expectedRemovedProxyIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), expectedRemovedProxyIntervals.at(i).second); } - QCOMPARE(removeSpy.count(), expectedRemovedProxyIntervals.count()); - for (int i = 0; i < removeSpy.count(); ++i) { + QCOMPARE(removeSpy.size(), expectedRemovedProxyIntervals.size()); + for (int i = 0; i < removeSpy.size(); ++i) { const auto &args = removeSpy.at(i); QCOMPARE(args.at(1).userType(), QMetaType::Int); QCOMPARE(args.at(2).userType(), QMetaType::Int); @@ -1603,11 +1603,11 @@ void tst_QSortFilterProxyModel::removeSourceRows() QCOMPARE(args.at(2).toInt(), expectedRemovedProxyIntervals.at(i).second); } - QCOMPARE(insertSpy.count(), 0); - QCOMPARE(aboutToInsertSpy.count(), 0); + QCOMPARE(insertSpy.size(), 0); + QCOMPARE(aboutToInsertSpy.size(), 0); - QCOMPARE(proxy.rowCount(QModelIndex()), expectedProxyItems.count()); - for (int i = 0; i < expectedProxyItems.count(); ++i) { + QCOMPARE(proxy.rowCount(QModelIndex()), expectedProxyItems.size()); + for (int i = 0; i < expectedProxyItems.size(); ++i) { QModelIndex pindex = proxy.index(i, 0, QModelIndex()); QCOMPARE(proxy.data(pindex, Qt::DisplayRole).toString(), expectedProxyItems.at(i)); } @@ -1654,9 +1654,9 @@ void tst_QSortFilterProxyModel::insertSourceRows() proxy.setSourceModel(&model); model.insertColumns(0, 1); - model.insertRows(0, sourceItems.count()); + model.insertRows(0, sourceItems.size()); - for (int i = 0; i < sourceItems.count(); ++i) { + for (int i = 0; i < sourceItems.size(); ++i) { QModelIndex index = model.index(i, 0, QModelIndex()); model.setData(index, sourceItems.at(i), Qt::DisplayRole); } @@ -1666,13 +1666,13 @@ void tst_QSortFilterProxyModel::insertSourceRows() model.insertRows(start, newItems.size(), QModelIndex()); - QCOMPARE(proxy.rowCount(QModelIndex()), proxyItems.count()); - for (int i = 0; i < newItems.count(); ++i) { + QCOMPARE(proxy.rowCount(QModelIndex()), proxyItems.size()); + for (int i = 0; i < newItems.size(); ++i) { QModelIndex index = model.index(start + i, 0, QModelIndex()); model.setData(index, newItems.at(i), Qt::DisplayRole); } - for (int i = 0; i < proxyItems.count(); ++i) { + for (int i = 0; i < proxyItems.size(); ++i) { QModelIndex index = proxy.index(i, 0, QModelIndex()); QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), proxyItems.at(i)); } @@ -1745,9 +1745,9 @@ void tst_QSortFilterProxyModel::changeFilter() proxy.setSourceModel(&model); model.insertColumns(0, 1); - model.insertRows(0, sourceItems.count()); + model.insertRows(0, sourceItems.size()); - for (int i = 0; i < sourceItems.count(); ++i) { + for (int i = 0; i < sourceItems.size(); ++i) { QModelIndex index = model.index(i, 0, QModelIndex()); model.setData(index, sourceItems.at(i), Qt::DisplayRole); } @@ -1763,9 +1763,9 @@ void tst_QSortFilterProxyModel::changeFilter() setupFilter(&proxy, initialFilter); - QCOMPARE(initialRemoveSpy.count(), initialRemoveIntervals.count()); - QCOMPARE(initialInsertSpy.count(), 0); - for (int i = 0; i < initialRemoveSpy.count(); ++i) { + QCOMPARE(initialRemoveSpy.size(), initialRemoveIntervals.size()); + QCOMPARE(initialInsertSpy.size(), 0); + for (int i = 0; i < initialRemoveSpy.size(); ++i) { const auto &args = initialRemoveSpy.at(i); QCOMPARE(args.at(1).userType(), QMetaType::Int); QCOMPARE(args.at(2).userType(), QMetaType::Int); @@ -1773,8 +1773,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(args.at(2).toInt(), initialRemoveIntervals.at(i).second); } - QCOMPARE(proxy.rowCount(QModelIndex()), initialProxyItems.count()); - for (int i = 0; i < initialProxyItems.count(); ++i) { + QCOMPARE(proxy.rowCount(QModelIndex()), initialProxyItems.size()); + for (int i = 0; i < initialProxyItems.size(); ++i) { QModelIndex index = proxy.index(i, 0, QModelIndex()); QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), initialProxyItems.at(i)); } @@ -1787,8 +1787,8 @@ void tst_QSortFilterProxyModel::changeFilter() setupFilter(&proxy, finalFilter); - QCOMPARE(finalRemoveSpy.count(), finalRemoveIntervals.count()); - for (int i = 0; i < finalRemoveSpy.count(); ++i) { + QCOMPARE(finalRemoveSpy.size(), finalRemoveIntervals.size()); + for (int i = 0; i < finalRemoveSpy.size(); ++i) { const auto &args = finalRemoveSpy.at(i); QCOMPARE(args.at(1).userType(), QMetaType::Int); QCOMPARE(args.at(2).userType(), QMetaType::Int); @@ -1796,8 +1796,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(args.at(2).toInt(), finalRemoveIntervals.at(i).second); } - QCOMPARE(finalInsertSpy.count(), insertIntervals.count()); - for (int i = 0; i < finalInsertSpy.count(); ++i) { + QCOMPARE(finalInsertSpy.size(), insertIntervals.size()); + for (int i = 0; i < finalInsertSpy.size(); ++i) { const auto &args = finalInsertSpy.at(i); QCOMPARE(args.at(1).userType(), QMetaType::Int); QCOMPARE(args.at(2).userType(), QMetaType::Int); @@ -1805,8 +1805,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(args.at(2).toInt(), insertIntervals.at(i).second); } - QCOMPARE(proxy.rowCount(QModelIndex()), finalProxyItems.count()); - for (int i = 0; i < finalProxyItems.count(); ++i) { + QCOMPARE(proxy.rowCount(QModelIndex()), finalProxyItems.size()); + for (int i = 0; i < finalProxyItems.size(); ++i) { QModelIndex index = proxy.index(i, 0, QModelIndex()); QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), finalProxyItems.at(i)); } @@ -1969,9 +1969,9 @@ void tst_QSortFilterProxyModel::changeSourceData() proxy.setDynamicSortFilter(dynamic); proxy.setSourceModel(&model); model.insertColumns(0, 1); - model.insertRows(0, sourceItems.count()); + model.insertRows(0, sourceItems.size()); - for (int i = 0; i < sourceItems.count(); ++i) { + for (int i = 0; i < sourceItems.size(); ++i) { QModelIndex index = model.index(i, 0, QModelIndex()); model.setData(index, sourceItems.at(i), Qt::DisplayRole); } @@ -1981,8 +1981,8 @@ void tst_QSortFilterProxyModel::changeSourceData() setupFilter(&proxy, filter); - QCOMPARE(proxy.rowCount(), expectedInitialProxyItems.count()); - for (int i = 0; i < expectedInitialProxyItems.count(); ++i) { + QCOMPARE(proxy.rowCount(), expectedInitialProxyItems.size()); + for (int i = 0; i < expectedInitialProxyItems.size(); ++i) { const QModelIndex index = proxy.index(i, 0, QModelIndex()); QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), expectedInitialProxyItems.at(i)); } @@ -2002,8 +2002,8 @@ void tst_QSortFilterProxyModel::changeSourceData() model.setData(index, newValue, Qt::DisplayRole); } - QCOMPARE(removeSpy.count(), removeIntervals.count()); - for (int i = 0; i < removeSpy.count(); ++i) { + QCOMPARE(removeSpy.size(), removeIntervals.size()); + for (int i = 0; i < removeSpy.size(); ++i) { const auto &args = removeSpy.at(i); QCOMPARE(args.at(1).userType(), QMetaType::Int); QCOMPARE(args.at(2).userType(), QMetaType::Int); @@ -2011,8 +2011,8 @@ void tst_QSortFilterProxyModel::changeSourceData() QCOMPARE(args.at(2).toInt(), removeIntervals.at(i).second); } - QCOMPARE(insertSpy.count(), insertIntervals.count()); - for (int i = 0; i < insertSpy.count(); ++i) { + QCOMPARE(insertSpy.size(), insertIntervals.size()); + for (int i = 0; i < insertSpy.size(); ++i) { const auto &args = insertSpy.at(i); QCOMPARE(args.at(1).userType(), QMetaType::Int); QCOMPARE(args.at(2).userType(), QMetaType::Int); @@ -2020,29 +2020,29 @@ void tst_QSortFilterProxyModel::changeSourceData() QCOMPARE(args.at(2).toInt(), insertIntervals.at(i).second); } - QCOMPARE(proxy.rowCount(QModelIndex()), proxyItems.count()); - for (int i = 0; i < proxyItems.count(); ++i) { + QCOMPARE(proxy.rowCount(QModelIndex()), proxyItems.size()); + for (int i = 0; i < proxyItems.size(); ++i) { QModelIndex index = proxy.index(i, 0, QModelIndex()); QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), proxyItems.at(i)); } if (expectedDataChangedRow == -1) { - QCOMPARE(dataChangedSpy.count(), 0); + QCOMPARE(dataChangedSpy.size(), 0); } else { - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); const QModelIndex idx = dataChangedSpy.at(0).at(0).value(); QCOMPARE(idx.row(), expectedDataChangedRow); QCOMPARE(idx.column(), 0); } - QCOMPARE(layoutChangedSpy.count(), expectedLayoutChanged ? 1 : 0); + QCOMPARE(layoutChangedSpy.size(), expectedLayoutChanged ? 1 : 0); } // Checks that the model is a table, and that each and every row is like this: // i-th row: ( rows.at(i), i ) static void checkSortedTableModel(const QAbstractItemModel *model, const QStringList &rows) { - QCOMPARE(model->rowCount(), rows.length()); + QCOMPARE(model->rowCount(), rows.size()); QCOMPARE(model->columnCount(), 2); for (int row = 0; row < model->rowCount(); ++row) { @@ -2066,7 +2066,7 @@ void tst_QSortFilterProxyModel::changeSourceDataKeepsStableSorting_qtbug1548() // Build a table of pairs (string, #row) in each row QStandardItemModel model(0, 2); - for (int rowNumber = 0; rowNumber < rows.length(); ++rowNumber) { + for (int rowNumber = 0; rowNumber < rows.size(); ++rowNumber) { QStandardItem *column0 = new QStandardItem(rows.at(rowNumber)); column0->setCheckable(true); column0->setCheckState(Qt::Unchecked); @@ -2120,7 +2120,7 @@ void tst_QSortFilterProxyModel::changeSourceDataForwardsRoles_qtbug35440() QSignalSpy spy(&proxy, &QAbstractItemModel::dataChanged); QVERIFY(spy.isValid()); - QCOMPARE(spy.length(), 0); + QCOMPARE(spy.size(), 0); QModelIndex index; @@ -2133,13 +2133,13 @@ void tst_QSortFilterProxyModel::changeSourceDataForwardsRoles_qtbug35440() index = model.index(0, 0); QVERIFY(index.isValid()); model.setData(index, QStringLiteral("teststring"), Qt::DisplayRole); - QCOMPARE(spy.length(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(2).value >(), expectedChangedRoles); index = model.index(1, 0); QVERIFY(index.isValid()); model.setData(index, QStringLiteral("teststring2"), Qt::EditRole); - QCOMPARE(spy.length(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(1).at(2).value >(), expectedChangedRoles); } @@ -2439,10 +2439,10 @@ void tst_QSortFilterProxyModel::selectionFilteredOut() QVERIFY(spy.isValid()); view.setCurrentIndex(proxy.index(0, 0)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); setupFilter(&proxy, QLatin1String("^B")); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QSortFilterProxyModel::match_data() @@ -2519,9 +2519,9 @@ void tst_QSortFilterProxyModel::match() proxy.setSourceModel(&model); model.insertColumns(0, 1); - model.insertRows(0, sourceItems.count()); + model.insertRows(0, sourceItems.size()); - for (int i = 0; i < sourceItems.count(); ++i) { + for (int i = 0; i < sourceItems.size(); ++i) { QModelIndex index = model.index(i, 0, QModelIndex()); model.setData(index, sourceItems.at(i), Qt::DisplayRole); } @@ -2531,10 +2531,10 @@ void tst_QSortFilterProxyModel::match() QModelIndex startIndex = proxy.index(proxyStartRow, 0); QModelIndexList indexes = proxy.match(startIndex, Qt::DisplayRole, what, - expectedProxyItems.count(), + expectedProxyItems.size(), matchFlags); - QCOMPARE(indexes.count(), expectedProxyItems.count()); - for (int i = 0; i < indexes.count(); ++i) + QCOMPARE(indexes.size(), expectedProxyItems.size()); + for (int i = 0; i < indexes.size(); ++i) QCOMPARE(indexes.at(i).row(), expectedProxyItems.at(i)); } @@ -2597,13 +2597,13 @@ void tst_QSortFilterProxyModel::insertIntoChildrenlessItem() QVERIFY(rowsInsertedSpy.isValid()); (void)proxy.rowCount(QModelIndex()); // force mapping of "a", "b", "c" - QCOMPARE(colsInsertedSpy.count(), 0); - QCOMPARE(rowsInsertedSpy.count(), 0); + QCOMPARE(colsInsertedSpy.size(), 0); + QCOMPARE(rowsInsertedSpy.size(), 0); // now add a child to itemB ==> should get insert notification from the proxy itemB->appendRow(new QStandardItem("a.0")); - QCOMPARE(colsInsertedSpy.count(), 1); - QCOMPARE(rowsInsertedSpy.count(), 1); + QCOMPARE(colsInsertedSpy.size(), 1); + QCOMPARE(rowsInsertedSpy.size(), 1); QVariantList args = colsInsertedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), proxy.mapFromSource(itemB->index())); @@ -2679,11 +2679,11 @@ void tst_QSortFilterProxyModel::insertRowIntoFilteredParent() QStandardItem *itemB = new QStandardItem(); itemA->appendRow(itemB); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); itemA->removeRow(0); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QSortFilterProxyModel::filterOutParentAndFilterInChild() @@ -2710,9 +2710,9 @@ void tst_QSortFilterProxyModel::filterOutParentAndFilterInChild() setupFilter(&proxy, QLatin1String("C")); // A and B will be filtered out, C filtered in // we should now have been notified that the subtree represented by itemA has been removed - QCOMPARE(removedSpy.count(), 1); + QCOMPARE(removedSpy.size(), 1); // we should NOT get any inserts; itemC should be filtered because its parent (itemA) is - QCOMPARE(insertedSpy.count(), 0); + QCOMPARE(insertedSpy.size(), 0); } void tst_QSortFilterProxyModel::sourceInsertRows() @@ -2897,16 +2897,16 @@ void tst_QSortFilterProxyModel::staticSorting() // prepare model QStandardItem *root = model.invisibleRootItem (); QList items; - for (int i = 0; i < initial.count(); ++i) { + for (int i = 0; i < initial.size(); ++i) { items.append(new QStandardItem(initial.at(i))); } root->insertRows(0, items); - QCOMPARE(model.rowCount(QModelIndex()), initial.count()); + QCOMPARE(model.rowCount(QModelIndex()), initial.size()); QCOMPARE(model.columnCount(QModelIndex()), 1); // make sure the proxy is unsorted QCOMPARE(proxy.columnCount(QModelIndex()), 1); - QCOMPARE(proxy.rowCount(QModelIndex()), initial.count()); + QCOMPARE(proxy.rowCount(QModelIndex()), initial.size()); for (int row = 0; row < proxy.rowCount(QModelIndex()); ++row) { QModelIndex index = proxy.index(row, 0, QModelIndex()); QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), initial.at(row)); @@ -2956,7 +2956,7 @@ void tst_QSortFilterProxyModel::dynamicSorting() QCOMPARE(proxy1.columnCount(QModelIndex()), 1); //the model should not be sorted because sorting has not been set to dynamic yet. - QCOMPARE(proxy1.rowCount(QModelIndex()), initial.count()); + QCOMPARE(proxy1.rowCount(QModelIndex()), initial.size()); for (int row = 0; row < proxy1.rowCount(QModelIndex()); ++row) { QModelIndex index = proxy1.index(row, 0, QModelIndex()); QCOMPARE(proxy1.data(index, Qt::DisplayRole).toString(), initial.at(row)); @@ -3266,7 +3266,7 @@ void tst_QSortFilterProxyModel::doubleProxySelectionSetSourceModel() QItemSelectionModel ism(proxyModel); ism.select(mi, QItemSelectionModel::Select); QModelIndexList mil = ism.selectedIndexes(); - QCOMPARE(mil.count(), 1); + QCOMPARE(mil.size(), 1); QCOMPARE(mil.first(), mi); toggleProxy->setSourceModel(model2); @@ -3337,10 +3337,10 @@ void tst_QSortFilterProxyModel::appearsAndSort() QCOMPARE(secondProxyModel.data(secondProxyModel.index(1,0), Qt::DisplayRole).toString(), QString::fromLatin1("b")); QCOMPARE(secondProxyModel.data(secondProxyModel.index(2,0), Qt::DisplayRole).toString(), QString::fromLatin1("a")); - QCOMPARE(spyAbout1.count(), 1); - QCOMPARE(spyChanged1.count(), 1); - QCOMPARE(spyAbout2.count(), 1); - QCOMPARE(spyChanged2.count(), 1); + QCOMPARE(spyAbout1.size(), 1); + QCOMPARE(spyChanged1.size(), 1); + QCOMPARE(spyAbout2.size(), 1); + QCOMPARE(spyChanged2.size(), 1); } void tst_QSortFilterProxyModel::unnecessaryDynamicSorting() @@ -4647,7 +4647,7 @@ public: return lst.at(index.row()); return QVariant(); } - int rowCount(const QModelIndex & = QModelIndex()) const override { return lst.count(); } + int rowCount(const QModelIndex & = QModelIndex()) const override { return lst.size(); } void replaceData(const QStringList &newData) { @@ -4788,7 +4788,7 @@ void tst_QSortFilterProxyModel::removeIntervals() model.replaceData(sourceItems); proxy.setSourceModel(&model); - for (int i = 0; i < sourceItems.count(); ++i) { + for (int i = 0; i < sourceItems.size(); ++i) { QModelIndex sindex = model.index(i, 0, QModelIndex()); QModelIndex pindex = proxy.index(i, 0, QModelIndex()); QCOMPARE(proxy.data(pindex, Qt::DisplayRole), model.data(sindex, Qt::DisplayRole)); @@ -4813,16 +4813,16 @@ void tst_QSortFilterProxyModel::removeIntervals() model.replaceData(replacementSourceItems); - QCOMPARE(aboutToRemoveSpy.count(), expectedRemovedProxyIntervals.count()); - for (int i = 0; i < aboutToRemoveSpy.count(); ++i) { + QCOMPARE(aboutToRemoveSpy.size(), expectedRemovedProxyIntervals.size()); + for (int i = 0; i < aboutToRemoveSpy.size(); ++i) { const auto &args = aboutToRemoveSpy.at(i); QCOMPARE(args.at(1).userType(), QMetaType::Int); QCOMPARE(args.at(2).userType(), QMetaType::Int); QCOMPARE(args.at(1).toInt(), expectedRemovedProxyIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), expectedRemovedProxyIntervals.at(i).second); } - QCOMPARE(removeSpy.count(), expectedRemovedProxyIntervals.count()); - for (int i = 0; i < removeSpy.count(); ++i) { + QCOMPARE(removeSpy.size(), expectedRemovedProxyIntervals.size()); + for (int i = 0; i < removeSpy.size(); ++i) { const auto &args = removeSpy.at(i); QCOMPARE(args.at(1).userType(), QMetaType::Int); QCOMPARE(args.at(2).userType(), QMetaType::Int); @@ -4830,11 +4830,11 @@ void tst_QSortFilterProxyModel::removeIntervals() QCOMPARE(args.at(2).toInt(), expectedRemovedProxyIntervals.at(i).second); } - QCOMPARE(insertSpy.count(), 0); - QCOMPARE(aboutToInsertSpy.count(), 0); + QCOMPARE(insertSpy.size(), 0); + QCOMPARE(aboutToInsertSpy.size(), 0); - QCOMPARE(proxy.rowCount(QModelIndex()), expectedProxyItems.count()); - for (int i = 0; i < expectedProxyItems.count(); ++i) { + QCOMPARE(proxy.rowCount(QModelIndex()), expectedProxyItems.size()); + for (int i = 0; i < expectedProxyItems.size(); ++i) { QModelIndex pindex = proxy.index(i, 0, QModelIndex()); QCOMPARE(proxy.data(pindex, Qt::DisplayRole).toString(), expectedProxyItems.at(i)); } @@ -4861,7 +4861,7 @@ void tst_QSortFilterProxyModel::dynamicFilterWithoutSort() QCOMPARE(model.stringList(), QStringList() << "Monday" << "Tuesday" << "Wednesday" << "Thursday" << "Friday"); - QCOMPARE(resetSpy.count(), 1); + QCOMPARE(resetSpy.size(), 1); } void tst_QSortFilterProxyModel::checkSetNewModel() @@ -5114,7 +5114,7 @@ void tst_QSortFilterProxyModel::filterAndInsertRow() QVERIFY(proxyModel.insertRow(row)); QCOMPARE(model.stringList(), expectedModelList); - QCOMPARE(proxyModel.rowCount(), expectedProxyModelList.count()); + QCOMPARE(proxyModel.rowCount(), expectedProxyModelList.size()); for (int r = 0; r < proxyModel.rowCount(); ++r) { QModelIndex index = proxyModel.index(r, 0); QVERIFY(index.isValid()); @@ -5387,7 +5387,7 @@ void tst_QSortFilterProxyModel::filterCaseSensitivityBinding() QRegularExpression regExp("pattern", QRegularExpression::CaseInsensitiveOption); proxyModel.setFilterRegularExpression(regExp); QCOMPARE(proxyModel.filterCaseSensitivity(), Qt::CaseInsensitive); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(!proxyModel.bindableFilterCaseSensitivity().hasBinding()); } diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/tst_qsortfilterproxymodel_regularexpression.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/tst_qsortfilterproxymodel_regularexpression.cpp index bce7b1733d..b99269d81c 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/tst_qsortfilterproxymodel_regularexpression.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/tst_qsortfilterproxymodel_regularexpression.cpp @@ -118,12 +118,12 @@ void tst_QSortFilterProxyModelRegularExpression::tst_regexCaseSensitivityNotific QSortFilterProxyModel proxy; QSignalSpy spy(&proxy, &QSortFilterProxyModel::filterCaseSensitivityChanged); proxy.setFilterCaseSensitivity(Qt::CaseInsensitive); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QRegularExpression re("regex"); QVERIFY(!re.patternOptions().testFlag(QRegularExpression::CaseInsensitiveOption)); proxy.setFilterRegularExpression(re); QCOMPARE(proxy.filterCaseSensitivity(), Qt::CaseSensitive); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } QTEST_MAIN(tst_QSortFilterProxyModelRegularExpression) diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp index ac2eda0ef0..084b7c5f0c 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp @@ -406,7 +406,7 @@ void tst_QStringListModel::setData_emits_on_change_only() const QModelIndex modelIdx = model.index(0, 0); const QString newStringData = QStringLiteral("test"); QVERIFY(model.setData(modelIdx, newStringData)); - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); const QList spyList = dataChangedSpy.takeFirst(); QCOMPARE(spyList.at(0).value(), modelIdx); QCOMPARE(spyList.at(1).value(), modelIdx); diff --git a/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp b/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp index 353d700e2d..8d34f0a574 100644 --- a/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp @@ -264,8 +264,8 @@ void tst_QTransposeProxyModel::sort() QVERIFY(layoutAboutToBeChangedSpy.isValid()); QPersistentModelIndex firstIndexBeforeSort = proxyModel.index(0, 0); baseModel.sort(0, Qt::AscendingOrder); - QCOMPARE(layoutChangedSpy.count(), 1); - QCOMPARE(layoutAboutToBeChangedSpy.count(), 1); + QCOMPARE(layoutChangedSpy.size(), 1); + QCOMPARE(layoutAboutToBeChangedSpy.size(), 1); QCOMPARE(layoutChangedSpy.takeFirst().at(1).toInt(), int(QAbstractItemModel::HorizontalSortHint)); QCOMPARE(firstIndexBeforeSort.data().toString(), firstItemBeforeSort); for (int i = 0; i < 100; ++i) @@ -298,8 +298,8 @@ void tst_QTransposeProxyModel::removeColumnBase() QVERIFY(model->removeColumn(1, parent)); QCOMPARE(proxy.rowCount(proxy.mapFromSource(parent)), oldRowCount - 1); QCOMPARE(proxy.index(1, 0, proxy.mapFromSource(parent)).data(), expectedNewVal); - QCOMPARE(rowRemoveSpy.count(), 1); - QCOMPARE(rowAboutToBeRemoveSpy.count(), 1); + QCOMPARE(rowRemoveSpy.size(), 1); + QCOMPARE(rowAboutToBeRemoveSpy.size(), 1); for (const auto &spyArgs : {rowRemoveSpy.takeFirst(), rowAboutToBeRemoveSpy.takeFirst()}) { QCOMPARE(spyArgs.at(0).value(), proxy.mapFromSource(parent)); @@ -412,8 +412,8 @@ void tst_QTransposeProxyModel::insertColumnBase() QVERIFY(model->insertColumn(1, parent)); QCOMPARE(proxy.rowCount(proxy.mapFromSource(parent)), oldRowCount + 1); QVERIFY(!proxy.index(1, 0, proxy.mapFromSource(parent)).data().isValid()); - QCOMPARE(rowInsertSpy.count(), 1); - QCOMPARE(rowAboutToBeInsertSpy.count(), 1); + QCOMPARE(rowInsertSpy.size(), 1); + QCOMPARE(rowAboutToBeInsertSpy.size(), 1); for (const auto &spyArgs : {rowInsertSpy.takeFirst(), rowAboutToBeInsertSpy.takeFirst()}) { QCOMPARE(spyArgs.at(0).value(), proxy.mapFromSource(parent)); @@ -450,8 +450,8 @@ void tst_QTransposeProxyModel::removeRowBase() QVERIFY(model->removeRow(1, parent)); QCOMPARE(proxy.columnCount(proxy.mapFromSource(parent)), oldColCount - 1); QCOMPARE(proxy.index(0, 1, proxy.mapFromSource(parent)).data(), expectedNewVal); - QCOMPARE(columnsRemoveSpy.count(), 1); - QCOMPARE(columnsAboutToBeRemoveSpy.count(), 1); + QCOMPARE(columnsRemoveSpy.size(), 1); + QCOMPARE(columnsAboutToBeRemoveSpy.size(), 1); for (const auto &spyArgs : {columnsRemoveSpy.takeFirst(), columnsAboutToBeRemoveSpy.takeFirst()}) { QCOMPARE(spyArgs.at(0).value(), proxy.mapFromSource(parent)); @@ -488,8 +488,8 @@ void tst_QTransposeProxyModel::insertRowBase() QCOMPARE(proxy.columnCount(proxy.mapFromSource(parent)), oldColCount + 1); QVariant result = proxy.index(0, 1, proxy.mapFromSource(parent)).data(); QVERIFY(result.isNull() || (result.metaType().id() == QMetaType::QString && result.toString().isNull())); - QCOMPARE(columnsInsertSpy.count(), 1); - QCOMPARE(columnsAboutToBeInsertSpy.count(), 1); + QCOMPARE(columnsInsertSpy.size(), 1); + QCOMPARE(columnsAboutToBeInsertSpy.size(), 1); for (const auto &spyArgs : {columnsInsertSpy.takeFirst(), columnsAboutToBeInsertSpy.takeFirst()}) { QCOMPARE(spyArgs.at(0).value(), proxy.mapFromSource(parent)); @@ -534,10 +534,10 @@ void tst_QTransposeProxyModel::removeColumnProxy() QCOMPARE(model->rowCount(sourceParent), oldRowCount - 1); QCOMPARE(proxy.index(0, 1, proxyParent).data(), expectedNewVal); QCOMPARE(model->index(1, 0, sourceParent).data(), expectedNewVal); - QCOMPARE(columnsRemoveSpy.count(), 1); - QCOMPARE(columnsAboutToBeRemoveSpy.count(), 1); - QCOMPARE(rowsRemoveSpy.count(), 1); - QCOMPARE(rowsAboutToBeRemoveSpy.count(), 1); + QCOMPARE(columnsRemoveSpy.size(), 1); + QCOMPARE(columnsAboutToBeRemoveSpy.size(), 1); + QCOMPARE(rowsRemoveSpy.size(), 1); + QCOMPARE(rowsAboutToBeRemoveSpy.size(), 1); for (const auto &spyArgs : {columnsRemoveSpy.takeFirst(), columnsAboutToBeRemoveSpy.takeFirst()}) { QCOMPARE(spyArgs.at(0).value(), proxyParent); @@ -589,10 +589,10 @@ void tst_QTransposeProxyModel::insertColumnProxy() QVERIFY(result.isNull() || (result.metaType().id() == QMetaType::QString && result.toString().isNull())); result = model->index(1, 0, sourceParent).data(); QVERIFY(result.isNull() || (result.metaType().id() == QMetaType::QString && result.toString().isNull())); - QCOMPARE(columnsInsertSpy.count(), 1); - QCOMPARE(columnsAboutToBeInsertSpy.count(), 1); - QCOMPARE(rowsInsertSpy.count(), 1); - QCOMPARE(rowsAboutToBeInsertSpy.count(), 1); + QCOMPARE(columnsInsertSpy.size(), 1); + QCOMPARE(columnsAboutToBeInsertSpy.size(), 1); + QCOMPARE(rowsInsertSpy.size(), 1); + QCOMPARE(rowsAboutToBeInsertSpy.size(), 1); for (const auto &spyArgs : {columnsInsertSpy.takeFirst(), columnsAboutToBeInsertSpy.takeFirst()}) { QCOMPARE(spyArgs.at(0).value(), proxyParent); @@ -642,10 +642,10 @@ void tst_QTransposeProxyModel::removeRowProxy() QCOMPARE(model->columnCount(sourceParent), oldColCount - 1); QCOMPARE(proxy.index(1, 0, proxyParent).data(), expectedNewVal); QCOMPARE(model->index(0, 1, sourceParent).data(), expectedNewVal); - QCOMPARE(columnsRemoveSpy.count(), 1); - QCOMPARE(columnsAboutToBeRemoveSpy.count(), 1); - QCOMPARE(rowsRemoveSpy.count(), 1); - QCOMPARE(rowsAboutToBeRemoveSpy.count(), 1); + QCOMPARE(columnsRemoveSpy.size(), 1); + QCOMPARE(columnsAboutToBeRemoveSpy.size(), 1); + QCOMPARE(rowsRemoveSpy.size(), 1); + QCOMPARE(rowsAboutToBeRemoveSpy.size(), 1); for (const auto &spyArgs : {columnsRemoveSpy.takeFirst(), columnsAboutToBeRemoveSpy.takeFirst()}) { QCOMPARE(spyArgs.at(0).value(), sourceParent); @@ -694,10 +694,10 @@ void tst_QTransposeProxyModel::insertRowProxy() QCOMPARE(model->columnCount(sourceParent), oldColCount + 1); QVERIFY(proxy.index(1, 0, proxyParent).data().isNull()); QVERIFY(model->index(0, 1, sourceParent).data().isNull()); - QCOMPARE(columnsInsertSpy.count(), 1); - QCOMPARE(columnsAboutToBeInsertSpy.count(), 1); - QCOMPARE(rowsInsertSpy.count(), 1); - QCOMPARE(rowsAboutToBeInsertSpy.count(), 1); + QCOMPARE(columnsInsertSpy.size(), 1); + QCOMPARE(columnsAboutToBeInsertSpy.size(), 1); + QCOMPARE(rowsInsertSpy.size(), 1); + QCOMPARE(rowsAboutToBeInsertSpy.size(), 1); for (const auto &spyArgs : {columnsInsertSpy.takeFirst(), columnsAboutToBeInsertSpy.takeFirst()}) { QCOMPARE(spyArgs.at(0).value(), sourceParent); @@ -869,8 +869,8 @@ void tst_QTransposeProxyModel::moveRowsBase() QVERIFY(model.moveRows(QModelIndex(), 0, 1, QModelIndex(), 2)); for (int i = 0; i < expectedNewVal.size(); ++i) QCOMPARE(proxy.index(0, i).data(), expectedNewVal.at(i)); - QCOMPARE(columnsMoveSpy.count(), 1); - QCOMPARE(columnsAboutToBeMoveSpy.count(), 1); + QCOMPARE(columnsMoveSpy.size(), 1); + QCOMPARE(columnsAboutToBeMoveSpy.size(), 1); for (const auto &spyArgs : {columnsMoveSpy.takeFirst(), columnsAboutToBeMoveSpy.takeFirst()}) { QVERIFY(!spyArgs.at(0).value().isValid()); @@ -901,10 +901,10 @@ void tst_QTransposeProxyModel::moveColumnsProxy() QCOMPARE(proxy.index(0, i).data(), expectedNewVal.at(i)); for (int i = 0; i < expectedNewVal.size(); ++i) QCOMPARE(model.index(i, 0).data(), expectedNewVal.at(i)); - QCOMPARE(columnsMoveSpy.count(), 1); - QCOMPARE(columnsAboutToBeMoveSpy.count(), 1); - QCOMPARE(rowsMoveSpy.count(), 1); - QCOMPARE(rowsAboutToBeMoveSpy.count(), 1); + QCOMPARE(columnsMoveSpy.size(), 1); + QCOMPARE(columnsAboutToBeMoveSpy.size(), 1); + QCOMPARE(rowsMoveSpy.size(), 1); + QCOMPARE(rowsAboutToBeMoveSpy.size(), 1); for (const auto &spyArgs : {columnsMoveSpy.takeFirst(), columnsAboutToBeMoveSpy.takeFirst(), rowsMoveSpy.takeFirst(),rowsAboutToBeMoveSpy.takeFirst()}) { diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 8ddca93cb7..46d52c2340 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -175,7 +175,7 @@ void tst_QCoreApplication::argc() char *argv[] = { const_cast(QTest::currentAppName()) }; TestApplication app(argc, argv); QCOMPARE(argc, 1); - QCOMPARE(app.arguments().count(), 1); + QCOMPARE(app.arguments().size(), 1); } { @@ -186,7 +186,7 @@ void tst_QCoreApplication::argc() const_cast("arg3") }; TestApplication app(argc, argv); QCOMPARE(argc, 4); - QCOMPARE(app.arguments().count(), 4); + QCOMPARE(app.arguments().size(), 4); } { @@ -194,7 +194,7 @@ void tst_QCoreApplication::argc() char **argv = 0; TestApplication app(argc, argv); QCOMPARE(argc, 0); - QCOMPARE(app.arguments().count(), 0); + QCOMPARE(app.arguments().size(), 0); } { @@ -203,7 +203,7 @@ void tst_QCoreApplication::argc() const_cast("-qmljsdebugger=port:3768,block") }; TestApplication app(argc, argv); QCOMPARE(argc, 1); - QCOMPARE(app.arguments().count(), 1); + QCOMPARE(app.arguments().size(), 1); } } @@ -1021,7 +1021,7 @@ void tst_QCoreApplication::addRemoveLibPaths() TestApplication app(argc, argv); // If libraryPaths only contains currentDir, neither will be in libraryPaths now. - if (paths.length() != 1 && currentDir != paths[0]) { + if (paths.size() != 1 && currentDir != paths[0]) { // Check that modifications stay alive across the creation of an application. QVERIFY(QCoreApplication::libraryPaths().contains(currentDir)); QVERIFY(!QCoreApplication::libraryPaths().contains(paths[0])); diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index 74b08601b7..16437d39f9 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -174,8 +174,8 @@ void tst_QEventLoop::processEvents() // process posted events, QEventLoop::processEvents() should return // true QVERIFY(eventLoop.processEvents()); - QCOMPARE(aboutToBlockSpy.count(), 0); - QCOMPARE(awakeSpy.count(), 1); + QCOMPARE(aboutToBlockSpy.size(), 0); + QCOMPARE(awakeSpy.size(), 1); // allow any session manager to complete its handshake, so that // there are no pending events left. This tests that we are able @@ -196,8 +196,8 @@ void tst_QEventLoop::processEvents() // processEvents is entered. There is no guarantee that that the // processEvents call actually blocked, since the OS may introduce // native events at any time. - QVERIFY(awakeSpy.count() > 0); - QVERIFY(awakeSpy.count() >= aboutToBlockSpy.count()); + QVERIFY(awakeSpy.size() > 0); + QVERIFY(awakeSpy.size() >= aboutToBlockSpy.size()); killTimer(timerId); } @@ -240,7 +240,7 @@ void tst_QEventLoop::exec() QVERIFY(spy.isValid()); thread.cond.wakeOne(); thread.cond.wait(&thread.mutex); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); int v = thread.result1; QCOMPARE(v, 0); @@ -249,7 +249,7 @@ void tst_QEventLoop::exec() thread.cond.wakeOne(); thread.mutex.unlock(); thread.wait(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); v = thread.result2; QCOMPARE(v, -1); } @@ -307,7 +307,7 @@ void tst_QEventLoop::wakeUp() QTimer::singleShot(1000, &eventLoop, SLOT(quit())); (void) eventLoop.exec(); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); thread.quit(); (void) eventLoop.exec(); diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp index e805b7e8cc..4c3bb8532b 100644 --- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp @@ -1928,16 +1928,16 @@ void tst_QMetaObject::invokeTypedefTypes() QSignalSpy spy(&obj, &QtTestCustomObject::sig_custom); QVERIFY(spy.isValid()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); CustomString arg("hello"); QVERIFY(QMetaObject::invokeMethod(&obj, "sig_custom", Q_ARG(CustomString, arg))); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).size(), 1); QCOMPARE(spy.at(0).at(0), QVariant(arg)); spy.clear(); QVERIFY(QMetaObject::invokeMethod(&obj, "sig_custom", arg)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).size(), 1); QCOMPARE(spy.at(0).at(0), QVariant(arg)); } diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 4e231c782a..38c896b6a3 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -1499,7 +1499,7 @@ void tst_QMetaObjectBuilder::usage_signal() QSignalSpy propChangedSpy(testObject.data(), &TestObject::intPropChanged); testObject->emitIntPropChanged(); - QCOMPARE(propChangedSpy.count(), 1); + QCOMPARE(propChangedSpy.size(), 1); QCOMPARE(propChangedSpy.at(0).size(), 1); QCOMPARE(propChangedSpy.at(0).at(0).toInt(), testObject->intProp()); } @@ -1515,7 +1515,7 @@ void tst_QMetaObjectBuilder::usage_property() QSignalSpy propChangedSpy(testObject.data(), &TestObject::intPropChanged); QVERIFY(testObject->intProp() != 123); testObject->setProperty("intProp", 123); - QCOMPARE(propChangedSpy.count(), 1); + QCOMPARE(propChangedSpy.size(), 1); prop = testObject->property("intProp"); QCOMPARE(prop.metaType(), QMetaType(QMetaType::Int)); QCOMPARE(prop.toInt(), 123); diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp index c934952e96..ccbf5484c1 100644 --- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp +++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp @@ -1155,12 +1155,12 @@ void tst_QProperty::qobjectBindableManualNotify() object.fooData.setValueBypassingBindings(42); // there is no change. QCOMPARE(fooChangeCount, 0); - QCOMPARE(fooChangedSpy.count(), 0); + QCOMPARE(fooChangedSpy.size(), 0); // Once we notify manually object.fooData.notify(); // observers are notified and the signal arrives. QCOMPARE(fooChangeCount, 1); - QCOMPARE(fooChangedSpy.count(), 1); + QCOMPARE(fooChangedSpy.size(), 1); // If we set a binding int i = 1; @@ -1169,16 +1169,16 @@ void tst_QProperty::qobjectBindableManualNotify() QCOMPARE(object.foo(), 1); // and the change and signal count are incremented. QCOMPARE(fooChangeCount, 2); - QCOMPARE(fooChangedSpy.count(), 2); + QCOMPARE(fooChangedSpy.size(), 2); // Changing a non-property won't trigger any notification. i = 2; QCOMPARE(fooChangeCount, 2); - QCOMPARE(fooChangedSpy.count(), 2); + QCOMPARE(fooChangedSpy.size(), 2); // Manually triggering the notification object.fooData.notify(); // increments the change count QCOMPARE(fooChangeCount, 3); - QCOMPARE(fooChangedSpy.count(), 3); + QCOMPARE(fooChangedSpy.size(), 3); // but doesn't actually cause a binding reevaluation. QCOMPARE(object.foo(), 1); } @@ -1561,7 +1561,7 @@ void tst_QProperty::compatPropertySignals() tester.setProp2(10); QCOMPARE(prop2Observer.value(), 10); - QCOMPARE(prop2Spy.count(), 1); + QCOMPARE(prop2Spy.size(), 1); QList arguments = prop2Spy.takeFirst(); QCOMPARE(arguments.size(), 1); QCOMPARE(arguments.at(0).metaType().id(), QMetaType::Int); @@ -1577,7 +1577,7 @@ void tst_QProperty::compatPropertySignals() tester.setProp3(5); QCOMPARE(prop3Observer.value(), 5); - QCOMPARE(prop3Spy.count(), 1); + QCOMPARE(prop3Spy.size(), 1); // Compat property with signal, default value, and custom setter. Signal has parameter. QProperty prop4Observer; @@ -1589,7 +1589,7 @@ void tst_QProperty::compatPropertySignals() tester.setProp4(10); QCOMPARE(prop4Observer.value(), 10); - QCOMPARE(prop4Spy.count(), 1); + QCOMPARE(prop4Spy.size(), 1); arguments = prop4Spy.takeFirst(); QCOMPARE(arguments.size(), 1); QCOMPARE(arguments.at(0).metaType().id(), QMetaType::Int); @@ -1598,7 +1598,7 @@ void tst_QProperty::compatPropertySignals() tester.setProp4(42); QCOMPARE(prop4Observer.value(), 42); - QCOMPARE(prop4Spy.count(), 1); + QCOMPARE(prop4Spy.size(), 1); arguments = prop4Spy.takeFirst(); QCOMPARE(arguments.size(), 1); QCOMPARE(arguments.at(0).metaType().id(), QMetaType::Int); @@ -1607,7 +1607,7 @@ void tst_QProperty::compatPropertySignals() tester.setProp4(0); QCOMPARE(prop4Observer.value(), 42); - QCOMPARE(prop4Spy.count(), 1); + QCOMPARE(prop4Spy.size(), 1); arguments = prop4Spy.takeFirst(); QCOMPARE(arguments.size(), 1); QCOMPARE(arguments.at(0).metaType().id(), QMetaType::Int); diff --git a/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/main.cpp b/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/main.cpp index 968b45aae1..6dc4fde7ca 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/main.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/main.cpp @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) QCoreApplication app(argc, argv); QStringList arguments = app.arguments(); - if (app.arguments().count() != 2) { + if (app.arguments().size() != 2) { qWarning("Please call the helper with the function to call as argument"); return EXIT_FAILURE; } diff --git a/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp index 131fc1f5f5..2bf8a74a1e 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp @@ -122,7 +122,7 @@ void tst_QSharedMemory::cleanup() jail.clear(); keys.append(EXISTING_SHARE); - for (int i = 0; i < keys.count(); ++i) { + for (int i = 0; i < keys.size(); ++i) { QSharedMemory sm(keys.at(i)); if (!sm.create(1024)) { //if (sm.error() != QSharedMemory::KeyError) diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp index 59ef20c6e4..c78650efba 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp @@ -309,8 +309,8 @@ void tst_QSocketNotifier::posixSockets() passive->waitForBytesWritten(5000); QTestEventLoop::instance().enterLoop(3); - QCOMPARE(readSpy.count(), 1); - QCOMPARE(errorSpy.count(), 0); + QCOMPARE(readSpy.size(), 1); + QCOMPARE(errorSpy.size(), 0); char buffer[100]; int r = qt_safe_read(posixSocket, buffer, 100); @@ -324,9 +324,9 @@ void tst_QSocketNotifier::posixSockets() qt_safe_write(posixSocket, "goodbye", 8); QTestEventLoop::instance().enterLoop(3); - QCOMPARE(readSpy.count(), 1); - QCOMPARE(writeSpy.count(), 1); - QCOMPARE(errorSpy.count(), 0); + QCOMPARE(readSpy.size(), 1); + QCOMPARE(writeSpy.size(), 1); + QCOMPARE(errorSpy.size(), 0); // Write notifier may have fired before the read notifier inside // QTcpSocket, give QTcpSocket a chance to see the incoming data @@ -387,7 +387,7 @@ void tst_QSocketNotifier::asyncMultipleDatagram() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); delete m_asyncSender; delete m_asyncReceiver; diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/main.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/main.cpp index 979649d662..b2de1d764c 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/main.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/main.cpp @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) QStringList arguments = app.arguments(); // binary name is not used here arguments.takeFirst(); - if (arguments.count() < 1) { + if (arguments.size() < 1) { qWarning("Please call the helper with the function to call as argument"); return EXIT_FAILURE; } @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) if (function == QLatin1String("acquire")) { int count = 1; bool ok = true; - if (arguments.count()) + if (arguments.size()) count = arguments.takeFirst().toInt(&ok); if (!ok) count = 1; diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 03a6f1b5aa..15e08a50a2 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -84,7 +84,7 @@ void tst_QTimer::zeroTimer() // Pass timeout to work round glib issue, see QTBUG-84291. QCoreApplication::processEvents(QEventLoop::AllEvents, INT_MAX); - QCOMPARE(timeoutSpy.count(), 1); + QCOMPARE(timeoutSpy.size(), 1); } void tst_QTimer::singleShotTimeout() @@ -98,9 +98,9 @@ void tst_QTimer::singleShotTimeout() timer.start(100); QVERIFY(timeoutSpy.wait(500)); - QCOMPARE(timeoutSpy.count(), 1); + QCOMPARE(timeoutSpy.size(), 1); QTest::qWait(500); - QCOMPARE(timeoutSpy.count(), 1); + QCOMPARE(timeoutSpy.size(), 1); } #define TIMEOUT_TIMEOUT 200 @@ -111,12 +111,12 @@ void tst_QTimer::timeout() QSignalSpy timeoutSpy(&timer, &QTimer::timeout); timer.start(100); - QCOMPARE(timeoutSpy.count(), 0); + QCOMPARE(timeoutSpy.size(), 0); - QTRY_VERIFY_WITH_TIMEOUT(timeoutSpy.count() > 0, TIMEOUT_TIMEOUT); - int oldCount = timeoutSpy.count(); + QTRY_VERIFY_WITH_TIMEOUT(timeoutSpy.size() > 0, TIMEOUT_TIMEOUT); + int oldCount = timeoutSpy.size(); - QTRY_VERIFY_WITH_TIMEOUT(timeoutSpy.count() > oldCount, TIMEOUT_TIMEOUT); + QTRY_VERIFY_WITH_TIMEOUT(timeoutSpy.size() > oldCount, TIMEOUT_TIMEOUT); } void tst_QTimer::remainingTime() @@ -259,24 +259,24 @@ void tst_QTimer::basic_chrono() QCoreApplication::processEvents(); - QCOMPARE(timeoutSpy.count(), 1); + QCOMPARE(timeoutSpy.size(), 1); timeoutSpy.clear(); timer.start(milliseconds(100)); - QCOMPARE(timeoutSpy.count(), 0); + QCOMPARE(timeoutSpy.size(), 0); QVERIFY(timeoutSpy.wait(TIMEOUT_TIMEOUT)); - QVERIFY(timeoutSpy.count() > 0); - int oldCount = timeoutSpy.count(); + QVERIFY(timeoutSpy.size() > 0); + int oldCount = timeoutSpy.size(); QVERIFY(timeoutSpy.wait(TIMEOUT_TIMEOUT)); - QVERIFY(timeoutSpy.count() > oldCount); + QVERIFY(timeoutSpy.size() > oldCount); timeoutSpy.clear(); timer.start(to_ms(microseconds(200000))); QCOMPARE(timer.intervalAsDuration().count(), milliseconds::rep(200)); QTest::qWait(50); - QCOMPARE(timeoutSpy.count(), 0); + QCOMPARE(timeoutSpy.size(), 0); milliseconds rt = timer.remainingTimeAsDuration(); QVERIFY2(rt.count() >= 50 && rt.count() <= 200, qPrintable(QString::number(rt.count()))); @@ -285,9 +285,9 @@ void tst_QTimer::basic_chrono() timer.setSingleShot(true); timer.start(milliseconds(100)); QVERIFY(timeoutSpy.wait(TIMEOUT_TIMEOUT)); - QCOMPARE(timeoutSpy.count(), 1); + QCOMPARE(timeoutSpy.size(), 1); QTest::qWait(500); - QCOMPARE(timeoutSpy.count(), 1); + QCOMPARE(timeoutSpy.size(), 1); } void tst_QTimer::livelock_data() @@ -1001,7 +1001,7 @@ void tst_QTimer::postedEventsShouldNotStarveTimers() timer.start(); SlotRepeater slotRepeater; slotRepeater.repeatThisSlot(); - QTRY_VERIFY_WITH_TIMEOUT(timeoutSpy.count() > 5, 100); + QTRY_VERIFY_WITH_TIMEOUT(timeoutSpy.size() > 5, 100); } struct DummyFunctor { @@ -1044,7 +1044,7 @@ void tst_QTimer::callOnTimeout() QTest::qWait(100); QCOMPARE(count, 2); - QCOMPARE(timeoutSpy.count(), 1); + QCOMPARE(timeoutSpy.size(), 1); // Test that connection is bound to context lifetime QVERIFY(connection); diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 79a1185e63..5f8f965973 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -3122,17 +3122,17 @@ void tst_QVariant::convertIterables() const { QStringList list; list.append("Hello"); - QCOMPARE(QVariant::fromValue(list).value().size(), list.count()); + QCOMPARE(QVariant::fromValue(list).value().size(), list.size()); } { QByteArrayList list; list.append("Hello"); - QCOMPARE(QVariant::fromValue(list).value().size(), list.count()); + QCOMPARE(QVariant::fromValue(list).value().size(), list.size()); } { QVariantList list; list.append("World"); - QCOMPARE(QVariant::fromValue(list).value().size(), list.count()); + QCOMPARE(QVariant::fromValue(list).value().size(), list.size()); } { QMap map; @@ -3147,12 +3147,12 @@ void tst_QVariant::convertIterables() const { QVariantMap map; map.insert("3", 4); - QCOMPARE(QVariant::fromValue(map).value().size(), map.count()); - QCOMPARE(QVariant::fromValue(map).value().size(), map.count()); + QCOMPARE(QVariant::fromValue(map).value().size(), map.size()); + QCOMPARE(QVariant::fromValue(map).value().size(), map.size()); map.insert("4", 5); - QCOMPARE(QVariant::fromValue(map).value().size(), map.count()); - QCOMPARE(QVariant::fromValue(map).value().size(), map.count()); + QCOMPARE(QVariant::fromValue(map).value().size(), map.size()); + QCOMPARE(QVariant::fromValue(map).value().size(), map.size()); } { QHash hash; @@ -3167,12 +3167,12 @@ void tst_QVariant::convertIterables() const { QVariantHash hash; hash.insert("3", 4); - QCOMPARE(QVariant::fromValue(hash).value().size(), hash.count()); - QCOMPARE(QVariant::fromValue(hash).value().size(), hash.count()); + QCOMPARE(QVariant::fromValue(hash).value().size(), hash.size()); + QCOMPARE(QVariant::fromValue(hash).value().size(), hash.size()); hash.insert("4", 5); - QCOMPARE(QVariant::fromValue(hash).value().size(), hash.count()); - QCOMPARE(QVariant::fromValue(hash).value().size(), hash.count()); + QCOMPARE(QVariant::fromValue(hash).value().size(), hash.size()); + QCOMPARE(QVariant::fromValue(hash).value().size(), hash.size()); } } diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index b21cb7e425..8c6bc73cdf 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -328,7 +328,7 @@ void tst_QMimeDatabase::inheritance() const QMimeType directory = db.mimeTypeForName(QString::fromLatin1("inode/directory")); QVERIFY(directory.isValid()); - QCOMPARE(directory.parentMimeTypes().count(), 0); + QCOMPARE(directory.parentMimeTypes().size(), 0); QVERIFY(!directory.inherits(QLatin1String("application/octet-stream"))); // Check that text/x-patch knows that it inherits from text/plain (it says so explicitly) @@ -349,7 +349,7 @@ void tst_QMimeDatabase::inheritance() const QStringList shellParents = shellscript.parentMimeTypes(); QVERIFY(shellParents.contains(QLatin1String("text/plain"))); QVERIFY(shellParents.contains(QLatin1String("application/x-executable"))); - QCOMPARE(shellParents.count(), 2); // only the above two + QCOMPARE(shellParents.size(), 2); // only the above two const QStringList allShellAncestors = shellscript.allAncestors(); QVERIFY(allShellAncestors.contains(QLatin1String("text/plain"))); QVERIFY(allShellAncestors.contains(QLatin1String("application/x-executable"))); diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index 721ac27020..6d68bdf3e0 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -376,14 +376,14 @@ void tst_QPluginLoader::deleteinstanceOnUnload() QVERIFY(spy2.isValid()); if (pass == 0) { QCOMPARE(loader2.unload(), false); // refcount not reached 0, not really unloaded - QCOMPARE(spy1.count(), 0); - QCOMPARE(spy2.count(), 0); + QCOMPARE(spy1.size(), 0); + QCOMPARE(spy2.size(), 0); } QCOMPARE(instance1->pluginName(), QLatin1String("Plugin ok")); QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok")); QVERIFY(loader1.unload()); // refcount reached 0, did really unload - QCOMPARE(spy1.count(), 1); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy1.size(), 1); + QCOMPARE(spy2.size(), 1); } } @@ -969,7 +969,7 @@ void tst_QPluginLoader::reloadPlugin() QSignalSpy spy(loader.instance(), &QObject::destroyed); QVERIFY(spy.isValid()); QVERIFY(loader.unload()); // refcount reached 0, did really unload - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // reload plugin QVERIFY(loader.load()); diff --git a/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp b/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp index dca6cbe02b..898fb785e8 100644 --- a/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp +++ b/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp @@ -81,7 +81,7 @@ void encodeVariant(QCborStreamWriter &writer, const QVariant &v) list = v.value(); writer.startArray(); } else { - writer.startArray(list.length()); + writer.startArray(list.size()); } for (const QVariant &v2 : std::as_const(list)) encodeVariant(writer, v2); @@ -94,7 +94,7 @@ void encodeVariant(QCborStreamWriter &writer, const QVariant &v) map = v.value(); writer.startMap(); } else { - writer.startMap(map.length()); + writer.startMap(map.size()); } for (auto pair : std::as_const(map)) { encodeVariant(writer, pair.first); diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp index e672162f3a..b88ec18652 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -711,7 +711,7 @@ void tst_QXmlStream::reportSuccess_data() const { QTest::addColumn("isError"); - const int len = m_handler.successes.count(); + const int len = m_handler.successes.size(); for (int i = 0; i < len; ++i) { const QByteArray testName = QByteArray::number(i) + ". " + m_handler.successes.at(i).toLatin1(); diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 0462d0689d..b164c846cd 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -5003,7 +5003,7 @@ void tst_QString::fromLatin1Roundtrip() } // fromLatin1 - QCOMPARE(QString::fromLatin1(latin1, latin1.length()).size(), unicode.size()); + QCOMPARE(QString::fromLatin1(latin1, latin1.size()).size(), unicode.size()); QCOMPARE(QString::fromLatin1(latin1, latin1.size()), unicode); // and back: @@ -5066,7 +5066,7 @@ void tst_QString::toLatin1Roundtrip() QCOMPARE(unicodesrc.toLatin1(), latin1); // and back: - QCOMPARE(QString::fromLatin1(latin1, latin1.length()).size(), unicodedst.size()); + QCOMPARE(QString::fromLatin1(latin1, latin1.size()).size(), unicodedst.size()); QCOMPARE(QString::fromLatin1(latin1, latin1.size()), unicodedst); // try the rvalue version of toLatin1() @@ -6617,7 +6617,7 @@ void tst_QString::arg_fillChar() QFETCH(QString, fillChars); QFETCH(QString, expected); QCOMPARE(replaceValues.size(), fillChars.size()); - QCOMPARE(replaceValues.size(), widths.count()); + QCOMPARE(replaceValues.size(), widths.size()); QString actual = pattern; for (int i=0; i 0); - QVERIFY(list4.indexOf("epsilon") < (list4.count() - 1)); + QVERIFY(list4.indexOf("epsilon") < (list4.size() - 1)); } void tst_QStringList::replaceInStrings() diff --git a/tests/auto/corelib/text/qunicodetools/tst_qunicodetools.cpp b/tests/auto/corelib/text/qunicodetools/tst_qunicodetools.cpp index 15aec7d63e..5232a62778 100644 --- a/tests/auto/corelib/text/qunicodetools/tst_qunicodetools.cpp +++ b/tests/auto/corelib/text/qunicodetools/tst_qunicodetools.cpp @@ -47,7 +47,7 @@ static void verifyCharClassPattern(QString str, qulonglong pattern, QCharAttributes cleared; memset(&cleared, 0, sizeof(QCharAttributes)); QList attributes(str.size() + 1, cleared); - QUnicodeTools::initCharAttributes(str, scriptItems.data(), scriptItems.count(), + QUnicodeTools::initCharAttributes(str, scriptItems.data(), scriptItems.size(), attributes.data(), type); qulonglong bit = 1ull << str.size(); diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp index 6664bb4776..217dfddd2f 100644 --- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp @@ -3555,7 +3555,7 @@ void tst_QFuture::resultsReadyAt() QCOMPARE(reported, nExpectedResults); QCOMPARE(nExpectedResults, iface.future().resultCount()); - QCOMPARE(readyCounter.count(), 3); + QCOMPARE(readyCounter.size(), 3); QCOMPARE(taken, 0b1111); } @@ -3925,7 +3925,7 @@ void tst_QFuture::rejectResultOverwrite() // in QFutureInterface: eventProcessor.enterLoopMSecs(2000); QVERIFY(!eventProcessor.timeout()); - QCOMPARE(resultCounter.count(), 1); + QCOMPARE(resultCounter.size(), 1); f.resume(); // overwrite with lvalue @@ -3964,7 +3964,7 @@ void tst_QFuture::rejectResultOverwrite() }); eventProcessor.enterLoopMSecs(2000); QVERIFY(!eventProcessor.timeout()); - QCOMPARE(resultCounter.count(), 1); + QCOMPARE(resultCounter.size(), 1); f.resume(); QCOMPARE(f.results(), initResults); } @@ -4003,7 +4003,7 @@ void tst_QFuture::rejectPendingResultOverwrite() // in QFutureInterface: eventProcessor.enterLoopMSecs(2000); QVERIFY(!eventProcessor.timeout()); - QCOMPARE(resultCounter.count(), 1); + QCOMPARE(resultCounter.size(), 1); f.resume(); } @@ -4047,7 +4047,7 @@ void tst_QFuture::rejectPendingResultOverwrite() }); eventProcessor.enterLoopMSecs(2000); QVERIFY(!eventProcessor.timeout()); - QCOMPARE(resultCounter.count(), 1); + QCOMPARE(resultCounter.size(), 1); f.resume(); } diff --git a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp index e9eb7b24b0..645e22602e 100644 --- a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp +++ b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp @@ -238,8 +238,8 @@ void tst_QFutureWatcher::cancelAndFinish() fi.cancelAndFinish(); // The signals should be emitted only once - QTRY_COMPARE(canceledSpy.count(), 1); - QTRY_COMPARE(finishedSpy.count(), 1); + QTRY_COMPARE(canceledSpy.size(), 1); + QTRY_COMPARE(finishedSpy.size(), 1); } class IntTask : public RunFunctionTaskBase @@ -349,21 +349,21 @@ void tst_QFutureWatcher::futureSignals() const int progress = 1; a.setProgressValue(progress); - QTRY_COMPARE(progressSpy.count(), 2); + QTRY_COMPARE(progressSpy.size(), 2); QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 0); QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 1); const int result = 10; a.reportResult(&result); QVERIFY(resultReadySpy.wait()); - QCOMPARE(resultReadySpy.count(), 1); + QCOMPARE(resultReadySpy.size(), 1); a.reportFinished(&result); - QTRY_COMPARE(resultReadySpy.count(), 2); + QTRY_COMPARE(resultReadySpy.size(), 2); QCOMPARE(resultReadySpy.takeFirst().at(0).toInt(), 0); // check the index QCOMPARE(resultReadySpy.takeFirst().at(0).toInt(), 1); - QCOMPARE(finishedSpy.count(), 1); + QCOMPARE(finishedSpy.size(), 1); } } @@ -402,10 +402,10 @@ void tst_QFutureWatcher::watchFinishedFuture() watcher.setFuture(f); QVERIFY(finishedSpy.wait()); - QCOMPARE(startedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 1); - QCOMPARE(resultReadySpy.count(), 1); - QCOMPARE(canceledSpy.count(), 0); + QCOMPARE(startedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 1); + QCOMPARE(resultReadySpy.size(), 1); + QCOMPARE(canceledSpy.size(), 0); } void tst_QFutureWatcher::watchCanceledFuture() @@ -436,10 +436,10 @@ void tst_QFutureWatcher::watchCanceledFuture() watcher.setFuture(f); QVERIFY(finishedSpy.wait()); - QCOMPARE(startedSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 1); - QCOMPARE(resultReadySpy.count(), 0); - QCOMPARE(canceledSpy.count(), 1); + QCOMPARE(startedSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 1); + QCOMPARE(resultReadySpy.size(), 0); + QCOMPARE(canceledSpy.size(), 1); } void tst_QFutureWatcher::disconnectRunningFuture() @@ -462,17 +462,17 @@ void tst_QFutureWatcher::disconnectRunningFuture() const int result = 10; a.reportResult(&result); QVERIFY(resultReadySpy.wait()); - QCOMPARE(resultReadySpy.count(), 1); + QCOMPARE(resultReadySpy.size(), 1); delete watcher; a.reportResult(&result); QTest::qWait(10); - QCOMPARE(resultReadySpy.count(), 1); + QCOMPARE(resultReadySpy.size(), 1); a.reportFinished(&result); QTest::qWait(10); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); } const int maxProgress = 100000; @@ -672,14 +672,14 @@ void tst_QFutureWatcher::changeFuture() watcher.setFuture(b); // But oh no! we're switching to another future QTest::qWait(10); // before the event gets delivered. - QCOMPARE(resultReadySpy.count(), 0); + QCOMPARE(resultReadySpy.size(), 0); watcher.setFuture(a); watcher.setFuture(b); watcher.setFuture(a); // setting it back gets us one event, not two. QVERIFY(resultReadySpy.wait()); - QCOMPARE(resultReadySpy.count(), 1); + QCOMPARE(resultReadySpy.size(), 1); } // Test that events aren't delivered from canceled futures @@ -707,7 +707,7 @@ void tst_QFutureWatcher::cancelEvents() QVERIFY(finishedSpy.wait()); - QCOMPARE(resultReadySpy.count(), 0); + QCOMPARE(resultReadySpy.size(), 0); } #if QT_DEPRECATED_SINCE(6, 0) @@ -734,14 +734,14 @@ void tst_QFutureWatcher::pauseEvents() watcher.setFuture(iface.future()); watcher.pause(); - QTRY_COMPARE(pauseSpy.count(), 1); + QTRY_COMPARE(pauseSpy.size(), 1); int value = 0; iface.reportFinished(&value); // A result is reported, although the watcher is paused. // The corresponding event should be also reported. - QTRY_COMPARE(resultReadySpy.count(), 1); + QTRY_COMPARE(resultReadySpy.size(), 1); watcher.resume(); } @@ -769,7 +769,7 @@ void tst_QFutureWatcher::pauseEvents() a.resume(); // should give us no results. QTest::qWait(10); - QCOMPARE(resultReadySpy.count(), 0); + QCOMPARE(resultReadySpy.size(), 0); } } @@ -789,23 +789,23 @@ void tst_QFutureWatcher::pausedSuspendedOrder() bool pausedBeforeSuspended = false; bool notSuspendedBeforePaused = false; connect(&watcher, &QFutureWatcher::paused, - [&] { notSuspendedBeforePaused = (suspendedSpy.count() == 0); }); + [&] { notSuspendedBeforePaused = (suspendedSpy.size() == 0); }); connect(&watcher, &QFutureWatcher::suspended, - [&] { pausedBeforeSuspended = (pausedSpy.count() == 1); }); + [&] { pausedBeforeSuspended = (pausedSpy.size() == 1); }); watcher.setFuture(iface.future()); iface.reportSuspended(); // Make sure reportPaused() is ignored if the state is not paused pausedSpy.wait(100); - QCOMPARE(pausedSpy.count(), 0); - QCOMPARE(suspendedSpy.count(), 0); + QCOMPARE(pausedSpy.size(), 0); + QCOMPARE(suspendedSpy.size(), 0); iface.setPaused(true); iface.reportSuspended(); - QTRY_COMPARE(suspendedSpy.count(), 1); - QCOMPARE(pausedSpy.count(), 1); + QTRY_COMPARE(suspendedSpy.size(), 1); + QCOMPARE(pausedSpy.size(), 1); QVERIFY(notSuspendedBeforePaused); QVERIFY(pausedBeforeSuspended); @@ -836,14 +836,14 @@ void tst_QFutureWatcher::suspendEvents() watcher.setFuture(iface.future()); watcher.suspend(); - QTRY_COMPARE(suspendingSpy.count(), 1); + QTRY_COMPARE(suspendingSpy.size(), 1); int value = 0; iface.reportFinished(&value); // A result is reported, although the watcher is paused. // The corresponding event should be also reported. - QTRY_COMPARE(resultReadySpy.count(), 1); + QTRY_COMPARE(resultReadySpy.size(), 1); watcher.resume(); } @@ -872,7 +872,7 @@ void tst_QFutureWatcher::suspendEvents() a.resume(); // should give us no results. QTest::qWait(10); - QCOMPARE(resultReadySpy.count(), 0); + QCOMPARE(resultReadySpy.size(), 0); } } @@ -910,29 +910,29 @@ QT_WARNING_POP watcher.suspend(); watcher.suspend(); - QTRY_COMPARE(suspendedSpy.count(), 1); // suspended() should be emitted only once - QCOMPARE(suspendingSpy.count(), 2); // suspending() is emitted as many times as requested + QTRY_COMPARE(suspendedSpy.size(), 1); // suspended() should be emitted only once + QCOMPARE(suspendingSpy.size(), 2); // suspending() is emitted as many times as requested #if QT_DEPRECATED_SINCE(6, 0) - QCOMPARE(pausedSpy.count(), 2); // paused() is emitted as many times as requested + QCOMPARE(pausedSpy.size(), 2); // paused() is emitted as many times as requested #endif // Make sure QFutureWatcher::resultReadyAt() is emitted only for already started threads. - const auto resultReadyAfterPaused = resultReadySpy.count(); + const auto resultReadyAfterPaused = resultReadySpy.size(); QCOMPARE(resultReadyAfterPaused, count); // Make sure no more results are reported before resuming. QThread::msleep(200); - QCOMPARE(resultReadyAfterPaused, resultReadySpy.count()); + QCOMPARE(resultReadyAfterPaused, resultReadySpy.size()); resultReadySpy.clear(); watcher.resume(); - QTRY_COMPARE(finishedSpy.count(), 1); + QTRY_COMPARE(finishedSpy.size(), 1); // Make sure that no more suspended() signals have been emitted. - QCOMPARE(suspendedSpy.count(), 1); + QCOMPARE(suspendedSpy.size(), 1); // Make sure the rest of results were reported after resume. - QCOMPARE(resultReadySpy.count(), numValues - resultReadyAfterPaused); + QCOMPARE(resultReadySpy.size(), numValues - resultReadyAfterPaused); } void tst_QFutureWatcher::suspendedEventsOrder() @@ -951,23 +951,23 @@ void tst_QFutureWatcher::suspendedEventsOrder() bool suspendingBeforeSuspended = false; bool notSuspendedBeforeSuspending = false; connect(&watcher, &QFutureWatcher::suspending, - [&] { notSuspendedBeforeSuspending = (suspendedSpy.count() == 0); }); + [&] { notSuspendedBeforeSuspending = (suspendedSpy.size() == 0); }); connect(&watcher, &QFutureWatcher::suspended, - [&] { suspendingBeforeSuspended = (suspendingSpy.count() == 1); }); + [&] { suspendingBeforeSuspended = (suspendingSpy.size() == 1); }); watcher.setFuture(iface.future()); iface.reportSuspended(); // Make sure reportPaused() is ignored if the state is not paused suspendingSpy.wait(100); - QCOMPARE(suspendingSpy.count(), 0); - QCOMPARE(suspendedSpy.count(), 0); + QCOMPARE(suspendingSpy.size(), 0); + QCOMPARE(suspendedSpy.size(), 0); iface.setSuspended(true); iface.reportSuspended(); - QTRY_COMPARE(suspendedSpy.count(), 1); - QCOMPARE(suspendingSpy.count(), 1); + QTRY_COMPARE(suspendedSpy.size(), 1); + QCOMPARE(suspendingSpy.size(), 1); QVERIFY(notSuspendedBeforeSuspending); QVERIFY(suspendingBeforeSuspended); @@ -997,7 +997,7 @@ void tst_QFutureWatcher::throttling() QVERIFY(iface.isThrottled()); - QTRY_COMPARE(resultSpy.count(), resultCount); // Process the results + QTRY_COMPARE(resultSpy.size(), resultCount); // Process the results QVERIFY(!iface.isThrottled()); diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp index f316cb0de8..62198322f6 100644 --- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp @@ -212,8 +212,8 @@ void tst_QTimeZone::createTest() tran.daylightTimeOffset = 3600; expected << tran; QTimeZone::OffsetDataList result = tz.transitions(janPrev, jan); - QCOMPARE(result.count(), expected.count()); - for (int i = 0; i < expected.count(); ++i) { + QCOMPARE(result.size(), expected.size()); + for (int i = 0; i < expected.size(); ++i) { QCOMPARE(result.at(i).atUtc, expected.at(i).atUtc); QCOMPARE(result.at(i).offsetFromUtc, expected.at(i).offsetFromUtc); QCOMPARE(result.at(i).standardTimeOffset, expected.at(i).standardTimeOffset); @@ -551,7 +551,7 @@ void tst_QTimeZone::specificTransition() QSKIP("Missing time-zone data"); QTimeZone::OffsetDataList transits = timeZone.transitions(start.startOfDay(timeZone), stop.endOfDay(timeZone)); - QCOMPARE(transits.length(), count); + QCOMPARE(transits.size(), count); if (count) { const QTimeZone::OffsetData &transition = transits.at(0); QCOMPARE(transition.offsetFromUtc, offset); @@ -1530,8 +1530,8 @@ void tst_QTimeZone::testCetPrivate(const QTimeZonePrivate &tzp) tran.daylightTimeOffset = 0; expected << tran; QTimeZonePrivate::DataList result = tzp.transitions(prev, std); - QCOMPARE(result.count(), expected.count()); - for (int i = 0; i < expected.count(); ++i) { + QCOMPARE(result.size(), expected.size()); + for (int i = 0; i < expected.size(); ++i) { QCOMPARE(QDateTime::fromMSecsSinceEpoch(result.at(i).atMSecsSinceEpoch, Qt::OffsetFromUTC, 3600), QDateTime::fromMSecsSinceEpoch(expected.at(i).atMSecsSinceEpoch, diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index 3ec49a7444..965deca33f 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -2693,7 +2693,7 @@ void tst_Collections::vector_stl() QFETCH(QStringList, elements); QList vector; - for (int i = 0; i < elements.count(); ++i) + for (int i = 0; i < elements.size(); ++i) vector << elements.at(i); #if QT_VERSION < QT_VERSION_CHECK(6,0,0) @@ -2728,7 +2728,7 @@ void tst_Collections::list_stl() QFETCH(QStringList, elements); QList list; - for (int i = 0; i < elements.count(); ++i) + for (int i = 0; i < elements.size(); ++i) list << elements.at(i); #if QT_VERSION < QT_VERSION_CHECK(6,0,0) @@ -3407,9 +3407,9 @@ void tst_Collections::foreach_2() varl5 << str; varl6 << str; } - QCOMPARE(varl4.size(), strlist.count()); - QCOMPARE(varl5.size(), strlist.count()); - QCOMPARE(varl6.size(), strlist.count()); + QCOMPARE(varl4.size(), strlist.size()); + QCOMPARE(varl5.size(), strlist.size()); + QCOMPARE(varl6.size(), strlist.size()); } struct IntOrString diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp index 4344f58ec3..b205bb76ee 100644 --- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp @@ -143,6 +143,7 @@ void tst_QBitArray::countBits() } QCOMPARE(bits.size(), numBits); + // NOLINTNEXTLINE(qt-port-to-std-compatible-api): We want to test count() and size() QCOMPARE(bits.count(), numBits); QCOMPARE(bits.count(true), onBits); QCOMPARE(bits.count(false), numBits - onBits); @@ -493,7 +494,7 @@ void tst_QBitArray::datastream() bits.setBit(i); } - QCOMPARE(bits.count(), numBits); + QCOMPARE(bits.size(), numBits); QCOMPARE(bits.count(true), onBits); QCOMPARE(bits.count(false), numBits - onBits); @@ -508,7 +509,7 @@ void tst_QBitArray::datastream() QBitArray array1, array2, array3; stream2 >> array1 >> array2 >> array3; - QCOMPARE(array1.count(), numBits); + QCOMPARE(array1.size(), numBits); QCOMPARE(array1.count(true), onBits); QCOMPARE(array1.count(false), numBits - onBits); diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index c2f6811d27..6252440232 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -503,7 +503,7 @@ void tst_QCommandLineParser::testSingleDashWordOptionModes() QVERIFY(parser.addOption(forceShort)); QVERIFY(parser.parse(commandLine)); QCOMPARE(parser.optionNames(), expectedOptionNames); - for (int i = 0; i < expectedOptionValues.count(); ++i) + for (int i = 0; i < expectedOptionValues.size(); ++i) QCOMPARE(parser.value(parser.optionNames().at(i)), expectedOptionValues.at(i)); QCOMPARE(parser.unknownOptionNames(), QStringList()); } @@ -762,7 +762,7 @@ void tst_QCommandLineParser::testVeryLongOptionNames() output.replace(QStringLiteral("\r\n"), QStringLiteral("\n")); #endif const QStringList lines = output.split('\n'); - const int last = lines.count() - 1; + const int last = lines.size() - 1; // Let's not compare everything, just the final parts. QCOMPARE(lines.at(last - 7), " cdefghijklmnopqrstuvwxyz"); QCOMPARE(lines.at(last - 6), " --looooooooooooong-option, --looooong-opt-alias c(10); QCOMPARE(c.capacity(), 10); QCOMPARE(c.size(), 0); + // NOLINTNEXTLINE(qt-port-to-std-compatible-api): Test both size() and count() QCOMPARE(c.count(), 0); QVERIFY(c.isEmpty()); c.append(1); + // NOLINTNEXTLINE(qt-port-to-std-compatible-api): Test both size() and count() QCOMPARE(c.count(), 1); QCOMPARE(c.size(), 1); QVERIFY(!c.isEmpty()); c.clear(); QCOMPARE(c.capacity(), 10); - QCOMPARE(c.count(), 0); + QCOMPARE(c.size(), 0); QVERIFY(c.isEmpty()); c.prepend(1); - QCOMPARE(c.count(), 1); + QCOMPARE(c.size(), 1); QVERIFY(!c.isEmpty()); c.clear(); - QCOMPARE(c.count(), 0); + QCOMPARE(c.size(), 0); QVERIFY(c.isEmpty()); QCOMPARE(c.capacity(), 10); } @@ -76,9 +78,9 @@ void tst_QContiguousCache::swap() c1.append(1); c1.swap(c2); QCOMPARE(c1.capacity(), 100); - QCOMPARE(c1.count(), 0 ); + QCOMPARE(c1.size(), 0 ); QCOMPARE(c2.capacity(), 10 ); - QCOMPARE(c2.count(), 1 ); + QCOMPARE(c2.size(), 1 ); } void tst_QContiguousCache::append_data() @@ -114,7 +116,7 @@ void tst_QContiguousCache::append() QCOMPARE(c.available(), qMax(qsizetype(0), cacheSize - i)); QCOMPARE(c.first(), qMax(qsizetype(1), i-cacheSize+1)); QCOMPARE(c.last(), i); - QCOMPARE(c.count(), qMin(i, cacheSize)); + QCOMPARE(c.size(), qMin(i, cacheSize)); QCOMPARE(c.isFull(), i >= cacheSize); i++; } @@ -127,7 +129,7 @@ void tst_QContiguousCache::append() // test taking from end until empty. for (j = 0; j < cacheSize; j++, i--) { QCOMPARE(c.takeLast(), i-1); - QCOMPARE(c.count(), cacheSize-j-1); + QCOMPARE(c.size(), cacheSize-j-1); QCOMPARE(c.available(), j+1); QVERIFY(!c.isFull()); QCOMPARE(c.isEmpty(), j==cacheSize-1); @@ -165,7 +167,7 @@ void tst_QContiguousCache::prepend() QCOMPARE(c.available(), qMax(0, cacheSize - i)); QCOMPARE(c.last(), qMax(1, i-cacheSize+1)); QCOMPARE(c.first(), i); - QCOMPARE(c.count(), qMin(i, cacheSize)); + QCOMPARE(c.size(), qMin(i, cacheSize)); QCOMPARE(c.isFull(), i >= cacheSize); i++; } @@ -178,7 +180,7 @@ void tst_QContiguousCache::prepend() // test taking from start until empty. for (j = 0; j < cacheSize; j++, i--) { QCOMPARE(c.takeFirst(), i-1); - QCOMPARE(c.count(), cacheSize-j-1); + QCOMPARE(c.size(), cacheSize-j-1); QCOMPARE(c.available(), j+1); QVERIFY(!c.isFull()); QCOMPARE(c.isEmpty(), j==cacheSize-1); @@ -298,7 +300,7 @@ void tst_QContiguousCache::setCapacity() for (i = 280; i < 310; ++i) contiguousCache.insert(i, i); QCOMPARE(contiguousCache.capacity(), 100); - QCOMPARE(contiguousCache.count(), 30); + QCOMPARE(contiguousCache.size(), 30); QCOMPARE(contiguousCache.firstIndex(), 280); QCOMPARE(contiguousCache.lastIndex(), 309); @@ -310,7 +312,7 @@ void tst_QContiguousCache::setCapacity() contiguousCache.setCapacity(150); QCOMPARE(contiguousCache.capacity(), 150); - QCOMPARE(contiguousCache.count(), 30); + QCOMPARE(contiguousCache.size(), 30); QCOMPARE(contiguousCache.firstIndex(), 280); QCOMPARE(contiguousCache.lastIndex(), 309); @@ -322,7 +324,7 @@ void tst_QContiguousCache::setCapacity() contiguousCache.setCapacity(20); QCOMPARE(contiguousCache.capacity(), 20); - QCOMPARE(contiguousCache.count(), 20); + QCOMPARE(contiguousCache.size(), 20); QCOMPARE(contiguousCache.firstIndex(), 290); QCOMPARE(contiguousCache.lastIndex(), 309); diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp index a64e3bfcb3..4989de521f 100644 --- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp @@ -374,7 +374,7 @@ void tst_QEasingCurve::valueForProgress() // in theory the baseline should't have an error of more than 0.00005 due to how its rounded, // but due to FP imprecision, we have to adjust the error a bit more. const qreal errorBound = 0.00006; - for (int i = 0; i < at.count(); ++i) { + for (int i = 0; i < at.size(); ++i) { const qreal ex = expected.at(i); const qreal error = qAbs(ex - curve.valueForProgress(at.at(i)/qreal(100))); QVERIFY(error <= errorBound); @@ -603,7 +603,7 @@ void tst_QEasingCurve::bezierSpline() setupBezierSpline(&bezierEasingCurve, definition); const qreal errorBound = 0.002; - for (int i = 0; i < at.count(); ++i) { + for (int i = 0; i < at.size(); ++i) { const qreal ex = expected.at(i); const qreal value = bezierEasingCurve.valueForProgress(at.at(i)/qreal(100)); const qreal error = qAbs(ex - value); @@ -646,7 +646,7 @@ static inline void setupTCBSpline(QEasingCurve *easingCurve, const QString &stri foreach (const QString &str, pointStr) { QStringList coordStr = str.split(QLatin1Char(',')); - Q_ASSERT(coordStr.count() == 5); + Q_ASSERT(coordStr.size() == 5); QPointF point(coordStr.first().toDouble(), coordStr.at(1).toDouble()); qreal t = coordStr.at(2).toDouble(); qreal c = coordStr.at(3).toDouble(); @@ -665,7 +665,7 @@ void tst_QEasingCurve::tcbSpline() setupTCBSpline(&tcbEasingCurve, definition); const qreal errorBound = 0.002; - for (int i = 0; i < at.count(); ++i) { + for (int i = 0; i < at.size(); ++i) { const qreal ex = expected.at(i); const qreal value = tcbEasingCurve.valueForProgress(at.at(i)/qreal(100)); const qreal error = qAbs(ex - value); diff --git a/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp b/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp index f57abbf156..112a393136 100644 --- a/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp +++ b/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp @@ -682,7 +682,7 @@ void tst_QFlatMap::viewIterators() }); auto it = keys.begin(); QCOMPARE(*it, "kaksi"); - QCOMPARE(it->length(), 5); + QCOMPARE(it->size(), 5); ++it; QCOMPARE(*it, "kolme"); it++; @@ -703,7 +703,7 @@ void tst_QFlatMap::viewIterators() }); auto it = values.begin(); QCOMPARE(*it, "twee"); - QCOMPARE(it->length(), 4); + QCOMPARE(it->size(), 4); ++it; QCOMPARE(*it, "dree"); it++; diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index cf0bc67761..ed21dc71b5 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -168,13 +168,13 @@ void tst_QHash::count() { MyMap map; MyMap map2( map ); - QCOMPARE( map.count(), 0 ); - QCOMPARE( map2.count(), 0 ); + QCOMPARE( map.size(), 0 ); + QCOMPARE( map2.size(), 0 ); QCOMPARE( MyClass::count, 0 ); // detach map2["Hallo"] = MyClass( "Fritz" ); - QCOMPARE( map.count(), 0 ); - QCOMPARE( map2.count(), 1 ); + QCOMPARE( map.size(), 0 ); + QCOMPARE( map2.size(), 1 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 1 ); #endif @@ -184,11 +184,11 @@ void tst_QHash::count() { typedef QHash Map; Map map; - QCOMPARE( map.count(), 0); + QCOMPARE( map.size(), 0); map.insert( "Torben", MyClass("Weis") ); - QCOMPARE( map.count(), 1 ); + QCOMPARE( map.size(), 1 ); map.insert( "Claudia", MyClass("Sorg") ); - QCOMPARE( map.count(), 2 ); + QCOMPARE( map.size(), 2 ); map.insert( "Lars", MyClass("Linzbach") ); map.insert( "Matthias", MyClass("Ettrich") ); map.insert( "Sue", MyClass("Paludo") ); @@ -196,7 +196,7 @@ void tst_QHash::count() map.insert( "Haavard", MyClass("Nord") ); map.insert( "Arnt", MyClass("Gulbrandsen") ); map.insert( "Paul", MyClass("Tvete") ); - QCOMPARE( map.count(), 9 ); + QCOMPARE( map.size(), 9 ); map.insert( "Paul", MyClass("Tvete 1") ); map.insert( "Paul", MyClass("Tvete 2") ); map.insert( "Paul", MyClass("Tvete 3") ); @@ -204,68 +204,68 @@ void tst_QHash::count() map.insert( "Paul", MyClass("Tvete 5") ); map.insert( "Paul", MyClass("Tvete 6") ); - QCOMPARE( map.count(), 9 ); + QCOMPARE( map.size(), 9 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif Map map2( map ); - QVERIFY( map2.count() == 9 ); + QVERIFY( map2.size() == 9 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map2.insert( "Kay", MyClass("Roemer") ); - QVERIFY( map2.count() == 10 ); - QVERIFY( map.count() == 9 ); + QVERIFY( map2.size() == 10 ); + QVERIFY( map.size() == 9 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 19 ); #endif map2 = map; - QVERIFY( map.count() == 9 ); - QVERIFY( map2.count() == 9 ); + QVERIFY( map.size() == 9 ); + QVERIFY( map2.size() == 9 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map2.insert( "Kay", MyClass("Roemer") ); - QVERIFY( map2.count() == 10 ); + QVERIFY( map2.size() == 10 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 19 ); #endif map2.clear(); - QVERIFY( map.count() == 9 ); - QVERIFY( map2.count() == 0 ); + QVERIFY( map.size() == 9 ); + QVERIFY( map2.size() == 0 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map2 = map; - QVERIFY( map.count() == 9 ); - QVERIFY( map2.count() == 9 ); + QVERIFY( map.size() == 9 ); + QVERIFY( map2.size() == 9 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map2.clear(); - QVERIFY( map.count() == 9 ); - QVERIFY( map2.count() == 0 ); + QVERIFY( map.size() == 9 ); + QVERIFY( map2.size() == 0 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map.remove( "Lars" ); - QVERIFY( map.count() == 8 ); - QVERIFY( map2.count() == 0 ); + QVERIFY( map.size() == 8 ); + QVERIFY( map2.size() == 0 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 8 ); #endif map.remove( "Mist" ); - QVERIFY( map.count() == 8 ); - QVERIFY( map2.count() == 0 ); + QVERIFY( map.size() == 8 ); + QVERIFY( map2.size() == 0 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 8 ); #endif @@ -279,22 +279,22 @@ void tst_QHash::count() #ifndef Q_CC_SUN QVERIFY( MyClass::count == 1 ); #endif - QVERIFY( map.count() == 1 ); + QVERIFY( map.size() == 1 ); (void)map["Torben"].str; (void)map["Lars"].str; #ifndef Q_CC_SUN QVERIFY( MyClass::count == 2 ); #endif - QVERIFY( map.count() == 2 ); + QVERIFY( map.size() == 2 ); const Map& cmap = map; (void)cmap["Depp"].str; #ifndef Q_CC_SUN QVERIFY( MyClass::count == 2 ); #endif - QVERIFY( map.count() == 2 ); - QVERIFY( cmap.count() == 2 ); + QVERIFY( map.size() == 2 ); + QVERIFY( cmap.size() == 2 ); } QCOMPARE( MyClass::count, 0 ); { diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp index 098976b228..eb7658517e 100644 --- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp +++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp @@ -166,8 +166,8 @@ void tst_QMap::count() { MyMap map; MyMap map2( map ); - QCOMPARE( map.count(), 0 ); - QCOMPARE( map2.count(), 0 ); + QCOMPARE( map.size(), 0 ); + QCOMPARE( map2.size(), 0 ); QCOMPARE( MyClass::count, int(0) ); QCOMPARE(map.count("key"), 0); QCOMPARE(map.size(), 0); @@ -176,9 +176,9 @@ void tst_QMap::count() QVERIFY(!map2.isDetached()); // detach map2["Hallo"] = MyClass( "Fritz" ); - QCOMPARE( map.count(), 0 ); QCOMPARE( map.size(), 0 ); - QCOMPARE( map2.count(), 1 ); + QCOMPARE( map.size(), 0 ); + QCOMPARE( map2.size(), 1 ); QCOMPARE( map2.size(), 1 ); QVERIFY(!map.isDetached()); #ifndef Q_CC_SUN @@ -190,11 +190,11 @@ void tst_QMap::count() { typedef QMap Map; Map map; - QCOMPARE( map.count(), 0); + QCOMPARE( map.size(), 0); map.insert( "Torben", MyClass("Weis") ); - QCOMPARE( map.count(), 1 ); + QCOMPARE( map.size(), 1 ); map.insert( "Claudia", MyClass("Sorg") ); - QCOMPARE( map.count(), 2 ); + QCOMPARE( map.size(), 2 ); map.insert( "Lars", MyClass("Linzbach") ); map.insert( "Matthias", MyClass("Ettrich") ); map.insert( "Sue", MyClass("Paludo") ); @@ -202,7 +202,7 @@ void tst_QMap::count() map.insert( "Haavard", MyClass("Nord") ); map.insert( "Arnt", MyClass("Gulbrandsen") ); map.insert( "Paul", MyClass("Tvete") ); - QCOMPARE( map.count(), 9 ); + QCOMPARE( map.size(), 9 ); map.insert( "Paul", MyClass("Tvete 1") ); map.insert( "Paul", MyClass("Tvete 2") ); map.insert( "Paul", MyClass("Tvete 3") ); @@ -210,69 +210,69 @@ void tst_QMap::count() map.insert( "Paul", MyClass("Tvete 5") ); map.insert( "Paul", MyClass("Tvete 6") ); - QCOMPARE( map.count(), 9 ); + QCOMPARE( map.size(), 9 ); QCOMPARE( map.count("Paul"), 1 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif Map map2( map ); - QVERIFY( map2.count() == 9 ); + QVERIFY( map2.size() == 9 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map2.insert( "Kay", MyClass("Roemer") ); - QVERIFY( map2.count() == 10 ); - QVERIFY( map.count() == 9 ); + QVERIFY( map2.size() == 10 ); + QVERIFY( map.size() == 9 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 19 ); #endif map2 = map; - QVERIFY( map.count() == 9 ); - QVERIFY( map2.count() == 9 ); + QVERIFY( map.size() == 9 ); + QVERIFY( map2.size() == 9 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map2.insert( "Kay", MyClass("Roemer") ); - QVERIFY( map2.count() == 10 ); + QVERIFY( map2.size() == 10 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 19 ); #endif map2.clear(); - QVERIFY( map.count() == 9 ); - QVERIFY( map2.count() == 0 ); + QVERIFY( map.size() == 9 ); + QVERIFY( map2.size() == 0 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map2 = map; - QVERIFY( map.count() == 9 ); - QVERIFY( map2.count() == 9 ); + QVERIFY( map.size() == 9 ); + QVERIFY( map2.size() == 9 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map2.clear(); - QVERIFY( map.count() == 9 ); - QVERIFY( map2.count() == 0 ); + QVERIFY( map.size() == 9 ); + QVERIFY( map2.size() == 0 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 9 ); #endif map.remove( "Lars" ); - QVERIFY( map.count() == 8 ); - QVERIFY( map2.count() == 0 ); + QVERIFY( map.size() == 8 ); + QVERIFY( map2.size() == 0 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 8 ); #endif map.remove( "Mist" ); - QVERIFY( map.count() == 8 ); - QVERIFY( map2.count() == 0 ); + QVERIFY( map.size() == 8 ); + QVERIFY( map2.size() == 0 ); #ifndef Q_CC_SUN QCOMPARE( MyClass::count, 8 ); #endif @@ -286,22 +286,22 @@ void tst_QMap::count() #ifndef Q_CC_SUN QVERIFY( MyClass::count == 1 ); #endif - QVERIFY( map.count() == 1 ); + QVERIFY( map.size() == 1 ); (void)map["Torben"].str; (void)map["Lars"].str; #ifndef Q_CC_SUN QVERIFY( MyClass::count == 2 ); #endif - QVERIFY( map.count() == 2 ); + QVERIFY( map.size() == 2 ); const Map& cmap = map; (void)cmap["Depp"].str; #ifndef Q_CC_SUN QVERIFY( MyClass::count == 2 ); #endif - QVERIFY( map.count() == 2 ); - QVERIFY( cmap.count() == 2 ); + QVERIFY( map.size() == 2 ); + QVERIFY( cmap.size() == 2 ); } QCOMPARE( MyClass::count, 0 ); { diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp index d1a1d2c169..7d0e121b30 100644 --- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp @@ -80,7 +80,7 @@ void tst_QTimeLine::range() timeLine.setStartFrame(5000); QVERIFY(timeLine.currentFrame() > oldValue); timeLine.setFrameRange(0, 500); - QTRY_VERIFY(spy.count() > 1); + QTRY_VERIFY(spy.size() > 1); QVERIFY(timeLine.currentFrame() < oldValue); } @@ -102,7 +102,7 @@ void tst_QTimeLine::currentTime() spy.clear(); timeLine.setCurrentTime(timeLine.duration()/2); timeLine.setCurrentTime(timeLine.duration()/2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QCOMPARE(timeLine.currentTime(), timeLine.duration()/2); timeLine.resume(); @@ -153,10 +153,10 @@ void tst_QTimeLine::bindableCurrentTime() spy.clear(); QProperty referenceCurrentTime(timeLine.duration() / 2); timeLine.bindableCurrentTime().setBinding([&]() { return referenceCurrentTime.value(); }); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // setting it a second time to check that valueChanged() is emitted only once referenceCurrentTime = timeLine.duration() / 2; - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QCOMPARE(timeLine.currentTime(), timeLine.duration() / 2); @@ -172,7 +172,7 @@ void tst_QTimeLine::bindableCurrentTime() spy.clear(); referenceCurrentTime = 0; QCOMPARE(currentTimeObserver.value(), timeLine.duration()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QTimeLine::duration() @@ -236,7 +236,7 @@ void tst_QTimeLine::frameRate() timeLine.start(); QTest::qWait(timeLine.duration()*2); QCOMPARE(timeLine.state(), QTimeLine::NotRunning); - int slowCount = spy.count(); + int slowCount = spy.size(); // Faster!! timeLine.setUpdateInterval(1000 / 100); @@ -245,7 +245,7 @@ void tst_QTimeLine::frameRate() timeLine.start(); QTest::qWait(timeLine.duration()*2); QCOMPARE(timeLine.state(), QTimeLine::NotRunning); - QVERIFY2(slowCount < spy.count(), QByteArray::number(spy.count())); + QVERIFY2(slowCount < spy.size(), QByteArray::number(spy.size())); } void tst_QTimeLine::bindableUpdateInterval() @@ -270,7 +270,7 @@ void tst_QTimeLine::bindableUpdateInterval() timeLine.start(); QTest::qWait(timeLine.duration() * 2); QCOMPARE(timeLine.state(), QTimeLine::NotRunning); - int slowCount = spy.count(); + int slowCount = spy.size(); // Faster!! updateIntervalReference = 1000 / 100; @@ -279,7 +279,7 @@ void tst_QTimeLine::bindableUpdateInterval() timeLine.start(); QTest::qWait(timeLine.duration() * 2); QCOMPARE(timeLine.state(), QTimeLine::NotRunning); - QVERIFY2(slowCount < spy.count(), QByteArray::number(spy.count())); + QVERIFY2(slowCount < spy.size(), QByteArray::number(spy.size())); } void tst_QTimeLine::value() @@ -294,7 +294,7 @@ void tst_QTimeLine::value() QTRY_VERIFY(timeLine.currentValue() > 0); QTRY_COMPARE(timeLine.state(), QTimeLine::NotRunning); QCOMPARE(timeLine.currentValue(), 1.0); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); // Reverse should decrease the value timeLine.setCurrentTime(100); @@ -380,8 +380,8 @@ void tst_QTimeLine::loopCount() loop.exec(); - QCOMPARE(finishedSpy.count(), 1); - QCOMPARE(frameChangedSpy.count(), 11); + QCOMPARE(finishedSpy.size(), 1); + QCOMPARE(frameChangedSpy.size(), 11); for (int i = 0; i < 11; ++i) QCOMPARE(frameChangedSpy.at(i).at(0).toInt(), (i+1) % 3); } @@ -390,8 +390,8 @@ void tst_QTimeLine::loopCount() timeLine.start(); loop.exec(); - QCOMPARE(finishedSpy.count(), 2); - QCOMPARE(frameChangedSpy.count(), 22); + QCOMPARE(finishedSpy.size(), 2); + QCOMPARE(frameChangedSpy.size(), 22); for (int i = 11; i < 22; ++i) { QCOMPARE(frameChangedSpy.at(i).at(0).toInt(), 2 - (i+2) % 3); } @@ -456,8 +456,8 @@ void tst_QTimeLine::bindableLoopCount() loop.exec(); - QCOMPARE(finishedSpy.count(), 1); - QCOMPARE(frameChangedSpy.count(), 11); + QCOMPARE(finishedSpy.size(), 1); + QCOMPARE(frameChangedSpy.size(), 11); for (int i = 0; i < 11; ++i) QCOMPARE(frameChangedSpy.at(i).at(0).toInt(), (i + 1) % 3); } @@ -466,8 +466,8 @@ void tst_QTimeLine::bindableLoopCount() timeLine.start(); loop.exec(); - QCOMPARE(finishedSpy.count(), 2); - QCOMPARE(frameChangedSpy.count(), 22); + QCOMPARE(finishedSpy.size(), 2); + QCOMPARE(frameChangedSpy.size(), 22); for (int i = 11; i < 22; ++i) QCOMPARE(frameChangedSpy.at(i).at(0).toInt(), 2 - (i + 2) % 3); } @@ -636,14 +636,14 @@ void tst_QTimeLine::frameChanged() timeLine.start(); QTest::qWait(timeLine.duration()/2); QCOMPARE(timeLine.state(), QTimeLine::Running); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QTest::qWait(timeLine.duration()); if (timeLine.state() != QTimeLine::NotRunning) QEXPECT_FAIL("", "QTBUG-24796: QTimeLine runs slower than it should", Abort); QCOMPARE(timeLine.state(), QTimeLine::NotRunning); - if (spy.count() != 1) + if (spy.size() != 1) QEXPECT_FAIL("", "QTBUG-24796: QTimeLine runs slower than it should", Abort); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // Test what happens when the frames are all emitted well before duration expires. timeLine.setUpdateInterval(5); @@ -652,7 +652,7 @@ void tst_QTimeLine::frameChanged() timeLine.start(); QTest::qWait(timeLine.duration()*2); QCOMPARE(timeLine.state(), QTimeLine::NotRunning); - QCOMPARE(spy.count(), 10); + QCOMPARE(spy.size(), 10); } void tst_QTimeLine::stopped() @@ -665,11 +665,11 @@ void tst_QTimeLine::stopped() timeLine.start(); QTest::qWait(timeLine.duration()*2); QCOMPARE(timeLine.state(), QTimeLine::NotRunning); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); spy.clear(); timeLine.start(); timeLine.stop(); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); timeLine.setDirection(QTimeLine::Backward); QCOMPARE(timeLine.loopCount(), 1); } @@ -681,13 +681,13 @@ void tst_QTimeLine::finished() QSignalSpy spy(&timeLine, &QTimeLine::finished); QVERIFY(spy.isValid()); timeLine.start(); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QCOMPARE(timeLine.state(), QTimeLine::NotRunning); spy.clear(); timeLine.start(); timeLine.stop(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QTimeLine::isRunning() @@ -720,7 +720,7 @@ void tst_QTimeLine::multipleTimeLines() timeLine.start(); timeLineKiller.stop(); QTest::qWait(timeLine.duration()*2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QTimeLine::sineCurve() diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp index 0228d3fddd..d4b61d27dd 100644 --- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp @@ -468,7 +468,7 @@ void tst_QDBusInterface::callMethod() QCOMPARE(reply.type(), QDBusMessage::ReplyMessage); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 1); + QCOMPARE(MyObject::callArgs.size(), 1); QVariant v = MyObject::callArgs.at(0); QDBusVariant dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -487,7 +487,7 @@ void tst_QDBusInterface::callMethod() QCOMPARE(reply.type(), QDBusMessage::ReplyMessage); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 1); + QCOMPARE(MyObject::callArgs.size(), 1); v = MyObject::callArgs.at(0); dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -515,7 +515,7 @@ void tst_QDBusInterface::invokeMethod() QCOMPARE(MyObject::callCount, 1); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 1); + QCOMPARE(MyObject::callArgs.size(), 1); QVariant v = MyObject::callArgs.at(0); QDBusVariant dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -527,7 +527,7 @@ void tst_QDBusInterface::invokeMethod() QCOMPARE(MyObject::callCount, 2); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 1); + QCOMPARE(MyObject::callArgs.size(), 1); v = MyObject::callArgs.at(0); dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -549,7 +549,7 @@ void tst_QDBusInterface::invokeMethodWithReturn() QCOMPARE(MyObject::callCount, 1); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 1); + QCOMPARE(MyObject::callArgs.size(), 1); QVariant v = MyObject::callArgs.at(0); QDBusVariant dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -564,7 +564,7 @@ void tst_QDBusInterface::invokeMethodWithReturn() QCOMPARE(MyObject::callCount, 2); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 1); + QCOMPARE(MyObject::callArgs.size(), 1); v = MyObject::callArgs.at(0); dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -593,7 +593,7 @@ void tst_QDBusInterface::invokeMethodWithMultiReturn() QCOMPARE(MyObject::callCount, 1); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 2); + QCOMPARE(MyObject::callArgs.size(), 2); QVariant v = MyObject::callArgs.at(0); QDBusVariant dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -618,7 +618,7 @@ void tst_QDBusInterface::invokeMethodWithMultiReturn() QCOMPARE(MyObject::callCount, 2); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 2); + QCOMPARE(MyObject::callArgs.size(), 2); v = MyObject::callArgs.at(0); dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -649,7 +649,7 @@ void tst_QDBusInterface::invokeMethodWithComplexReturn() QCOMPARE(MyObject::callCount, 1); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 1); + QCOMPARE(MyObject::callArgs.size(), 1); QVariant v = MyObject::callArgs.at(0); QCOMPARE(v.userType(), qMetaTypeId()); QCOMPARE(qdbus_cast >(v), arg); @@ -663,7 +663,7 @@ void tst_QDBusInterface::invokeMethodWithComplexReturn() QCOMPARE(MyObject::callCount, 2); // verify what the callee received - QCOMPARE(MyObject::callArgs.count(), 1); + QCOMPARE(MyObject::callArgs.size(), 1); v = MyObject::callArgs.at(0); QCOMPARE(v.userType(), qMetaTypeId()); QCOMPARE(qdbus_cast >(v), arg2); @@ -703,7 +703,7 @@ void tst_QDBusInterface::callMethodPeer() // verify what the callee received QVariantList callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 1); + QCOMPARE(callArgs.size(), 1); QVariant v = callArgs.at(0); QDBusVariant dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -723,7 +723,7 @@ void tst_QDBusInterface::callMethodPeer() // verify what the callee received callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 1); + QCOMPARE(callArgs.size(), 1); v = callArgs.at(0); dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -752,7 +752,7 @@ void tst_QDBusInterface::invokeMethodPeer() // verify what the callee received QVariantList callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 1); + QCOMPARE(callArgs.size(), 1); QVariant v = callArgs.at(0); QDBusVariant dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -765,7 +765,7 @@ void tst_QDBusInterface::invokeMethodPeer() // verify what the callee received callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 1); + QCOMPARE(callArgs.size(), 1); v = callArgs.at(0); dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -788,7 +788,7 @@ void tst_QDBusInterface::invokeMethodWithReturnPeer() // verify what the callee received QVariantList callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 1); + QCOMPARE(callArgs.size(), 1); QVariant v = callArgs.at(0); QDBusVariant dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -804,7 +804,7 @@ void tst_QDBusInterface::invokeMethodWithReturnPeer() // verify what the callee received callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 1); + QCOMPARE(callArgs.size(), 1); v = callArgs.at(0); dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -834,7 +834,7 @@ void tst_QDBusInterface::invokeMethodWithMultiReturnPeer() // verify what the callee received QVariantList callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 2); + QCOMPARE(callArgs.size(), 2); QVariant v = callArgs.at(0); QDBusVariant dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -860,7 +860,7 @@ void tst_QDBusInterface::invokeMethodWithMultiReturnPeer() // verify what the callee received callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 2); + QCOMPARE(callArgs.size(), 2); v = callArgs.at(0); dv = qdbus_cast(v); QCOMPARE(dv.variant().userType(), QMetaType::QString); @@ -892,7 +892,7 @@ void tst_QDBusInterface::invokeMethodWithComplexReturnPeer() // verify what the callee received QVariantList callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 1); + QCOMPARE(callArgs.size(), 1); QVariant v = callArgs.at(0); QCOMPARE(v.userType(), qMetaTypeId()); QCOMPARE(qdbus_cast >(v), arg); @@ -907,7 +907,7 @@ void tst_QDBusInterface::invokeMethodWithComplexReturnPeer() // verify what the callee received callArgs = callArgsPeer(); - QCOMPARE(callArgs.count(), 1); + QCOMPARE(callArgs.size(), 1); v = callArgs.at(0); QCOMPARE(v.userType(), qMetaTypeId()); QCOMPARE(qdbus_cast >(v), arg2); diff --git a/tests/auto/dbus/qdbuslocalcalls/tst_qdbuslocalcalls.cpp b/tests/auto/dbus/qdbuslocalcalls/tst_qdbuslocalcalls.cpp index f5f72de07a..7ea5958805 100644 --- a/tests/auto/dbus/qdbuslocalcalls/tst_qdbuslocalcalls.cpp +++ b/tests/auto/dbus/qdbuslocalcalls/tst_qdbuslocalcalls.cpp @@ -137,7 +137,7 @@ void tst_QDBusLocalCalls::makeCalls() QCOMPARE(int(replyMsg.type()), int(QDBusMessage::ReplyMessage)); QVariantList replyArgs = replyMsg.arguments(); - QCOMPARE(replyArgs.count(), 1); + QCOMPARE(replyArgs.size(), 1); QCOMPARE(replyArgs.at(0), value); } @@ -152,7 +152,7 @@ void tst_QDBusLocalCalls::makeCallsVariant() QCOMPARE(int(replyMsg.type()), int(QDBusMessage::ReplyMessage)); QVariantList replyArgs = replyMsg.arguments(); - QCOMPARE(replyArgs.count(), 1); + QCOMPARE(replyArgs.size(), 1); const QVariant &reply = replyArgs.at(0); QCOMPARE(reply.userType(), qMetaTypeId()); @@ -169,7 +169,7 @@ void tst_QDBusLocalCalls::makeCallsTwoRets() QCOMPARE(int(replyMsg.type()), int(QDBusMessage::ReplyMessage)); QVariantList replyArgs = replyMsg.arguments(); - QCOMPARE(replyArgs.count(), 2); + QCOMPARE(replyArgs.size(), 2); QCOMPARE(replyArgs.at(0).toString(), QString::fromLatin1("One")); QCOMPARE(replyArgs.at(1).toString(), QString::fromLatin1("Two")); } @@ -189,7 +189,7 @@ void tst_QDBusLocalCalls::makeCallsComplex() QCOMPARE(int(replyMsg.type()), int(QDBusMessage::ReplyMessage)); QVariantList replyArgs = replyMsg.arguments(); - QCOMPARE(replyArgs.count(), 1); + QCOMPARE(replyArgs.size(), 1); const QVariant &reply = replyArgs.at(0); QCOMPARE(reply.userType(), qMetaTypeId()); QCOMPARE(qdbus_cast >(reply), value); diff --git a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp index f8f272ab08..4bcee5cada 100644 --- a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp +++ b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp @@ -157,7 +157,7 @@ void tst_QDBusPendingCall::waitForFinished() QCOMPARE(reply.signature(), QString("as")); const QVariantList args = ac.reply().arguments(); - QCOMPARE(args.count(), 1); + QCOMPARE(args.size(), 1); const QVariant &arg = args.at(0); QCOMPARE(arg.userType(), QMetaType::QStringList); diff --git a/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp b/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp index 6c80334a5c..7ac2c6690e 100644 --- a/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp +++ b/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp @@ -99,12 +99,12 @@ void tst_QDBusServiceWatcher::watchForCreation() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -122,12 +122,12 @@ void tst_QDBusServiceWatcher::watchForCreation() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -163,12 +163,12 @@ void tst_QDBusServiceWatcher::watchForDisappearance() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 0); + QCOMPARE(spyR.size(), 0); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), registeredName); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); @@ -197,12 +197,12 @@ void tst_QDBusServiceWatcher::watchForDisappearanceUniqueConnection() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 0); + QCOMPARE(spyR.size(), 0); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), watchedName); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), watchedName); QCOMPARE(spyO.at(0).at(1).toString(), watchedName); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); @@ -234,12 +234,12 @@ void tst_QDBusServiceWatcher::watchForOwnerChange() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -257,13 +257,13 @@ void tst_QDBusServiceWatcher::watchForOwnerChange() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), registeredName); - QCOMPARE(spyO.count(), 2); + QCOMPARE(spyO.size(), 2); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); @@ -298,12 +298,12 @@ void tst_QDBusServiceWatcher::modeChange() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), registeredName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QVERIFY(spyO.at(0).at(1).toString().isEmpty()); QCOMPARE(spyO.at(0).at(2).toString(), con.baseService()); @@ -321,12 +321,12 @@ void tst_QDBusServiceWatcher::modeChange() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 0); + QCOMPARE(spyR.size(), 0); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), registeredName); - QCOMPARE(spyO.count(), 1); + QCOMPARE(spyO.size(), 1); QCOMPARE(spyO.at(0).at(0).toString(), registeredName); QCOMPARE(spyO.at(0).at(1).toString(), con.baseService()); QVERIFY(spyO.at(0).at(2).toString().isEmpty()); @@ -377,9 +377,9 @@ void tst_QDBusServiceWatcher::setConnection() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 1); + QCOMPARE(spyR.size(), 1); QCOMPARE(spyR.at(0).at(0).toString(), serviceName); - QCOMPARE(spyU.count(), 0); + QCOMPARE(spyU.size(), 0); // is the system bus available? if (!QDBusConnection::systemBus().isConnected()) @@ -400,9 +400,9 @@ void tst_QDBusServiceWatcher::setConnection() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spyR.count(), 0); + QCOMPARE(spyR.size(), 0); - QCOMPARE(spyU.count(), 1); + QCOMPARE(spyU.size(), 1); QCOMPARE(spyU.at(0).at(0).toString(), watchedName); } diff --git a/tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp b/tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp index e25199c87f..5e1ff9e5b7 100644 --- a/tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp +++ b/tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp @@ -106,9 +106,9 @@ void tst_QDBusXmlParser::parsing_common(const QString &xmlData) QFETCH(int, objectCount); QFETCH(int, annotationCount); QFETCH(QStringList, introspection); - QCOMPARE(obj.interfaces.count(), interfaceCount); - QCOMPARE(obj.childObjects.count(), objectCount); - QCOMPARE(QDBusIntrospection::parseInterface(xmlData).annotations.count(), annotationCount); + QCOMPARE(obj.interfaces.size(), interfaceCount); + QCOMPARE(obj.childObjects.size(), objectCount); + QCOMPARE(QDBusIntrospection::parseInterface(xmlData).annotations.size(), annotationCount); QDBusIntrospection::Interfaces ifaces = QDBusIntrospection::parseInterfaces(xmlData); @@ -327,7 +327,7 @@ void tst_QDBusXmlParser::methods() QFETCH(MethodMap, methodMap); MethodMap parsedMap = iface.methods; - QCOMPARE(parsedMap.count(), methodMap.count()); + QCOMPARE(parsedMap.size(), methodMap.size()); QCOMPARE(parsedMap, methodMap); } @@ -441,7 +441,7 @@ void tst_QDBusXmlParser::signals_() QFETCH(SignalMap, signalMap); SignalMap parsedMap = iface.signals_; - QCOMPARE(signalMap.count(), parsedMap.count()); + QCOMPARE(signalMap.size(), parsedMap.size()); QCOMPARE(signalMap, parsedMap); } @@ -531,7 +531,7 @@ void tst_QDBusXmlParser::properties() QFETCH(PropertyMap, propertyMap); PropertyMap parsedMap = iface.properties; - QCOMPARE(propertyMap.count(), parsedMap.count()); + QCOMPARE(propertyMap.size(), parsedMap.size()); QCOMPARE(propertyMap, parsedMap); } diff --git a/tests/auto/gui/image/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp index b2f9c038aa..1cf13f6f9c 100644 --- a/tests/auto/gui/image/qmovie/tst_qmovie.cpp +++ b/tests/auto/gui/image/qmovie/tst_qmovie.cpp @@ -156,7 +156,7 @@ void tst_QMovie::playMovie() movie.start(); QCOMPARE(movie.state(), QMovie::Running); QTestEventLoop::instance().enterLoop(2); - QCOMPARE(finishedSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); QCOMPARE(movie.state(), QMovie::Running); QCOMPARE(movie.currentFrameNumber(), 0); } diff --git a/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp index b42136ee9d..3802f8afc6 100644 --- a/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -173,7 +173,7 @@ void tst_QFileSystemModel::rootPath() QSignalSpy rootChanged(model.data(), &QFileSystemModel::rootPathChanged); QModelIndex root = model->setRootPath(model->rootPath()); root = model->setRootPath("this directory shouldn't exist"); - QCOMPARE(rootChanged.count(), 0); + QCOMPARE(rootChanged.size(), 0); QString oldRootPath = model->rootPath(); const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); @@ -190,26 +190,26 @@ void tst_QFileSystemModel::rootPath() QTRY_VERIFY(model->rowCount(root) >= 0); QCOMPARE(model->rootPath(), QString(documentPath)); - QCOMPARE(rootChanged.count(), oldRootPath == model->rootPath() ? 0 : 1); + QCOMPARE(rootChanged.size(), oldRootPath == model->rootPath() ? 0 : 1); QCOMPARE(model->rootDirectory().absolutePath(), documentPath); model->setRootPath(QDir::rootPath()); - int oldCount = rootChanged.count(); + int oldCount = rootChanged.size(); oldRootPath = model->rootPath(); root = model->setRootPath(documentPath + QLatin1String("/.")); QTRY_VERIFY(model->rowCount(root) >= 0); QCOMPARE(model->rootPath(), documentPath); - QCOMPARE(rootChanged.count(), oldRootPath == model->rootPath() ? oldCount : oldCount + 1); + QCOMPARE(rootChanged.size(), oldRootPath == model->rootPath() ? oldCount : oldCount + 1); QCOMPARE(model->rootDirectory().absolutePath(), documentPath); QDir newdir = documentPath; if (newdir.cdUp()) { - oldCount = rootChanged.count(); + oldCount = rootChanged.size(); oldRootPath = model->rootPath(); root = model->setRootPath(documentPath + QLatin1String("/..")); QTRY_VERIFY(model->rowCount(root) >= 0); QCOMPARE(model->rootPath(), newdir.path()); - QCOMPARE(rootChanged.count(), oldCount + 1); + QCOMPARE(rootChanged.size(), oldCount + 1); QCOMPARE(model->rootDirectory().absolutePath(), newdir.path()); } @@ -403,8 +403,8 @@ void tst_QFileSystemModel::rowCount() QModelIndex root = prepareTestModelRoot(model.data(), flatDirTestPath, &spy2, &spy3); QVERIFY(root.isValid()); - QVERIFY(spy2 && spy2->count() > 0); - QVERIFY(spy3 && spy3->count() > 0); + QVERIFY(spy2 && spy2->size() > 0); + QVERIFY(spy3 && spy3->size() > 0); } void tst_QFileSystemModel::rowsInserted_data() @@ -446,7 +446,7 @@ void tst_QFileSystemModel::rowsInserted() QVERIFY(createFiles(model.data(), tmp, files, 5)); QTRY_COMPARE(model->rowCount(root), oldCount + count); int totalRowsInserted = 0; - for (int i = 0; i < spy0.count(); ++i) { + for (int i = 0; i < spy0.size(); ++i) { int start = spy0[i].value(1).toInt(); int end = spy0[i].value(2).toInt(); totalRowsInserted += end - start + 1; @@ -455,24 +455,24 @@ void tst_QFileSystemModel::rowsInserted() const QString expected = ascending == Qt::AscendingOrder ? QStringLiteral("j") : QStringLiteral("b"); QTRY_COMPARE(lastEntry(root), expected); - if (spy0.count() > 0) { + if (spy0.size() > 0) { if (count == 0) - QCOMPARE(spy0.count(), 0); + QCOMPARE(spy0.size(), 0); else - QVERIFY(spy0.count() >= 1); + QVERIFY(spy0.size() >= 1); } - if (count == 0) QCOMPARE(spy1.count(), 0); else QVERIFY(spy1.count() >= 1); + if (count == 0) QCOMPARE(spy1.size(), 0); else QVERIFY(spy1.size() >= 1); QVERIFY(createFiles(model.data(), tmp, QStringList(".hidden_file"), 5 + count)); if (count != 0) - QTRY_VERIFY(spy0.count() >= 1); + QTRY_VERIFY(spy0.size() >= 1); else - QTRY_COMPARE(spy0.count(), 0); + QTRY_COMPARE(spy0.size(), 0); if (count != 0) - QTRY_VERIFY(spy1.count() >= 1); + QTRY_VERIFY(spy1.size() >= 1); else - QTRY_COMPARE(spy1.count(), 0); + QTRY_COMPARE(spy1.size(), 0); } void tst_QFileSystemModel::rowsRemoved_data() @@ -503,14 +503,14 @@ void tst_QFileSystemModel::rowsRemoved() } for (int i = 0 ; i < 10; ++i) { if (count != 0) { - if (i == 10 || spy0.count() != 0) { - QVERIFY(spy0.count() >= 1); - QVERIFY(spy1.count() >= 1); + if (i == 10 || spy0.size() != 0) { + QVERIFY(spy0.size() >= 1); + QVERIFY(spy1.size() >= 1); } } else { - if (i == 10 || spy0.count() == 0) { - QCOMPARE(spy0.count(), 0); - QCOMPARE(spy1.count(), 0); + if (i == 10 || spy0.size() == 0) { + QCOMPARE(spy0.size(), 0); + QCOMPARE(spy1.size(), 0); } } QStringList lst; @@ -529,11 +529,11 @@ void tst_QFileSystemModel::rowsRemoved() QVERIFY(QFile::remove(tmp + QLatin1String("/.c"))); if (count != 0) { - QVERIFY(spy0.count() >= 1); - QVERIFY(spy1.count() >= 1); + QVERIFY(spy0.size() >= 1); + QVERIFY(spy1.size() >= 1); } else { - QCOMPARE(spy0.count(), 0); - QCOMPARE(spy1.count(), 0); + QCOMPARE(spy0.size(), 0); + QCOMPARE(spy1.size(), 0); } } @@ -565,7 +565,7 @@ void tst_QFileSystemModel::dataChanged() QTest::qWait(WAITTIME); - if (count != 0) QVERIFY(spy.count() >= 1); else QCOMPARE(spy.count(), 0); + if (count != 0) QVERIFY(spy.size() >= 1); else QCOMPARE(spy.size(), 0); } void tst_QFileSystemModel::filters_data() @@ -620,7 +620,7 @@ void tst_QFileSystemModel::filters() QFETCH(QStringList, nameFilters); QFETCH(int, rowCount); - if (nameFilters.count() > 0) + if (nameFilters.size() > 0) model->setNameFilters(nameFilters); model->setNameFilterDisables(false); model->setFilter(dirFilters); @@ -632,12 +632,12 @@ void tst_QFileSystemModel::filters() QDir xFactor(tmp); QStringList dirEntries; - if (nameFilters.count() > 0) + if (nameFilters.size() > 0) dirEntries = xFactor.entryList(nameFilters, dirFilters); else dirEntries = xFactor.entryList(dirFilters); - QCOMPARE(dirEntries.count(), rowCount); + QCOMPARE(dirEntries.size(), rowCount); QStringList modelEntries; @@ -649,7 +649,7 @@ void tst_QFileSystemModel::filters() QCOMPARE(dirEntries, modelEntries); #ifdef Q_OS_LINUX - if (files.count() >= 3 && rowCount >= 3 && rowCount != 5) { + if (files.size() >= 3 && rowCount >= 3 && rowCount != 5) { QString fileName1 = (tmp + '/' + files.at(0)); QString fileName2 = (tmp + '/' + files.at(1)); QString fileName3 = (tmp + '/' + files.at(2)); @@ -748,7 +748,7 @@ void tst_QFileSystemModel::setData() tmpIdx = model->index(tmp); model->fetchMore(tmpIdx); } - QTRY_COMPARE(model->rowCount(tmpIdx), files.count()); + QTRY_COMPARE(model->rowCount(tmpIdx), files.size()); QModelIndex idx = model->index(tmp + '/' + oldFileName); QCOMPARE(idx.isValid(), true); @@ -758,7 +758,7 @@ void tst_QFileSystemModel::setData() QCOMPARE(model->setData(idx, newFileName), success); model->setReadOnly(true); if (success) { - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(model->data(idx, QFileSystemModel::FileNameRole).toString(), newFileName); QCOMPARE(model->fileInfo(idx).filePath(), tmp + '/' + newFileName); @@ -767,7 +767,7 @@ void tst_QFileSystemModel::setData() QCOMPARE(arguments.at(2).toString(), newFileName); QCOMPARE(QFile::rename(tmp + '/' + newFileName, tmp + '/' + oldFileName), true); } - QTRY_COMPARE(model->rowCount(tmpIdx), files.count()); + QTRY_COMPARE(model->rowCount(tmpIdx), files.size()); // cleanup if (!subdirName.isEmpty()) QVERIFY(QDir(tmp).removeRecursively()); @@ -997,7 +997,7 @@ void tst_QFileSystemModel::caseSensitivity() QStringList paths; QModelIndexList indexes; QCOMPARE(model->rowCount(root), 0); - for (int i = 0; i < files.count(); ++i) { + for (int i = 0; i < files.size(); ++i) { const QString path = tmp + '/' + files.at(i); const QModelIndex index = model->index(path); QVERIFY(index.isValid()); @@ -1007,7 +1007,7 @@ void tst_QFileSystemModel::caseSensitivity() if (!QFileSystemEngine::isCaseSensitive()) { // QTBUG-31103, QTBUG-64147: Verify that files can be accessed by paths with fLipPeD case. - for (int i = 0; i < paths.count(); ++i) { + for (int i = 0; i < paths.size(); ++i) { const QModelIndex flippedCaseIndex = model->index(flipCase(paths.at(i))); QCOMPARE(indexes.at(i), flippedCaseIndex); } diff --git a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp index 616488a3e8..6f42c45821 100644 --- a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp +++ b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp @@ -984,8 +984,8 @@ void tst_QStandardItem::sortChildren() QCOMPARE(two->child(1)->text(), QLatin1String("e")); QCOMPARE(two->child(2)->text(), QLatin1String("f")); - QCOMPARE(layoutAboutToBeChangedSpy.count(), (x == 0) ? 0 : 3); - QCOMPARE(layoutChangedSpy.count(), (x == 0) ? 0 : 3); + QCOMPARE(layoutAboutToBeChangedSpy.size(), (x == 0) ? 0 : 3); + QCOMPARE(layoutChangedSpy.size(), (x == 0) ? 0 : 3); if (x == 0) delete item; @@ -1027,7 +1027,7 @@ void tst_QStandardItem::subclassing() QSignalSpy itemChangedSpy(&model, &QStandardItemModel::itemChanged); item->emitDataChanged(); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); QCOMPARE(itemChangedSpy.at(0).size(), 1); QCOMPARE(qvariant_cast(itemChangedSpy.at(0).at(0)), item); diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index c9f503c1f8..07fc074577 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -448,16 +448,16 @@ void tst_QStandardItemModel::setHeaderData() for (int i = 0; i < count; ++i) { QString customString = QString("custom") + QString::number(i); QCOMPARE(m_model->setHeaderData(i, orient, customString), true); - QCOMPARE(headerDataChangedSpy.count(), 1); - QCOMPARE(dataChangedSpy.count(), 0); + QCOMPARE(headerDataChangedSpy.size(), 1); + QCOMPARE(dataChangedSpy.size(), 0); QVariantList args = headerDataChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), orient); QCOMPARE(args.at(1).toInt(), i); QCOMPARE(args.at(2).toInt(), i); QCOMPARE(m_model->headerData(i, orient).toString(), customString); QCOMPARE(m_model->setHeaderData(i, orient, customString), true); - QCOMPARE(headerDataChangedSpy.count(), 0); - QCOMPARE(dataChangedSpy.count(), 0); + QCOMPARE(headerDataChangedSpy.size(), 0); + QCOMPARE(dataChangedSpy.size(), 0); } //check read from invalid sections @@ -761,9 +761,9 @@ void tst_QStandardItemModel::clear() model.clear(); - QCOMPARE(modelResetSpy.count(), 1); - QCOMPARE(layoutChangedSpy.count(), 0); - QCOMPARE(rowsRemovedSpy.count(), 0); + QCOMPARE(modelResetSpy.size(), 1); + QCOMPARE(layoutChangedSpy.size(), 0); + QCOMPARE(rowsRemovedSpy.size(), 0); QCOMPARE(model.index(0, 0), QModelIndex()); QCOMPARE(model.columnCount(), 0); QCOMPARE(model.rowCount(), 0); @@ -805,8 +805,8 @@ void tst_QStandardItemModel::sort() QFETCH(QStringList, expected); // prepare model QStandardItemModel model; - QVERIFY(model.insertRows(0, initial.count(), QModelIndex())); - QCOMPARE(model.rowCount(QModelIndex()), initial.count()); + QVERIFY(model.insertRows(0, initial.size(), QModelIndex())); + QCOMPARE(model.rowCount(QModelIndex()), initial.size()); model.insertColumns(0, 1, QModelIndex()); QCOMPARE(model.columnCount(QModelIndex()), 1); for (int row = 0; row < model.rowCount(QModelIndex()); ++row) { @@ -822,8 +822,8 @@ void tst_QStandardItemModel::sort() // sort model.sort(0, sortOrder); - QCOMPARE(layoutAboutToBeChangedSpy.count(), 1); - QCOMPARE(layoutChangedSpy.count(), 1); + QCOMPARE(layoutAboutToBeChangedSpy.size(), 1); + QCOMPARE(layoutChangedSpy.size(), 1); // make sure the model is sorted for (int row = 0; row < model.rowCount(QModelIndex()); ++row) { @@ -867,7 +867,7 @@ void tst_QStandardItemModel::sortRole() QFETCH(QVariantList, expectedData); QStandardItemModel model; - for (int i = 0; i < initialText.count(); ++i) { + for (int i = 0; i < initialText.size(); ++i) { QStandardItem *item = new QStandardItem; item->setText(initialText.at(i)); item->setData(initialData.at(i), Qt::UserRole); @@ -875,7 +875,7 @@ void tst_QStandardItemModel::sortRole() } model.setSortRole(sortRole); model.sort(0, sortOrder); - for (int i = 0; i < expectedText.count(); ++i) { + for (int i = 0; i < expectedText.size(); ++i) { QStandardItem *item = model.item(i); QCOMPARE(item->text(), expectedText.at(i)); QCOMPARE(item->data(Qt::UserRole), expectedData.at(i)); @@ -1061,9 +1061,9 @@ void tst_QStandardItemModel::getSetItemData() QSignalSpy modelDataChangedSpy( &model, &QStandardItemModel::dataChanged); QVERIFY(model.setItemData(idx, roles)); - QCOMPARE(modelDataChangedSpy.count(), 1); + QCOMPARE(modelDataChangedSpy.size(), 1); QVERIFY(model.setItemData(idx, roles)); - QCOMPARE(modelDataChangedSpy.count(), 1); //it was already changed once + QCOMPARE(modelDataChangedSpy.size(), 1); //it was already changed once QCOMPARE(model.itemData(idx), roles); } @@ -1127,12 +1127,12 @@ void tst_QStandardItemModel::setHeaderLabels() model.setHorizontalHeaderLabels(labels); else model.setVerticalHeaderLabels(labels); - for (int i = 0; i < expectedLabels.count(); ++i) + for (int i = 0; i < expectedLabels.size(); ++i) QCOMPARE(model.headerData(i, orientation).toString(), expectedLabels.at(i)); - QCOMPARE(columnsInsertedSpy.count(), - (orientation == Qt::Vertical) ? 0 : labels.count() > columns); - QCOMPARE(rowsInsertedSpy.count(), - (orientation == Qt::Horizontal) ? 0 : labels.count() > rows); + QCOMPARE(columnsInsertedSpy.size(), + (orientation == Qt::Vertical) ? 0 : labels.size() > columns); + QCOMPARE(rowsInsertedSpy.size(), + (orientation == Qt::Horizontal) ? 0 : labels.size() > rows); } void tst_QStandardItemModel::itemDataChanged() @@ -1143,8 +1143,8 @@ void tst_QStandardItemModel::itemDataChanged() QSignalSpy itemChangedSpy(&model, &QStandardItemModel::itemChanged); model.setItem(0, &item); - QCOMPARE(dataChangedSpy.count(), 1); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); + QCOMPARE(itemChangedSpy.size(), 1); QModelIndex index = model.indexFromItem(&item); QList args; args = dataChangedSpy.takeFirst(); @@ -1154,8 +1154,8 @@ void tst_QStandardItemModel::itemDataChanged() QCOMPARE(qvariant_cast(args.at(0)), &item); item.setData(QLatin1String("foo"), Qt::DisplayRole); - QCOMPARE(dataChangedSpy.count(), 1); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = dataChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), index); QCOMPARE(qvariant_cast(args.at(1)), index); @@ -1163,12 +1163,12 @@ void tst_QStandardItemModel::itemDataChanged() QCOMPARE(qvariant_cast(args.at(0)), &item); item.setData(item.data(Qt::DisplayRole), Qt::DisplayRole); - QCOMPARE(dataChangedSpy.count(), 0); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(dataChangedSpy.size(), 0); + QCOMPARE(itemChangedSpy.size(), 0); item.setFlags(Qt::ItemIsEnabled); - QCOMPARE(dataChangedSpy.count(), 1); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = dataChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), index); QCOMPARE(qvariant_cast(args.at(1)), index); @@ -1176,8 +1176,8 @@ void tst_QStandardItemModel::itemDataChanged() QCOMPARE(qvariant_cast(args.at(0)), &item); item.setFlags(item.flags()); - QCOMPARE(dataChangedSpy.count(), 0); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(dataChangedSpy.size(), 0); + QCOMPARE(itemChangedSpy.size(), 0); } void tst_QStandardItemModel::takeHeaderItem() @@ -1305,7 +1305,7 @@ void tst_QStandardItemModel::setNullChild() QSignalSpy spy(&model, &QAbstractItemModel::dataChanged); item->setChild(0, nullptr); QCOMPARE(item->child(0), nullptr); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QStandardItemModel::deleteChild() @@ -1317,7 +1317,7 @@ void tst_QStandardItemModel::deleteChild() QSignalSpy spy(&model, &QAbstractItemModel::dataChanged); delete item->child(0); QCOMPARE(item->child(0), nullptr); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QStandardItemModel::rootItemFlags() @@ -1558,8 +1558,8 @@ void tst_QStandardItemModel::removeRowsAndColumns() QStringList row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(','); QStringList col_list = row_list; QStandardItemModel model; - for (int c = 0; c < col_list.count(); c++) - for (int r = 0; r < row_list.count(); r++) + for (int c = 0; c < col_list.size(); c++) + for (int r = 0; r < row_list.size(); r++) model.setItem(r, c, new QStandardItem(row_list[r] + QLatin1Char('x') + col_list[c])); VERIFY_MODEL @@ -1580,15 +1580,15 @@ void tst_QStandardItemModel::removeRowsAndColumns() VERIFY_MODEL QList row_taken = model.takeRow(6); - QCOMPARE(row_taken.size(), col_list.count()); - for (int c = 0; c < col_list.count(); c++) + QCOMPARE(row_taken.size(), col_list.size()); + for (int c = 0; c < col_list.size(); c++) QCOMPARE(row_taken[c]->text() , row_list[6] + QLatin1Char('x') + col_list[c]); row_list.remove(6); VERIFY_MODEL QList col_taken = model.takeColumn(10); - QCOMPARE(col_taken.size(), row_list.count()); - for (int r = 0; r < row_list.count(); r++) + QCOMPARE(col_taken.size(), row_list.size()); + for (int r = 0; r < row_list.size(); r++) QCOMPARE(col_taken[r]->text() , row_list[r] + QLatin1Char('x') + col_list[10]); col_list.remove(10); VERIFY_MODEL @@ -1605,8 +1605,8 @@ void tst_QStandardItemModel::itemRoleNames() QStringList row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(','); QStringList col_list = row_list; QStandardItemModel model; - for (int c = 0; c < col_list.count(); c++) - for (int r = 0; r < row_list.count(); r++) + for (int c = 0; c < col_list.size(); c++) + for (int r = 0; r < row_list.size(); r++) model.setItem(r, c, new QStandardItem(row_list[r] + QLatin1Char('x') + col_list[c])); VERIFY_MODEL @@ -1646,7 +1646,7 @@ void tst_QStandardItemModel::taskQTBUG_45114_setItemData() QModelIndex index = item->index(); QCOMPARE(model.itemData(index).size(), 3); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QMap roles; @@ -1654,21 +1654,21 @@ void tst_QStandardItemModel::taskQTBUG_45114_setItemData() roles.insert(Qt::UserRole + 2, 2); model.setItemData(index, roles); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); roles.insert(Qt::UserRole + 1, 1); roles.insert(Qt::UserRole + 2, 2); roles.insert(Qt::UserRole + 3, QVariant()); model.setItemData(index, roles); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); roles.clear(); roles.insert(Qt::UserRole + 1, 10); roles.insert(Qt::UserRole + 3, 12); model.setItemData(index, roles); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QMap itemRoles = model.itemData(index); QCOMPARE(itemRoles.size(), 4); @@ -1680,13 +1680,13 @@ void tst_QStandardItemModel::taskQTBUG_45114_setItemData() roles.insert(Qt::UserRole + 3, 1); model.setItemData(index, roles); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); roles.clear(); roles.insert(Qt::UserRole + 3, QVariant()); model.setItemData(index, roles); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); itemRoles = model.itemData(index); QCOMPARE(itemRoles.size(), 3); @@ -1739,13 +1739,13 @@ void tst_QStandardItemModel::signalsOnTakeItem() // QTBUG-89145 QSignalSpy dataChangedSpy(&m, &QAbstractItemModel::dataChanged); QStandardItem *const takenItem = m.takeItem(1, 0); for (auto &&spy : removeSpies) { - QCOMPARE(spy->count(), 1); + QCOMPARE(spy->size(), 1); const auto spyArgs = spy->takeFirst(); QCOMPARE(spyArgs.at(0).value(), parentIndex); QCOMPARE(spyArgs.at(1).toInt(), 0); QCOMPARE(spyArgs.at(2).toInt(), 1); } - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); const auto dataChangedSpyArgs = dataChangedSpy.takeFirst(); QCOMPARE(dataChangedSpyArgs.at(0).value(), m.index(1, 0)); QCOMPARE(dataChangedSpyArgs.at(1).value(), m.index(1, 0)); diff --git a/tests/auto/gui/kernel/qaction/tst_qaction.cpp b/tests/auto/gui/kernel/qaction/tst_qaction.cpp index cebcf9ca5a..930cee26b8 100644 --- a/tests/auto/gui/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/gui/kernel/qaction/tst_qaction.cpp @@ -209,11 +209,11 @@ void tst_QAction::setToolTip() QFETCH(QStringList, values); QFETCH(QStringList, expectedToolTips); - QCOMPARE(properties.count(), values.count()); - QCOMPARE(properties.count(), expectedToolTips.count()); + QCOMPARE(properties.size(), values.size()); + QCOMPARE(properties.size(), expectedToolTips.size()); QAction action(nullptr); - for (int i = 0; i < properties.count(); ++i) { + for (int i = 0; i < properties.size(); ++i) { const auto property = properties.at(i); const auto value = values.at(i); const auto expectedToolTip = expectedToolTips.at(i); @@ -272,19 +272,19 @@ void tst_QAction::task229128TriggeredSignalWithoutActiongroup() // test without a group const QScopedPointer actionWithoutGroup(new QAction("Test", nullptr)); QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), QOverload::of(&QAction::triggered)); - QCOMPARE(spyWithoutGroup.count(), 0); + QCOMPARE(spyWithoutGroup.size(), 0); actionWithoutGroup->trigger(); // signal should be emitted - QCOMPARE(spyWithoutGroup.count(), 1); + QCOMPARE(spyWithoutGroup.size(), 1); // it is now a checkable checked action actionWithoutGroup->setCheckable(true); actionWithoutGroup->setChecked(true); spyWithoutGroup.clear(); - QCOMPARE(spyWithoutGroup.count(), 0); + QCOMPARE(spyWithoutGroup.size(), 0); actionWithoutGroup->trigger(); // signal should be emitted - QCOMPARE(spyWithoutGroup.count(), 1); + QCOMPARE(spyWithoutGroup.size(), 1); } void tst_QAction::setData() // QTBUG-62006 @@ -292,14 +292,14 @@ void tst_QAction::setData() // QTBUG-62006 QAction act(nullptr); QSignalSpy spy(&act, &QAction::changed); QCOMPARE(act.data(), QVariant()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); act.setData(QVariant()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); act.setData(-1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); act.setData(-1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QAction::setEnabledSetVisible() @@ -308,22 +308,22 @@ void tst_QAction::setEnabledSetVisible() QSignalSpy spy(&action, &QAction::enabledChanged); QVERIFY(action.isEnabled()); QVERIFY(action.isVisible()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); action.setVisible(false); QVERIFY(!action.isEnabled()); QVERIFY(!action.isVisible()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); action.setEnabled(false); QVERIFY(!action.isEnabled()); QVERIFY(!action.isVisible()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); action.setVisible(true); QVERIFY(!action.isEnabled()); QVERIFY(action.isVisible()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); action.resetEnabled(); QVERIFY(action.isEnabled()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QAction::setCheckabledSetChecked() @@ -334,37 +334,37 @@ void tst_QAction::setCheckabledSetChecked() QSignalSpy checkableSpy(&action, &QAction::checkableChanged); QVERIFY(!action.isCheckable()); QVERIFY(!action.isChecked()); - QCOMPARE(changedSpy.count(), 0); - QCOMPARE(checkedSpy.count(), 0); - QCOMPARE(checkableSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); + QCOMPARE(checkedSpy.size(), 0); + QCOMPARE(checkableSpy.size(), 0); action.setCheckable(true); QVERIFY(action.isCheckable()); QVERIFY(!action.isChecked()); - QCOMPARE(changedSpy.count(), 1); - QCOMPARE(checkedSpy.count(), 0); - QCOMPARE(checkableSpy.count(), 1); + QCOMPARE(changedSpy.size(), 1); + QCOMPARE(checkedSpy.size(), 0); + QCOMPARE(checkableSpy.size(), 1); action.setChecked(true); QVERIFY(action.isCheckable()); QVERIFY(action.isChecked()); - QCOMPARE(changedSpy.count(), 2); - QCOMPARE(checkedSpy.count(), 1); - QCOMPARE(checkableSpy.count(), 1); + QCOMPARE(changedSpy.size(), 2); + QCOMPARE(checkedSpy.size(), 1); + QCOMPARE(checkableSpy.size(), 1); action.setCheckable(false); QVERIFY(!action.isCheckable()); QVERIFY(!action.isChecked()); - QCOMPARE(changedSpy.count(), 3); - QCOMPARE(checkedSpy.count(), 2); - QCOMPARE(checkableSpy.count(), 2); + QCOMPARE(changedSpy.size(), 3); + QCOMPARE(checkedSpy.size(), 2); + QCOMPARE(checkableSpy.size(), 2); action.setCheckable(true); QVERIFY(action.isCheckable()); QVERIFY(action.isChecked()); - QCOMPARE(changedSpy.count(), 4); - QCOMPARE(checkedSpy.count(), 3); - QCOMPARE(checkableSpy.count(), 3); + QCOMPARE(changedSpy.size(), 4); + QCOMPARE(checkedSpy.size(), 3); + QCOMPARE(checkableSpy.size(), 3); } QTEST_MAIN(tst_QAction) diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index ecc821f7b4..d5150d97b1 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -124,7 +124,7 @@ public: operator bool() const { - if (m_timer.elapsed() && !m_spy.count()) + if (m_timer.elapsed() && !m_spy.size()) return true; m_spy.clear(); return false; @@ -166,10 +166,10 @@ void tst_QClipboard::testSignals() // Test the default mode signal. clipboard->setText(text); - QTRY_COMPARE(dataChangedSpy.count(), 1); - QCOMPARE(searchChangedSpy.count(), 0); - QCOMPARE(selectionChangedSpy.count(), 0); - QCOMPARE(changedSpy.count(), 1); + QTRY_COMPARE(dataChangedSpy.size(), 1); + QCOMPARE(searchChangedSpy.size(), 0); + QCOMPARE(selectionChangedSpy.size(), 0); + QCOMPARE(changedSpy.size(), 1); QCOMPARE(changedSpy.at(0).size(), 1); QCOMPARE(qvariant_cast(changedSpy.at(0).at(0)), QClipboard::Clipboard); @@ -178,29 +178,29 @@ void tst_QClipboard::testSignals() // Test the selection mode signal. if (clipboard->supportsSelection()) { clipboard->setText(text, QClipboard::Selection); - QCOMPARE(selectionChangedSpy.count(), 1); - QCOMPARE(changedSpy.count(), 1); + QCOMPARE(selectionChangedSpy.size(), 1); + QCOMPARE(changedSpy.size(), 1); QCOMPARE(changedSpy.at(0).size(), 1); QCOMPARE(qvariant_cast(changedSpy.at(0).at(0)), QClipboard::Selection); } else { - QCOMPARE(selectionChangedSpy.count(), 0); + QCOMPARE(selectionChangedSpy.size(), 0); } - QCOMPARE(dataChangedSpy.count(), 1); - QCOMPARE(searchChangedSpy.count(), 0); + QCOMPARE(dataChangedSpy.size(), 1); + QCOMPARE(searchChangedSpy.size(), 0); changedSpy.clear(); // Test the search mode signal. if (clipboard->supportsFindBuffer()) { clipboard->setText(text, QClipboard::FindBuffer); - QCOMPARE(searchChangedSpy.count(), 1); - QCOMPARE(changedSpy.count(), 1); + QCOMPARE(searchChangedSpy.size(), 1); + QCOMPARE(changedSpy.size(), 1); QCOMPARE(changedSpy.at(0).size(), 1); QCOMPARE(qvariant_cast(changedSpy.at(0).at(0)), QClipboard::FindBuffer); } else { - QCOMPARE(searchChangedSpy.count(), 0); + QCOMPARE(searchChangedSpy.size(), 0); } - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); } #if defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_QNX) @@ -340,16 +340,16 @@ void tst_QClipboard::setMimeData() QGuiApplication::clipboard()->clear(QClipboard::FindBuffer); if (QGuiApplication::clipboard()->supportsSelection()) - QCOMPARE(spySelection.count(), 1); + QCOMPARE(spySelection.size(), 1); else - QCOMPARE(spySelection.count(), 0); + QCOMPARE(spySelection.size(), 0); if (QGuiApplication::clipboard()->supportsFindBuffer()) - QCOMPARE(spyFindBuffer.count(), 1); + QCOMPARE(spyFindBuffer.size(), 1); else - QCOMPARE(spyFindBuffer.count(), 0); + QCOMPARE(spyFindBuffer.size(), 0); - QTRY_COMPARE(spyData.count(), 1); + QTRY_COMPARE(spyData.size(), 1); // an other crash test data = new QMimeData; @@ -376,16 +376,16 @@ void tst_QClipboard::setMimeData() QGuiApplication::clipboard()->setMimeData(newData, QClipboard::FindBuffer); if (QGuiApplication::clipboard()->supportsSelection()) - QCOMPARE(spySelection.count(), 1); + QCOMPARE(spySelection.size(), 1); else - QCOMPARE(spySelection.count(), 0); + QCOMPARE(spySelection.size(), 0); if (QGuiApplication::clipboard()->supportsFindBuffer()) - QCOMPARE(spyFindBuffer.count(), 1); + QCOMPARE(spyFindBuffer.size(), 1); else - QCOMPARE(spyFindBuffer.count(), 0); + QCOMPARE(spyFindBuffer.size(), 0); - QTRY_COMPARE(spyData.count(), 1); + QTRY_COMPARE(spyData.size(), 1); } void tst_QClipboard::clearBeforeSetText() diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index 0ff9276902..5a206d8177 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -98,20 +98,20 @@ void tst_QGuiApplication::displayName() QGuiApplication::setApplicationName("The Core Application"); QCOMPARE(QGuiApplication::applicationName(), QString::fromLatin1("The Core Application")); QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The Core Application")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QGuiApplication::setApplicationDisplayName("The GUI Application"); QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application")); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QGuiApplication::setApplicationName("The Core Application 2"); QCOMPARE(QGuiApplication::applicationName(), QString::fromLatin1("The Core Application 2")); QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application")); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QGuiApplication::setApplicationDisplayName("The GUI Application 2"); QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application 2")); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); } void tst_QGuiApplication::desktopFileName() @@ -222,12 +222,12 @@ void tst_QGuiApplication::focusObject() window1.setFocusObject(&obj1); QCOMPARE(app.focusObject(), &obj1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); window1.setFocusObject(&obj2); QCOMPARE(app.focusObject(), &obj2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); window2.setFocusObject(&obj3); @@ -236,12 +236,12 @@ void tst_QGuiApplication::focusObject() QVERIFY(QTest::qWaitForWindowExposed(&window2)); QTRY_COMPARE(app.focusWindow(), &window2); QCOMPARE(app.focusObject(), &obj3); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // focus change on unfocused window does not show spy.clear(); window1.setFocusObject(&obj1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(app.focusObject(), &obj3); } @@ -253,13 +253,13 @@ void tst_QGuiApplication::allWindows() QWindow *window2 = new QWindow(window1); QVERIFY(app.allWindows().contains(window1)); QVERIFY(app.allWindows().contains(window2)); - QCOMPARE(app.allWindows().count(), 2); + QCOMPARE(app.allWindows().size(), 2); delete window1; window1 = nullptr; window2 = nullptr; QVERIFY(!app.allWindows().contains(window2)); QVERIFY(!app.allWindows().contains(window1)); - QCOMPARE(app.allWindows().count(), 0); + QCOMPARE(app.allWindows().size(), 0); } void tst_QGuiApplication::topLevelWindows() @@ -270,13 +270,13 @@ void tst_QGuiApplication::topLevelWindows() QWindow *window2 = new QWindow(window1); QVERIFY(app.topLevelWindows().contains(window1)); QVERIFY(!app.topLevelWindows().contains(window2)); - QCOMPARE(app.topLevelWindows().count(), 1); + QCOMPARE(app.topLevelWindows().size(), 1); delete window1; window1 = nullptr; window2 = nullptr; QVERIFY(!app.topLevelWindows().contains(window2)); QVERIFY(!app.topLevelWindows().contains(window1)); - QCOMPARE(app.topLevelWindows().count(), 0); + QCOMPARE(app.topLevelWindows().size(), 0); } class ShowCloseShowWindow : public QWindow @@ -531,7 +531,7 @@ void tst_QGuiApplication::palette() QGuiApplication::setPalette(newPalette); QVERIFY(palettesMatch(QGuiApplication::palette(), newPalette)); #if QT_DEPRECATED_SINCE(6, 0) - QCOMPARE(signalSpy.count(), 1); + QCOMPARE(signalSpy.size(), 1); QVERIFY(palettesMatch(signalSpy.at(0).at(0).value(), newPalette)); #endif QCOMPARE(QGuiApplication::palette(), QPalette()); @@ -539,7 +539,7 @@ void tst_QGuiApplication::palette() QGuiApplication::setPalette(oldPalette); QVERIFY(palettesMatch(QGuiApplication::palette(), oldPalette)); #if QT_DEPRECATED_SINCE(6, 0) - QCOMPARE(signalSpy.count(), 2); + QCOMPARE(signalSpy.size(), 2); QVERIFY(palettesMatch(signalSpy.at(1).at(0).value(), oldPalette)); #endif QCOMPARE(QGuiApplication::palette(), QPalette()); @@ -547,7 +547,7 @@ void tst_QGuiApplication::palette() QGuiApplication::setPalette(oldPalette); QVERIFY(palettesMatch(QGuiApplication::palette(), oldPalette)); #if QT_DEPRECATED_SINCE(6, 0) - QCOMPARE(signalSpy.count(), 2); + QCOMPARE(signalSpy.size(), 2); #endif QCOMPARE(QGuiApplication::palette(), QPalette()); } @@ -567,21 +567,21 @@ void tst_QGuiApplication::font() QGuiApplication::setFont(newFont); QCOMPARE(QGuiApplication::font(), newFont); #if QT_DEPRECATED_SINCE(6, 0) - QCOMPARE(signalSpy.count(), 1); + QCOMPARE(signalSpy.size(), 1); QCOMPARE(signalSpy.at(0).at(0), QVariant(newFont)); #endif QGuiApplication::setFont(oldFont); QCOMPARE(QGuiApplication::font(), oldFont); #if QT_DEPRECATED_SINCE(6, 0) - QCOMPARE(signalSpy.count(), 2); + QCOMPARE(signalSpy.size(), 2); QCOMPARE(signalSpy.at(1).at(0), QVariant(oldFont)); #endif QGuiApplication::setFont(oldFont); QCOMPARE(QGuiApplication::font(), oldFont); #if QT_DEPRECATED_SINCE(6, 0) - QCOMPARE(signalSpy.count(), 2); + QCOMPARE(signalSpy.size(), 2); #endif } @@ -887,9 +887,9 @@ void tst_QGuiApplication::quitOnLastWindowClosed() app.exec(); - QCOMPARE(spyAboutToQuit.count(), 1); + QCOMPARE(spyAboutToQuit.size(), 1); // Should be around 10 if closing caused the quit - QVERIFY2(spyTimeout.count() < 15, QByteArray::number(spyTimeout.count()).constData()); + QVERIFY2(spyTimeout.size() < 15, QByteArray::number(spyTimeout.size()).constData()); } void tst_QGuiApplication::quitOnLastWindowClosedMulti() @@ -930,7 +930,7 @@ void tst_QGuiApplication::quitOnLastWindowClosedMulti() app.exec(); QVERIFY(!prematureQuit); - QCOMPARE(spyAboutToQuit.count(), 1); // fired only once + QCOMPARE(spyAboutToQuit.size(), 1); // fired only once } void tst_QGuiApplication::dontQuitOnLastWindowClosed() @@ -958,8 +958,8 @@ void tst_QGuiApplication::dontQuitOnLastWindowClosed() app.setQuitOnLastWindowClosed(true); // restore underlying static to default value - QCOMPARE(spyTimeout.count(), 1); // quit timer fired - QCOMPARE(spyLastWindowClosed.count(), 1); // lastWindowClosed emitted + QCOMPARE(spyTimeout.size(), 1); // quit timer fired + QCOMPARE(spyLastWindowClosed.size(), 1); // lastWindowClosed emitted } class QuitSpy : public QObject @@ -1161,12 +1161,12 @@ void tst_QGuiApplication::layoutDirection() QGuiApplication::setLayoutDirection(oldDirection); QCOMPARE(QGuiApplication::layoutDirection(), oldDirection); - QCOMPARE(signalSpy.count(), 1); + QCOMPARE(signalSpy.size(), 1); QCOMPARE(signalSpy.at(0).at(0).toInt(), static_cast(oldDirection)); QGuiApplication::setLayoutDirection(oldDirection); QCOMPARE(QGuiApplication::layoutDirection(), oldDirection); - QCOMPARE(signalSpy.count(), 1); + QCOMPARE(signalSpy.size(), 1); // with QGuiApplication instantiated, install a translator that gives us control class LayoutDirectionTranslator : public QTranslator @@ -1197,31 +1197,31 @@ void tst_QGuiApplication::layoutDirection() LayoutDirectionTranslator translator(oldDirection); QGuiApplication::installTranslator(&translator); QCOMPARE(QGuiApplication::layoutDirection(), translator.direction); - QCOMPARE(signalSpy.count(), layoutDirectionChangedCount); + QCOMPARE(signalSpy.size(), layoutDirectionChangedCount); } - QCOMPARE(signalSpy.count(), layoutDirectionChangedCount); // ltrTranslator removed, no change + QCOMPARE(signalSpy.size(), layoutDirectionChangedCount); // ltrTranslator removed, no change // install a new translator that changes the direction { LayoutDirectionTranslator translator(newDirection); QGuiApplication::installTranslator(&translator); QCOMPARE(QGuiApplication::layoutDirection(), translator.direction); - QCOMPARE(signalSpy.count(), ++layoutDirectionChangedCount); + QCOMPARE(signalSpy.size(), ++layoutDirectionChangedCount); } // rtlTranslator removed - QCOMPARE(signalSpy.count(), ++layoutDirectionChangedCount); + QCOMPARE(signalSpy.size(), ++layoutDirectionChangedCount); // override translation QGuiApplication::setLayoutDirection(newDirection); - QCOMPARE(signalSpy.count(), ++layoutDirectionChangedCount); + QCOMPARE(signalSpy.size(), ++layoutDirectionChangedCount); { // this translator will be ignored LayoutDirectionTranslator translator(oldDirection); QGuiApplication::installTranslator(&translator); QCOMPARE(QGuiApplication::layoutDirection(), newDirection); - QCOMPARE(signalSpy.count(), layoutDirectionChangedCount); + QCOMPARE(signalSpy.size(), layoutDirectionChangedCount); } - QCOMPARE(signalSpy.count(), layoutDirectionChangedCount); + QCOMPARE(signalSpy.size(), layoutDirectionChangedCount); } diff --git a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp index 86669fde62..c562a5c362 100644 --- a/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp +++ b/tests/auto/gui/kernel/qinputmethod/tst_qinputmethod.cpp @@ -125,7 +125,7 @@ void tst_qinputmethod::animating() QSignalSpy spy(qApp->inputMethod(), SIGNAL(animatingChanged())); m_platformInputContext.emitAnimatingChanged(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_qinputmethod::keyboarRectangle() @@ -137,7 +137,7 @@ void tst_qinputmethod::keyboarRectangle() QSignalSpy spy(qApp->inputMethod(), SIGNAL(keyboardRectangleChanged())); m_platformInputContext.emitKeyboardRectChanged(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_qinputmethod::inputItemTransform() @@ -152,7 +152,7 @@ void tst_qinputmethod::inputItemTransform() qApp->inputMethod()->setInputItemTransform(transform); QCOMPARE(qApp->inputMethod()->inputItemTransform(), transform); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // reset qApp->inputMethod()->setInputItemTransform(QTransform()); diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp index 9d85a31d5a..b537b211c1 100644 --- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp +++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp @@ -158,27 +158,27 @@ void tst_QScreen::orientationChange() QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation); QWindowSystemInterface::flushWindowSystemEvents(); QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation); - QCOMPARE(spy.count(), ++expectedSignalCount); + QCOMPARE(spy.size(), ++expectedSignalCount); QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::PortraitOrientation); QWindowSystemInterface::flushWindowSystemEvents(); QTRY_COMPARE(screen->orientation(), Qt::PortraitOrientation); - QCOMPARE(spy.count(), ++expectedSignalCount); + QCOMPARE(spy.size(), ++expectedSignalCount); QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::InvertedLandscapeOrientation); QWindowSystemInterface::flushWindowSystemEvents(); QTRY_COMPARE(screen->orientation(), Qt::InvertedLandscapeOrientation); - QCOMPARE(spy.count(), ++expectedSignalCount); + QCOMPARE(spy.size(), ++expectedSignalCount); QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::InvertedPortraitOrientation); QWindowSystemInterface::flushWindowSystemEvents(); QTRY_COMPARE(screen->orientation(), Qt::InvertedPortraitOrientation); - QCOMPARE(spy.count(), ++expectedSignalCount); + QCOMPARE(spy.size(), ++expectedSignalCount); QWindowSystemInterface::handleScreenOrientationChange(screen, Qt::LandscapeOrientation); QWindowSystemInterface::flushWindowSystemEvents(); QTRY_COMPARE(screen->orientation(), Qt::LandscapeOrientation); - QCOMPARE(spy.count(), ++expectedSignalCount); + QCOMPARE(spy.size(), ++expectedSignalCount); } void tst_QScreen::grabWindow_data() diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 123aa84bbc..d2d89c0ebf 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -1511,7 +1511,7 @@ void tst_QWindow::orientation() QSignalSpy spy(&window, SIGNAL(contentOrientationChanged(Qt::ScreenOrientation))); window.reportContentOrientationChange(Qt::LandscapeOrientation); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QWindow::sizes() @@ -1530,40 +1530,40 @@ void tst_QWindow::sizes() QCOMPARE(window.minimumHeight(), 0); QCOMPARE(window.minimumSize(), QSize(10, 0)); QCOMPARE(window.maximumSize(), oldMaximum); - QCOMPARE(minimumWidthSpy.count(), 1); - QCOMPARE(minimumHeightSpy.count(), 0); - QCOMPARE(maximumWidthSpy.count(), 0); - QCOMPARE(maximumHeightSpy.count(), 0); + QCOMPARE(minimumWidthSpy.size(), 1); + QCOMPARE(minimumHeightSpy.size(), 0); + QCOMPARE(maximumWidthSpy.size(), 0); + QCOMPARE(maximumHeightSpy.size(), 0); window.setMinimumHeight(10); QCOMPARE(window.minimumWidth(), 10); QCOMPARE(window.minimumHeight(), 10); QCOMPARE(window.minimumSize(), QSize(10, 10)); QCOMPARE(window.maximumSize(), oldMaximum); - QCOMPARE(minimumWidthSpy.count(), 1); - QCOMPARE(minimumHeightSpy.count(), 1); - QCOMPARE(maximumWidthSpy.count(), 0); - QCOMPARE(maximumHeightSpy.count(), 0); + QCOMPARE(minimumWidthSpy.size(), 1); + QCOMPARE(minimumHeightSpy.size(), 1); + QCOMPARE(maximumWidthSpy.size(), 0); + QCOMPARE(maximumHeightSpy.size(), 0); window.setMaximumWidth(100); QCOMPARE(window.maximumWidth(), 100); QCOMPARE(window.maximumHeight(), oldMaximum.height()); QCOMPARE(window.minimumSize(), QSize(10, 10)); QCOMPARE(window.maximumSize(), QSize(100, oldMaximum.height())); - QCOMPARE(minimumWidthSpy.count(), 1); - QCOMPARE(minimumHeightSpy.count(), 1); - QCOMPARE(maximumWidthSpy.count(), 1); - QCOMPARE(maximumHeightSpy.count(), 0); + QCOMPARE(minimumWidthSpy.size(), 1); + QCOMPARE(minimumHeightSpy.size(), 1); + QCOMPARE(maximumWidthSpy.size(), 1); + QCOMPARE(maximumHeightSpy.size(), 0); window.setMaximumHeight(100); QCOMPARE(window.maximumWidth(), 100); QCOMPARE(window.maximumHeight(), 100); QCOMPARE(window.minimumSize(), QSize(10, 10)); QCOMPARE(window.maximumSize(), QSize(100, 100)); - QCOMPARE(minimumWidthSpy.count(), 1); - QCOMPARE(minimumHeightSpy.count(), 1); - QCOMPARE(maximumWidthSpy.count(), 1); - QCOMPARE(maximumHeightSpy.count(), 1); + QCOMPARE(minimumWidthSpy.size(), 1); + QCOMPARE(minimumHeightSpy.size(), 1); + QCOMPARE(maximumWidthSpy.size(), 1); + QCOMPARE(maximumHeightSpy.size(), 1); // test if min and max limits will change the size QVERIFY(window.minimumWidth() < 50 && window.maximumWidth() > 80); @@ -1806,25 +1806,25 @@ void tst_QWindow::windowModality() QCOMPARE(window.modality(), Qt::NonModal); window.setModality(Qt::NonModal); QCOMPARE(window.modality(), Qt::NonModal); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); window.setModality(Qt::WindowModal); QCOMPARE(window.modality(), Qt::WindowModal); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); window.setModality(Qt::WindowModal); QCOMPARE(window.modality(), Qt::WindowModal); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); window.setModality(Qt::ApplicationModal); QCOMPARE(window.modality(), Qt::ApplicationModal); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); window.setModality(Qt::ApplicationModal); QCOMPARE(window.modality(), Qt::ApplicationModal); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); window.setModality(Qt::NonModal); QCOMPARE(window.modality(), Qt::NonModal); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); } void tst_QWindow::inputReentrancy() @@ -2007,32 +2007,32 @@ void tst_QWindow::visibility() QVERIFY(window.isVisible()); QVERIFY(window.visibility() != QWindow::Hidden); QVERIFY(window.visibility() != QWindow::AutomaticVisibility); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); window.setVisibility(QWindow::Hidden); QVERIFY(!window.isVisible()); QCOMPARE(window.visibility(), QWindow::Hidden); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); window.setVisibility(QWindow::FullScreen); QVERIFY(window.isVisible()); QCOMPARE(window.windowState(), Qt::WindowFullScreen); QCOMPARE(window.visibility(), QWindow::FullScreen); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTRY_COMPARE(window.lastReceivedWindowState, Qt::WindowFullScreen); spy.clear(); window.setWindowState(Qt::WindowNoState); QCOMPARE(window.visibility(), QWindow::Windowed); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTRY_COMPARE(window.lastReceivedWindowState, Qt::WindowNoState); spy.clear(); window.setVisible(false); QCOMPARE(window.visibility(), QWindow::Hidden); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); } diff --git a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp index 87dda161d2..512381ab95 100644 --- a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp +++ b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp @@ -168,8 +168,8 @@ void tst_QPolygon::swap() QPolygon p2(QList() << QPoint(0, 0) << QPoint(0, 10) << QPoint(10, 10) << QPoint(10, 0)); p1.swap(p2); - QCOMPARE(p1.count(),4); - QCOMPARE(p2.count(),3); + QCOMPARE(p1.size(),4); + QCOMPARE(p2.size(),3); } void tst_QPolygon::intersections_data() diff --git a/tests/auto/gui/rhi/qshader/tst_qshader.cpp b/tests/auto/gui/rhi/qshader/tst_qshader.cpp index 861adff463..26ea56b047 100644 --- a/tests/auto/gui/rhi/qshader/tst_qshader.cpp +++ b/tests/auto/gui/rhi/qshader/tst_qshader.cpp @@ -276,7 +276,7 @@ void tst_QShader::mslResourceMapping() resMap = s.nativeResourceBindingMap(QShaderKey(QShader::MslShader, QShaderVersion(12))); QVERIFY(!resMap.isEmpty()); - QCOMPARE(resMap.count(), 2); + QCOMPARE(resMap.size(), 2); QCOMPARE(resMap.value(0).first, 0); // mapped to native buffer index 0 QCOMPARE(resMap.value(1), qMakePair(0, 0)); // mapped to native texture index 0 and sampler index 0 } @@ -575,10 +575,10 @@ void tst_QShader::loadV6WithSeparateImagesAndSamplers() QShader::NativeResourceBindingMap resMap = s.nativeResourceBindingMap(QShaderKey(QShader::HlslShader, QShaderVersion(50))); - QVERIFY(resMap.count() == 4); + QVERIFY(resMap.size() == 4); QVERIFY(s.separateToCombinedImageSamplerMappingList(QShaderKey(QShader::HlslShader, QShaderVersion(50))).isEmpty()); resMap = s.nativeResourceBindingMap(QShaderKey(QShader::MslShader, QShaderVersion(12))); - QVERIFY(resMap.count() == 4); + QVERIFY(resMap.size() == 4); QVERIFY(s.separateToCombinedImageSamplerMappingList(QShaderKey(QShader::MslShader, QShaderVersion(12))).isEmpty()); for (auto key : { @@ -587,7 +587,7 @@ void tst_QShader::loadV6WithSeparateImagesAndSamplers() QShaderKey(QShader::GlslShader, QShaderVersion(150)) }) { auto list = s.separateToCombinedImageSamplerMappingList(key); - QCOMPARE(list.count(), 2); + QCOMPARE(list.size(), 2); } } @@ -665,7 +665,7 @@ void tst_QShader::loadV7() QCOMPARE(tese.description().inputBuiltinVariables()[2].type, QShaderDescription::TessLevelInnerBuiltin); QCOMPARE(tese.description().inputBuiltinVariables()[3].type, QShaderDescription::TessCoordBuiltin); - QCOMPARE(tese.nativeResourceBindingMap(QShaderKey(QShader::MslShader, QShaderVersion(12))).count(), 1); + QCOMPARE(tese.nativeResourceBindingMap(QShaderKey(QShader::MslShader, QShaderVersion(12))).size(), 1); QCOMPARE(tese.nativeResourceBindingMap(QShaderKey(QShader::MslShader, QShaderVersion(12))).value(0), qMakePair(0, -1)); QShader frag = getShader(QLatin1String(":/data/metal_enabled_tessellation_v7.frag.qsb")); diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 571dbc3a84..5ca983450a 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -159,14 +159,14 @@ void tst_QCssParser::scanner() lines.append(line); } - if (lines.count() != symbols.size()) { + if (lines.size() != symbols.size()) { debug(symbols); - QCOMPARE(lines.count(), symbols.size()); + QCOMPARE(lines.size(), symbols.size()); } - for (int i = 0; i < lines.count(); ++i) { + for (int i = 0; i < lines.size(); ++i) { QStringList l = lines.at(i).split(QChar::fromLatin1('|')); - QCOMPARE(l.count(), 2); + QCOMPARE(l.size(), 2); const QString expectedToken = l.at(0); const QString expectedLexem = l.at(1); QString actualToken = QString::fromLatin1(tokenName(symbols.at(i).token)); @@ -371,7 +371,7 @@ void tst_QCssParser::import() QVERIFY(parser.testImport()); QVERIFY(parser.parseImport(&rule)); QCOMPARE(rule.href, QString("www.kde.org")); - QCOMPARE(rule.media.count(), 2); + QCOMPARE(rule.media.size(), 2); QCOMPARE(rule.media.at(0), QString("print")); QCOMPARE(rule.media.at(1), QString("screen")); } @@ -382,7 +382,7 @@ void tst_QCssParser::media() QVERIFY(parser.testMedia()); QCss::MediaRule rule; QVERIFY(parser.parseMedia(&rule)); - QCOMPARE(rule.media.count(), 2); + QCOMPARE(rule.media.size(), 2); QCOMPARE(rule.media.at(0), QString("print")); QCOMPARE(rule.media.at(1), QString("screen")); QVERIFY(rule.styleRules.isEmpty()); diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index c33e4d74cb..76d844b007 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -357,15 +357,15 @@ void tst_QFont::insertAndRemoveSubstitutions() // inserting Foo QFont::insertSubstitution("BogusFontFamily", "Foo"); - QCOMPARE(QFont::substitutes("BogusFontFamily").count(), 1); - QCOMPARE(QFont::substitutes("bogusfontfamily").count(), 1); + QCOMPARE(QFont::substitutes("BogusFontFamily").size(), 1); + QCOMPARE(QFont::substitutes("bogusfontfamily").size(), 1); // inserting Bar and Baz QStringList moreFonts; moreFonts << "Bar" << "Baz"; QFont::insertSubstitutions("BogusFontFamily", moreFonts); - QCOMPARE(QFont::substitutes("BogusFontFamily").count(), 3); - QCOMPARE(QFont::substitutes("bogusfontfamily").count(), 3); + QCOMPARE(QFont::substitutes("BogusFontFamily").size(), 3); + QCOMPARE(QFont::substitutes("bogusfontfamily").size(), 3); QFont::removeSubstitutions("BogusFontFamily"); // make sure it is empty again diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp index 9c56d9b2d2..665ee75a35 100644 --- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp @@ -236,7 +236,7 @@ void tst_QFontDatabase::addAppFont() QCOMPARE(id, -1); return; #endif - QCOMPARE(fontDbChangedSpy.count(), 1); + QCOMPARE(fontDbChangedSpy.size(), 1); if (id == -1) QSKIP("Skip the test since app fonts are not supported on this system"); @@ -245,9 +245,9 @@ void tst_QFontDatabase::addAppFont() const QStringList newFamilies = QFontDatabase::families(); QVERIFY(!newFamilies.isEmpty()); - QVERIFY(newFamilies.count() >= oldFamilies.count()); + QVERIFY(newFamilies.size() >= oldFamilies.size()); - for (int i = 0; i < addedFamilies.count(); ++i) { + for (int i = 0; i < addedFamilies.size(); ++i) { QString family = addedFamilies.at(i); QVERIFY(newFamilies.contains(family)); QFont qfont(family); @@ -256,9 +256,9 @@ void tst_QFontDatabase::addAppFont() } QVERIFY(QFontDatabase::removeApplicationFont(id)); - QCOMPARE(fontDbChangedSpy.count(), 2); + QCOMPARE(fontDbChangedSpy.size(), 2); - QVERIFY(QFontDatabase::families().count() <= oldFamilies.count()); + QVERIFY(QFontDatabase::families().size() <= oldFamilies.size()); } void tst_QFontDatabase::addTwoAppFontsFromFamily() diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index 0e90572709..8b203f439e 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -96,7 +96,7 @@ void tst_QRawFont::initTestCase() if (testFont.isEmpty() || testFontBoldItalic.isEmpty()) QFAIL("qrawfont unittest font files not found!"); - if (QFontDatabase::families().count() == 0) + if (QFontDatabase::families().size() == 0) QSKIP("No fonts available!!!"); } diff --git a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp index 68312470cc..2d92d49f4f 100644 --- a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp +++ b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp @@ -493,7 +493,7 @@ void tst_QSyntaxHighlighter::noContentsChangedDuringHighlight() QSignalSpy contentsChangedSpy(doc, SIGNAL(contentsChanged())); cursor.insertText("Hello World"); - QCOMPARE(contentsChangedSpy.count(), 1); + QCOMPARE(contentsChangedSpy.size(), 1); QVERIFY(hl->highlighted); QVERIFY(lout->documentChangedCalled); } diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index a82fc19490..dc93c86829 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -465,17 +465,17 @@ void tst_QTextDocument::basicIsModifiedChecks() QVERIFY(!doc->isModified()); cursor.insertText("Hello World"); QVERIFY(doc->isModified()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(spy.takeFirst().at(0).toBool()); doc->undo(); QVERIFY(!doc->isModified()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(!spy.takeFirst().at(0).toBool()); doc->redo(); QVERIFY(doc->isModified()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(spy.takeFirst().at(0).toBool()); } @@ -566,16 +566,16 @@ void tst_QTextDocument::noundo_basicIsModifiedChecks() QVERIFY(!doc->isModified()); cursor.insertText("Hello World"); QVERIFY(doc->isModified()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(spy.takeFirst().at(0).toBool()); doc->undo(); QVERIFY(doc->isModified()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); doc->redo(); QVERIFY(doc->isModified()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QTextDocument::task240325() @@ -2868,13 +2868,13 @@ void tst_QTextDocument::blockCountChanged() doc->setPlainText("Foo"); QCOMPARE(doc->blockCount(), 1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); doc->setPlainText("Foo\nBar"); QCOMPARE(doc->blockCount(), 2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).value(0).toInt(), 2); spy.clear(); @@ -2882,16 +2882,16 @@ void tst_QTextDocument::blockCountChanged() cursor.movePosition(QTextCursor::End); cursor.insertText("Blahblah"); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); cursor.insertBlock(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).value(0).toInt(), 3); spy.clear(); doc->undo(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).value(0).toInt(), 2); } @@ -3155,11 +3155,11 @@ void tst_QTextDocument::testUndoCommandAdded() QVERIFY(spy.isEmpty()); cursor.insertText("a"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); cursor.insertText("b"); // should be merged - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); cursor.insertText("c"); // should be merged - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(doc->toPlainText(), QString("abc")); doc->undo(); QCOMPARE(doc->toPlainText(), QString("")); @@ -3167,11 +3167,11 @@ void tst_QTextDocument::testUndoCommandAdded() doc->clear(); spy.clear(); cursor.insertText("aaa"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); cursor.insertText("aaaa\nbcd"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); cursor.beginEditBlock(); @@ -3181,11 +3181,11 @@ void tst_QTextDocument::testUndoCommandAdded() cursor.insertText("\nccc"); QVERIFY(spy.isEmpty()); cursor.endEditBlock(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); cursor.insertBlock(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); cursor.setPosition(5); @@ -3197,18 +3197,18 @@ void tst_QTextDocument::testUndoCommandAdded() QTextCharFormat cf; cf.setFontItalic(true); cursor.mergeCharFormat(cf); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); doc->undo(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); doc->undo(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); doc->redo(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); doc->redo(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QTextDocument::testUndoBlocks() @@ -3934,7 +3934,7 @@ void tst_QTextDocument::insertHtmlWithComments() QTextDocument doc; doc.setHtml(html); - QCOMPARE(doc.blockCount(), expectedBlocks.count()); + QCOMPARE(doc.blockCount(), expectedBlocks.size()); QStringList blockContent; auto currentBlock = doc.begin(); diff --git a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp index aeb59dcc27..1b28274748 100644 --- a/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp +++ b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp @@ -648,15 +648,15 @@ void tst_QTextFormat::clearCollection() charFormat2.setUnderlineStyle(QTextCharFormat::SingleUnderline); int formatIndex2 = collection.indexForFormat(charFormat2); QCOMPARE(formatIndex2, 1); - QCOMPARE(collection.formats.count(), 2); + QCOMPARE(collection.formats.size(), 2); QCOMPARE(collection.hashes.size(), 2); QCOMPARE(collection.defaultFont(), f); collection.clear(); - QCOMPARE(collection.formats.count(), 0); + QCOMPARE(collection.formats.size(), 0); QCOMPARE(collection.hashes.size(), 0); QCOMPARE(collection.indexForFormat(charFormat2), 0); - QCOMPARE(collection.formats.count(), 1); + QCOMPARE(collection.formats.size(), 1); QCOMPARE(collection.hashes.size(), 1); QCOMPARE(collection.defaultFont(), f); // kept, QTextDocument::clear or setPlainText should not reset the font set by setDefaultFont } diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index c85d498318..67d4b9884b 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1858,7 +1858,7 @@ void tst_QTextLayout::capitalization_allUpperCase() QTextEngine *engine = layout.engine(); engine->itemize(); - QCOMPARE(engine->layoutData->items.count(), 1); + QCOMPARE(engine->layoutData->items.size(), 1); QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::Uppercase)); } @@ -1878,7 +1878,7 @@ void tst_QTextLayout::capitalization_allUpperCase_newline() QTextEngine *engine = layout.engine(); engine->itemize(); - QCOMPARE(engine->layoutData->items.count(), 3); + QCOMPARE(engine->layoutData->items.size(), 3); QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::Uppercase)); QCOMPARE(engine->layoutData->items.at(1).analysis.flags, ushort(QScriptAnalysis::LineOrParagraphSeparator)); QCOMPARE(engine->layoutData->items.at(2).analysis.flags, ushort(QScriptAnalysis::Uppercase)); @@ -1896,7 +1896,7 @@ void tst_QTextLayout::capitalization_allLowerCase() QTextEngine *engine = layout.engine(); engine->itemize(); - QCOMPARE(engine->layoutData->items.count(), 1); + QCOMPARE(engine->layoutData->items.size(), 1); QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::Lowercase)); } @@ -1912,7 +1912,7 @@ void tst_QTextLayout::capitalization_smallCaps() QTextEngine *engine = layout.engine(); engine->itemize(); - QCOMPARE(engine->layoutData->items.count(), 2); + QCOMPARE(engine->layoutData->items.size(), 2); QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::None)); QCOMPARE(engine->layoutData->items.at(1).analysis.flags, ushort(QScriptAnalysis::SmallCaps)); } @@ -1929,7 +1929,7 @@ void tst_QTextLayout::capitalization_capitalize() QTextEngine *engine = layout.engine(); engine->itemize(); - QCOMPARE(engine->layoutData->items.count(), 5); + QCOMPARE(engine->layoutData->items.size(), 5); QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::Uppercase)); QCOMPARE(engine->layoutData->items.at(1).analysis.flags, ushort(QScriptAnalysis::None)); QCOMPARE(engine->layoutData->items.at(2).analysis.flags, ushort(QScriptAnalysis::Tab)); diff --git a/tests/auto/gui/util/qdoublevalidator/tst_qdoublevalidator.cpp b/tests/auto/gui/util/qdoublevalidator/tst_qdoublevalidator.cpp index c06aa42fce..859c198595 100644 --- a/tests/auto/gui/util/qdoublevalidator/tst_qdoublevalidator.cpp +++ b/tests/auto/gui/util/qdoublevalidator/tst_qdoublevalidator.cpp @@ -311,74 +311,74 @@ void tst_QDoubleValidator::notifySignals() QCOMPARE(dv.decimals(), 10); dv.setTop(0.8); - QCOMPARE(topSpy.count(), 1); - QCOMPARE(changedSpy.count(), 1); + QCOMPARE(topSpy.size(), 1); + QCOMPARE(changedSpy.size(), 1); QCOMPARE(dv.top(), 0.8); dv.setBottom(0.2); - QCOMPARE(bottomSpy.count(), 1); - QCOMPARE(changedSpy.count(), 2); + QCOMPARE(bottomSpy.size(), 1); + QCOMPARE(changedSpy.size(), 2); QCOMPARE(dv.bottom(), 0.2); dv.setRange(0.2, 0.7); - QCOMPARE(topSpy.count(), 2); - QCOMPARE(bottomSpy.count(), 1); - QCOMPARE(decSpy.count(), 0); - QCOMPARE(changedSpy.count(), 3); + QCOMPARE(topSpy.size(), 2); + QCOMPARE(bottomSpy.size(), 1); + QCOMPARE(decSpy.size(), 0); + QCOMPARE(changedSpy.size(), 3); QCOMPARE(dv.bottom(), 0.2); QCOMPARE(dv.top(), 0.7); QCOMPARE(dv.decimals(), 10); dv.setRange(0.3, 0.7); - QCOMPARE(topSpy.count(), 2); - QCOMPARE(bottomSpy.count(), 2); - QCOMPARE(changedSpy.count(), 4); + QCOMPARE(topSpy.size(), 2); + QCOMPARE(bottomSpy.size(), 2); + QCOMPARE(changedSpy.size(), 4); QCOMPARE(dv.bottom(), 0.3); QCOMPARE(dv.top(), 0.7); QCOMPARE(dv.decimals(), 10); dv.setRange(0.4, 0.6); - QCOMPARE(topSpy.count(), 3); - QCOMPARE(bottomSpy.count(), 3); - QCOMPARE(changedSpy.count(), 5); + QCOMPARE(topSpy.size(), 3); + QCOMPARE(bottomSpy.size(), 3); + QCOMPARE(changedSpy.size(), 5); QCOMPARE(dv.bottom(), 0.4); QCOMPARE(dv.top(), 0.6); QCOMPARE(dv.decimals(), 10); dv.setDecimals(5); - QCOMPARE(decSpy.count(), 1); - QCOMPARE(changedSpy.count(), 6); + QCOMPARE(decSpy.size(), 1); + QCOMPARE(changedSpy.size(), 6); QCOMPARE(dv.decimals(), 5); dv.setRange(0.4, 0.6, 100); - QCOMPARE(topSpy.count(), 3); - QCOMPARE(bottomSpy.count(), 3); - QCOMPARE(decSpy.count(), 2); - QCOMPARE(changedSpy.count(), 7); + QCOMPARE(topSpy.size(), 3); + QCOMPARE(bottomSpy.size(), 3); + QCOMPARE(decSpy.size(), 2); + QCOMPARE(changedSpy.size(), 7); QCOMPARE(dv.bottom(), 0.4); QCOMPARE(dv.top(), 0.6); QCOMPARE(dv.decimals(), 100); dv.setNotation(QDoubleValidator::StandardNotation); - QCOMPARE(notSpy.count(), 1); - QCOMPARE(changedSpy.count(), 8); + QCOMPARE(notSpy.size(), 1); + QCOMPARE(changedSpy.size(), 8); QCOMPARE(dv.notation(), QDoubleValidator::StandardNotation); dv.setRange(dv.bottom(), dv.top(), dv.decimals()); - QCOMPARE(topSpy.count(), 3); - QCOMPARE(bottomSpy.count(), 3); - QCOMPARE(decSpy.count(), 2); - QCOMPARE(changedSpy.count(), 8); + QCOMPARE(topSpy.size(), 3); + QCOMPARE(bottomSpy.size(), 3); + QCOMPARE(decSpy.size(), 2); + QCOMPARE(changedSpy.size(), 8); dv.setNotation(dv.notation()); - QCOMPARE(notSpy.count(), 1); - QCOMPARE(changedSpy.count(), 8); + QCOMPARE(notSpy.size(), 1); + QCOMPARE(changedSpy.size(), 8); dv.setLocale(QLocale("C")); - QCOMPARE(changedSpy.count(), 8); + QCOMPARE(changedSpy.size(), 8); dv.setLocale(QLocale("en")); - QCOMPARE(changedSpy.count(), 9); + QCOMPARE(changedSpy.size(), 9); } void tst_QDoubleValidator::fixup() diff --git a/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp b/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp index 6e380bdcaa..ec4e3930ec 100644 --- a/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp +++ b/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp @@ -211,45 +211,45 @@ void tst_QIntValidator::notifySignals() QSignalSpy changedSpy(&iv, SIGNAL(changed())); iv.setTop(9); - QCOMPARE(topSpy.count(), 1); - QCOMPARE(changedSpy.count(), 1); + QCOMPARE(topSpy.size(), 1); + QCOMPARE(changedSpy.size(), 1); QCOMPARE(iv.top(), 9); iv.setBottom(1); - QCOMPARE(bottomSpy.count(), 1); - QCOMPARE(changedSpy.count(), 2); + QCOMPARE(bottomSpy.size(), 1); + QCOMPARE(changedSpy.size(), 2); QCOMPARE(iv.bottom(), 1); iv.setRange(1, 8); - QCOMPARE(topSpy.count(), 2); - QCOMPARE(bottomSpy.count(), 1); - QCOMPARE(changedSpy.count(), 3); + QCOMPARE(topSpy.size(), 2); + QCOMPARE(bottomSpy.size(), 1); + QCOMPARE(changedSpy.size(), 3); QCOMPARE(iv.top(), 8); QCOMPARE(iv.bottom(), 1); iv.setRange(2, 8); - QCOMPARE(topSpy.count(), 2); - QCOMPARE(bottomSpy.count(), 2); - QCOMPARE(changedSpy.count(), 4); + QCOMPARE(topSpy.size(), 2); + QCOMPARE(bottomSpy.size(), 2); + QCOMPARE(changedSpy.size(), 4); QCOMPARE(iv.top(), 8); QCOMPARE(iv.bottom(), 2); iv.setRange(3, 7); - QCOMPARE(topSpy.count(), 3); - QCOMPARE(bottomSpy.count(), 3); - QCOMPARE(changedSpy.count(), 5); + QCOMPARE(topSpy.size(), 3); + QCOMPARE(bottomSpy.size(), 3); + QCOMPARE(changedSpy.size(), 5); QCOMPARE(iv.top(), 7); QCOMPARE(iv.bottom(), 3); iv.setRange(3, 7); - QCOMPARE(topSpy.count(), 3); - QCOMPARE(bottomSpy.count(), 3); - QCOMPARE(changedSpy.count(), 5); + QCOMPARE(topSpy.size(), 3); + QCOMPARE(bottomSpy.size(), 3); + QCOMPARE(changedSpy.size(), 5); iv.setLocale(QLocale("C")); - QCOMPARE(changedSpy.count(), 5); + QCOMPARE(changedSpy.size(), 5); iv.setLocale(QLocale("en")); - QCOMPARE(changedSpy.count(), 6); + QCOMPARE(changedSpy.size(), 6); } void tst_QIntValidator::fixup() diff --git a/tests/auto/gui/util/qregularexpressionvalidator/tst_qregularexpressionvalidator.cpp b/tests/auto/gui/util/qregularexpressionvalidator/tst_qregularexpressionvalidator.cpp index fa631c82d7..c2ddafa2c6 100644 --- a/tests/auto/gui/util/qregularexpressionvalidator/tst_qregularexpressionvalidator.cpp +++ b/tests/auto/gui/util/qregularexpressionvalidator/tst_qregularexpressionvalidator.cpp @@ -77,8 +77,8 @@ void tst_QRegularExpressionValidator::validate() else QCOMPARE(pos, -1); // ensure pos is not modified if validate returned Acceptable or Intermediate - QCOMPARE(spy.count(), signalCount); - QCOMPARE(changedSpy.count(), signalCount); + QCOMPARE(spy.size(), signalCount); + QCOMPARE(changedSpy.size(), signalCount); } QTEST_GUILESS_MAIN(tst_QRegularExpressionValidator) diff --git a/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp b/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp index b3da6439ab..f554e94a98 100644 --- a/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp +++ b/tests/auto/gui/util/qundogroup/tst_qundogroup.cpp @@ -65,7 +65,7 @@ InsertCommand::InsertCommand(QString *str, int idx, const QString &text, QUndoCommand *parent) : QUndoCommand(parent) { - QVERIFY(str->length() >= idx); + QVERIFY(str->size() >= idx); setText("insert"); @@ -76,7 +76,7 @@ InsertCommand::InsertCommand(QString *str, int idx, const QString &text, void InsertCommand::redo() { - QVERIFY(m_str->length() >= m_idx); + QVERIFY(m_str->size() >= m_idx); m_str->insert(m_idx, m_text); } @@ -91,7 +91,7 @@ void InsertCommand::undo() RemoveCommand::RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent) : QUndoCommand(parent) { - QVERIFY(str->length() >= idx + len); + QVERIFY(str->size() >= idx + len); setText("remove"); @@ -109,7 +109,7 @@ void RemoveCommand::redo() void RemoveCommand::undo() { - QVERIFY(m_str->length() >= m_idx); + QVERIFY(m_str->size() >= m_idx); m_str->insert(m_idx, m_text); } @@ -131,9 +131,9 @@ void AppendCommand::redo() void AppendCommand::undo() { - QCOMPARE(m_str->mid(m_str->length() - m_text.size()), m_text); + QCOMPARE(m_str->mid(m_str->size() - m_text.size()), m_text); - m_str->truncate(m_str->length() - m_text.size()); + m_str->truncate(m_str->size() - m_text.size()); } int AppendCommand::id() const diff --git a/tests/auto/gui/util/qundostack/tst_qundostack.cpp b/tests/auto/gui/util/qundostack/tst_qundostack.cpp index 5023ed82d5..b47a4ee1a9 100644 --- a/tests/auto/gui/util/qundostack/tst_qundostack.cpp +++ b/tests/auto/gui/util/qundostack/tst_qundostack.cpp @@ -97,7 +97,7 @@ InsertCommand::InsertCommand(QString *str, int idx, const QString &text, QUndoCommand *parent) : QUndoCommand(parent) { - QVERIFY(str->length() >= idx); + QVERIFY(str->size() >= idx); setText("insert"); @@ -108,7 +108,7 @@ InsertCommand::InsertCommand(QString *str, int idx, const QString &text, void InsertCommand::redo() { - QVERIFY(m_str->length() >= m_idx); + QVERIFY(m_str->size() >= m_idx); m_str->insert(m_idx, m_text); } @@ -123,7 +123,7 @@ void InsertCommand::undo() RemoveCommand::RemoveCommand(QString *str, int idx, int len, QUndoCommand *parent) : QUndoCommand(parent) { - QVERIFY(str->length() >= idx + len); + QVERIFY(str->size() >= idx + len); setText("remove"); @@ -141,7 +141,7 @@ void RemoveCommand::redo() void RemoveCommand::undo() { - QVERIFY(m_str->length() >= m_idx); + QVERIFY(m_str->size() >= m_idx); m_str->insert(m_idx, m_text); } @@ -172,9 +172,9 @@ void AppendCommand::redo() void AppendCommand::undo() { - QCOMPARE(m_str->mid(m_str->length() - m_text.size()), m_text); + QCOMPARE(m_str->mid(m_str->size() - m_text.size()), m_text); - m_str->truncate(m_str->length() - m_text.size()); + m_str->truncate(m_str->size() - m_text.size()); } int AppendCommand::id() const @@ -324,44 +324,44 @@ static void checkState(QSignalSpy &redoTextChangedSpy, QCOMPARE(stack.canRedo(), _canRedo); QCOMPARE(stack.redoText(), QString(_redoText)); if (_indexChanged) { - QCOMPARE(indexChangedSpy.count(), 1); + QCOMPARE(indexChangedSpy.size(), 1); QCOMPARE(indexChangedSpy.at(0).at(0).toInt(), _index); indexChangedSpy.clear(); } else { - QCOMPARE(indexChangedSpy.count(), 0); + QCOMPARE(indexChangedSpy.size(), 0); } if (_cleanChanged) { - QCOMPARE(cleanChangedSpy.count(), 1); + QCOMPARE(cleanChangedSpy.size(), 1); QCOMPARE(cleanChangedSpy.at(0).at(0).toBool(), _clean); cleanChangedSpy.clear(); } else { - QCOMPARE(cleanChangedSpy.count(), 0); + QCOMPARE(cleanChangedSpy.size(), 0); } if (_undoChanged) { - QCOMPARE(canUndoChangedSpy.count(), 1); + QCOMPARE(canUndoChangedSpy.size(), 1); QCOMPARE(canUndoChangedSpy.at(0).at(0).toBool(), _canUndo); QCOMPARE(undoAction->isEnabled(), _canUndo); - QCOMPARE(undoTextChangedSpy.count(), 1); + QCOMPARE(undoTextChangedSpy.size(), 1); QCOMPARE(undoTextChangedSpy.at(0).at(0).toString(), QString(_undoText)); QCOMPARE(undoAction->text(), glue("foo", _undoText)); canUndoChangedSpy.clear(); undoTextChangedSpy.clear(); } else { - QCOMPARE(canUndoChangedSpy.count(), 0); - QCOMPARE(undoTextChangedSpy.count(), 0); + QCOMPARE(canUndoChangedSpy.size(), 0); + QCOMPARE(undoTextChangedSpy.size(), 0); } if (_redoChanged) { - QCOMPARE(canRedoChangedSpy.count(), 1); + QCOMPARE(canRedoChangedSpy.size(), 1); QCOMPARE(canRedoChangedSpy.at(0).at(0).toBool(), _canRedo); QCOMPARE(redoAction->isEnabled(), _canRedo); - QCOMPARE(redoTextChangedSpy.count(), 1); + QCOMPARE(redoTextChangedSpy.size(), 1); QCOMPARE(redoTextChangedSpy.at(0).at(0).toString(), QString(_redoText)); QCOMPARE(redoAction->text(), glue("bar", _redoText)); canRedoChangedSpy.clear(); redoTextChangedSpy.clear(); } else { - QCOMPARE(canRedoChangedSpy.count(), 0); - QCOMPARE(redoTextChangedSpy.count(), 0); + QCOMPARE(canRedoChangedSpy.size(), 0); + QCOMPARE(redoTextChangedSpy.size(), 0); } } diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 5525fd7630..0702a03541 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -292,7 +292,7 @@ void tst_Http2::singleRequest() #if QT_CONFIG(ssl) if (connectionType == H2Type::h2Alpn || connectionType == H2Type::h2Direct) - QCOMPARE(encSpy.count(), 1); + QCOMPARE(encSpy.size(), 1); #endif // QT_CONFIG(ssl) } @@ -780,7 +780,7 @@ void tst_Http2::maxFrameSize() // Normally, with a 16kb limit, our server would split such // a response into 3 'DATA' frames (16kb + 16kb + 0|END_STREAM). - QCOMPARE(frameCounter.count(), 1); + QCOMPARE(frameCounter.size(), 1); QVERIFY(nRequests == 0); QVERIFY(prefaceOK); diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index d40411ba3d..28bbf5459a 100644 --- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -265,7 +265,7 @@ void tst_QAbstractNetworkCache::runTest() // prime the cache QNetworkReply *reply = manager.get(request); QSignalSpy downloaded1(reply, SIGNAL(finished())); - QTRY_COMPARE(downloaded1.count(), 1); + QTRY_COMPARE(downloaded1.size(), 1); QCOMPARE(diskCache->gotData, false); QByteArray goodData = reply->readAll(); @@ -274,7 +274,7 @@ void tst_QAbstractNetworkCache::runTest() // should be in the cache now QNetworkReply *reply2 = manager.get(request); QSignalSpy downloaded2(reply2, SIGNAL(finished())); - QTRY_COMPARE(downloaded2.count(), 1); + QTRY_COMPARE(downloaded2.size(), 1); QByteArray secondData = reply2->readAll(); if (!fetchFromCache && cacheLoadControl == QNetworkRequest::AlwaysCache) { @@ -363,7 +363,7 @@ void tst_QAbstractNetworkCache::deleteCache() QNetworkReply *reply = manager.get(request); QSignalSpy downloaded1(reply, SIGNAL(finished())); manager.setCache(0); - QTRY_COMPARE(downloaded1.count(), 1); + QTRY_COMPARE(downloaded1.size(), 1); } diff --git a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp index e36acc81da..0780ae1f0e 100644 --- a/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp +++ b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp @@ -77,7 +77,7 @@ void tst_QHttpNetworkReply::parseHeader() QHttpNetworkReply reply; reply.parseHeader(headers); - for (int i = 0; i < fields.count(); ++i) { + for (int i = 0; i < fields.size(); ++i) { //qDebug() << "field" << fields.at(i) << "value" << reply.headerField(fields.at(i)) << "expected" << values.at(i); QString field = reply.headerField(fields.at(i).toLatin1()); QCOMPARE(field, values.at(i)); diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index 5f4a513a28..64a569e9fa 100644 --- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -278,17 +278,17 @@ void tst_QNetworkDiskCache::clear() QVERIFY(cache.cacheSize() > qint64(0)); QString cacheDirectory = cache.cacheDirectory(); - QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3); + QCOMPARE(countFiles(cacheDirectory).size(), NUM_SUBDIRECTORIES + 3); cache.clear(); - QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 2); + QCOMPARE(countFiles(cacheDirectory).size(), NUM_SUBDIRECTORIES + 2); // don't delete files that it didn't create QTemporaryFile file(cacheDirectory + "/XXXXXX"); if (file.open()) { file.fileName(); // make sure it exists with a name - QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3); + QCOMPARE(countFiles(cacheDirectory).size(), NUM_SUBDIRECTORIES + 3); cache.clear(); - QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3); + QCOMPARE(countFiles(cacheDirectory).size(), NUM_SUBDIRECTORIES + 3); } } @@ -355,9 +355,9 @@ void tst_QNetworkDiskCache::remove() QUrl url(EXAMPLE_URL); cache.setupWithOne(tempDir.path(), url); QString cacheDirectory = cache.cacheDirectory(); - QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3); + QCOMPARE(countFiles(cacheDirectory).size(), NUM_SUBDIRECTORIES + 3); cache.remove(url); - QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 2); + QCOMPARE(countFiles(cacheDirectory).size(), NUM_SUBDIRECTORIES + 2); } void tst_QNetworkDiskCache::accessAfterRemove() // QTBUG-17400 @@ -477,7 +477,7 @@ void tst_QNetworkDiskCache::fileMetaData() QString cacheDirectory = cache.cacheDirectory(); QStringList list = countFiles(cacheDirectory); - QCOMPARE(list.count(), NUM_SUBDIRECTORIES + 3); + QCOMPARE(list.size(), NUM_SUBDIRECTORIES + 3); foreach(QString fileName, list) { QFileInfo info(fileName); if (info.isFile()) { @@ -531,7 +531,7 @@ void tst_QNetworkDiskCache::expire() } } std::sort(cacheList.begin(), cacheList.end()); - for (int i = 0; i < cacheList.count(); ++i) { + for (int i = 0; i < cacheList.size(); ++i) { QString fileName = cacheList[i]; QCOMPARE(fileName, QLatin1String("http://localhost:4/") + QString::number(i + 6)); } @@ -570,7 +570,7 @@ void tst_QNetworkDiskCache::oldCacheVersionFile() QVERIFY(!QFile::exists(name)); } else { QStringList files = countFiles(cache.cacheDirectory()); - QCOMPARE(files.count(), NUM_SUBDIRECTORIES + 3); + QCOMPARE(files.size(), NUM_SUBDIRECTORIES + 3); // find the file QString cacheFile; foreach (QString file, files) { diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 78a3bb51aa..ea8e31c5e6 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -1460,11 +1460,11 @@ QString tst_QNetworkReply::runSimpleRequest(QNetworkAccessManager::Operation op, while (!reply->isFinished()) { QTimer::singleShot(20000, loop, SLOT(quit())); code = loop->exec(); - if (count == spy.count() && !reply->isFinished()) { + if (count == spy.size() && !reply->isFinished()) { code = Timeout; break; } - count = spy.count(); + count = spy.size(); } delete loop; loop = 0; @@ -1530,11 +1530,11 @@ int tst_QNetworkReply::waitForFinish(QNetworkReplyPtr &reply) QSignalSpy spy(reply.data(), SIGNAL(downloadProgress(qint64,qint64))); while (!reply->isFinished()) { QTimer::singleShot(5000, loop, SLOT(quit())); - if (loop->exec() == Timeout && count == spy.count() && !reply->isFinished()) { + if (loop->exec() == Timeout && count == spy.size() && !reply->isFinished()) { returnCode = Timeout; break; } - count = spy.count(); + count = spy.size(); } delete loop; loop = 0; @@ -2277,9 +2277,9 @@ void tst_QNetworkReply::putToFtp() QSignalSpy spy(r, SIGNAL(downloadProgress(qint64,qint64))); while (!r->isFinished()) { QTestEventLoop::instance().enterLoop(10); - if (count == spy.count() && !r->isFinished()) + if (count == spy.size() && !r->isFinished()) break; - count = spy.count(); + count = spy.size(); } QObject::disconnect(r, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); @@ -3589,7 +3589,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth() QCOMPARE(reader1.data, expectedData); QCOMPARE(reader2.data, expectedData); - QCOMPARE(authspy.count(), (expectedAuth ? 1 : 0)); + QCOMPARE(authspy.size(), (expectedAuth ? 1 : 0)); expectedAuth = qMax(0, expectedAuth - 1); } @@ -3610,7 +3610,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth() QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); QCOMPARE(reader.data, expectedData); - QCOMPARE(authspy.count(), (expectedAuth ? 1 : 0)); + QCOMPARE(authspy.size(), (expectedAuth ? 1 : 0)); expectedAuth = qMax(0, expectedAuth - 1); } @@ -3627,7 +3627,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth() // bad credentials in a synchronous request should just fail QCOMPARE(replySync->error(), QNetworkReply::AuthenticationRequiredError); } else { - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); // we cannot use a data reader here, since that connects to the readyRead signal, // just use readAll() @@ -3653,7 +3653,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth() // bad credentials in a synchronous request should just fail QCOMPARE(replySync->error(), QNetworkReply::AuthenticationRequiredError); } else { - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); // we cannot use a data reader here, since that connects to the readyRead signal, // just use readAll() @@ -3679,7 +3679,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuthSynchronous() QNetworkReplyPtr replySync(manager.get(request)); QVERIFY(replySync->isFinished()); // synchronous QCOMPARE(replySync->error(), QNetworkReply::AuthenticationRequiredError); - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); QCOMPARE(replySync->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 401); } @@ -3720,7 +3720,7 @@ void tst_QNetworkReply::ioGetFromHttpWithProxyAuth() QCOMPARE(reader1.data, referenceData); QCOMPARE(reader2.data, referenceData); - QCOMPARE(authspy.count(), 1); + QCOMPARE(authspy.size(), 1); } reference.seek(0); @@ -3743,7 +3743,7 @@ void tst_QNetworkReply::ioGetFromHttpWithProxyAuth() QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); QCOMPARE(reader.data, reference.readAll()); - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); } // now check with synchronous calls: @@ -3756,7 +3756,7 @@ void tst_QNetworkReply::ioGetFromHttpWithProxyAuth() QSignalSpy authspy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); QNetworkReplyPtr replySync(manager.get(request)); QVERIFY(replySync->isFinished()); // synchronous - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); // we cannot use a data reader here, since that connects to the readyRead signal, // just use readAll() @@ -3784,7 +3784,7 @@ void tst_QNetworkReply::ioGetFromHttpWithProxyAuthSynchronous() manager.setProxy(QNetworkProxy()); // reset QVERIFY(replySync->isFinished()); // synchronous QCOMPARE(replySync->error(), QNetworkReply::ProxyAuthenticationRequiredError); - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); QCOMPARE(replySync->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 407); } @@ -3816,7 +3816,7 @@ void tst_QNetworkReply::ioGetFromHttpWithSocksProxy() QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); QCOMPARE(reader.data, reference.readAll()); - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); } // set an invalid proxy just to make sure that we can't load @@ -3843,7 +3843,7 @@ void tst_QNetworkReply::ioGetFromHttpWithSocksProxy() QEXPECT_FAIL("", "QTcpSocket doesn't return enough information yet", Continue); QCOMPARE(int(reply->error()), int(QNetworkReply::ProxyConnectionRefusedError)); - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); } } #endif // QT_CONFIG(networkproxy) @@ -3871,7 +3871,7 @@ void tst_QNetworkReply::ioGetFromHttpsWithSslErrors() QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); QCOMPARE(reader.data, reference.readAll()); - QCOMPARE(sslspy.count(), 1); + QCOMPARE(sslspy.size(), 1); QVERIFY(!storedSslConfiguration.isNull()); QVERIFY(!reply->sslConfiguration().isNull()); @@ -3899,7 +3899,7 @@ void tst_QNetworkReply::ioGetFromHttpsWithIgnoreSslErrors() QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); QCOMPARE(reader.data, reference.readAll()); - QCOMPARE(sslspy.count(), 1); + QCOMPARE(sslspy.size(), 1); QVERIFY(!storedSslConfiguration.isNull()); QVERIFY(!reply->sslConfiguration().isNull()); @@ -3922,7 +3922,7 @@ void tst_QNetworkReply::ioGetFromHttpsWithSslHandshakeError() QCOMPARE(waitForFinish(reply), int(Failure)); QCOMPARE(reply->error(), QNetworkReply::SslHandshakeFailedError); - QCOMPARE(sslspy.count(), 0); + QCOMPARE(sslspy.size(), 0); } #endif @@ -3980,7 +3980,7 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer() QCOMPARE(waitForFinish(reply), int(Failure)); QCOMPARE(reply->url(), request.url()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(reply->error() != QNetworkReply::NoError); } @@ -4498,16 +4498,16 @@ void tst_QNetworkReply::ioGetWithManyProxies() // now verify that the proxies worked: QFETCH(QNetworkProxy, proxyUsed); if (proxyUsed.type() == QNetworkProxy::NoProxy) { - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); } else { if (QByteArray(QTest::currentDataTag()).startsWith("ftp-")) return; // No authentication with current FTP or with FTP proxies - QCOMPARE(authspy.count(), 1); + QCOMPARE(authspy.size(), 1); QCOMPARE(qvariant_cast(authspy.at(0).at(0)), proxyUsed); } } else { // request failed - QCOMPARE(authspy.count(), 0); + QCOMPARE(authspy.size(), 0); } } #endif // QT_CONFIG(networkproxy) @@ -4891,8 +4891,8 @@ void tst_QNetworkReply::ioPostToHttpFromSocket() QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); - QTEST(int(authenticationRequiredSpy.count()), "authenticationRequiredCount"); - QTEST(int(proxyAuthenticationRequiredSpy.count()), "proxyAuthenticationRequiredCount"); + QTEST(int(authenticationRequiredSpy.size()), "authenticationRequiredCount"); + QTEST(int(proxyAuthenticationRequiredSpy.size()), "proxyAuthenticationRequiredCount"); } void tst_QNetworkReply::ioPostToHttpFromSocketSynchronous_data() @@ -5391,7 +5391,7 @@ void tst_QNetworkReply::emitAllUploadProgressSignals() QVERIFY(!QTestEventLoop::instance().timeout()); incomingSocket->close(); - signalCount.append(spy.count()); + signalCount.append(spy.size()); reply->deleteLater(); } server.close(); @@ -5437,7 +5437,7 @@ void tst_QNetworkReply::ioPostToHttpEmptyUploadProgress() QVERIFY(!QTestEventLoop::instance().timeout()); // final check: only 1 uploadProgress has been emitted - QCOMPARE(spy.length(), 1); + QCOMPARE(spy.size(), 1); QList args = spy.last(); QVERIFY(!args.isEmpty()); QCOMPARE(args.at(0).toLongLong(), buffer.size()); @@ -5608,7 +5608,7 @@ void tst_QNetworkReply::downloadProgress() QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(reply->isFinished()); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); //final progress should have equal current & total QList args = spy.takeLast(); @@ -5654,14 +5654,14 @@ void tst_QNetworkReply::uploadProgress() QVERIFY(server.hasPendingConnections()); QTcpSocket *receiver = server.nextPendingConnection(); - if (finished.count() == 0) { + if (finished.size() == 0) { // it's not finished yet, so wait for it to be QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); } delete receiver; - QVERIFY(finished.count() > 0); - QVERIFY(spy.count() > 0); + QVERIFY(finished.size() > 0); + QVERIFY(spy.size() > 0); QList args = spy.last(); QCOMPARE(args.at(0).toInt(), data.size()); @@ -5943,8 +5943,8 @@ void tst_QNetworkReply::nestedEventLoops() QTestEventLoop::instance().enterLoop(20); QVERIFY2(!QTestEventLoop::instance().timeout(), "Network timeout"); - QCOMPARE(finishedspy.count(), 1); - QCOMPARE(errorspy.count(), 0); + QCOMPARE(finishedspy.size(), 1); + QCOMPARE(errorspy.size(), 0); } #if QT_CONFIG(networkproxy) @@ -6171,9 +6171,9 @@ void tst_QNetworkReply::authorizationError() QCOMPARE(waitForFinish(reply), int(Failure)); QFETCH(int, errorSignalCount); - QCOMPARE(errorSpy.count(), errorSignalCount); + QCOMPARE(errorSpy.size(), errorSignalCount); QFETCH(int, finishedSignalCount); - QCOMPARE(finishedSpy.count(), finishedSignalCount); + QCOMPARE(finishedSpy.size(), finishedSignalCount); QFETCH(int, error); QCOMPARE(reply->error(), QNetworkReply::NetworkError(error)); @@ -6532,7 +6532,7 @@ void tst_QNetworkReply::encrypted() QTestEventLoop::instance().enterLoop(20); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); reply->deleteLater(); } @@ -6561,7 +6561,7 @@ void tst_QNetworkReply::abortOnEncrypted() }); QSignalSpy spyEncrypted(reply, &QNetworkReply::encrypted); - QTRY_COMPARE(spyEncrypted.count(), 1); + QTRY_COMPARE(spyEncrypted.size(), 1); // Wait for the socket to be closed again in order to be sure QTcpSocket::readyRead would have been emitted. QTRY_VERIFY(server.socket != nullptr); @@ -7144,9 +7144,9 @@ void tst_QNetworkReply::qtbug4121unknownAuthentication() QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(authSpy.count(), 0); - QCOMPARE(finishedSpy.count(), 1); - QCOMPARE(errorSpy.count(), 1); + QCOMPARE(authSpy.size(), 0); + QCOMPARE(finishedSpy.size(), 1); + QCOMPARE(errorSpy.size(), 1); QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError); } @@ -7240,8 +7240,8 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->error(), QNetworkReply::ProxyAuthenticationRequiredError); - QCOMPARE(authSpy.count(), 0); - QCOMPARE(proxyAuthSpy.count(), 1); + QCOMPARE(authSpy.size(), 0); + QCOMPARE(proxyAuthSpy.size(), 1); proxyAuthSpy.clear(); //should fail due to bad credentials @@ -7255,8 +7255,8 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() // Work round known quirk in the old test server (danted -v < v1.1.19): if (reply->error() != QNetworkReply::HostNotFoundError) QCOMPARE(reply->error(), QNetworkReply::ProxyAuthenticationRequiredError); - QCOMPARE(authSpy.count(), 0); - QVERIFY(proxyAuthSpy.count() > 0); + QCOMPARE(authSpy.size(), 0); + QVERIFY(proxyAuthSpy.size() > 0); proxyAuthSpy.clear(); // QTBUG-23136 workaround (needed even with danted v1.1.19): @@ -7281,10 +7281,10 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError); - QVERIFY(authSpy.count() > 0); + QVERIFY(authSpy.size() > 0); authSpy.clear(); if (proxyAuth) { - QVERIFY(proxyAuthSpy.count() > 0); + QVERIFY(proxyAuthSpy.size() > 0); proxyAuthSpy.clear(); } @@ -7297,11 +7297,11 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError); - QVERIFY(authSpy.count() > 0); + QVERIFY(authSpy.size() > 0); authSpy.clear(); if (proxyAuth) { //should be supplied from cache - QCOMPARE(proxyAuthSpy.count(), 0); + QCOMPARE(proxyAuthSpy.size(), 0); proxyAuthSpy.clear(); } @@ -7315,11 +7315,11 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->error(), QNetworkReply::NoError); - QVERIFY(authSpy.count() > 0); + QVERIFY(authSpy.size() > 0); authSpy.clear(); if (proxyAuth) { //should be supplied from cache - QCOMPARE(proxyAuthSpy.count(), 0); + QCOMPARE(proxyAuthSpy.size(), 0); proxyAuthSpy.clear(); } @@ -7331,11 +7331,11 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QCOMPARE(reply->error(), QNetworkReply::NoError); //should be supplied from cache - QCOMPARE(authSpy.count(), 0); + QCOMPARE(authSpy.size(), 0); authSpy.clear(); if (proxyAuth) { //should be supplied from cache - QCOMPARE(proxyAuthSpy.count(), 0); + QCOMPARE(proxyAuthSpy.size(), 0); proxyAuthSpy.clear(); } @@ -7437,8 +7437,8 @@ void tst_QNetworkReply::httpWithNoCredentialUsage() QNetworkReplyPtr reply(manager.get(request)); QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); // credentials in URL, so don't expect authentication signal - QCOMPARE(authSpy.count(), 0); - QCOMPARE(finishedSpy.count(), 1); + QCOMPARE(authSpy.size(), 0); + QCOMPARE(finishedSpy.size(), 1); finishedSpy.clear(); } @@ -7448,8 +7448,8 @@ void tst_QNetworkReply::httpWithNoCredentialUsage() QNetworkReplyPtr reply(manager.get(request)); QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); // credentials in cache, so don't expect authentication signal - QCOMPARE(authSpy.count(), 0); - QCOMPARE(finishedSpy.count(), 1); + QCOMPARE(authSpy.size(), 0); + QCOMPARE(finishedSpy.size(), 1); finishedSpy.clear(); } @@ -7466,9 +7466,9 @@ void tst_QNetworkReply::httpWithNoCredentialUsage() QVERIFY(!QTestEventLoop::instance().timeout()); // We check if authenticationRequired was emitted, however we do not anything in it so it should be 401 - QCOMPARE(authSpy.count(), 1); - QCOMPARE(finishedSpy.count(), 1); - QCOMPARE(errorSpy.count(), 1); + QCOMPARE(authSpy.size(), 1); + QCOMPARE(finishedSpy.size(), 1); + QCOMPARE(errorSpy.size(), 1); QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError); } @@ -7753,8 +7753,8 @@ void tst_QNetworkReply::qtbug45581WrongReplyStatusCode() QCOMPARE(reply->readAll(), expectedContent); - QCOMPARE(finishedSpy.count(), 0); - QCOMPARE(sslErrorsSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); + QCOMPARE(sslErrorsSpy.size(), 0); QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), expectedContent.size()); @@ -7843,8 +7843,8 @@ void tst_QNetworkReply::synchronousRequest() QSignalSpy sslErrorsSpy(&manager, SIGNAL(sslErrors(QNetworkReply*,QList))); RUN_REQUEST(runSimpleRequest(QNetworkAccessManager::GetOperation, request, reply, 0)); QVERIFY(reply->isFinished()); - QCOMPARE(finishedSpy.count(), 0); - QCOMPARE(sslErrorsSpy.count(), 0); + QCOMPARE(finishedSpy.size(), 0); + QCOMPARE(sslErrorsSpy.size(), 0); QCOMPARE(reply->header(QNetworkRequest::ContentTypeHeader).toString(), mimeType); @@ -7883,7 +7883,7 @@ void tst_QNetworkReply::synchronousRequestSslFailure() runSimpleRequest(QNetworkAccessManager::GetOperation, request, reply, 0); QVERIFY(reply->isFinished()); QCOMPARE(reply->error(), QNetworkReply::SslHandshakeFailedError); - QCOMPARE(sslErrorsSpy.count(), 0); + QCOMPARE(sslErrorsSpy.size(), 0); } #endif @@ -8347,9 +8347,9 @@ void tst_QNetworkReply::emitErrorForAllReplies() // QTBUG-36890 QVERIFY(!QTestEventLoop::instance().timeout()); for (int a = 0; a < urls.size(); ++a) { QVERIFY(replies.at(a)->isFinished()); - QCOMPARE(errorSpies.at(a)->count(), 1); + QCOMPARE(errorSpies.at(a)->size(), 1); errorSpies.at(a)->deleteLater(); - QCOMPARE(finishedSpies.at(a)->count(), 1); + QCOMPARE(finishedSpies.at(a)->size(), 1); finishedSpies.at(a)->deleteLater(); replies.at(a)->deleteLater(); } @@ -8469,8 +8469,8 @@ void tst_QNetworkReply::ioHttpSingleRedirect() QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); // Redirected and finished should be emitted exactly once - QCOMPARE(redSpy.count(), 1); - QCOMPARE(finSpy.count(), 1); + QCOMPARE(redSpy.size(), 1); + QCOMPARE(finSpy.size(), 1); // Original URL should not be changed after redirect QCOMPARE(request.url(), localhost); @@ -8516,8 +8516,8 @@ void tst_QNetworkReply::ioHttpChangeMaxRedirects() QCOMPARE(waitForFinish(reply), int(Failure)); - QCOMPARE(redSpy.count(), request.maximumRedirectsAllowed()); - QCOMPARE(spy.count(), 1); + QCOMPARE(redSpy.size(), request.maximumRedirectsAllowed()); + QCOMPARE(spy.size(), 1); QCOMPARE(reply->error(), QNetworkReply::TooManyRedirectsError); // Increase max redirects to allow successful completion @@ -8528,7 +8528,7 @@ void tst_QNetworkReply::ioHttpChangeMaxRedirects() QVERIFY2(waitForFinish(reply2) == Success, msgWaitForFinished(reply2)); - QCOMPARE(redSpy2.count(), 2); + QCOMPARE(redSpy2.size(), 2); QCOMPARE(reply2->url(), server3Url); QCOMPARE(reply2->error(), QNetworkReply::NoError); QVERIFY(validateRedirectedResponseHeaders(reply2)); @@ -8661,8 +8661,8 @@ void tst_QNetworkReply::ioHttpRedirectPolicy() QSignalSpy redirectSpy(reply.data(), SIGNAL(redirected(QUrl))); QSignalSpy finishedSpy(reply.data(), SIGNAL(finished())); QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); - QCOMPARE(finishedSpy.count(), 1); - QCOMPARE(redirectSpy.count(), redirectCount); + QCOMPARE(finishedSpy.size(), 1); + QCOMPARE(redirectSpy.size(), redirectCount); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), statusCode); QVERIFY(validateRedirectedResponseHeaders(reply) || statusCode != 200); } @@ -8745,7 +8745,7 @@ void tst_QNetworkReply::ioHttpRedirectPolicyErrors() QSignalSpy spy(reply.data(), SIGNAL(errorOccurred(QNetworkReply::NetworkError))); QCOMPARE(waitForFinish(reply), int(Failure)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(reply->error(), expectedError); } @@ -8795,7 +8795,7 @@ void tst_QNetworkReply::ioHttpUserVerifiedRedirect() QSignalSpy finishedSpy(reply.data(), SIGNAL(finished())); waitForFinish(reply); - QCOMPARE(finishedSpy.count(), 1); + QCOMPARE(finishedSpy.size(), 1); QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), statusCode); QVERIFY(validateRedirectedResponseHeaders(reply) || statusCode != 200); } @@ -9386,7 +9386,7 @@ void tst_QNetworkReply::autoDeleteRepliesAttribute() QSignalSpy finishedSpy(reply, &QNetworkReply::finished); QSignalSpy destroyedSpy(reply, &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QVERIFY(destroyedSpy.wait()); } { @@ -9397,7 +9397,7 @@ void tst_QNetworkReply::autoDeleteRepliesAttribute() QSignalSpy finishedSpy(reply, &QNetworkReply::finished); QSignalSpy destroyedSpy(reply, &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QVERIFY(destroyedSpy.wait()); } // Now repeated, but without the attribute to make sure it does not get deleted automatically. @@ -9411,10 +9411,10 @@ void tst_QNetworkReply::autoDeleteRepliesAttribute() QSignalSpy finishedSpy(reply.data(), &QNetworkReply::finished); QSignalSpy destroyedSpy(reply.data(), &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QCoreApplication::processEvents(); QCoreApplication::processEvents(); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); } { // Post @@ -9423,10 +9423,10 @@ void tst_QNetworkReply::autoDeleteRepliesAttribute() QSignalSpy finishedSpy(reply.data(), &QNetworkReply::finished); QSignalSpy destroyedSpy(reply.data(), &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QCoreApplication::processEvents(); QCoreApplication::processEvents(); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); } } @@ -9447,7 +9447,7 @@ void tst_QNetworkReply::autoDeleteReplies() QSignalSpy finishedSpy(reply, &QNetworkReply::finished); QSignalSpy destroyedSpy(reply, &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QVERIFY(destroyedSpy.wait()); } { @@ -9457,7 +9457,7 @@ void tst_QNetworkReply::autoDeleteReplies() QSignalSpy finishedSpy(reply, &QNetworkReply::finished); QSignalSpy destroyedSpy(reply, &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QVERIFY(destroyedSpy.wait()); } // Here we repeat the test, but override the auto-deletion in the QNetworkRequest @@ -9472,10 +9472,10 @@ void tst_QNetworkReply::autoDeleteReplies() QSignalSpy finishedSpy(reply.data(), &QNetworkReply::finished); QSignalSpy destroyedSpy(reply.data(), &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QCoreApplication::processEvents(); QCoreApplication::processEvents(); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); } { // Post @@ -9485,10 +9485,10 @@ void tst_QNetworkReply::autoDeleteReplies() QSignalSpy finishedSpy(reply.data(), &QNetworkReply::finished); QSignalSpy destroyedSpy(reply.data(), &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QCoreApplication::processEvents(); QCoreApplication::processEvents(); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); } // Now we repeat the test with autoDeleteReplies set to false cleanup.dismiss(); @@ -9500,10 +9500,10 @@ void tst_QNetworkReply::autoDeleteReplies() QSignalSpy finishedSpy(reply.data(), &QNetworkReply::finished); QSignalSpy destroyedSpy(reply.data(), &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QCoreApplication::processEvents(); QCoreApplication::processEvents(); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); } { // Post @@ -9512,10 +9512,10 @@ void tst_QNetworkReply::autoDeleteReplies() QSignalSpy finishedSpy(reply.data(), &QNetworkReply::finished); QSignalSpy destroyedSpy(reply.data(), &QObject::destroyed); QVERIFY(finishedSpy.wait()); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); QCoreApplication::processEvents(); QCoreApplication::processEvents(); - QCOMPARE(destroyedSpy.count(), 0); + QCOMPARE(destroyedSpy.size(), 0); } } @@ -9529,7 +9529,7 @@ void tst_QNetworkReply::getWithTimeout() QCOMPARE(waitForFinish(reply), int(Success)); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QVERIFY(reply->error() == QNetworkReply::NoError); request.setTransferTimeout(1000); @@ -9540,7 +9540,7 @@ void tst_QNetworkReply::getWithTimeout() QCOMPARE(waitForFinish(reply2), int(Failure)); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); QVERIFY(reply2->error() == QNetworkReply::OperationCanceledError); request.setTransferTimeout(0); @@ -9551,7 +9551,7 @@ void tst_QNetworkReply::getWithTimeout() QCOMPARE(waitForFinish(reply3), int(Failure)); - QCOMPARE(spy3.count(), 1); + QCOMPARE(spy3.size(), 1); QVERIFY(reply3->error() == QNetworkReply::OperationCanceledError); manager.setTransferTimeout(0); @@ -9569,7 +9569,7 @@ void tst_QNetworkReply::postWithTimeout() QCOMPARE(waitForFinish(reply), int(Success)); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QVERIFY(reply->error() == QNetworkReply::NoError); request.setTransferTimeout(1000); @@ -9580,7 +9580,7 @@ void tst_QNetworkReply::postWithTimeout() QCOMPARE(waitForFinish(reply2), int(Failure)); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); QVERIFY(reply2->error() == QNetworkReply::OperationCanceledError); request.setTransferTimeout(0); @@ -9591,7 +9591,7 @@ void tst_QNetworkReply::postWithTimeout() QCOMPARE(waitForFinish(reply3), int(Failure)); - QCOMPARE(spy3.count(), 1); + QCOMPARE(spy3.size(), 1); QVERIFY(reply3->error() == QNetworkReply::OperationCanceledError); manager.setTransferTimeout(0); @@ -9636,13 +9636,13 @@ void tst_QNetworkReply::moreActivitySignals() QSignalSpy spy3(reply.data(), SIGNAL(metaDataChanged())); QSignalSpy spy4(reply.data(), SIGNAL(finished())); spy1.wait(); - QCOMPARE(spy1.count(), 1); + QCOMPARE(spy1.size(), 1); spy2.wait(); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); spy3.wait(); - QCOMPARE(spy3.count(), 1); + QCOMPARE(spy3.size(), 1); spy4.wait(); - QCOMPARE(spy4.count(), 1); + QCOMPARE(spy4.size(), 1); QVERIFY(reply->error() == QNetworkReply::NoError); // Second request will not send socketStartedConnecting because of keep-alive, so don't check it. QNetworkReplyPtr secondreply; @@ -9656,11 +9656,11 @@ void tst_QNetworkReply::moreActivitySignals() QSignalSpy secondspy3(secondreply.data(), SIGNAL(metaDataChanged())); QSignalSpy secondspy4(secondreply.data(), SIGNAL(finished())); secondspy2.wait(); - QCOMPARE(secondspy2.count(), 1); + QCOMPARE(secondspy2.size(), 1); secondspy3.wait(); - QCOMPARE(secondspy3.count(), 1); + QCOMPARE(secondspy3.size(), 1); secondspy4.wait(); - QCOMPARE(secondspy4.count(), 1); + QCOMPARE(secondspy4.size(), 1); QVERIFY(secondreply->error() == QNetworkReply::NoError); } diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index b1867d55fb..d22d858b26 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -66,7 +66,7 @@ QString tst_QDnsLookup::domainNameList(const QString &input) QStringList tst_QDnsLookup::domainNameListAlternatives(const QString &input) { QStringList alternatives = input.split('|'); - for (int i = 0; i < alternatives.length(); ++i) + for (int i = 0; i < alternatives.size(); ++i) alternatives[i] = domainNameList(alternatives[i]); return alternatives; } @@ -367,7 +367,7 @@ void tst_QDnsLookup::bindingsAndProperties() const QSignalSpy typeChangeSpy(&lookup, &QDnsLookup::typeChanged); dnsTypeProp = QDnsLookup::AAAA; - QCOMPARE(typeChangeSpy.count(), 1); + QCOMPARE(typeChangeSpy.size(), 1); QCOMPARE(lookup.type(), QDnsLookup::AAAA); dnsTypeProp.setBinding(lookup.bindableType().makeBinding()); @@ -379,7 +379,7 @@ void tst_QDnsLookup::bindingsAndProperties() const QSignalSpy nameChangeSpy(&lookup, &QDnsLookup::nameChanged); nameProp = QStringLiteral("a-plus-aaaa"); - QCOMPARE(nameChangeSpy.count(), 1); + QCOMPARE(nameChangeSpy.size(), 1); QCOMPARE(lookup.name(), QStringLiteral("a-plus-aaaa")); nameProp.setBinding(lookup.bindableName().makeBinding()); @@ -391,7 +391,7 @@ void tst_QDnsLookup::bindingsAndProperties() const QSignalSpy nameserverChangeSpy(&lookup, &QDnsLookup::nameserverChanged); nameserverProp = QHostAddress::LocalHost; - QCOMPARE(nameserverChangeSpy.count(), 1); + QCOMPARE(nameserverChangeSpy.size(), 1); QCOMPARE(lookup.nameserver(), QHostAddress::LocalHost); nameserverProp.setBinding(lookup.bindableNameserver().makeBinding()); diff --git a/tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp b/tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp index cde2399424..720388c53f 100644 --- a/tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp +++ b/tests/auto/network/kernel/qnetworkinformation/tst_qnetworkinformation.cpp @@ -241,14 +241,14 @@ void tst_QNetworkInformation::isMetered() QSignalSpy spy(info, &QNetworkInformation::isMeteredChanged); QVERIFY(!info->isMetered()); MockBackend::setNewMetered(true); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(info->isMetered()); QVERIFY(spy[0][0].toBool()); spy.clear(); // Set the same value again, signal should not be emitted again MockBackend::setNewMetered(true); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } QTEST_MAIN(tst_QNetworkInformation); diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 0add6b2400..f240f3e832 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -246,7 +246,7 @@ void tst_QLocalSocket::server_basic() QCOMPARE(server.listen(QString()), false); QCOMPARE(server.hits.size(), 0); - QCOMPARE(spyNewConnection.count(), 0); + QCOMPARE(spyNewConnection.size(), 0); } void tst_QLocalSocket::server_connectionsCount() @@ -287,11 +287,11 @@ void tst_QLocalSocket::socket_basic() QCOMPARE(socket.waitForDisconnected(0), false); QCOMPARE(socket.waitForReadyRead(0), false); - QCOMPARE(spyConnected.count(), 0); - QCOMPARE(spyDisconnected.count(), 0); - QCOMPARE(spyError.count(), 0); - QCOMPARE(spyStateChanged.count(), 0); - QCOMPARE(spyReadyRead.count(), 0); + QCOMPARE(spyConnected.size(), 0); + QCOMPARE(spyDisconnected.size(), 0); + QCOMPARE(spyError.size(), 0); + QCOMPARE(spyStateChanged.size(), 0); + QCOMPARE(spyReadyRead.size(), 0); } void tst_QLocalSocket::listen_data() @@ -322,7 +322,7 @@ void tst_QLocalSocket::listen() QCOMPARE(server.hasPendingConnections(), false); QCOMPARE(server.nextPendingConnection(), (QLocalSocket*)0); QCOMPARE(server.hits.size(), 0); - QCOMPARE(spyNewConnection.count(), 0); + QCOMPARE(spyNewConnection.size(), 0); if (canListen) { QVERIFY(server.errorString().isEmpty()); QCOMPARE(server.serverError(), QAbstractSocket::UnknownSocketError); @@ -396,7 +396,7 @@ void tst_QLocalSocket::listenAndConnect() QCOMPARE(socket->error(), QLocalSocket::UnknownSocketError); QCOMPARE(socket->state(), QLocalSocket::ConnectedState); //QVERIFY(socket->socketDescriptor() != -1); - QCOMPARE(spyError.count(), 0); + QCOMPARE(spyError.size(), 0); } else { QVERIFY(!socket->errorString().isEmpty()); QVERIFY(socket->error() != QLocalSocket::UnknownSocketError); @@ -415,13 +415,13 @@ void tst_QLocalSocket::listenAndConnect() QCOMPARE(socket->waitForConnected(0), canListen); QCOMPARE(socket->waitForReadyRead(0), false); - QTRY_COMPARE(spyConnected.count(), canListen ? 1 : 0); - QCOMPARE(spyDisconnected.count(), 0); + QTRY_COMPARE(spyConnected.size(), canListen ? 1 : 0); + QCOMPARE(spyDisconnected.size(), 0); // error signals - QVERIFY(spyError.count() >= 0); + QVERIFY(spyError.size() >= 0); if (canListen) { - if (spyError.count() > 0) + if (spyError.size() > 0) QCOMPARE(qvariant_cast(spyError.first()[0]), QLocalSocket::SocketTimeoutError); } else { @@ -436,8 +436,8 @@ void tst_QLocalSocket::listenAndConnect() if (canListen) QCOMPARE(qvariant_cast(spyStateChanged.last()[0]), QLocalSocket::ConnectedState); - QCOMPARE(spyStateChanged.count(), 2); - QCOMPARE(spyReadyRead.count(), 0); + QCOMPARE(spyStateChanged.size(), 2); + QCOMPARE(spyReadyRead.size(), 0); bool timedOut = true; QCOMPARE(server.waitForNewConnection(3000, &timedOut), canListen); @@ -452,14 +452,14 @@ void tst_QLocalSocket::listenAndConnect() QVERIFY(server.fullServerName().contains(name)); QVERIFY(server.nextPendingConnection() != (QLocalSocket*)0); QTRY_COMPARE(server.hits.size(), i + 1); - QCOMPARE(spyNewConnection.count(), i + 1); + QCOMPARE(spyNewConnection.size(), i + 1); QVERIFY(server.errorString().isEmpty()); QCOMPARE(server.serverError(), QAbstractSocket::UnknownSocketError); } else { QVERIFY(server.serverName().isEmpty()); QVERIFY(server.fullServerName().isEmpty()); QCOMPARE(server.nextPendingConnection(), (QLocalSocket*)0); - QCOMPARE(spyNewConnection.count(), 0); + QCOMPARE(spyNewConnection.size(), 0); QCOMPARE(server.hits.size(), 0); QVERIFY(!server.errorString().isEmpty()); QCOMPARE(server.serverError(), QAbstractSocket::HostNotFoundError); @@ -470,7 +470,7 @@ void tst_QLocalSocket::listenAndConnect() server.close(); QCOMPARE(server.hits.size(), (canListen ? connections : 0)); - QCOMPARE(spyNewConnection.count(), (canListen ? connections : 0)); + QCOMPARE(spyNewConnection.size(), (canListen ? connections : 0)); } void tst_QLocalSocket::connectWithOpen() @@ -494,7 +494,7 @@ void tst_QLocalSocket::connectWithOpen() socket.close(); server.close(); - QCOMPARE(spyAboutToClose.count(), 1); + QCOMPARE(spyAboutToClose.size(), 1); } void tst_QLocalSocket::listenAndConnectAbstractNamespaceTrailingZeros_data() @@ -660,7 +660,7 @@ void tst_QLocalSocket::sendData() QTest::qWait(250); #endif QVERIFY(!timedOut); - QCOMPARE(spyConnected.count(), canListen ? 1 : 0); + QCOMPARE(spyConnected.size(), canListen ? 1 : 0); QCOMPARE(socket.state(), canListen ? QLocalSocket::ConnectedState : QLocalSocket::UnconnectedState); // test sending/receiving data @@ -686,7 +686,7 @@ void tst_QLocalSocket::sendData() QCOMPARE(socket.flush(), false); QCOMPARE(socket.isValid(), canListen); QCOMPARE(socket.readBufferSize(), (qint64)0); - QCOMPARE(spyReadyRead.count(), expectedReadyReadSignals); + QCOMPARE(spyReadyRead.size(), expectedReadyReadSignals); QVERIFY(testLine.startsWith(in.readLine())); @@ -697,16 +697,16 @@ void tst_QLocalSocket::sendData() } socket.disconnectFromServer(); - QCOMPARE(spyConnected.count(), canListen ? 1 : 0); - QCOMPARE(spyDisconnected.count(), canListen ? 1 : 0); - QCOMPARE(spyError.count(), canListen ? 0 : 1); - QCOMPARE(spyStateChanged.count(), canListen ? 4 : 2); - QCOMPARE(spyReadyRead.count(), canListen ? expectedReadyReadSignals : 0); + QCOMPARE(spyConnected.size(), canListen ? 1 : 0); + QCOMPARE(spyDisconnected.size(), canListen ? 1 : 0); + QCOMPARE(spyError.size(), canListen ? 0 : 1); + QCOMPARE(spyStateChanged.size(), canListen ? 4 : 2); + QCOMPARE(spyReadyRead.size(), canListen ? expectedReadyReadSignals : 0); server.close(); QCOMPARE(server.hits.size(), (canListen ? 1 : 0)); - QCOMPARE(spy.count(), (canListen ? 1 : 0)); + QCOMPARE(spy.size(), (canListen ? 1 : 0)); } void tst_QLocalSocket::readLine_data() @@ -1006,7 +1006,7 @@ void tst_QLocalSocket::simpleCommandProtocol2() localSocketWrite.abort(); QCOMPARE(localSocketWrite.state(), QLocalSocket::UnconnectedState); - QCOMPARE(spyDisconnected.count(), 1); + QCOMPARE(spyDisconnected.size(), 1); QCOMPARE(localSocketWrite.bytesToWrite(), 0); QVERIFY(!localSocketWrite.isOpen()); @@ -1096,9 +1096,9 @@ public: QVERIFY(socket.waitForConnected(1000)); // We should *not* have this signal yet! - QCOMPARE(spyReadyRead.count(), 0); + QCOMPARE(spyReadyRead.size(), 0); socket.waitForReadyRead(); - QCOMPARE(spyReadyRead.count(), 1); + QCOMPARE(spyReadyRead.size(), 1); QTextStream in(&socket); QCOMPARE(in.readLine(), testLine); socket.close(); @@ -1309,7 +1309,7 @@ void tst_QLocalSocket::waitForDisconnectByServer() serverSocket->close(); QCOMPARE(serverSocket->state(), QLocalSocket::UnconnectedState); QVERIFY(socket.waitForDisconnected(3000)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QLocalSocket::waitForReadyReadOnDisconnected() @@ -1426,7 +1426,7 @@ void tst_QLocalSocket::recycleClientSocket() QLocalSocket client; QSignalSpy clientReadyReadSpy(&client, SIGNAL(readyRead())); QSignalSpy clientErrorSpy(&client, SIGNAL(errorOccurred(QLocalSocket::LocalSocketError))); - for (int i = 0; i < lines.count(); ++i) { + for (int i = 0; i < lines.size(); ++i) { client.abort(); clientReadyReadSpy.clear(); client.connectToServer(serverName); @@ -1521,7 +1521,7 @@ void tst_QLocalSocket::writeToClientAndDisconnect() QVERIFY(clientSocket->waitForDisconnected()); QVERIFY(client.waitForDisconnected()); - QCOMPARE(readChannelFinishedSpy.count(), 1); + QCOMPARE(readChannelFinishedSpy.size(), 1); const QByteArray received = client.readAll(); QCOMPARE(received.size(), qint64(sizeof(buffer) * chunks)); QCOMPARE(client.state(), QLocalSocket::UnconnectedState); @@ -1551,7 +1551,7 @@ void tst_QLocalSocket::writeToDisconnected() QCOMPARE(client.bytesToWrite(), qint64(1)); QVERIFY(!client.waitForBytesWritten()); - QCOMPARE(spyError.count(), 1); + QCOMPARE(spyError.size(), 1); QCOMPARE(client.state(), QLocalSocket::UnconnectedState); } @@ -1656,7 +1656,7 @@ void tst_QLocalSocket::asyncDisconnectNotify() QVERIFY(serverSocket); delete serverSocket; QTRY_VERIFY(!disconnectedSpy.isEmpty()); - QCOMPARE(readChannelFinishedSpy.count(), 1); + QCOMPARE(readChannelFinishedSpy.size(), 1); } void tst_QLocalSocket::verifySocketOptions_data() diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 5c87a3f04b..b10bce335b 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -248,7 +248,7 @@ void tst_QTcpServer::clientServerLoop() QVERIFY(server.waitForNewConnection(5000)); QVERIFY(server.hasPendingConnections()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTcpSocket *serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket != 0); @@ -409,9 +409,9 @@ void tst_QTcpServer::maxPendingConnections() // two connections have been made. The second compare makes sure no // more are accepted. Creating connections happens multithreaded so // qWait must be used for that. - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE(spy.size(), 2); QTest::qWait(100); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(server.hasPendingConnections()); QVERIFY(server.nextPendingConnection()); @@ -1016,12 +1016,12 @@ void tst_QTcpServer::eagainBlockingAccept() QTcpSocket s; s.connectToHost(QHostAddress::LocalHost, 7896); QSignalSpy spy(&server, SIGNAL(newConnection())); - QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 500); + QTRY_COMPARE_WITH_TIMEOUT(spy.size(), 1, 500); s.close(); // To test try again, should connect just fine. s.connectToHost(QHostAddress::LocalHost, 7896); - QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 2, 500); + QTRY_COMPARE_WITH_TIMEOUT(spy.size(), 2, 500); s.close(); server.close(); } @@ -1057,13 +1057,13 @@ void tst_QTcpServer::pauseAccepting() QTcpSocket sockets[NumSockets]; sockets[0].connectToHost(address, server.serverPort()); QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); server.pauseAccepting(); for (int i = 1; i < NumSockets; ++i) sockets[i].connectToHost(address, server.serverPort()); QVERIFY(!spy.wait(400)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); server.resumeAccepting(); if (setProxy) { @@ -1071,7 +1071,7 @@ void tst_QTcpServer::pauseAccepting() Abort); } QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); } @@ -1135,11 +1135,11 @@ void tst_QTcpServer::pendingConnectionAvailable() QCOMPARE(socket.state(), QTcpSocket::ConnectedState); int expectedPendingConnections = useDerivedServer ? 0 : 1; - QCOMPARE(pendingConnectionSpy.count(), expectedPendingConnections); + QCOMPARE(pendingConnectionSpy.size(), expectedPendingConnections); if (useDerivedServer) static_cast(server)->emitNextSocket(); - QCOMPARE(pendingConnectionSpy.count(), 1); + QCOMPARE(pendingConnectionSpy.size(), 1); } QTEST_MAIN(tst_QTcpServer) diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index bf933406a6..e35c771b0b 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -1781,7 +1781,7 @@ void tst_QTcpSocket::recursiveReadyRead() QVERIFY2(!timeout(), "Timed out when waiting for the readyRead() signal."); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); delete testSocket; } @@ -2006,8 +2006,8 @@ void tst_QTcpSocket::remoteCloseError() enterLoop(30); QVERIFY(!timeout()); - QCOMPARE(disconnectedSpy.count(), 1); - QCOMPARE(errorSpy.count(), 1); + QCOMPARE(disconnectedSpy.size(), 1); + QCOMPARE(errorSpy.size(), 1); QCOMPARE(clientSocket->error(), QAbstractSocket::RemoteHostClosedError); delete serverSocket; @@ -2138,7 +2138,7 @@ void tst_QTcpSocket::waitForConnectedInHostLookupSlot() if (tmpSocket->state() != QAbstractSocket::ConnectedState) loop.exec(); - QCOMPARE(timerSpy.count(), 0); + QCOMPARE(timerSpy.size(), 0); delete tmpSocket; } @@ -2243,7 +2243,7 @@ void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead() // Wait for the read QVERIFY(socket->waitForReadyRead(10000)); - QCOMPARE(readyReadSpy.count(), 1); + QCOMPARE(readyReadSpy.size(), 1); QString s = socket->readLine(); QVERIFY2(QtNetworkSettings::compareReplyIMAP(s.toLatin1()), s.toLatin1().constData()); @@ -2251,7 +2251,7 @@ void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead() QCoreApplication::instance()->processEvents(); QCOMPARE(socket->bytesAvailable(), qint64(0)); - QCOMPARE(readyReadSpy.count(), 1); + QCOMPARE(readyReadSpy.size(), 1); delete socket; } @@ -2325,8 +2325,8 @@ void tst_QTcpSocket::abortiveClose() enterLoop(5); - QCOMPARE(readyReadSpy.count(), 0); - QCOMPARE(errorSpy.count(), 1); + QCOMPARE(readyReadSpy.size(), 0); + QCOMPARE(errorSpy.size(), 1); QCOMPARE(*static_cast(errorSpy.at(0).at(0).constData()), int(QAbstractSocket::RemoteHostClosedError)); @@ -2445,11 +2445,11 @@ void tst_QTcpSocket::connectionRefused() QCOMPARE(socket->state(), QAbstractSocket::UnconnectedState); QCOMPARE(socket->error(), QAbstractSocket::ConnectionRefusedError); - QCOMPARE(stateSpy.count(), 3); + QCOMPARE(stateSpy.size(), 3); QCOMPARE(qvariant_cast(stateSpy.at(0).at(0)), QAbstractSocket::HostLookupState); QCOMPARE(qvariant_cast(stateSpy.at(1).at(0)), QAbstractSocket::ConnectingState); QCOMPARE(qvariant_cast(stateSpy.at(2).at(0)), QAbstractSocket::UnconnectedState); - QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorSpy.size(), 1); delete socket; } @@ -3118,8 +3118,8 @@ void tst_QTcpSocket::serverDisconnectWithBuffered() QCOMPARE(socket->state(), QAbstractSocket::UnconnectedState); } // Test signal emitting - QCOMPARE(spyDisconnected.count(), 1); - QVERIFY(spyStateChanged.count() > 0); + QCOMPARE(spyDisconnected.size(), 1); + QVERIFY(spyStateChanged.size() > 0); QVERIFY(qvariant_cast(spyStateChanged.last().first()) == QAbstractSocket::UnconnectedState); @@ -3208,7 +3208,7 @@ void tst_QTcpSocket::readNotificationsAfterBind() QTestEventLoop::instance().enterLoop(10); QVERIFY2(!QTestEventLoop::instance().timeout(), "Connection to closed port timed out instead of refusing, something is wrong"); QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!"); - QCOMPARE(spyReadyRead.count(), 0); + QCOMPARE(spyReadyRead.size(), 0); } QTEST_MAIN(tst_QTcpSocket) diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 22d24ed448..4380433899 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -334,7 +334,7 @@ void tst_QUdpSocket::unconnectedServerAndClientTest() QSignalSpy stateChangedSpy(&serverSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState))); QVERIFY2(serverSocket.bind(), serverSocket.errorString().toLatin1().constData()); - QCOMPARE(stateChangedSpy.count(), 1); + QCOMPARE(stateChangedSpy.size(), 1); const char *message[] = {"Yo mista", "Yo", "Wassap"}; @@ -875,17 +875,17 @@ void tst_QUdpSocket::writeDatagram() #if defined (Q_OS_HPUX) QSKIP("HP-UX 11.11 on hai (PA-RISC 64) truncates too long datagrams."); #endif - QCOMPARE(bytesspy.count(), 0); - QCOMPARE(errorspy.count(), 1); + QCOMPARE(bytesspy.size(), 0); + QCOMPARE(errorspy.size(), 1); QCOMPARE(*static_cast(errorspy.at(0).at(0).constData()), int(QUdpSocket::DatagramTooLargeError)); QCOMPARE(client.error(), QUdpSocket::DatagramTooLargeError); break; } - QCOMPARE(bytesspy.count(), 1); + QCOMPARE(bytesspy.size(), 1); QCOMPARE(*static_cast(bytesspy.at(0).at(0).constData()), qint64(i * 1024)); - QCOMPARE(errorspy.count(), 0); + QCOMPARE(errorspy.size(), 0); if (!server.waitForReadyRead(5000)) QSKIP(QString("UDP packet lost at size %1, unable to complete the test.").arg(i * 1024).toLatin1().data()); QCOMPARE(server.pendingDatagramSize(), qint64(i * 1024)); @@ -998,7 +998,7 @@ void tst_QUdpSocket::writeDatagramToNonExistingPeer() QVERIFY(sUdp.bind()); QCOMPARE(sUdp.writeDatagram("", 1, peerAddress, peerPort), qint64(1)); QTestEventLoop::instance().enterLoop(1); - QCOMPARE(sReadyReadSpy.count(), 0); + QCOMPARE(sReadyReadSpy.size(), 0); } void tst_QUdpSocket::writeToNonExistingPeer_data() @@ -1041,8 +1041,8 @@ void tst_QUdpSocket::writeToNonExistingPeer() // the third one will succeed... QCOMPARE(sConnected.write("", 1), qint64(1)); QTestEventLoop::instance().enterLoop(1); - QCOMPARE(sConnectedReadyReadSpy.count(), 0); - QCOMPARE(sConnectedErrorSpy.count(), 1); + QCOMPARE(sConnectedReadyReadSpy.size(), 0); + QCOMPARE(sConnectedErrorSpy.size(), 1); QCOMPARE(int(sConnected.error()), int(QUdpSocket::ConnectionRefusedError)); // we should now get a read error @@ -1647,7 +1647,7 @@ void tst_QUdpSocket::linkLocalIPv6() QSignalSpy spy(s, SIGNAL(readyRead())); QVERIFY(s->writeDatagram(testData, s->localAddress(), neutral.localPort())); - QTRY_VERIFY(neutralReadSpy.count() > 0); //note may need to accept a firewall prompt + QTRY_VERIFY(neutralReadSpy.size() > 0); //note may need to accept a firewall prompt QNetworkDatagram dgram = neutral.receiveDatagram(testData.size() * 2); QVERIFY(dgram.isValid()); @@ -1659,7 +1659,7 @@ void tst_QUdpSocket::linkLocalIPv6() QCOMPARE(dgram.data(), testData); QVERIFY(neutral.writeDatagram(dgram.makeReply(testData))); - QTRY_VERIFY(spy.count() > 0); //note may need to accept a firewall prompt + QTRY_VERIFY(spy.size() > 0); //note may need to accept a firewall prompt dgram = s->receiveDatagram(testData.size() * 2); QCOMPARE(dgram.data(), testData); @@ -1786,7 +1786,7 @@ void tst_QUdpSocket::readyRead() QTest::qWait(100); // make sure only one signal was emitted - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(receiver.hasPendingDatagrams()); #ifdef RELIABLE_BYTES_AVAILABLE QCOMPARE(receiver.bytesAvailable(), qint64(2)); @@ -1798,7 +1798,7 @@ void tst_QUdpSocket::readyRead() // no new signal should be emitted because we haven't read the first datagram yet QTest::qWait(100); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(receiver.hasPendingDatagrams()); QVERIFY(receiver.bytesAvailable() >= 1); // most likely is 1, but it could be 1 + 2 in the future QCOMPARE(receiver.pendingDatagramSize(), qint64(2)); @@ -1810,7 +1810,7 @@ void tst_QUdpSocket::readyRead() // write a new datagram and ensure the signal is emitted now sender.writeDatagram("abc", makeNonAny(receiver.localAddress()), port); QTest::qWait(100); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(receiver.hasPendingDatagrams()); #ifdef RELIABLE_BYTES_AVAILABLE QCOMPARE(receiver.bytesAvailable(), qint64(3)); @@ -1890,7 +1890,7 @@ void tst_QUdpSocket::asyncReadDatagram() QTestEventLoop::instance().enterLoop(1); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); delete m_asyncSender; delete m_asyncReceiver; diff --git a/tests/auto/network/ssl/qsslserver/tst_qsslserver.cpp b/tests/auto/network/ssl/qsslserver/tst_qsslserver.cpp index f5356e58f7..13a3201345 100644 --- a/tests/auto/network/ssl/qsslserver/tst_qsslserver.cpp +++ b/tests/auto/network/ssl/qsslserver/tst_qsslserver.cpp @@ -142,15 +142,15 @@ void tst_QSslServer::testOneSuccessfulConnection() QVERIFY(server.startedEncryptionHandshakeSpy.isValid()); // Check that no connections has occurred - QCOMPARE(server.sslErrorsSpy.count(), 0); - QCOMPARE(server.peerVerifyErrorSpy.count(), 0); - QCOMPARE(server.errorOccurredSpy.count(), 0); - QCOMPARE(server.pendingConnectionAvailableSpy.count(), 0); - QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.count(), 0); - QCOMPARE(server.alertSentSpy.count(), 0); - QCOMPARE(server.alertReceivedSpy.count(), 0); - QCOMPARE(server.handshakeInterruptedOnErrorSpy.count(), 0); - QCOMPARE(server.startedEncryptionHandshakeSpy.count(), 0); + QCOMPARE(server.sslErrorsSpy.size(), 0); + QCOMPARE(server.peerVerifyErrorSpy.size(), 0); + QCOMPARE(server.errorOccurredSpy.size(), 0); + QCOMPARE(server.pendingConnectionAvailableSpy.size(), 0); + QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.size(), 0); + QCOMPARE(server.alertSentSpy.size(), 0); + QCOMPARE(server.alertReceivedSpy.size(), 0); + QCOMPARE(server.handshakeInterruptedOnErrorSpy.size(), 0); + QCOMPARE(server.startedEncryptionHandshakeSpy.size(), 0); // Connect client QSslSocket client; @@ -187,15 +187,15 @@ void tst_QSslServer::testOneSuccessfulConnection() loop.exec(); // Check that one encrypted connection has occurred without error - QCOMPARE(server.sslErrorsSpy.count(), 0); - QCOMPARE(server.peerVerifyErrorSpy.count(), 0); - QCOMPARE(server.errorOccurredSpy.count(), 0); - QCOMPARE(server.pendingConnectionAvailableSpy.count(), 1); - QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.count(), 0); - QCOMPARE(server.alertSentSpy.count(), 0); - QCOMPARE(server.alertReceivedSpy.count(), 0); - QCOMPARE(server.handshakeInterruptedOnErrorSpy.count(), 0); - QCOMPARE(server.startedEncryptionHandshakeSpy.count(), 1); + QCOMPARE(server.sslErrorsSpy.size(), 0); + QCOMPARE(server.peerVerifyErrorSpy.size(), 0); + QCOMPARE(server.errorOccurredSpy.size(), 0); + QCOMPARE(server.pendingConnectionAvailableSpy.size(), 1); + QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.size(), 0); + QCOMPARE(server.alertSentSpy.size(), 0); + QCOMPARE(server.alertReceivedSpy.size(), 0); + QCOMPARE(server.handshakeInterruptedOnErrorSpy.size(), 0); + QCOMPARE(server.startedEncryptionHandshakeSpy.size(), 1); // Check client socket QVERIFY(client.isEncrypted()); @@ -224,16 +224,16 @@ void tst_QSslServer::testSelfSignedCertificateRejectedByServer() loop.exec(); // Check that one encrypted connection has failed - QCOMPARE(server.sslErrorsSpy.count(), 1); - QCOMPARE(server.peerVerifyErrorSpy.count(), 1); - QCOMPARE(server.errorOccurredSpy.count(), 1); - QCOMPARE(server.pendingConnectionAvailableSpy.count(), 0); - QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.count(), 0); - QCOMPARE(server.alertSentSpy.count(), + QCOMPARE(server.sslErrorsSpy.size(), 1); + QCOMPARE(server.peerVerifyErrorSpy.size(), 1); + QCOMPARE(server.errorOccurredSpy.size(), 1); + QCOMPARE(server.pendingConnectionAvailableSpy.size(), 0); + QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.size(), 0); + QCOMPARE(server.alertSentSpy.size(), isTestingOpenSsl ? 1 : 0); // OpenSSL only signal - QCOMPARE(server.alertReceivedSpy.count(), 0); - QCOMPARE(server.handshakeInterruptedOnErrorSpy.count(), 0); - QCOMPARE(server.startedEncryptionHandshakeSpy.count(), 1); + QCOMPARE(server.alertReceivedSpy.size(), 0); + QCOMPARE(server.handshakeInterruptedOnErrorSpy.size(), 0); + QCOMPARE(server.startedEncryptionHandshakeSpy.size(), 1); // Type of certificate error to expect const auto certificateError = @@ -290,32 +290,32 @@ void tst_QSslServer::testSelfSignedCertificateRejectedByClient() QTcpSocket *connection = server.server.nextPendingConnection(); if (connection == nullptr) { // Client disconnected before connection accepted by server - QCOMPARE(server.sslErrorsSpy.count(), 0); - QCOMPARE(server.peerVerifyErrorSpy.count(), 0); - QCOMPARE(server.errorOccurredSpy.count(), 1); // Client rejected first - QCOMPARE(server.pendingConnectionAvailableSpy.count(), 0); - QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.count(), 0); - QCOMPARE(server.alertSentSpy.count(), 0); - QCOMPARE(server.alertReceivedSpy.count(), + QCOMPARE(server.sslErrorsSpy.size(), 0); + QCOMPARE(server.peerVerifyErrorSpy.size(), 0); + QCOMPARE(server.errorOccurredSpy.size(), 1); // Client rejected first + QCOMPARE(server.pendingConnectionAvailableSpy.size(), 0); + QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.size(), 0); + QCOMPARE(server.alertSentSpy.size(), 0); + QCOMPARE(server.alertReceivedSpy.size(), isTestingOpenSsl ? 1 : 0); // OpenSSL only signal - QCOMPARE(server.handshakeInterruptedOnErrorSpy.count(), 0); - QCOMPARE(server.startedEncryptionHandshakeSpy.count(), 1); + QCOMPARE(server.handshakeInterruptedOnErrorSpy.size(), 0); + QCOMPARE(server.startedEncryptionHandshakeSpy.size(), 1); const auto errrOccuredSpyError = qvariant_cast( std::as_const(server.errorOccurredSpy).first()[1]); QCOMPARE(errrOccuredSpyError, socketError); } else { // Client disconnected after connection accepted by server - QCOMPARE(server.sslErrorsSpy.count(), 0); - QCOMPARE(server.peerVerifyErrorSpy.count(), 0); - QCOMPARE(server.errorOccurredSpy.count(), 0); // Server accepted first - QCOMPARE(server.pendingConnectionAvailableSpy.count(), 1); - QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.count(), 0); - QCOMPARE(server.alertSentSpy.count(), 0); - QCOMPARE(server.alertReceivedSpy.count(), + QCOMPARE(server.sslErrorsSpy.size(), 0); + QCOMPARE(server.peerVerifyErrorSpy.size(), 0); + QCOMPARE(server.errorOccurredSpy.size(), 0); // Server accepted first + QCOMPARE(server.pendingConnectionAvailableSpy.size(), 1); + QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.size(), 0); + QCOMPARE(server.alertSentSpy.size(), 0); + QCOMPARE(server.alertReceivedSpy.size(), isTestingOpenSsl ? 1 : 0); // OpenSSL only signal - QCOMPARE(server.handshakeInterruptedOnErrorSpy.count(), 0); - QCOMPARE(server.startedEncryptionHandshakeSpy.count(), 1); + QCOMPARE(server.handshakeInterruptedOnErrorSpy.size(), 0); + QCOMPARE(server.startedEncryptionHandshakeSpy.size(), 1); QCOMPARE(connection->state(), QAbstractSocket::UnconnectedState); QCOMPARE(connection->error(), socketError); @@ -325,12 +325,12 @@ void tst_QSslServer::testSelfSignedCertificateRejectedByClient() } // Check that client has rejected server - QCOMPARE(clientConnectedSpy.count(), 1); - QCOMPARE(clientHostFoundSpy.count(), 1); - QCOMPARE(clientDisconnectedSpy.count(), 1); - QCOMPARE(clientConnectionEncryptedSpy.count(), 0); - QCOMPARE(clientSslErrorsSpy.count(), isTestingOpenSsl ? 0 : 1); - QCOMPARE(clientErrorOccurredSpy.count(), 1); + QCOMPARE(clientConnectedSpy.size(), 1); + QCOMPARE(clientHostFoundSpy.size(), 1); + QCOMPARE(clientDisconnectedSpy.size(), 1); + QCOMPARE(clientConnectionEncryptedSpy.size(), 0); + QCOMPARE(clientSslErrorsSpy.size(), isTestingOpenSsl ? 0 : 1); + QCOMPARE(clientErrorOccurredSpy.size(), 1); // Check client socket QVERIFY(!client.isEncrypted()); @@ -364,15 +364,15 @@ void tst_QSslServer::testHandshakeInterruptedOnError() loop.exec(); // Check that client certificate causes handshake interrupted signal to be emitted - QCOMPARE(server.sslErrorsSpy.count(), 0); - QCOMPARE(server.peerVerifyErrorSpy.count(), 0); - QCOMPARE(server.errorOccurredSpy.count(), 1); - QCOMPARE(server.pendingConnectionAvailableSpy.count(), 0); - QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.count(), 0); - QCOMPARE(server.alertSentSpy.count(), 1); - QCOMPARE(server.alertReceivedSpy.count(), 0); - QCOMPARE(server.handshakeInterruptedOnErrorSpy.count(), 1); - QCOMPARE(server.startedEncryptionHandshakeSpy.count(), 1); + QCOMPARE(server.sslErrorsSpy.size(), 0); + QCOMPARE(server.peerVerifyErrorSpy.size(), 0); + QCOMPARE(server.errorOccurredSpy.size(), 1); + QCOMPARE(server.pendingConnectionAvailableSpy.size(), 0); + QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.size(), 0); + QCOMPARE(server.alertSentSpy.size(), 1); + QCOMPARE(server.alertReceivedSpy.size(), 0); + QCOMPARE(server.handshakeInterruptedOnErrorSpy.size(), 1); + QCOMPARE(server.startedEncryptionHandshakeSpy.size(), 1); } void tst_QSslServer::testPreSharedKeyAuthenticationRequired() @@ -422,15 +422,15 @@ void tst_QSslServer::testPreSharedKeyAuthenticationRequired() loop.exec(); // Check that server is connected - QCOMPARE(server.sslErrorsSpy.count(), 1); - QCOMPARE(server.peerVerifyErrorSpy.count(), 1); - QCOMPARE(server.errorOccurredSpy.count(), 0); - QCOMPARE(server.pendingConnectionAvailableSpy.count(), 1); - QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.count(), 1); - QCOMPARE(server.alertSentSpy.count(), 0); - QCOMPARE(server.alertReceivedSpy.count(), 0); - QCOMPARE(server.handshakeInterruptedOnErrorSpy.count(), 0); - QCOMPARE(server.startedEncryptionHandshakeSpy.count(), 1); + QCOMPARE(server.sslErrorsSpy.size(), 1); + QCOMPARE(server.peerVerifyErrorSpy.size(), 1); + QCOMPARE(server.errorOccurredSpy.size(), 0); + QCOMPARE(server.pendingConnectionAvailableSpy.size(), 1); + QCOMPARE(server.preSharedKeyAuthenticationRequiredSpy.size(), 1); + QCOMPARE(server.alertSentSpy.size(), 0); + QCOMPARE(server.alertReceivedSpy.size(), 0); + QCOMPARE(server.handshakeInterruptedOnErrorSpy.size(), 0); + QCOMPARE(server.startedEncryptionHandshakeSpy.size(), 1); // Check client socket QVERIFY(client.isEncrypted()); @@ -457,7 +457,7 @@ void tst_QSslServer::plaintextClient() socket.write("Hello World!"); socket.waitForBytesWritten(); // ... and quickly get disconnected: - QTRY_COMPARE_GT(socketDisconnectedSpy.count(), 0); + QTRY_COMPARE_GT(socketDisconnectedSpy.size(), 0); QCOMPARE(socket.state(), QAbstractSocket::SocketState::UnconnectedState); } diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 5d8de03d7f..4e380bcde1 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -836,30 +836,30 @@ void tst_QSslSocket::simpleConnect() // Entered connecting state QCOMPARE(socket.state(), QAbstractSocket::ConnectingState); - QCOMPARE(connectedSpy.count(), 0); - QCOMPARE(hostFoundSpy.count(), 1); - QCOMPARE(disconnectedSpy.count(), 0); + QCOMPARE(connectedSpy.size(), 0); + QCOMPARE(hostFoundSpy.size(), 1); + QCOMPARE(disconnectedSpy.size(), 0); enterLoop(10); // Entered connected state QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); QCOMPARE(socket.mode(), QSslSocket::UnencryptedMode); QVERIFY(!socket.isEncrypted()); - QCOMPARE(connectedSpy.count(), 1); - QCOMPARE(hostFoundSpy.count(), 1); - QCOMPARE(disconnectedSpy.count(), 0); + QCOMPARE(connectedSpy.size(), 1); + QCOMPARE(hostFoundSpy.size(), 1); + QCOMPARE(disconnectedSpy.size(), 0); // Enter encrypted mode socket.startClientEncryption(); QCOMPARE(socket.mode(), QSslSocket::SslClientMode); QVERIFY(!socket.isEncrypted()); - QCOMPARE(connectionEncryptedSpy.count(), 0); - QCOMPARE(sslErrorsSpy.count(), 0); + QCOMPARE(connectionEncryptedSpy.size(), 0); + QCOMPARE(sslErrorsSpy.size(), 0); // Starting handshake enterLoop(10); - QCOMPARE(sslErrorsSpy.count(), 1); - QCOMPARE(connectionEncryptedSpy.count(), 0); + QCOMPARE(sslErrorsSpy.size(), 1); + QCOMPARE(connectionEncryptedSpy.size(), 0); QVERIFY(!socket.isEncrypted()); QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState); } @@ -897,10 +897,10 @@ void tst_QSslSocket::simpleConnectWithIgnore() enterLoop(10); // Done; encryption should be enabled. - QCOMPARE(sslErrorsSpy.count(), 1); + QCOMPARE(sslErrorsSpy.size(), 1); QVERIFY(socket.isEncrypted()); QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); - QCOMPARE(encryptedSpy.count(), 1); + QCOMPARE(encryptedSpy.size(), 1); // Wait for incoming data if (!socket.canReadLine()) @@ -2821,7 +2821,7 @@ void tst_QSslSocket::closeWhileEmittingSocketError() QTestEventLoop::instance().enterLoopMSecs(1000); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(socketErrorSpy.count(), 1); + QCOMPARE(socketErrorSpy.size(), 1); } #endif // Feature 'openssl'. @@ -2918,7 +2918,7 @@ void tst_QSslSocket::ignoreSslErrorsList() bool expectEncryptionSuccess = (expectedSslErrorSignalCount == 0); if (socket.waitForEncrypted(10000) != expectEncryptionSuccess) QSKIP("Skipping flaky test - See QTBUG-29941"); - QCOMPARE(sslErrorsSpy.count(), expectedSslErrorSignalCount); + QCOMPARE(sslErrorsSpy.size(), expectedSslErrorSignalCount); } void tst_QSslSocket::ignoreSslErrorsListWithSlot_data() @@ -3160,9 +3160,9 @@ void tst_QSslSocket::resume() QFETCH_GLOBAL(bool, setProxy); if (setProxy && QTestEventLoop::instance().timeout()) QSKIP("Skipping flaky test - See QTBUG-29941"); - QCOMPARE(sslErrorSpy.count(), 1); - QCOMPARE(errorSpy.count(), 0); - QCOMPARE(encryptedSpy.count(), 0); + QCOMPARE(sslErrorSpy.size(), 1); + QCOMPARE(errorSpy.size(), 0); + QCOMPARE(encryptedSpy.size(), 0); QVERIFY(!socket.isEncrypted()); if (ignoreErrorsAfterPause) { if (errorsToIgnore.empty()) @@ -3174,15 +3174,15 @@ void tst_QSslSocket::resume() QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); // quit by encrypted() or error() signal if (expectSuccess) { - QCOMPARE(encryptedSpy.count(), 1); + QCOMPARE(encryptedSpy.size(), 1); QVERIFY(socket.isEncrypted()); - QCOMPARE(errorSpy.count(), 0); + QCOMPARE(errorSpy.size(), 0); socket.disconnectFromHost(); QVERIFY(socket.waitForDisconnected(10000)); } else { - QCOMPARE(encryptedSpy.count(), 0); + QCOMPARE(encryptedSpy.size(), 0); QVERIFY(!socket.isEncrypted()); - QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorSpy.size(), 1); QCOMPARE(socket.error(), QAbstractSocket::SslHandshakeFailedError); } } @@ -4142,32 +4142,32 @@ void tst_QSslSocket::simplePskConnect() // Entered connecting state QCOMPARE(socket.state(), QAbstractSocket::ConnectingState); - QCOMPARE(connectedSpy.count(), 0); - QCOMPARE(hostFoundSpy.count(), 1); - QCOMPARE(disconnectedSpy.count(), 0); + QCOMPARE(connectedSpy.size(), 0); + QCOMPARE(hostFoundSpy.size(), 1); + QCOMPARE(disconnectedSpy.size(), 0); enterLoop(10); // Entered connected state QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); QCOMPARE(socket.mode(), QSslSocket::UnencryptedMode); QVERIFY(!socket.isEncrypted()); - QCOMPARE(connectedSpy.count(), 1); - QCOMPARE(hostFoundSpy.count(), 1); - QCOMPARE(disconnectedSpy.count(), 0); + QCOMPARE(connectedSpy.size(), 1); + QCOMPARE(hostFoundSpy.size(), 1); + QCOMPARE(disconnectedSpy.size(), 0); // Enter encrypted mode socket.startClientEncryption(); QCOMPARE(socket.mode(), QSslSocket::SslClientMode); QVERIFY(!socket.isEncrypted()); - QCOMPARE(connectionEncryptedSpy.count(), 0); - QCOMPARE(sslErrorsSpy.count(), 0); - QCOMPARE(peerVerifyErrorSpy.count(), 0); + QCOMPARE(connectionEncryptedSpy.size(), 0); + QCOMPARE(sslErrorsSpy.size(), 0); + QCOMPARE(peerVerifyErrorSpy.size(), 0); // Start handshake. enterLoop(10); // We must get the PSK signal in all cases - QCOMPARE(pskAuthenticationRequiredSpy.count(), 1); + QCOMPARE(pskAuthenticationRequiredSpy.size(), 1); switch (pskTestType) { case PskConnectDoNotHandlePsk: @@ -4176,40 +4176,40 @@ void tst_QSslSocket::simplePskConnect() case PskConnectWrongIdentity: case PskConnectWrongPreSharedKey: // Handshake failure - QCOMPARE(socketErrorsSpy.count(), 1); + QCOMPARE(socketErrorsSpy.size(), 1); QCOMPARE(qvariant_cast(socketErrorsSpy.at(0).at(0)), QAbstractSocket::SslHandshakeFailedError); - QCOMPARE(sslErrorsSpy.count(), 0); - QCOMPARE(peerVerifyErrorSpy.count(), 0); - QCOMPARE(connectionEncryptedSpy.count(), 0); + QCOMPARE(sslErrorsSpy.size(), 0); + QCOMPARE(peerVerifyErrorSpy.size(), 0); + QCOMPARE(connectionEncryptedSpy.size(), 0); QVERIFY(!socket.isEncrypted()); break; case PskConnectRightCredentialsPeerVerifyFailure: // Peer verification failure - QCOMPARE(socketErrorsSpy.count(), 1); + QCOMPARE(socketErrorsSpy.size(), 1); QCOMPARE(qvariant_cast(socketErrorsSpy.at(0).at(0)), QAbstractSocket::SslHandshakeFailedError); - QCOMPARE(sslErrorsSpy.count(), 1); - QCOMPARE(peerVerifyErrorSpy.count(), 1); - QCOMPARE(connectionEncryptedSpy.count(), 0); + QCOMPARE(sslErrorsSpy.size(), 1); + QCOMPARE(peerVerifyErrorSpy.size(), 1); + QCOMPARE(connectionEncryptedSpy.size(), 0); QVERIFY(!socket.isEncrypted()); break; case PskConnectRightCredentialsVerifyPeer: // Peer verification failure, but ignore it and keep connecting - QCOMPARE(socketErrorsSpy.count(), 0); - QCOMPARE(sslErrorsSpy.count(), 1); - QCOMPARE(peerVerifyErrorSpy.count(), 1); - QCOMPARE(connectionEncryptedSpy.count(), 1); + QCOMPARE(socketErrorsSpy.size(), 0); + QCOMPARE(sslErrorsSpy.size(), 1); + QCOMPARE(peerVerifyErrorSpy.size(), 1); + QCOMPARE(connectionEncryptedSpy.size(), 1); QVERIFY(socket.isEncrypted()); QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); break; case PskConnectRightCredentialsDoNotVerifyPeer: // No peer verification => no failure - QCOMPARE(socketErrorsSpy.count(), 0); - QCOMPARE(sslErrorsSpy.count(), 0); - QCOMPARE(peerVerifyErrorSpy.count(), 0); - QCOMPARE(connectionEncryptedSpy.count(), 1); + QCOMPARE(socketErrorsSpy.size(), 0); + QCOMPARE(sslErrorsSpy.size(), 0); + QCOMPARE(peerVerifyErrorSpy.size(), 0); + QCOMPARE(connectionEncryptedSpy.size(), 1); QVERIFY(socket.isEncrypted()); QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); break; @@ -4250,7 +4250,7 @@ void tst_QSslSocket::simplePskConnect() } QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState); - QCOMPARE(disconnectedSpy.count(), 1); + QCOMPARE(disconnectedSpy.size(), 1); } void tst_QSslSocket::ephemeralServerKey_data() @@ -4283,7 +4283,7 @@ void tst_QSslSocket::ephemeralServerKey() client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort()); spy.wait(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(server.config.ephemeralServerKey().isNull()); QCOMPARE(client->sslConfiguration().ephemeralServerKey().isNull(), emptyKey); } @@ -4346,22 +4346,22 @@ void tst_QSslSocket::pskServer() QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); QCOMPARE(socket.mode(), QSslSocket::UnencryptedMode); QVERIFY(!socket.isEncrypted()); - QCOMPARE(connectedSpy.count(), 1); - QCOMPARE(disconnectedSpy.count(), 0); + QCOMPARE(connectedSpy.size(), 1); + QCOMPARE(disconnectedSpy.size(), 0); // Enter encrypted mode socket.startClientEncryption(); QCOMPARE(socket.mode(), QSslSocket::SslClientMode); QVERIFY(!socket.isEncrypted()); - QCOMPARE(connectionEncryptedSpy.count(), 0); + QCOMPARE(connectionEncryptedSpy.size(), 0); // Start handshake. enterLoop(10); // We must get the PSK signal in all cases - QCOMPARE(pskAuthenticationRequiredSpy.count(), 1); + QCOMPARE(pskAuthenticationRequiredSpy.size(), 1); - QCOMPARE(connectionEncryptedSpy.count(), 1); + QCOMPARE(connectionEncryptedSpy.size(), 1); QVERIFY(socket.isEncrypted()); QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); @@ -4374,7 +4374,7 @@ void tst_QSslSocket::pskServer() enterLoop(10); QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState); - QCOMPARE(disconnectedSpy.count(), 1); + QCOMPARE(disconnectedSpy.size(), 1); } void tst_QSslSocket::signatureAlgorithm_data() @@ -4527,7 +4527,7 @@ void tst_QSslSocket::forwardReadChannelFinished() &QTestEventLoop::instance(), &QTestEventLoop::exitLoop); socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); enterLoop(10); - QVERIFY(readChannelFinishedSpy.count()); + QVERIFY(readChannelFinishedSpy.size()); } #endif // QT_CONFIG(openssl) @@ -4714,8 +4714,8 @@ void tst_QSslSocket::alertMissingCertificate() runner.enterLoopMSecs(10000); } - QVERIFY(serverSpy.count() > 0); - QVERIFY(clientSpy.count() > 0); + QVERIFY(serverSpy.size() > 0); + QVERIFY(clientSpy.size() > 0); QVERIFY(server.socket && !server.socket->isEncrypted()); QVERIFY(!clientSocket.isEncrypted()); } @@ -4768,9 +4768,9 @@ void tst_QSslSocket::alertInvalidCertificate() runner.enterLoopMSecs(1000); - QVERIFY(serverSpy.count() > 0); - QVERIFY(clientSpy.count() > 0); - QVERIFY(interruptedSpy.count() > 0); + QVERIFY(serverSpy.size() > 0); + QVERIFY(clientSpy.size() > 0); + QVERIFY(interruptedSpy.size() > 0); QVERIFY(server.socket && !server.socket->isEncrypted()); QVERIFY(!clientSocket.isEncrypted()); } @@ -4897,14 +4897,14 @@ void tst_QSslSocket::selfSignedCertificates() runner.enterLoopMSecs(1000); if (clientKnown) { - QCOMPARE(serverSpy.count(), 0); - QCOMPARE(clientSpy.count(), 0); + QCOMPARE(serverSpy.size(), 0); + QCOMPARE(clientSpy.size(), 0); QVERIFY(server.socket && server.socket->isEncrypted()); QVERIFY(clientSocket.isEncrypted()); } else { - QVERIFY(serverSpy.count() > 0); + QVERIFY(serverSpy.size() > 0); QEXPECT_FAIL("", "Failing to trigger signal, QTBUG-81661", Continue); - QVERIFY(clientSpy.count() > 0); + QVERIFY(clientSpy.size() > 0); QVERIFY(server.socket && !server.socket->isEncrypted()); QVERIFY(!clientSocket.isEncrypted()); } @@ -5035,15 +5035,15 @@ void tst_QSslSocket::pskHandshake() runner.enterLoopMSecs(1000); if (pskRight) { - QCOMPARE(serverSpy.count(), 0); - QCOMPARE(clientSpy.count(), 0); + QCOMPARE(serverSpy.size(), 0); + QCOMPARE(clientSpy.size(), 0); QVERIFY(server.socket && server.socket->isEncrypted()); QVERIFY(clientSocket.isEncrypted()); } else { - QVERIFY(serverSpy.count() > 0); + QVERIFY(serverSpy.size() > 0); QCOMPARE(serverSpy.first().at(0).toInt(), static_cast(QSsl::AlertLevel::Fatal)); QCOMPARE(serverSpy.first().at(1).toInt(), static_cast(QSsl::AlertType::BadRecordMac)); - QVERIFY(clientSpy.count() > 0); + QVERIFY(clientSpy.size() > 0); QCOMPARE(clientSpy.first().at(0).toInt(), static_cast(QSsl::AlertLevel::Fatal)); QCOMPARE(clientSpy.first().at(1).toInt(), static_cast(QSsl::AlertType::BadRecordMac)); QVERIFY(server.socket && !server.socket->isEncrypted()); diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index f65230c07c..a7b9512661 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -298,9 +298,9 @@ void tst_QAccessibility::cleanup() { const EventList list = QTestAccessibility::events(); if (!list.isEmpty()) { - qWarning("%zd accessibility event(s) were not handled in testfunction '%s':", size_t(list.count()), + qWarning("%zd accessibility event(s) were not handled in testfunction '%s':", size_t(list.size()), QString(QTest::currentTestFunction()).toLatin1().constData()); - for (int i = 0; i < list.count(); ++i) + for (int i = 0; i < list.size(); ++i) qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i)->object(), qAccessibleEventString(list.at(i)->type()), list.at(i)->child()); } @@ -4176,7 +4176,7 @@ void tst_QAccessibility::focusChild() spy.clear(); tableView->setCurrentCell(2, 1); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QAccessibleInterface *child = iface->focusChild(); QVERIFY(child); @@ -4184,7 +4184,7 @@ void tst_QAccessibility::focusChild() spy.clear(); tableView->setCurrentCell(1, 2); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); child = iface->focusChild(); QVERIFY(child); @@ -4236,7 +4236,7 @@ void tst_QAccessibility::focusChild() spy.clear(); treeView->setCurrentItem(item2); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QAccessibleInterface *child = iface->focusChild(); QVERIFY(child); @@ -4244,7 +4244,7 @@ void tst_QAccessibility::focusChild() spy.clear(); treeView->setCurrentItem(item3); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); child = iface->focusChild(); QVERIFY(child); diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp index e70d132ea7..3541576bb8 100644 --- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp @@ -35,20 +35,20 @@ void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop() qApp->processEvents(QEventLoop::AllEvents, 100); // we mustn't have read anything in the event loop - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // ensure the process hasn't died QVERIFY(!process.waitForFinished(250)); // we mustn't have read anything during waitForFinished either - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // release the child for the second write process.write("\n"); QVERIFY(process.waitForFinished(5000)); QCOMPARE(int(process.exitStatus()), int(QProcess::NormalExit)); QCOMPARE(process.exitCode(), 0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(process.readAll().trimmed(), msg); #endif } diff --git a/tests/auto/sql/kernel/qsql/tst_qsql.cpp b/tests/auto/sql/kernel/qsql/tst_qsql.cpp index 1d6b271f44..55cbfad421 100644 --- a/tests/auto/sql/kernel/qsql/tst_qsql.cpp +++ b/tests/auto/sql/kernel/qsql/tst_qsql.cpp @@ -125,10 +125,10 @@ void tst_QSql::open() QVERIFY(dbs.open()); if (count == -1) // first iteration: see how many dbs are open - count = (int) dbs.dbNames.count(); + count = (int) dbs.dbNames.size(); else // next iterations: make sure all are opened again - QCOMPARE(count, (int)dbs.dbNames.count()); + QCOMPARE(count, (int)dbs.dbNames.size()); dbs.close(); } } diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index 959c76dded..93906934be 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h +++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h @@ -125,7 +125,7 @@ public: QTest::addColumn( "dbName" ); int count = 0; - for ( int i = 0; i < dbNames.count(); ++i ) { + for ( int i = 0; i < dbNames.size(); ++i ) { QSqlDatabase db = QSqlDatabase::database( dbNames.at( i ) ); if ( !db.isValid() ) @@ -146,7 +146,7 @@ public: QTest::addColumn("submitpolicy_i"); int count = 0; - for ( int i = 0; i < dbNames.count(); ++i ) { + for ( int i = 0; i < dbNames.size(); ++i ) { QSqlDatabase db = QSqlDatabase::database( dbNames.at( i ) ); if ( !db.isValid() ) diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index 77ee1583fb..8e1df673da 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -2196,7 +2196,7 @@ void tst_QSqlDatabase::eventNotificationIBase() // Interbase needs some time to post the notification and call the driver callback. // This happends from another thread, and we have to process events in order for the // event handler in the driver to be executed and emit the notification signal. - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toString(), procedureName); QVERIFY_SQL(*driver, unsubscribeFromNotification(procedureName)); @@ -2218,7 +2218,7 @@ void tst_QSqlDatabase::eventNotificationPSQL() QVERIFY_SQL(*driver, subscribeToNotification(procedureName)); QSignalSpy spy(driver, QOverload::of(&QSqlDriver::notification)); query.exec(QString("NOTIFY \"%1\", '%2'").arg(procedureName).arg(payload)); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toString(), procedureName); QCOMPARE(qvariant_cast(arguments.at(1)), QSqlDriver::SelfSource); @@ -2244,12 +2244,12 @@ void tst_QSqlDatabase::eventNotificationSQLite() QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INTEGER, realVal REAL)")); driver->subscribeToNotification(noEscapeTableName); QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)")); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toString(), noEscapeTableName); driver->unsubscribeFromNotification(noEscapeTableName); QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, realVal) VALUES (1, 2.3)")); - QTRY_COMPARE(spy.count(), 0); + QTRY_COMPARE(spy.size(), 0); } void tst_QSqlDatabase::sqlite_bindAndFetchUInt() diff --git a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp index 3a6e16020f..e2877a1157 100644 --- a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp @@ -125,10 +125,10 @@ void tst_QSqlDriver::record() QCOMPARE(rec.field(1).length(), 20); if (dbType == QSqlDriver::Interbase || dbType == QSqlDriver::Oracle || dbType == QSqlDriver::DB2) - for(int i = 0; i < fields.count(); ++i) + for(int i = 0; i < fields.size(); ++i) fields[i] = fields[i].toUpper(); - for (int i = 0; i < fields.count(); ++i) + for (int i = 0; i < fields.size(); ++i) QCOMPARE(rec.fieldName(i), fields[i]); if (driverSupportsDefaultValues(dbType)) @@ -145,7 +145,7 @@ void tst_QSqlDriver::record() QCOMPARE(rec.count(), 5); } - for (int i = 0; i < fields.count(); ++i) + for (int i = 0; i < fields.size(); ++i) QCOMPARE(rec.fieldName(i), fields[i]); if (dbType == QSqlDriver::Interbase || dbType == QSqlDriver::Oracle || dbType == QSqlDriver::DB2) diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 7379e19ff8..55f41e3f59 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -2213,7 +2213,7 @@ void tst_QSqlQuery::prepare_bind_exec() q.bindValue(":id", i); QVERIFY_SQL(q, exec()); const QVariantList m = q.boundValues(); - QCOMPARE(m.count(), qsizetype(2)); + QCOMPARE(m.size(), qsizetype(2)); QCOMPARE(m.at(0).toInt(), i); QCOMPARE(m.at(1).toString(), values[i]); } diff --git a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp index d868cf0197..a174ea6f37 100644 --- a/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp +++ b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp @@ -258,7 +258,7 @@ void tst_QSqlThread::generic_data(const QString& engine) void tst_QSqlThread::dropTestTables() { - for (int i = 0; i < dbs.dbNames.count(); ++i) { + for (int i = 0; i < dbs.dbNames.size(); ++i) { QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); @@ -268,7 +268,7 @@ void tst_QSqlThread::dropTestTables() void tst_QSqlThread::createTestTables() { - for (int i = 0; i < dbs.dbNames.count(); ++i) { + for (int i = 0; i < dbs.dbNames.size(); ++i) { QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); @@ -285,7 +285,7 @@ void tst_QSqlThread::createTestTables() void tst_QSqlThread::repopulateTestTables() { - for (int i = 0; i < dbs.dbNames.count(); ++i) { + for (int i = 0; i < dbs.dbNames.size(); ++i) { QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); diff --git a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp index 8b7476b3e7..202fc1080c 100644 --- a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -202,7 +202,7 @@ void tst_QSqlQueryModel::removeColumn() QCOMPARE(model.columnCount(), 3); QVERIFY(model.removeColumn(0)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(*(QModelIndex *)spy.at(0).at(0).constData() == QModelIndex()); QCOMPARE(spy.at(0).at(1).toInt(), 0); QCOMPARE(spy.at(0).at(2).toInt(), 0); @@ -232,7 +232,7 @@ void tst_QSqlQueryModel::removeColumn() QVERIFY(model.removeColumn(2)); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(*(QModelIndex *)spy.at(1).at(0).constData() == QModelIndex()); QCOMPARE(spy.at(1).at(1).toInt(), 2); QCOMPARE(spy.at(1).at(2).toInt(), 2); @@ -245,7 +245,7 @@ void tst_QSqlQueryModel::removeColumn() QVERIFY(model.removeColumn(1)); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); QVERIFY(*(QModelIndex *)spy.at(2).at(0).constData() == QModelIndex()); QCOMPARE(spy.at(2).at(1).toInt(), 1); QCOMPARE(spy.at(2).at(2).toInt(), 1); @@ -259,7 +259,7 @@ void tst_QSqlQueryModel::removeColumn() QVERIFY(model.removeColumn(0)); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); QVERIFY(*(QModelIndex *)spy.at(3).at(0).constData() == QModelIndex()); QCOMPARE(spy.at(3).at(1).toInt(), 0); QCOMPARE(spy.at(3).at(2).toInt(), 0); @@ -301,7 +301,7 @@ void tst_QSqlQueryModel::insertColumn() QVERIFY(model.insertColumn(1)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(*(QModelIndex *)spy.at(0).at(0).constData() == QModelIndex()); QCOMPARE(spy.at(0).at(1).toInt(), 1); QCOMPARE(spy.at(0).at(2).toInt(), 1); @@ -330,7 +330,7 @@ void tst_QSqlQueryModel::insertColumn() QVERIFY(model.insertColumn(0)); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(*(QModelIndex *)spy.at(1).at(0).constData() == QModelIndex()); QCOMPARE(spy.at(1).at(1).toInt(), 0); QCOMPARE(spy.at(1).at(2).toInt(), 0); @@ -345,7 +345,7 @@ void tst_QSqlQueryModel::insertColumn() QVERIFY(!model.insertColumn(6)); QVERIFY(model.insertColumn(5)); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); QVERIFY(*(QModelIndex *)spy.at(2).at(0).constData() == QModelIndex()); QCOMPARE(spy.at(2).at(1).toInt(), 5); QCOMPARE(spy.at(2).at(2).toInt(), 5); @@ -424,7 +424,7 @@ void tst_QSqlQueryModel::setHeaderData() QSignalSpy spy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); QVERIFY(model.setHeaderData(2, Qt::Horizontal, "bar")); QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("bar")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.value(0).value(0)), Qt::Horizontal); QCOMPARE(spy.value(0).value(1).toInt(), 2); QCOMPARE(spy.value(0).value(2).toInt(), 2); @@ -452,8 +452,8 @@ void tst_QSqlQueryModel::fetchMore() model.setQuery(QSqlQuery("select * from " + qTableName("many", __FILE__, db), db)); int rowCount = model.rowCount(); - QCOMPARE(modelAboutToBeResetSpy.count(), 1); - QCOMPARE(modelResetSpy.count(), 1); + QCOMPARE(modelAboutToBeResetSpy.size(), 1); + QCOMPARE(modelResetSpy.size(), 1); // If the driver doesn't return the query size fetchMore() causes the // model to grow and new signals are emitted @@ -499,11 +499,11 @@ void tst_QSqlQueryModel::withSortFilterProxyModel() QCOMPARE(proxy.rowCount(), 511); // setQuery() resets the model accompanied by begin and end signals - QCOMPARE(modelAboutToBeResetSpy.count(), 1); - QCOMPARE(modelResetSpy.count(), 1); + QCOMPARE(modelAboutToBeResetSpy.size(), 1); + QCOMPARE(modelResetSpy.size(), 1); // The call to scrollToBottom() forces the model to fetch additional rows. - QCOMPARE(modelRowsInsertedSpy.count(), 1); + QCOMPARE(modelRowsInsertedSpy.size(), 1); QCOMPARE(modelRowsInsertedSpy.value(0).value(1).toInt(), 256); QCOMPARE(modelRowsInsertedSpy.value(0).value(2).toInt(), 510); } @@ -523,14 +523,14 @@ void tst_QSqlQueryModel::setQuerySignalEmission() // First select, the model was empty and no rows had to be removed, but model resets anyway. model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test", __FILE__, db), db)); - QCOMPARE(modelAboutToBeResetSpy.count(), 1); - QCOMPARE(modelResetSpy.count(), 1); + QCOMPARE(modelAboutToBeResetSpy.size(), 1); + QCOMPARE(modelResetSpy.size(), 1); // Second select, the model wasn't empty and two rows had to be removed! // setQuery() resets the model accompanied by begin and end signals model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test", __FILE__, db), db)); - QCOMPARE(modelAboutToBeResetSpy.count(), 2); - QCOMPARE(modelResetSpy.count(), 2); + QCOMPARE(modelAboutToBeResetSpy.size(), 2); + QCOMPARE(modelResetSpy.size(), 2); } // For task 170783: When the query's result set is empty no rows should be inserted, @@ -549,8 +549,8 @@ void tst_QSqlQueryModel::setQueryWithNoRowsInResultSet() QSqlQuery query(db); QVERIFY_SQL(query, exec("SELECT * FROM " + qTableName("test", __FILE__, db) + " where 0 = 1")); model.setQuery(std::move(query)); - QCOMPARE(modelRowsAboutToBeInsertedSpy.count(), 0); - QCOMPARE(modelRowsInsertedSpy.count(), 0); + QCOMPARE(modelRowsAboutToBeInsertedSpy.size(), 0); + QCOMPARE(modelRowsInsertedSpy.size(), 0); } class NestedResetsTest: public QSqlQueryModel diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp index 974a365b7e..ece99efa0a 100644 --- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp @@ -148,7 +148,7 @@ tst_QSqlTableModel::~tst_QSqlTableModel() void tst_QSqlTableModel::dropTestTables() { - for (int i = 0; i < dbs.dbNames.count(); ++i) { + for (int i = 0; i < dbs.dbNames.size(); ++i) { QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); QSqlQuery q(db); @@ -177,7 +177,7 @@ void tst_QSqlTableModel::dropTestTables() void tst_QSqlTableModel::createTestTables() { - for (int i = 0; i < dbs.dbNames.count(); ++i) { + for (int i = 0; i < dbs.dbNames.size(); ++i) { QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); QSqlQuery q(db); @@ -207,7 +207,7 @@ void tst_QSqlTableModel::createTestTables() void tst_QSqlTableModel::repopulateTestTables() { - for (int i = 0; i < dbs.dbNames.count(); ++i) { + for (int i = 0; i < dbs.dbNames.size(); ++i) { QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); const auto test = qTableName("test1", __FILE__, db); @@ -602,7 +602,7 @@ void tst_QSqlTableModel::setRecord() // dataChanged() emitted by setData() for each *changed* column if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnManualSubmit) { - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(0).size(), 2); QCOMPARE(qvariant_cast(spy.at(0).at(0)), model.index(i, 1)); QCOMPARE(qvariant_cast(spy.at(0).at(1)), model.index(i, 1)); @@ -614,9 +614,9 @@ void tst_QSqlTableModel::setRecord() else { if ((QSqlTableModel::EditStrategy)submitpolicy != QSqlTableModel::OnManualSubmit) // dataChanged() also emitted by selectRow() - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); else - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.at(0).size(), 2); QCOMPARE(qvariant_cast(spy.at(0).at(0)), model.index(i, 1)); QCOMPARE(qvariant_cast(spy.at(0).at(1)), model.index(i, 1)); @@ -1092,7 +1092,7 @@ void tst_QSqlTableModel::removeRow() QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); QVERIFY(model.removeRow(1)); - QCOMPARE(headerDataChangedSpy.count(), 1); + QCOMPARE(headerDataChangedSpy.size(), 1); QCOMPARE(*static_cast(headerDataChangedSpy.at(0).value(0).constData()), Qt::Vertical); QCOMPARE(headerDataChangedSpy.at(0).at(1).toInt(), 1); QCOMPARE(headerDataChangedSpy.at(0).at(2).toInt(), 1); @@ -1112,7 +1112,7 @@ void tst_QSqlTableModel::removeRow() headerDataChangedSpy.clear(); QVERIFY(model.removeRow(1)); - QCOMPARE(headerDataChangedSpy.count(), 1); + QCOMPARE(headerDataChangedSpy.size(), 1); QCOMPARE(model.rowCount(), 3); QVERIFY_SQL(model, select()); @@ -1148,7 +1148,7 @@ void tst_QSqlTableModel::removeRows() QVERIFY_SQL(model, removeRows(0, 1)); QVERIFY_SQL(model, removeRows(1, 1)); - QCOMPARE(beforeDeleteSpy.count(), 2); + QCOMPARE(beforeDeleteSpy.size(), 2); QCOMPARE(beforeDeleteSpy.at(0).at(0).toInt(), 0); QCOMPARE(beforeDeleteSpy.at(1).at(0).toInt(), 1); // deleted rows shown as empty until select @@ -1179,15 +1179,15 @@ void tst_QSqlTableModel::removeRows() qRegisterMetaType("Qt::Orientation"); QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); QVERIFY(model.removeRows(0, 2, QModelIndex())); - QCOMPARE(headerDataChangedSpy.count(), 2); + QCOMPARE(headerDataChangedSpy.size(), 2); QCOMPARE(headerDataChangedSpy.at(0).at(1).toInt(), 1); QCOMPARE(headerDataChangedSpy.at(0).at(2).toInt(), 1); QCOMPARE(headerDataChangedSpy.at(1).at(1).toInt(), 0); QCOMPARE(headerDataChangedSpy.at(1).at(2).toInt(), 0); QCOMPARE(model.rowCount(), 3); - QCOMPARE(beforeDeleteSpy.count(), 0); + QCOMPARE(beforeDeleteSpy.size(), 0); QVERIFY(model.submitAll()); - QCOMPARE(beforeDeleteSpy.count(), 2); + QCOMPARE(beforeDeleteSpy.size(), 2); QCOMPARE(beforeDeleteSpy.at(0).at(0).toInt(), 0); QCOMPARE(beforeDeleteSpy.at(1).at(0).toInt(), 1); QCOMPARE(model.rowCount(), 1); @@ -1784,8 +1784,8 @@ void tst_QSqlTableModel::setFilter() model.setFilter("id = 2"); // check the signals - QCOMPARE(modelAboutToBeResetSpy.count(), 1); - QCOMPARE(modelResetSpy.count(), 1); + QCOMPARE(modelAboutToBeResetSpy.size(), 1); + QCOMPARE(modelResetSpy.size(), 1); QCOMPARE(model.rowCount(), 1); QCOMPARE(model.data(model.index(0, 0)).toInt(), 2); @@ -1928,8 +1928,8 @@ void tst_QSqlTableModel::insertRecordsInLoop() model.submitAll(); // submitAll() calls select() which clears and repopulates the table // model emits reset signals - QCOMPARE(modelAboutToBeResetSpy.count(), 1); - QCOMPARE(modelResetSpy.count(), 1); + QCOMPARE(modelAboutToBeResetSpy.size(), 1); + QCOMPARE(modelResetSpy.size(), 1); QCOMPARE(model.rowCount(), 13); QCOMPARE(model.columnCount(), 3); diff --git a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp index 78f0c17762..8b0319679f 100644 --- a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp +++ b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp @@ -79,12 +79,12 @@ void tst_QSignalSpy::spyWithoutArgs() QtTestObject obj; QSignalSpy spy(&obj, SIGNAL(sig0())); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); emit obj.sig0(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); emit obj.sig0(); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QList args = spy.takeFirst(); QCOMPARE(args.size(), 0); @@ -96,7 +96,7 @@ void tst_QSignalSpy::spyWithBasicArgs() QSignalSpy spy(&obj, SIGNAL(sig1(int,int))); emit obj.sig1(1, 2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList args = spy.takeFirst(); QCOMPARE(args.size(), 2); @@ -124,7 +124,7 @@ void tst_QSignalSpy::spyWithPointers() int i2 = 2; emit obj.sig2(&i1, &i2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList args = spy.takeFirst(); QCOMPARE(args.size(), 2); @@ -155,14 +155,14 @@ void tst_QSignalSpy::spyWithBasicQtClasses() QSignalSpy spy(&obj, SIGNAL(sig(QString))); emit obj.sig(QString("bubu")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).size(), 1); QCOMPARE(spy.at(0).at(0).toString(), QString("bubu")); QSignalSpy spy2(&obj, SIGNAL(sig5(QVariant))); QVariant val(45); emit obj.sig5(val); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); QCOMPARE(spy2.at(0).size(), 1); QCOMPARE(spy2.at(0).at(0), val); QCOMPARE(qvariant_cast(spy2.at(0).at(0)), val); @@ -176,7 +176,7 @@ void tst_QSignalSpy::spyWithQtClasses() QSignalSpy spy(&obj, SIGNAL(sig2(QDateTime))); QDateTime dt = QDateTime::currentDateTime(); emit obj.sig2(dt); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).size(), 1); QCOMPARE(spy.at(0).at(0).typeName(), "QDateTime"); QCOMPARE(*static_cast(spy.at(0).at(0).constData()), dt); @@ -248,7 +248,7 @@ void tst_QSignalSpy::wait_signalEmittedTooLate() QTimer::singleShot(500, this, SIGNAL(sigFoo())); QSignalSpy spy(this, SIGNAL(sigFoo())); QVERIFY(!spy.wait(200)); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); } void tst_QSignalSpy::wait_signalEmittedMultipleTimes() @@ -257,13 +257,13 @@ void tst_QSignalSpy::wait_signalEmittedMultipleTimes() QTimer::singleShot(800, this, SIGNAL(sigFoo())); QSignalSpy spy(this, SIGNAL(sigFoo())); QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 1); // we don't wait for the second signal... + QCOMPARE(spy.size(), 1); // we don't wait for the second signal... QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(!spy.wait(1)); QTimer::singleShot(10, this, SIGNAL(sigFoo())); QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); } void tst_QSignalSpy::spyFunctionPointerWithoutArgs() @@ -271,12 +271,12 @@ void tst_QSignalSpy::spyFunctionPointerWithoutArgs() QtTestObject obj; QSignalSpy spy(&obj, &QtTestObject::sig0); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); emit obj.sig0(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); emit obj.sig0(); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QList args = spy.takeFirst(); QCOMPARE(args.size(), 0); @@ -288,7 +288,7 @@ void tst_QSignalSpy::spyFunctionPointerWithBasicArgs() QSignalSpy spy(&obj, &QtTestObject::sig1); emit obj.sig1(1, 2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList args = spy.takeFirst(); QCOMPARE(args.size(), 2); @@ -316,7 +316,7 @@ void tst_QSignalSpy::spyFunctionPointerWithPointers() int i2 = 2; emit obj.sig2(&i1, &i2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList args = spy.takeFirst(); QCOMPARE(args.size(), 2); @@ -330,14 +330,14 @@ void tst_QSignalSpy::spyFunctionPointerWithBasicQtClasses() QSignalSpy spy(&obj, &QtTestObject2::sig); emit obj.sig(QString("bubu")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).size(), 1); QCOMPARE(spy.at(0).at(0).toString(), QString("bubu")); QSignalSpy spy2(&obj, &QtTestObject2::sig5); QVariant val(45); emit obj.sig5(val); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); QCOMPARE(spy2.at(0).size(), 1); QCOMPARE(spy2.at(0).at(0), val); QCOMPARE(qvariant_cast(spy2.at(0).at(0)), val); @@ -350,7 +350,7 @@ void tst_QSignalSpy::spyFunctionPointerWithQtClasses() QSignalSpy spy(&obj, &QtTestObject2::sig2); QDateTime dt = QDateTime::currentDateTime(); emit obj.sig2(dt); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).size(), 1); QCOMPARE(spy.at(0).at(0).typeName(), "QDateTime"); QCOMPARE(*static_cast(spy.at(0).at(0).constData()), dt); @@ -373,7 +373,7 @@ void tst_QSignalSpy::spyFunctionPointerWithCustomClass() { QSignalSpy spy(&obj, &QtTestObject2::sig6); emit obj.sig6({}); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).size(), 1); QCOMPARE(spy.at(0).at(0).typeName(), "CustomType"); } @@ -420,7 +420,7 @@ void tst_QSignalSpy::waitFunctionPointer_signalEmittedTooLate() QSignalSpy spy(this, &tst_QSignalSpy::sigFoo); QVERIFY(!spy.wait(200)); QTest::qWait(400); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QSignalSpy::waitFunctionPointer_signalEmittedMultipleTimes() @@ -429,13 +429,13 @@ void tst_QSignalSpy::waitFunctionPointer_signalEmittedMultipleTimes() QTimer::singleShot(800, this, SIGNAL(sigFoo())); QSignalSpy spy(this, &tst_QSignalSpy::sigFoo); QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 1); // we don't wait for the second signal... + QCOMPARE(spy.size(), 1); // we don't wait for the second signal... QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(!spy.wait(1)); QTimer::singleShot(10, this, SIGNAL(sigFoo())); QVERIFY(spy.wait()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); } void tst_QSignalSpy::spyOnMetaMethod() @@ -454,7 +454,7 @@ void tst_QSignalSpy::spyOnMetaMethod() QVERIFY(spy.isValid()); obj.setObjectName("A new object name"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } Q_DECLARE_METATYPE(QMetaMethod); diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 13670257dd..f6c97bc345 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -432,8 +432,8 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error) // format: // "function","[globaltag:]tag","metric",value_per_iteration,total,iterations QStringList split = line.split(','); - if (split.count() != 6) { - if (error) *error = QString("Wrong number of columns (%1)").arg(split.count()); + if (split.size() != 6) { + if (error) *error = QString("Wrong number of columns (%1)").arg(split.size()); return out; } diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 3580703aad..3ed8f1a766 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -954,12 +954,12 @@ void tst_Moc::supportConstSignals() QSignalSpy spy1(this, SIGNAL(constSignal1())); QVERIFY(spy1.isEmpty()); emit constSignal1(); - QCOMPARE(spy1.count(), 1); + QCOMPARE(spy1.size(), 1); QSignalSpy spy2(this, SIGNAL(constSignal2(int))); QVERIFY(spy2.isEmpty()); emit constSignal2(42); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); QCOMPARE(spy2.at(0).at(0).toInt(), 42); } @@ -2513,7 +2513,7 @@ void tst_Moc::memberProperties() if (!signal.isEmpty()) { - QCOMPARE(notifySpy.count(), 1); + QCOMPARE(notifySpy.size(), 1); if (prop.notifySignal().parameterNames().size() > 0) { QList arguments = notifySpy.takeFirst(); QCOMPARE(arguments.size(), 1); @@ -2523,7 +2523,7 @@ void tst_Moc::memberProperties() notifySpy.clear(); // a second write with the same value should not cause the signal to be emitted again QCOMPARE(prop.write(pObj, writeValue), expectedWriteResult); - QCOMPARE(notifySpy.count(), 0); + QCOMPARE(notifySpy.size(), 0); } } @@ -4205,7 +4205,7 @@ void tst_Moc::qpropertyMembers() instance.publicProperty.setValue(100); QCOMPARE(prop.read(&instance).toInt(), 100); - QCOMPARE(publicPropertySpy.count(), 1); + QCOMPARE(publicPropertySpy.size(), 1); QCOMPARE(prop.metaType(), QMetaType(QMetaType::Int)); diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index bddaeba042..8e6d7eada2 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -2800,7 +2800,7 @@ static bool compareState(QMakeEvaluator *eval, ProFile *out) } ProValueMap::Iterator it; ProValueMap *vmap = eval->findValues(var, &it); - if (value.length() == 1 && value.at(0) == "UNDEF") { + if (value.size() == 1 && value.at(0) == "UNDEF") { if (vmap) { qWarning("Value of %s is incorrect.\n Actual:%s\nExpected: ", qPrintable(var.toQString()), diff --git a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp index 7d2f59dc83..a35864811a 100644 --- a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp +++ b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp @@ -77,7 +77,7 @@ void tst_QColorDialog::native_activeModalWidget() void tst_QColorDialog::postKeyReturn() { QWidgetList list = QApplication::topLevelWidgets(); - for (int i=0; i(list[i]); if (dialog) { QTest::keyClick( list[i], Qt::Key_Return, Qt::NoModifier ); diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index 1f8eacee0d..1db186225d 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -695,7 +695,7 @@ void tst_QDialog::virtualsOnClose() // Qt doesn't deliver events to QWidgets closed during destruction QCOMPARE(filter.closeEventCount, 0); // QDialog doesn't emit signals when closed by destruction - QCOMPARE(rejectedSpy.count(), 0); + QCOMPARE(rejectedSpy.size(), 0); } } @@ -748,7 +748,7 @@ void tst_QDialog::quitOnDone() // also quit with a timer in case the test fails QTimer::singleShot(1000, QApplication::instance(), &QApplication::quit); QApplication::exec(); - QCOMPARE(quitSpy.count(), 1); + QCOMPARE(quitSpy.size(), 1); } void tst_QDialog::focusWidgetAfterOpen() diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 4970dbd64d..00c38b9752 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -208,7 +208,7 @@ void tst_QFiledialog::currentChangedSignal() QVERIFY(listView->model()->hasChildren(folder)); listView->setCurrentIndex(folder); - QCOMPARE(spyCurrentChanged.count(), 1); + QCOMPARE(spyCurrentChanged.size(), 1); } // only emitted from the views, sidebar, or lookin combo @@ -230,7 +230,7 @@ void tst_QFiledialog::directoryEnteredSignal() QVERIFY(secondItem.isValid()); sidebar->setCurrentIndex(secondItem); QTest::keyPress(sidebar->viewport(), Qt::Key_Return); - QCOMPARE(spyDirectoryEntered.count(), 1); + QCOMPARE(spyDirectoryEntered.size(), 1); spyDirectoryEntered.clear(); // lookInCombo @@ -239,7 +239,7 @@ void tst_QFiledialog::directoryEnteredSignal() QVERIFY(comboBox->view()->model()->index(1, 0).isValid()); comboBox->view()->setCurrentIndex(comboBox->view()->model()->index(1, 0)); QTest::keyPress(comboBox->view()->viewport(), Qt::Key_Return); - QCOMPARE(spyDirectoryEntered.count(), 1); + QCOMPARE(spyDirectoryEntered.size(), 1); spyDirectoryEntered.clear(); // view @@ -316,7 +316,7 @@ void tst_QFiledialog::filesSelectedSignal() QVERIFY(button->isEnabled()); button->animateClick(); QTRY_COMPARE(fd.isVisible(), false); - QCOMPARE(spyFilesSelected.count(), 1); + QCOMPARE(spyFilesSelected.size(), 1); } // only emitted when the combo box is activated @@ -341,7 +341,7 @@ void tst_QFiledialog::filterSelectedSignal() QTest::keyPress(filters, Qt::Key_Down); - QCOMPARE(spyFilterSelected.count(), 1); + QCOMPARE(spyFilterSelected.size(), 1); } void tst_QFiledialog::args() @@ -382,10 +382,10 @@ void tst_QFiledialog::directory() #ifndef Q_OS_WIN QCOMPARE(tempPath, fd.directory().absolutePath()); #endif - QCOMPARE(spyCurrentChanged.count(), 0); - QCOMPARE(spyDirectoryEntered.count(), 0); - QCOMPARE(spyFilesSelected.count(), 0); - QCOMPARE(spyFilterSelected.count(), 0); + QCOMPARE(spyCurrentChanged.size(), 0); + QCOMPARE(spyDirectoryEntered.size(), 0); + QCOMPARE(spyFilesSelected.size(), 0); + QCOMPARE(spyFilterSelected.size(), 0); // Check my way QList list = fd.findChildren("listView"); @@ -574,16 +574,16 @@ void tst_QFiledialog::completer_up() fd.show(); QLineEdit *lineEdit = fd.findChild("fileNameEdit"); QVERIFY(lineEdit); - QCOMPARE(spyFilesSelected.count(), 0); - int depth = QDir::currentPath().split('/').count(); + QCOMPARE(spyFilesSelected.size(), 0); + int depth = QDir::currentPath().split('/').size(); for (int i = 0; i <= depth * 3 + 1; ++i) { lineEdit->insert("../"); qApp->processEvents(); } - QCOMPARE(spyCurrentChanged.count(), 0); - QCOMPARE(spyDirectoryEntered.count(), 0); - QCOMPARE(spyFilesSelected.count(), 0); - QCOMPARE(spyFilterSelected.count(), 0); + QCOMPARE(spyCurrentChanged.size(), 0); + QCOMPARE(spyDirectoryEntered.size(), 0); + QCOMPARE(spyFilesSelected.size(), 0); + QCOMPARE(spyFilterSelected.size(), 0); } void tst_QFiledialog::acceptMode() @@ -678,15 +678,15 @@ void tst_QFiledialog::filters() QCOMPARE(fd.nameFilters(), filters); fd.setNameFilter("Image files (*.png *.xpm *.jpg);;Text files (*.txt);;Any files (*.*)"); QCOMPARE(fd.nameFilters(), filters); - QCOMPARE(spyCurrentChanged.count(), 0); - QCOMPARE(spyDirectoryEntered.count(), 0); - QCOMPARE(spyFilesSelected.count(), 0); - QCOMPARE(spyFilterSelected.count(), 0); + QCOMPARE(spyCurrentChanged.size(), 0); + QCOMPARE(spyDirectoryEntered.size(), 0); + QCOMPARE(spyFilesSelected.size(), 0); + QCOMPARE(spyFilterSelected.size(), 0); // setting shouldn't emit any signals for (int i = views.at(0)->currentIndex(); i < views.at(0)->count(); ++i) views.at(0)->setCurrentIndex(i); - QCOMPARE(spyFilterSelected.count(), 0); + QCOMPARE(spyFilterSelected.size(), 0); //Let check if filters with whitespaces QFileDialog fd2; @@ -725,7 +725,7 @@ void tst_QFiledialog::selectFilter() QCOMPARE(fd.selectedNameFilter(), filters.at(2)); fd.selectNameFilter(""); QCOMPARE(fd.selectedNameFilter(), filters.at(2)); - QCOMPARE(spyFilterSelected.count(), 0); + QCOMPARE(spyFilterSelected.size(), 0); } void tst_QFiledialog::history() @@ -764,10 +764,10 @@ void tst_QFiledialog::history() badHistory << QDir::toNativeSeparators(QDir::current().absolutePath()); QCOMPARE(fd.history(), badHistory); - QCOMPARE(spyCurrentChanged.count(), 0); - QCOMPARE(spyDirectoryEntered.count(), 0); - QCOMPARE(spyFilesSelected.count(), 0); - QCOMPARE(spyFilterSelected.count(), 0); + QCOMPARE(spyCurrentChanged.size(), 0); + QCOMPARE(spyDirectoryEntered.size(), 0); + QCOMPARE(spyFilesSelected.size(), 0); + QCOMPARE(spyFilterSelected.size(), 0); } void tst_QFiledialog::iconProvider() @@ -870,7 +870,7 @@ void tst_QFiledialog::selectFile() QVERIFY(model); fd->setDirectory(QDir::currentPath()); // default value - QCOMPARE(fd->selectedFiles().count(), 1); + QCOMPARE(fd->selectedFiles().size(), 1); QScopedPointer tempFile; if (file == QLatin1String("temp")) { @@ -880,7 +880,7 @@ void tst_QFiledialog::selectFile() } fd->selectFile(file); - QCOMPARE(fd->selectedFiles().count(), count); + QCOMPARE(fd->selectedFiles().size(), count); if (tempFile.isNull()) { QCOMPARE(model->index(fd->directory().path()), model->index(QDir::currentPath())); } else { @@ -937,29 +937,29 @@ void tst_QFiledialog::selectFiles() // Get a list of files in the view and then get the corresponding index's QStringList list = fd.directory().entryList(QDir::Files); QModelIndexList toSelect; - QVERIFY(list.count() > 1); + QVERIFY(list.size() > 1); QListView* listView = fd.findChild("listView"); QVERIFY(listView); - for (int i = 0; i < list.count(); ++i) { + for (int i = 0; i < list.size(); ++i) { fd.selectFile(fd.directory().path() + QLatin1Char('/') + list.at(i)); QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty()); toSelect.append(listView->selectionModel()->selectedRows().last()); } - QCOMPARE(spyFilesSelected.count(), 0); + QCOMPARE(spyFilesSelected.size(), 0); listView->selectionModel()->clear(); - QCOMPARE(spyFilesSelected.count(), 0); + QCOMPARE(spyFilesSelected.size(), 0); // select the indexes - for (int i = 0; i < toSelect.count(); ++i) { + for (int i = 0; i < toSelect.size(); ++i) { listView->selectionModel()->select(toSelect.at(i), QItemSelectionModel::Select | QItemSelectionModel::Rows); } - QCOMPARE(fd.selectedFiles().count(), toSelect.count()); - QCOMPARE(spyCurrentChanged.count(), 0); - QCOMPARE(spyDirectoryEntered.count(), 0); - QCOMPARE(spyFilesSelected.count(), 0); - QCOMPARE(spyFilterSelected.count(), 0); + QCOMPARE(fd.selectedFiles().size(), toSelect.size()); + QCOMPARE(spyCurrentChanged.size(), 0); + QCOMPARE(spyDirectoryEntered.size(), 0); + QCOMPARE(spyFilesSelected.size(), 0); + QCOMPARE(spyFilterSelected.size(), 0); } @@ -1160,13 +1160,13 @@ void tst_QFiledialog::historyBack() QCOMPARE(backButton->isEnabled(), true); QCOMPARE(forwardButton->isEnabled(), false); fd.setDirectory(desktop); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); backButton->click(); qApp->processEvents(); QCOMPARE(backButton->isEnabled(), true); QCOMPARE(forwardButton->isEnabled(), true); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); QString currentPath = qvariant_cast(spy.last().first()); QCOMPARE(model->index(currentPath), model->index(temp)); @@ -1175,11 +1175,11 @@ void tst_QFiledialog::historyBack() QCOMPARE(currentPath, home); QCOMPARE(backButton->isEnabled(), false); QCOMPARE(forwardButton->isEnabled(), true); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); // nothing should change at this point backButton->click(); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); QCOMPARE(backButton->isEnabled(), false); QCOMPARE(forwardButton->isEnabled(), true); } @@ -1213,7 +1213,7 @@ void tst_QFiledialog::historyForward() QCOMPARE(model->index(qvariant_cast(spy.last().first())), model->index(desktop)); QCOMPARE(backButton->isEnabled(), true); QCOMPARE(forwardButton->isEnabled(), false); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); backButton->click(); QCOMPARE(model->index(qvariant_cast(spy.last().first())), model->index(temp)); @@ -1223,13 +1223,13 @@ void tst_QFiledialog::historyForward() QCOMPARE(model->index(qvariant_cast(spy.last().first())), model->index(home)); QCOMPARE(backButton->isEnabled(), false); QCOMPARE(forwardButton->isEnabled(), true); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); forwardButton->click(); QCOMPARE(model->index(qvariant_cast(spy.last().first())), model->index(temp)); backButton->click(); QCOMPARE(model->index(qvariant_cast(spy.last().first())), model->index(home)); - QCOMPARE(spy.count(), 8); + QCOMPARE(spy.size(), 8); forwardButton->click(); QCOMPARE(model->index(qvariant_cast(spy.last().first())), model->index(temp)); diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 5a9365ebcd..e54839cdd4 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -805,8 +805,8 @@ void tst_QFileDialog2::task235069_hideOnEscape() child->setFocus(); QTest::keyClick(child, Qt::Key_Escape); QCOMPARE(fd.isVisible(), false); - QCOMPARE(spyFinished.count(), 1); // QTBUG-7690 - QCOMPARE(spyRejected.count(), 1); // reject(), don't hide() + QCOMPARE(spyFinished.size(), 1); // QTBUG-7690 + QCOMPARE(spyRejected.size(), 1); // reject(), don't hide() } #ifdef QT_BUILD_INTERNAL @@ -1133,7 +1133,7 @@ void tst_QFileDialog2::task254490_selectFileMultipleTimes() QCOMPARE(lineEdit->text(),QLatin1String("new_file.txt")); QListView *list = fd.findChild("listView"); QVERIFY(list); - QCOMPARE(list->selectionModel()->selectedRows(0).count(), 0); + QCOMPARE(list->selectionModel()->selectedRows(0).size(), 0); t->deleteLater(); } diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp index 2ab7293428..0a77bc3808 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp +++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp @@ -76,7 +76,7 @@ void tst_QFontDialog::cleanup() void tst_QFontDialog::postKeyReturn() { QWidgetList list = QApplication::topLevelWidgets(); - for (int i=0; i(list[i]); if (dialog) { QTest::keyClick( list[i], Qt::Key_Return, Qt::NoModifier ); diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index ae73ec4d5d..495a935255 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -638,7 +638,7 @@ void tst_QMessageBox::acceptedRejectedSignals() button->click(); if (roles.contains(messageBox.buttonRole(button))) - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); else QVERIFY(spy.isEmpty()); } diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp index f4e208fb6c..167c4bf8f1 100644 --- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp @@ -55,7 +55,7 @@ void tst_QSidebar::selectUrls() QSignalSpy spy(&qsidebar, SIGNAL(goToUrl(QUrl))); qsidebar.selectUrl(urls.at(0)); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QSidebar::addUrls() @@ -171,7 +171,7 @@ void tst_QSidebar::goToUrl() QSignalSpy spy(&qsidebar, SIGNAL(goToUrl(QUrl))); QTest::mousePress(qsidebar.viewport(), Qt::LeftButton, {}, qsidebar.visualRect(qsidebar.model()->index(0, 0)).center()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((spy.value(0)).at(0).toUrl(), urls.first()); } diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 7d51a0501e..a9d5359318 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -524,7 +524,7 @@ void tst_QWizard::addPage() QCOMPARE(wizard.addPage(pages[i]), i); QCOMPARE(pages[i]->window(), (QWidget *)&wizard); QCOMPARE(wizard.startId(), 0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), i); } @@ -537,29 +537,29 @@ void tst_QWizard::addPage() QVERIFY(!wizard.page(N + 1)); wizard.setPage(N + 50, new QWizardPage); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), N + 50); wizard.setPage(-3000, new QWizardPage); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), -3000); QWizardPage *pageX = new QWizardPage; QCOMPARE(wizard.addPage(pageX), N + 51); QCOMPARE(wizard.page(N + 51), pageX); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), N + 51); QCOMPARE(wizard.addPage(new QWizardPage), N + 52); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), N + 52); QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert null page"); wizard.addPage(0); // generates a warning - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); delete parent; } @@ -586,7 +586,7 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert page with ID -1"); wizard.setPage(-1, page); // gives a warning and does nothing - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QVERIFY(!wizard.page(-2)); QVERIFY(!wizard.page(-1)); QVERIFY(!wizard.page(0)); @@ -598,7 +598,7 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); wizard.setPage(0, page); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 0); QCOMPARE(page->window(), (QWidget *)&wizard); @@ -611,7 +611,7 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); wizard.setPage(-2, page); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), -2); QCOMPARE(page->window(), (QWidget *)&wizard); @@ -632,7 +632,7 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); wizard.setPage(2, page); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.page(2), page); @@ -651,7 +651,7 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); wizard.setPage(-3, page); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), -3); QCOMPARE(wizard.page(-3), page); @@ -722,7 +722,7 @@ void tst_QWizard::setPage() QCOMPARE(wizard.nextId(), -2); CHECK_VISITED(wizard, QList() << -3); } - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); delete parent; } @@ -2275,36 +2275,36 @@ void tst_QWizard::removePage() wizard.restart(); QCOMPARE(wizard.pageIds().size(), 4); QCOMPARE(wizard.visitedIds().size(), 1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // Removing a non-existent page wizard.removePage(4); QCOMPARE(wizard.pageIds().size(), 4); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // Removing and then reinserting a page QCOMPARE(wizard.pageIds().size(), 4); QVERIFY(wizard.pageIds().contains(2)); wizard.removePage(2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.pageIds().size(), 3); QVERIFY(!wizard.pageIds().contains(2)); wizard.setPage(2, page2); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(wizard.pageIds().size(), 4); QVERIFY(wizard.pageIds().contains(2)); // Removing the same page twice wizard.removePage(2); // restore - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.pageIds().size(), 3); QVERIFY(!wizard.pageIds().contains(2)); wizard.removePage(2); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(wizard.pageIds().size(), 3); QVERIFY(!wizard.pageIds().contains(2)); @@ -2314,9 +2314,9 @@ void tst_QWizard::removePage() wizard.next(); QCOMPARE(wizard.visitedIds().size(), 2); QCOMPARE(wizard.currentPage(), page1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); wizard.removePage(2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.visitedIds().size(), 2); @@ -2327,11 +2327,11 @@ void tst_QWizard::removePage() wizard.setPage(2, page2); // restore wizard.restart(); wizard.next(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(wizard.visitedIds().size(), 2); QCOMPARE(wizard.currentPage(), page1); wizard.removePage(0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 0); QCOMPARE(wizard.visitedIds().size(), 1); @@ -2343,11 +2343,11 @@ void tst_QWizard::removePage() wizard.setPage(0, page0); // restore wizard.restart(); wizard.next(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(wizard.visitedIds().size(), 2); QCOMPARE(wizard.currentPage(), page1); wizard.removePage(1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 1); QCOMPARE(wizard.visitedIds().size(), 1); @@ -2357,7 +2357,7 @@ void tst_QWizard::removePage() // Remove the current page which is the first (and only) one in the history wizard.removePage(0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 0); QCOMPARE(wizard.visitedIds().size(), 1); @@ -2367,7 +2367,7 @@ void tst_QWizard::removePage() QCOMPARE(wizard.currentPage(), page2); // wizard.removePage(2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.visitedIds().size(), 1); @@ -2377,7 +2377,7 @@ void tst_QWizard::removePage() QCOMPARE(wizard.currentPage(), page3); // wizard.removePage(3); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), 3); QVERIFY(wizard.visitedIds().empty()); diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 8b4d8b0b68..e1cccaadc9 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -1663,7 +1663,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() // Determine amount of widgets to add. int widgetCount = -1; - for (int i = 0; i < data.count(); ++i) { + for (int i = 0; i < data.size(); ++i) { const BasicLayoutTestData item = data[i]; widgetCount = qMax(widgetCount, item.firstIndex); widgetCount = qMax(widgetCount, item.secondIndex); @@ -1678,7 +1678,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() // Setup anchor layout TheAnchorLayout *layout = new TheAnchorLayout; - for (int i = 0; i < data.count(); ++i) { + for (int i = 0; i < data.size(); ++i) { const BasicLayoutTestData item = data[i]; layout->setAnchor( getItem(item.firstIndex, widgets, layout), @@ -1695,7 +1695,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() QCOMPARE(widget->size(), size); // Validate - for (int i = 0; i < result.count(); ++i) { + for (int i = 0; i < result.size(); ++i) { const BasicLayoutTestResult item = result[i]; QRectF expected = item.rect; QRectF actual = widgets[item.index]->geometry(); @@ -1707,7 +1707,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() widget->setLayoutDirection(Qt::RightToLeft); layout->activate(); // Validate - for (int j = 0; j < result.count(); ++j) { + for (int j = 0; j < result.size(); ++j) { const BasicLayoutTestResult item = result[j]; QRectF mirroredRect(item.rect); // only valid cases are mirrored @@ -2168,7 +2168,7 @@ void tst_QGraphicsAnchorLayout1::testRemoveCenterAnchor() // Determine amount of widgets to add. int widgetCount = -1; - for (int i = 0; i < data.count(); ++i) { + for (int i = 0; i < data.size(); ++i) { const BasicLayoutTestData item = data[i]; widgetCount = qMax(widgetCount, item.firstIndex); widgetCount = qMax(widgetCount, item.secondIndex); @@ -2185,7 +2185,7 @@ void tst_QGraphicsAnchorLayout1::testRemoveCenterAnchor() // Setup anchor layout TheAnchorLayout *layout = new TheAnchorLayout; - for (int i = 0; i < data.count(); ++i) { + for (int i = 0; i < data.size(); ++i) { const BasicLayoutTestData item = data[i]; layout->setAnchor( getItem(item.firstIndex, widgets, layout), @@ -2195,7 +2195,7 @@ void tst_QGraphicsAnchorLayout1::testRemoveCenterAnchor() item.spacing ); } - for (int i = 0; i < removeData.count(); ++i) { + for (int i = 0; i < removeData.size(); ++i) { const BasicLayoutTestData item = removeData[i]; layout->removeAnchor( getItem(item.firstIndex, widgets, layout), @@ -2211,7 +2211,7 @@ void tst_QGraphicsAnchorLayout1::testRemoveCenterAnchor() QCOMPARE(widget->size(), size); // Validate - for (int i = 0; i < result.count(); ++i) { + for (int i = 0; i < result.size(); ++i) { const BasicLayoutTestResult item = result[i]; QCOMPARE(widgets[item.index]->geometry(), item.rect); @@ -2999,7 +2999,7 @@ void tst_QGraphicsAnchorLayout1::testComplexCases() // Determine amount of widgets to add. int widgetCount = -1; - for (int i = 0; i < data.count(); ++i) { + for (int i = 0; i < data.size(); ++i) { const BasicLayoutTestData item = data[i]; widgetCount = qMax(widgetCount, item.firstIndex); widgetCount = qMax(widgetCount, item.secondIndex); @@ -3025,7 +3025,7 @@ void tst_QGraphicsAnchorLayout1::testComplexCases() // Setup anchor layout TheAnchorLayout *layout = new TheAnchorLayout; - for (int i = 0; i < data.count(); ++i) { + for (int i = 0; i < data.size(); ++i) { const BasicLayoutTestData item = data[i]; layout->setAnchor( getItem(item.firstIndex, widgets, layout), @@ -3042,7 +3042,7 @@ void tst_QGraphicsAnchorLayout1::testComplexCases() QCOMPARE(widget->size(), size); // Validate - for (int i = 0; i < result.count(); ++i) { + for (int i = 0; i < result.size(); ++i) { const BasicLayoutTestResult item = result[i]; QCOMPARE(widgets[item.index]->geometry(), item.rect); } @@ -3051,7 +3051,7 @@ void tst_QGraphicsAnchorLayout1::testComplexCases() widget->setLayoutDirection(Qt::RightToLeft); layout->activate(); // Validate - for (int j = 0; j < result.count(); ++j) { + for (int j = 0; j < result.size(); ++j) { const BasicLayoutTestResult item = result[j]; QRectF mirroredRect(item.rect); // only valid cases are mirrored diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index f4b3a5ef99..9af5433388 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -1658,7 +1658,7 @@ void tst_QGraphicsGridLayout::sizeHint() widget->setContentsMargins(0, 0, 0, 0); int i; - for (i = 0; i < itemDescriptions.count(); ++i) { + for (i = 0; i < itemDescriptions.size(); ++i) { ItemDesc desc = itemDescriptions.at(i); RectWidget *item = new RectWidget(widget); desc.apply(layout, item); @@ -2159,7 +2159,7 @@ void tst_QGraphicsGridLayout::defaultStretchFactors() widget->setContentsMargins(0, 0, 0, 0); int i; - for (i = 0; i < itemDescriptions.count(); ++i) { + for (i = 0; i < itemDescriptions.size(); ++i) { ItemDesc desc = itemDescriptions.at(i); RectWidget *item = new RectWidget(widget); desc.apply(layout, item); @@ -2174,7 +2174,7 @@ void tst_QGraphicsGridLayout::defaultStretchFactors() widget->resize(newSize); QApplication::sendPostedEvents(0, 0); - for (i = 0; i < expectedSizes.count(); ++i) { + for (i = 0; i < expectedSizes.size(); ++i) { QSizeF itemSize = layout->itemAt(i)->geometry().size(); QCOMPARE(itemSize, expectedSizes.at(i)); } @@ -2318,7 +2318,7 @@ void tst_QGraphicsGridLayout::alignment2() widget->setContentsMargins(0, 0, 0, 0); int i; - for (i = 0; i < itemDescriptions.count(); ++i) { + for (i = 0; i < itemDescriptions.size(); ++i) { ItemDesc desc = itemDescriptions.at(i); RectWidget *item = new RectWidget(widget); desc.apply(layout, item); @@ -2333,7 +2333,7 @@ void tst_QGraphicsGridLayout::alignment2() widget->resize(newSize); QApplication::sendPostedEvents(0, 0); - for (i = 0; i < expectedGeometries.count(); ++i) { + for (i = 0; i < expectedGeometries.size(); ++i) { QRectF itemRect = layout->itemAt(i)->geometry(); QCOMPARE(itemRect, expectedGeometries.at(i)); } @@ -2896,7 +2896,7 @@ void tst_QGraphicsGridLayout::geometries() widget->setContentsMargins(0, 0, 0, 0); int i; - for (i = 0; i < itemDescriptions.count(); ++i) { + for (i = 0; i < itemDescriptions.size(); ++i) { ItemDesc desc = itemDescriptions.at(i); RectWidget *item = new RectWidget(widget); desc.apply(layout, item); @@ -2911,7 +2911,7 @@ void tst_QGraphicsGridLayout::geometries() widget->resize(newSize); QApplication::processEvents(); - for (i = 0; i < expectedGeometries.count(); ++i) { + for (i = 0; i < expectedGeometries.size(); ++i) { QRectF itemRect = layout->itemAt(i)->geometry(); QCOMPARE(itemRect, expectedGeometries.at(i)); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 7f9dea5601..93d116242a 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -2208,7 +2208,7 @@ void tst_QGraphicsItem::setTransform() scene.update(scene.sceneRect()); QCoreApplication::processEvents(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setTransform(QTransform().rotate(qreal(12.34))); QRectF rotatedRect = scene.sceneRect(); @@ -2216,14 +2216,14 @@ void tst_QGraphicsItem::setTransform() scene.update(scene.sceneRect()); QCoreApplication::processEvents(); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); item.setTransform(QTransform()); scene.update(scene.sceneRect()); QCoreApplication::processEvents(); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); QList rlist = qvariant_cast >(spy.last().at(0)); QCOMPARE(rlist.size(), 2); @@ -8228,7 +8228,7 @@ void tst_QGraphicsItem::sorting() QVERIFY(QTest::qWaitForWindowActive(&view)); } QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTRY_VERIFY(_paintedItems.count() > 0); + QTRY_VERIFY(_paintedItems.size() > 0); _paintedItems.clear(); @@ -11704,7 +11704,7 @@ public: QLatin1String wiseWords("AZ BUKI VEDI"); QString sentence(wiseWords); QStringList words = sentence.split(QLatin1Char(' '), Qt::SkipEmptyParts); - for (int i = 0; i < words.count(); ++i) { + for (int i = 0; i < words.size(); ++i) { QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this); QLabel *label = new QLabel(words.at(i)); proxy->setWidget(label); diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 83e03b9c58..e8fc027117 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -1121,7 +1121,7 @@ void tst_QGraphicsLinearLayout::setStretchFactor() int i; - for (i = 0; i < stretches.count(); ++i) { + for (i = 0; i < stretches.size(); ++i) { QGraphicsWidget *item = new RectWidget(widget); item->setMinimumSize(5,5); item->setPreferredSize(10,5); @@ -1139,7 +1139,7 @@ void tst_QGraphicsLinearLayout::setStretchFactor() qreal firstStretch = -1; qreal firstExtent = -1.; qreal sumExtent = 0; - for (i = 0; i < stretches.count(); ++i) { + for (i = 0; i < stretches.size(); ++i) { QGraphicsWidget *item = static_cast(layout.itemAt(i)); qreal extent = item->size().width(); qreal stretch = (qreal)stretches.at(i); @@ -1297,7 +1297,7 @@ void tst_QGraphicsLinearLayout::defaultStretchFactors() QSizeF itemSize = layout->itemAt(i)->geometry().size(); if (orientation == Qt::Vertical) itemSize.transpose(); - if (i < expectedSizes.count()) + if (i < expectedSizes.size()) QCOMPARE(itemSize.width(), qreal(expectedSizes.at(i))); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp index 849ac19d25..bade098023 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp @@ -41,28 +41,28 @@ void tst_QGraphicsObject::pos() QSignalSpy ySpy(&object, SIGNAL(yChanged())); QVERIFY(object.pos() == QPointF(0, 0)); object.setPos(10, 10); - QCOMPARE(xSpy.count(), 1); - QCOMPARE(ySpy.count(), 1); + QCOMPARE(xSpy.size(), 1); + QCOMPARE(ySpy.size(), 1); QCOMPARE(object.pos(), QPointF(10,10)); object.setPos(10, 10); - QCOMPARE(xSpy.count(), 1); - QCOMPARE(ySpy.count(), 1); + QCOMPARE(xSpy.size(), 1); + QCOMPARE(ySpy.size(), 1); object.setProperty("pos", QPointF(0, 0)); - QCOMPARE(xSpy.count(), 2); - QCOMPARE(ySpy.count(), 2); + QCOMPARE(xSpy.size(), 2); + QCOMPARE(ySpy.size(), 2); QCOMPARE(object.property("pos").toPointF(), QPointF(0,0)); object.setProperty("pos", QPointF(10, 0)); - QCOMPARE(xSpy.count(), 3); - QCOMPARE(ySpy.count(), 2); + QCOMPARE(xSpy.size(), 3); + QCOMPARE(ySpy.size(), 2); QCOMPARE(object.property("pos").toPointF(), QPointF(10,0)); object.setProperty("pos", QPointF(10, 10)); - QCOMPARE(xSpy.count(), 3); - QCOMPARE(ySpy.count(), 3); + QCOMPARE(xSpy.size(), 3); + QCOMPARE(ySpy.size(), 3); QVERIFY(object.property("pos") == QPointF(10, 10)); } @@ -73,19 +73,19 @@ void tst_QGraphicsObject::x() QSignalSpy ySpy(&object, SIGNAL(yChanged())); QVERIFY(object.pos() == QPointF(0, 0)); object.setX(10); - QCOMPARE(xSpy.count(), 1); - QCOMPARE(ySpy.count(), 0); + QCOMPARE(xSpy.size(), 1); + QCOMPARE(ySpy.size(), 0); QVERIFY(object.pos() == QPointF(10, 0)); QCOMPARE(object.x(), qreal(10)); object.setX(10); - QCOMPARE(xSpy.count(), 1); - QCOMPARE(ySpy.count(), 0); + QCOMPARE(xSpy.size(), 1); + QCOMPARE(ySpy.size(), 0); object.setProperty("x", 0); - QCOMPARE(xSpy.count(), 2); - QCOMPARE(ySpy.count(), 0); + QCOMPARE(xSpy.size(), 2); + QCOMPARE(ySpy.size(), 0); QCOMPARE(object.property("x").toDouble(), double(0)); } @@ -96,19 +96,19 @@ void tst_QGraphicsObject::y() QSignalSpy ySpy(&object, SIGNAL(yChanged())); QVERIFY(object.pos() == QPointF(0, 0)); object.setY(10); - QCOMPARE(xSpy.count(), 0); - QCOMPARE(ySpy.count(), 1); + QCOMPARE(xSpy.size(), 0); + QCOMPARE(ySpy.size(), 1); QVERIFY(object.pos() == QPointF(0, 10)); QCOMPARE(object.y(), qreal(10)); object.setY(10); - QCOMPARE(xSpy.count(), 0); - QCOMPARE(ySpy.count(), 1); + QCOMPARE(xSpy.size(), 0); + QCOMPARE(ySpy.size(), 1); object.setProperty("y", 0); - QCOMPARE(xSpy.count(), 0); - QCOMPARE(ySpy.count(), 2); + QCOMPARE(xSpy.size(), 0); + QCOMPARE(ySpy.size(), 2); QCOMPARE(object.property("y").toDouble(), qreal(0)); } @@ -118,15 +118,15 @@ void tst_QGraphicsObject::z() QSignalSpy zSpy(&object, SIGNAL(zChanged())); QCOMPARE(object.zValue(), qreal(0)); object.setZValue(10); - QCOMPARE(zSpy.count(), 1); + QCOMPARE(zSpy.size(), 1); QCOMPARE(object.zValue(), qreal(10)); object.setZValue(10); - QCOMPARE(zSpy.count(), 1); + QCOMPARE(zSpy.size(), 1); object.setProperty("z", 0); - QCOMPARE(zSpy.count(), 2); + QCOMPARE(zSpy.size(), 2); QCOMPARE(object.property("z").toDouble(), double(0)); } @@ -136,15 +136,15 @@ void tst_QGraphicsObject::opacity() QSignalSpy spy(&object, SIGNAL(opacityChanged())); QCOMPARE(object.opacity(), 1.); object.setOpacity(0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(object.opacity(), 0.); object.setOpacity(0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); object.setProperty("opacity", .5); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(object.property("opacity").toDouble(), .5); } @@ -154,15 +154,15 @@ void tst_QGraphicsObject::enabled() QSignalSpy spy(&object, SIGNAL(enabledChanged())); QVERIFY(object.isEnabled()); object.setEnabled(false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(!object.isEnabled()); object.setEnabled(false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); object.setProperty("enabled", true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(object.property("enabled").toBool()); } @@ -172,15 +172,15 @@ void tst_QGraphicsObject::visible() QSignalSpy spy(&object, SIGNAL(visibleChanged())); QVERIFY(object.isVisible()); object.setVisible(false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(!object.isVisible()); object.setVisible(false); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); object.setProperty("visible", true); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QVERIFY(object.property("visible").toBool()); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 3cb0925e59..4562ac3a84 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -945,7 +945,7 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent() proxy->setPos(50, 0); QSignalSpy sceneChangedSpy(&scene, &QGraphicsScene::changed); scene.addItem(proxy); - QTRY_VERIFY(sceneChangedSpy.count() > 0); + QTRY_VERIFY(sceneChangedSpy.size() > 0); // outside graphics item QTest::mouseMove(&view, QPoint(10, 10)); @@ -1043,9 +1043,9 @@ void tst_QGraphicsProxyWidget::keyReleaseEvent() proxy->setFocus(); QTest::keyPress(view.viewport(), Qt::Key_Space); - QTRY_COMPARE(spy.count(), 0); + QTRY_COMPARE(spy.size(), 0); QTest::keyRelease(view.viewport(), Qt::Key_Space); - QTRY_COMPARE(spy.count(), hasWidget ? 1 : 0); + QTRY_COMPARE(spy.size(), hasWidget ? 1 : 0); } // protected void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) @@ -1073,7 +1073,7 @@ void tst_QGraphicsProxyWidget::mouseDoubleClickEvent() QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(QApplication::activeWindow(), (QWidget*)&view); // wait for scene to be updated before doing any coordinate mappings on it - QTRY_VERIFY(sceneChangedSpy.count() > 0); + QTRY_VERIFY(sceneChangedSpy.size() > 0); QPoint pointInLineEdit = view.mapFromScene(proxy->mapToScene(15, proxy->boundingRect().center().y())); QTest::mousePress(view.viewport(), Qt::LeftButton, {}, pointInLineEdit); @@ -1114,13 +1114,13 @@ void tst_QGraphicsProxyWidget::mousePressReleaseEvent() proxy->setFocus(); // wait for scene to be updated before doing any coordinate mappings on it - QTRY_VERIFY(sceneChangedSpy.count() > 0); + QTRY_VERIFY(sceneChangedSpy.size() > 0); QPoint buttonCenter = view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())); QTest::mousePress(view.viewport(), Qt::LeftButton, {}, buttonCenter); - QTRY_COMPARE(spy.count(), 0); + QTRY_COMPARE(spy.size(), 0); QTest::mouseRelease(view.viewport(), Qt::LeftButton, {}, buttonCenter); - QTRY_COMPARE(spy.count(), hasWidget ? 1 : 0); + QTRY_COMPARE(spy.size(), hasWidget ? 1 : 0); } void tst_QGraphicsProxyWidget::resizeEvent_data() @@ -1171,7 +1171,7 @@ void tst_QGraphicsProxyWidget::paintEvent() QSignalSpy sceneChangedSpy(&scene, &QGraphicsScene::changed); scene.addItem(&proxy); - QTRY_VERIFY(sceneChangedSpy.count() > 0); // make sure the scene is ready + QTRY_VERIFY(sceneChangedSpy.size() > 0); // make sure the scene is ready proxy.paintCount = 0; w->update(); @@ -2410,7 +2410,7 @@ void tst_QGraphicsProxyWidget::changingCursor_basic() proxy->setWidget(widget); QSignalSpy sceneChangedSpy(&scene, &QGraphicsScene::changed); scene.addItem(proxy); - QTRY_VERIFY(sceneChangedSpy.count() > 0); // make sure the scene is ready + QTRY_VERIFY(sceneChangedSpy.size() > 0); // make sure the scene is ready // in QTest::mouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); @@ -2628,7 +2628,7 @@ void tst_QGraphicsProxyWidget::windowOpacity() QTRY_COMPARE(eventSpy.counts[QEvent::UpdateRequest], 0); QTRY_COMPARE(eventSpy.counts[QEvent::Paint], paints); - QTRY_COMPARE(signalSpy.count(), 1); + QTRY_COMPARE(signalSpy.size(), 1); const QList arguments = signalSpy.takeFirst(); const QList updateRects = qvariant_cast >(arguments.at(0)); QCOMPARE(updateRects.size(), 1); @@ -2903,10 +2903,10 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget() QTest::mousePress(view.viewport(), Qt::LeftButton, {}, view.mapFromScene(checkboxProxy->mapToScene(QPointF(8,8)))); - QTRY_COMPARE(spy.count(), 0); + QTRY_COMPARE(spy.size(), 0); QTest::mouseRelease(view.viewport(), Qt::LeftButton, {}, view.mapFromScene(checkboxProxy->mapToScene(QPointF(8,8)))); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); @@ -3702,27 +3702,27 @@ void tst_QGraphicsProxyWidget::wheelEventPropagation() // accepted by the embedded widget QCOMPARE(view.itemAt(wheelPosition), nullptr); wheelUp(Qt::NoScrollPhase); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); // wheeling on the label, which ignores the event, should scroll the view QCOMPARE(view.itemAt(wheelPosition), labelProxy); wheelUp(Qt::NoScrollPhase); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); QCOMPARE(view.itemAt(wheelPosition), labelProxy); wheelUp(Qt::NoScrollPhase); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); // left the widget QCOMPARE(view.itemAt(wheelPosition), nullptr); wheelUp(Qt::NoScrollPhase); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); // reached the nested widget, which accepts the wheel event, so no more scrolling QCOMPARE(view.itemAt(wheelPosition), nestedProxy); // remember this position for later const int scrollBarValueOnNestedProxy = view.verticalScrollBar()->value(); wheelUp(Qt::NoScrollPhase); - QCOMPARE(scrollSpy.count(), scrollCount); + QCOMPARE(scrollSpy.size(), scrollCount); QCOMPARE(nestedWidget->wheelEventCount, 1); // reset, try with kinetic events @@ -3733,41 +3733,41 @@ void tst_QGraphicsProxyWidget::wheelEventPropagation() // no matter if the widget accepts wheel events - the view has the grab QCOMPARE(view.itemAt(wheelPosition), nullptr); wheelUp(Qt::ScrollBegin); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); for (int i = 0; i < 5; ++i) { wheelUp(Qt::ScrollUpdate); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); } wheelUp(Qt::ScrollEnd); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); // reset view.verticalScrollBar()->setValue(0); - scrollCount = scrollSpy.count(); + scrollCount = scrollSpy.size(); // starting a scroll on a widget that doesn't accept wheel events // should also scroll the view, which still gets the grab wheelUp(Qt::NoScrollPhase); - scrollCount = scrollSpy.count(); + scrollCount = scrollSpy.size(); QCOMPARE(view.itemAt(wheelPosition), labelProxy); wheelUp(Qt::ScrollBegin); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); for (int i = 0; i < 5; ++i) { wheelUp(Qt::ScrollUpdate); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); } wheelUp(Qt::ScrollEnd); - QCOMPARE(scrollSpy.count(), ++scrollCount); + QCOMPARE(scrollSpy.size(), ++scrollCount); // starting a scroll on a widget that does accept wheel events // should not scroll the view view.verticalScrollBar()->setValue(scrollBarValueOnNestedProxy); - scrollCount = scrollSpy.count(); + scrollCount = scrollSpy.size(); QCOMPARE(view.itemAt(wheelPosition), nestedProxy); wheelUp(Qt::ScrollBegin); - QCOMPARE(scrollSpy.count(), scrollCount); + QCOMPARE(scrollSpy.size(), scrollCount); } #endif // QT_CONFIG(wheelevent) @@ -3969,7 +3969,7 @@ void tst_QGraphicsProxyWidget::touchEventPropagation() QCOMPARE(record.receiver, view.windowHandle()); QCOMPARE(record.eventType, QEvent::TouchEnd); QCOMPARE(eventSpy.mousePressReceiver, pushButton1); - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); eventSpy.clear(); clickedSpy.clear(); @@ -4037,7 +4037,7 @@ void tst_QGraphicsProxyWidget::touchEventPropagation() QCOMPARE(eventSpy.at(0, 3).receiver, touchWidget2); QCOMPARE(eventSpy.at(1, 3).receiver, touchWidget2); QCOMPARE(eventSpy.at(2, 3).receiver, touchWidget2); - QCOMPARE(clickedSpy.count(), 0); // multi-touch event does not synthesize a mouse event + QCOMPARE(clickedSpy.size(), 0); // multi-touch event does not synthesize a mouse event } QTEST_MAIN(tst_QGraphicsProxyWidget) diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 473d3df0b8..f42670e4bd 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -321,27 +321,27 @@ void tst_QGraphicsScene::sceneRect() QGraphicsScene scene; QSignalSpy sceneRectChanged(&scene, &QGraphicsScene::sceneRectChanged); QCOMPARE(scene.sceneRect(), QRectF()); - QCOMPARE(sceneRectChanged.count(), 0); + QCOMPARE(sceneRectChanged.size(), 0); QGraphicsRectItem *item = scene.addRect(QRectF(0, 0, 10, 10)); item->setPen(QPen(Qt::black, 0)); item->setPos(-5, -5); - QCOMPARE(sceneRectChanged.count(), 0); + QCOMPARE(sceneRectChanged.size(), 0); QCOMPARE(itemAt(scene, 0, 0), item); QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); - QCOMPARE(sceneRectChanged.count(), 0); + QCOMPARE(sceneRectChanged.size(), 0); QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 10, 10)); - QCOMPARE(sceneRectChanged.count(), 1); + QCOMPARE(sceneRectChanged.size(), 1); QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); item->setPos(0, 0); QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 15, 15)); - QCOMPARE(sceneRectChanged.count(), 2); + QCOMPARE(sceneRectChanged.size(), 2); QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); scene.setSceneRect(-100, -100, 10, 10); - QCOMPARE(sceneRectChanged.count(), 3); + QCOMPARE(sceneRectChanged.size(), 3); QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); QCOMPARE(itemAt(scene, 0, 0), item); @@ -349,16 +349,16 @@ void tst_QGraphicsScene::sceneRect() QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10)); item->setPos(10, 10); QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10)); - QCOMPARE(sceneRectChanged.count(), 3); + QCOMPARE(sceneRectChanged.size(), 3); QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); scene.setSceneRect(QRectF()); QCOMPARE(itemAt(scene, 10, 10), item); QVERIFY(scene.items(QPointF(20, 20)).isEmpty()); - QCOMPARE(sceneRectChanged.count(), 4); + QCOMPARE(sceneRectChanged.size(), 4); QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 25, 25)); - QCOMPARE(sceneRectChanged.count(), 5); + QCOMPARE(sceneRectChanged.size(), 5); QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); } @@ -946,32 +946,32 @@ void tst_QGraphicsScene::selectionChanged() { QGraphicsScene scene(0, 0, 1000, 1000); QSignalSpy spy(&scene, &QGraphicsScene::selectionChanged); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QPainterPath path; path.addRect(scene.sceneRect()); QCOMPARE(scene.selectionArea(), QPainterPath()); scene.setSelectionArea(path); QCOMPARE(scene.selectionArea(), path); - QCOMPARE(spy.count(), 0); // selection didn't change + QCOMPARE(spy.size(), 0); // selection didn't change QVERIFY(scene.selectedItems().isEmpty()); QGraphicsItem *rect = scene.addRect(QRectF(0, 0, 100, 100)); - QCOMPARE(spy.count(), 0); // selection didn't change + QCOMPARE(spy.size(), 0); // selection didn't change rect->setSelected(true); QVERIFY(!rect->isSelected()); - QCOMPARE(spy.count(), 0); // selection didn't change, item isn't selectable + QCOMPARE(spy.size(), 0); // selection didn't change, item isn't selectable rect->setFlag(QGraphicsItem::ItemIsSelectable); rect->setSelected(true); QVERIFY(rect->isSelected()); - QCOMPARE(spy.count(), 1); // selection changed + QCOMPARE(spy.size(), 1); // selection changed QCOMPARE(scene.selectedItems(), {rect}); rect->setSelected(false); QVERIFY(!rect->isSelected()); - QCOMPARE(spy.count(), 2); // selection changed + QCOMPARE(spy.size(), 2); // selection changed QVERIFY(scene.selectedItems().isEmpty()); QGraphicsEllipseItem *parentItem = new QGraphicsEllipseItem(QRectF(0, 0, 100, 100)); @@ -983,33 +983,33 @@ void tst_QGraphicsScene::selectionChanged() grandChildItem->setSelected(true); scene.addItem(parentItem); - QCOMPARE(spy.count(), 3); // the grandchild was added, so the selection changed once + QCOMPARE(spy.size(), 3); // the grandchild was added, so the selection changed once scene.removeItem(parentItem); - QCOMPARE(spy.count(), 4); // the grandchild was removed, so the selection changed + QCOMPARE(spy.size(), 4); // the grandchild was removed, so the selection changed rect->setSelected(true); - QCOMPARE(spy.count(), 5); // the rect was reselected, so the selection changed + QCOMPARE(spy.size(), 5); // the rect was reselected, so the selection changed scene.clearSelection(); - QCOMPARE(spy.count(), 6); // the scene selection was cleared + QCOMPARE(spy.size(), 6); // the scene selection was cleared rect->setSelected(true); - QCOMPARE(spy.count(), 7); // the rect was reselected, so the selection changed + QCOMPARE(spy.size(), 7); // the rect was reselected, so the selection changed rect->setFlag(QGraphicsItem::ItemIsSelectable, false); - QCOMPARE(spy.count(), 8); // the rect was unselected, so the selection changed + QCOMPARE(spy.size(), 8); // the rect was unselected, so the selection changed rect->setSelected(true); - QCOMPARE(spy.count(), 8); // the rect is not longer selectable, so the selection does not change + QCOMPARE(spy.size(), 8); // the rect is not longer selectable, so the selection does not change rect->setFlag(QGraphicsItem::ItemIsSelectable, true); rect->setSelected(true); - QCOMPARE(spy.count(), 9); // the rect is again selectable, so the selection changed + QCOMPARE(spy.size(), 9); // the rect is again selectable, so the selection changed delete rect; - QCOMPARE(spy.count(), 10); // a selected item was deleted; selection changed + QCOMPARE(spy.size(), 10); // a selected item was deleted; selection changed } void tst_QGraphicsScene::selectionChanged2() @@ -1022,7 +1022,7 @@ void tst_QGraphicsScene::selectionChanged2() item1->setFlag(QGraphicsItem::ItemIsSelectable); item2->setFlag(QGraphicsItem::ItemIsSelectable); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); event.setScenePos(QPointF(50, 50)); @@ -1037,7 +1037,7 @@ void tst_QGraphicsScene::selectionChanged2() } QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); event.setScenePos(QPointF(150, 150)); @@ -1052,7 +1052,7 @@ void tst_QGraphicsScene::selectionChanged2() } QVERIFY(!item1->isSelected()); QVERIFY(item2->isSelected()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); event.setScenePos(QPointF(50, 50)); @@ -1062,7 +1062,7 @@ void tst_QGraphicsScene::selectionChanged2() } QVERIFY(!item1->isSelected()); QVERIFY(item2->isSelected()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseRelease); event.setScenePos(QPointF(50, 50)); @@ -1071,7 +1071,7 @@ void tst_QGraphicsScene::selectionChanged2() } QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); } void tst_QGraphicsScene::addItem() @@ -2834,7 +2834,7 @@ void tst_QGraphicsScene::update() QCoreApplication::processEvents(); // Check that the update region is correct - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QRectF region; const auto &rects = qvariant_cast >(spy.at(0).at(0)); for (const auto &rectF : rects) @@ -3533,7 +3533,7 @@ void tst_QGraphicsScene::task160653_selectionChanged() QVERIFY(QTest::qWaitForWindowActive(&view)); QTest::mouseClick( view.viewport(), Qt::LeftButton, {}, view.mapFromScene(scene.items().first()->scenePos())); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QGraphicsScene::task250680_childClip() @@ -4623,17 +4623,17 @@ void tst_QGraphicsScene::focusItemChangedSignal() QGraphicsScene scene; QSignalSpy spy(&scene, &QGraphicsScene::focusItemChanged); QVERIFY(spy.isValid()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); scene.setFocus(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QEvent activateEvent(QEvent::WindowActivate); QCoreApplication::sendEvent(&scene, &activateEvent); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QGraphicsRectItem *topLevelItem1 = new QGraphicsRectItem; topLevelItem1->setFlag(QGraphicsItem::ItemIsFocusable); scene.addItem(topLevelItem1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QVERIFY(!topLevelItem1->hasFocus()); QGraphicsRectItem *topLevelItem2 = new QGraphicsRectItem; @@ -4641,7 +4641,7 @@ void tst_QGraphicsScene::focusItemChangedSignal() topLevelItem2->setFocus(); QVERIFY(!topLevelItem2->hasFocus()); scene.addItem(topLevelItem2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); QCOMPARE(qvariant_cast(arguments.at(0)), topLevelItem2); @@ -4650,7 +4650,7 @@ void tst_QGraphicsScene::focusItemChangedSignal() QVERIFY(topLevelItem2->hasFocus()); scene.clearFocus(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); QCOMPARE(qvariant_cast(arguments.at(0)), nullptr); @@ -4658,7 +4658,7 @@ void tst_QGraphicsScene::focusItemChangedSignal() QCOMPARE(qvariant_cast(arguments.at(2)), Qt::OtherFocusReason); scene.setFocus(Qt::MenuBarFocusReason); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); QCOMPARE(qvariant_cast(arguments.at(0)), topLevelItem2); @@ -4687,16 +4687,16 @@ void tst_QGraphicsScene::focusItemChangedSignal() QEvent deactivateEvent(QEvent::WindowDeactivate); QCoreApplication::sendEvent(&scene, &deactivateEvent); QEXPECT_FAIL("", "QTBUG-28346", Continue); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCoreApplication::sendEvent(&scene, &activateEvent); QEXPECT_FAIL("", "QTBUG-28346", Continue); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QGraphicsRectItem *panel1 = new QGraphicsRectItem; panel1->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemIsFocusable); panel1->setFocus(); scene.addItem(panel1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); QCOMPARE(qvariant_cast(arguments.at(0)), panel1); @@ -4706,11 +4706,11 @@ void tst_QGraphicsScene::focusItemChangedSignal() QGraphicsRectItem *panel2 = new QGraphicsRectItem; panel2->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemIsFocusable); scene.addItem(panel2); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); for (int i = 0; i < 3; ++i) { scene.setActivePanel(panel2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); QCOMPARE(qvariant_cast(arguments.at(0)), panel2); @@ -4718,7 +4718,7 @@ void tst_QGraphicsScene::focusItemChangedSignal() QCOMPARE(qvariant_cast(arguments.at(2)), Qt::ActiveWindowFocusReason); scene.setActivePanel(panel1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); QCOMPARE(qvariant_cast(arguments.at(0)), panel1); @@ -4865,23 +4865,23 @@ void tst_QGraphicsScene::clearSelection() scene.addItem(regularRect); scene.addItem(selectedRect); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(scene.selectedItems().size(), 2); scene.clearSelection(); QVERIFY(!regularRect->isSelected()); QVERIFY(selectedRect->isSelected()); QCOMPARE(scene.selectedItems().size(), 1); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); delete regularRect; - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); scene.clearSelection(); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); delete selectedRect; - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.size(), 4); } void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache() diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index d7803ba6f8..d5807c1958 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -667,16 +667,16 @@ void tst_QGraphicsView::openGLViewport() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTRY_VERIFY(spy1.count() > 0); - QTRY_VERIFY(spy2.count() >= spy1.count()); + QTRY_VERIFY(spy1.size() > 0); + QTRY_VERIFY(spy2.size() >= spy1.size()); spy1.clear(); spy2.clear(); // Now test for resize (QTBUG-52419). This is special when the viewport is // a QOpenGLWidget since the underlying FBO must also be maintained. view.resize(300, 300); - QTRY_VERIFY(spy1.count() > 0); - QTRY_VERIFY(spy2.count() >= spy1.count()); + QTRY_VERIFY(spy1.size() > 0); + QTRY_VERIFY(spy2.size() >= spy1.size()); // There is no sane way to check if the framebuffer contents got updated // (grabFramebuffer is no good for the viewport case as that does not go // through paintGL). So skip the actual verification. diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index 372ebf9038..a6fcdb9b9a 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -950,9 +950,9 @@ void tst_QGraphicsWidget::geometry() widget.setPos(pos); widget.resize(size); if (!size.isNull() && !pos.isNull()) - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); if (!size.isNull() && pos.isNull()) - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(widget.geometry(), QRectF(pos, size)); } @@ -963,10 +963,10 @@ void tst_QGraphicsWidget::geometryChanged() QCOMPARE(w.geometry(), QRectF(0, 0, 200, 200)); QSignalSpy spy(&w, SIGNAL(geometryChanged())); w.setGeometry(0, 0, 100, 100); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(w.geometry(), QRectF(0, 0, 100, 100)); w.setPos(10, 10); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(w.geometry(), QRectF(10, 10, 100, 100)); } @@ -978,10 +978,10 @@ void tst_QGraphicsWidget::width() QSignalSpy spy(&w, SIGNAL(widthChanged())); w.setProperty("width", qreal(50)); QCOMPARE(w.property("width").toReal(), qreal(50)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); //calling old school setGeometry should work too w.setGeometry(0, 0, 200, 200); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QGraphicsWidget::height() @@ -991,10 +991,10 @@ void tst_QGraphicsWidget::height() QSignalSpy spy(&w, SIGNAL(heightChanged())); w.setProperty("height", qreal(50)); QCOMPARE(w.property("height").toReal(), qreal(50)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); //calling old school setGeometry should work too w.setGeometry(0, 0, 200, 200); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QGraphicsWidget::getContentsMargins_data() @@ -1145,7 +1145,7 @@ void tst_QGraphicsWidget::layout() QCOMPARE(item->parentWidget(), (QGraphicsWidget *)&widget); QVERIFY(item->geometry() != QRectF(0, 0, -1, -1)); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); // don't crash widget.setLayout(0); } @@ -2731,11 +2731,11 @@ void tst_QGraphicsWidget::task250119_shortcutContext() w_signal.setFocus(); QTest::keyPress(&view, Qt::Key_B); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); w_signal.clearFocus(); QTest::keyPress(&view, Qt::Key_B); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); scene.removeItem(&w_signal); } diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 61c33f8c2d..63b0446088 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -425,12 +425,12 @@ void tst_QAbstractItemView::basic_tests(QAbstractItemView *view) QVERIFY(spy.isValid()); view->setIconSize(QSize(32, 32)); QCOMPARE(view->iconSize(), QSize(32, 32)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).value(), QSize(32, 32)); // Should this happen? view->setIconSize(QSize(-1, -1)); QCOMPARE(view->iconSize(), QSize(-1, -1)); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(view->currentIndex(), QModelIndex()); QCOMPARE(view->rootIndex(), QModelIndex()); @@ -664,9 +664,9 @@ void tst_QAbstractItemView::selectAll() GeometriesTestView view; view.setModel(&model); - QCOMPARE(view.selectedIndexes().count(), 0); + QCOMPARE(view.selectedIndexes().size(), 0); view.selectAll(); - QCOMPARE(view.selectedIndexes().count(), 4 * 4); + QCOMPARE(view.selectedIndexes().size(), 4 * 4); } void tst_QAbstractItemView::ctrlA() @@ -675,9 +675,9 @@ void tst_QAbstractItemView::ctrlA() GeometriesTestView view; view.setModel(&model); - QCOMPARE(view.selectedIndexes().count(), 0); + QCOMPARE(view.selectedIndexes().size(), 0); QTest::keyClick(&view, Qt::Key_A, Qt::ControlModifier); - QCOMPARE(view.selectedIndexes().count(), 4 * 4); + QCOMPARE(view.selectedIndexes().size(), 4 * 4); } void tst_QAbstractItemView::persistentEditorFocus() @@ -1355,7 +1355,7 @@ void tst_QAbstractItemView::task200665_itemEntered() QSignalSpy spy(&view, &QAbstractItemView::entered); view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum()); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); } void tst_QAbstractItemView::task257481_emptyEditor() @@ -1422,7 +1422,7 @@ void tst_QAbstractItemView::shiftArrowSelectionAfterScrolling() QCOMPARE(view.currentIndex(), index1); QModelIndexList selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 2); + QCOMPARE(selected.size(), 2); QVERIFY(selected.contains(index0)); QVERIFY(selected.contains(index1)); } @@ -1476,7 +1476,7 @@ void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection() // Verify that the selection worked OK QModelIndexList selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 2); + QCOMPARE(selected.size(), 2); QVERIFY(selected.contains(index1)); QVERIFY(selected.contains(index2)); @@ -1499,7 +1499,7 @@ void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection() // Verify that the selection worked OK selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 2); + QCOMPARE(selected.size(), 2); QVERIFY(selected.contains(index1)); QVERIFY(selected.contains(index2)); } @@ -1528,7 +1528,7 @@ void tst_QAbstractItemView::ctrlRubberbandSelection() // Select item 1 view.setCurrentIndex(index1); QModelIndexList selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 1); + QCOMPARE(selected.size(), 1); QVERIFY(selected.contains(index1)); // Now press control and draw a rubberband around items 1 and 2. @@ -1545,7 +1545,7 @@ void tst_QAbstractItemView::ctrlRubberbandSelection() // Verify that item 2 is selected now selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 1); + QCOMPARE(selected.size(), 1); QVERIFY(selected.contains(index2)); } @@ -1654,12 +1654,12 @@ void tst_QAbstractItemView::testClickedSignal() QSignalSpy clickedSpy(&view, &QTableWidget::clicked); QTest::mouseClick(view.viewport(), Qt::LeftButton, {}, p); - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); QTest::mouseClick(view.viewport(), Qt::RightButton, {}, p); // We expect that right-clicks do not cause the clicked() signal to // be emitted. - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); } @@ -1723,28 +1723,28 @@ void tst_QAbstractItemView::deselectInSingleSelection() QPoint clickpos = rect22.center(); QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, clickpos); QCOMPARE(view.currentIndex(), index22); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1); QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, clickpos); QCOMPARE(view.currentIndex(), index22); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 0); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 0); // second click with modifier however does select QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, clickpos); QCOMPARE(view.currentIndex(), index22); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1); // keyboard QTest::keyClick(&view, Qt::Key_Space, Qt::NoModifier); QCOMPARE(view.currentIndex(), index22); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1); QTest::keyClick(&view, Qt::Key_Space, Qt::ControlModifier); QCOMPARE(view.currentIndex(), index22); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 0); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 0); // second keypress with modifier however does select QTest::keyClick(&view, Qt::Key_Space, Qt::ControlModifier); QCOMPARE(view.currentIndex(), index22); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1); } void tst_QAbstractItemView::testNoActivateOnDisabledItem() @@ -1772,7 +1772,7 @@ void tst_QAbstractItemView::testNoActivateOnDisabledItem() QPoint clickPos = treeView.visualRect(itemIndex).center(); QTest::mouseClick(treeView.viewport(), Qt::LeftButton, {}, clickPos); - QCOMPARE(activatedSpy.count(), 0); + QCOMPARE(activatedSpy.size(), 0); } void tst_QAbstractItemView::testFocusPolicy_data() @@ -1866,7 +1866,7 @@ void tst_QAbstractItemView::QTBUG31411_noSelection() QVERIFY(editor2); QTest::keyClick(editor2, Qt::Key_Escape, Qt::NoModifier); - QCOMPARE(selectionChangeSpy.count(), 0); + QCOMPARE(selectionChangeSpy.size(), 0); } void tst_QAbstractItemView::QTBUG39324_settingSameInstanceOfIndexWidget() @@ -1908,7 +1908,7 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents() // Click "C" QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, view.visualRect(indexC).center()); QModelIndexList selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 1); + QCOMPARE(selected.size(), 1); QVERIFY(selected.contains(indexC)); // Insert new item "B1" @@ -1918,14 +1918,14 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents() // Shift-click "D" -> we expect that "C" and "D" are selected QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, view.visualRect(indexD).center()); selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 2); + QCOMPARE(selected.size(), 2); QVERIFY(selected.contains(indexC)); QVERIFY(selected.contains(indexD)); // Click "D" QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, view.visualRect(indexD).center()); selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 1); + QCOMPARE(selected.size(), 1); QVERIFY(selected.contains(indexD)); // Remove items "B" and "C" @@ -1937,7 +1937,7 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents() // Shift-click "F" -> we expect that "D", "E", and "F" are selected QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, view.visualRect(indexF).center()); selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 3); + QCOMPARE(selected.size(), 3); QVERIFY(selected.contains(indexD)); QVERIFY(selected.contains(indexE)); QVERIFY(selected.contains(indexF)); @@ -1946,7 +1946,7 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents() while (view.currentIndex() != indexA) QTest::keyClick(&view, Qt::Key_Up); selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 1); + QCOMPARE(selected.size(), 1); QVERIFY(selected.contains(indexA)); // Change the sort order @@ -1955,7 +1955,7 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents() // Shift-click "F" -> All items should be selected QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, view.visualRect(indexF).center()); selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), model.rowCount()); + QCOMPARE(selected.size(), model.rowCount()); // Restore the old sort order proxyModel.sort(0, Qt::AscendingOrder); @@ -1963,7 +1963,7 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents() // Click "D" QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, view.visualRect(indexD).center()); selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 1); + QCOMPARE(selected.size(), 1); QVERIFY(selected.contains(indexD)); // Insert new item "B2" @@ -1973,7 +1973,7 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents() // Press Shift+Down -> "D" and "E" should be selected. QTest::keyClick(&view, Qt::Key_Down, Qt::ShiftModifier); selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 2); + QCOMPARE(selected.size(), 2); QVERIFY(selected.contains(indexD)); QVERIFY(selected.contains(indexE)); @@ -1982,7 +1982,7 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents() QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, view.visualRect(indexA).center()); view.setCurrentIndex(indexD); selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 1); + QCOMPARE(selected.size(), 1); QVERIFY(selected.contains(indexD)); // Insert new item "B3" @@ -1992,7 +1992,7 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents() // Press Shift+Down -> "D" and "E" should be selected. QTest::keyClick(&view, Qt::Key_Down, Qt::ShiftModifier); selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 2); + QCOMPARE(selected.size(), 2); QVERIFY(selected.contains(indexD)); QVERIFY(selected.contains(indexE)); } @@ -2270,14 +2270,14 @@ void tst_QAbstractItemView::testClickToSelect() // Click the center of the visualRect of item "A" QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, centerA); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.back().front().value(), QRect(centerA, QSize(1, 1))); // Click a point slightly away from the center const QPoint nearCenterA = centerA + QPoint(1, 1); QVERIFY(visualRectA.contains(nearCenterA)); QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, nearCenterA); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(spy.back().front().value(), QRect(nearCenterA, QSize(1, 1))); } @@ -2635,7 +2635,7 @@ void tst_QAbstractItemView::dragSelectAfterNewPress() // Verify that the selection worked OK QModelIndexList selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 3); + QCOMPARE(selected.size(), 3); for (int i = 0; i < 2; ++i) QVERIFY(selected.contains(model.index(i, 0))); @@ -2652,7 +2652,7 @@ void tst_QAbstractItemView::dragSelectAfterNewPress() // Verify that the selection worked OK selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 6); + QCOMPARE(selected.size(), 6); for (int i = 0; i < 5; ++i) QVERIFY(selected.contains(model.index(i, 0))); } @@ -3328,7 +3328,7 @@ void tst_QAbstractItemView::selectionAutoScrolling() QTRY_COMPARE(scrollBar->value(), 0); else QTRY_COMPARE(scrollBar->value(), scrollBar->maximum()); - QVERIFY(listview.selectionModel()->selectedIndexes().count() > 0); + QVERIFY(listview.selectionModel()->selectedIndexes().size() > 0); QTest::mouseRelease(listview.viewport(), Qt::LeftButton, Qt::NoModifier, dragPoint); } diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index 820c65dd26..8bdbc08467 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -497,11 +497,11 @@ void tst_QColumnView::selectAll() view.setModel(&m_fakeDirModel); view.selectAll(); - QVERIFY(view.selectionModel()->selectedIndexes().count() >= 0); + QVERIFY(view.selectionModel()->selectedIndexes().size() >= 0); view.setCurrentIndex(m_fakeDirHomeIndex); view.selectAll(); - QVERIFY(view.selectionModel()->selectedIndexes().count() > 0); + QVERIFY(view.selectionModel()->selectedIndexes().size() > 0); QModelIndex file; for (int i = 0; i < m_fakeDirModel.rowCount(m_fakeDirHomeIndex); ++i) { @@ -512,10 +512,10 @@ void tst_QColumnView::selectAll() } view.setCurrentIndex(file); view.selectAll(); - QVERIFY(view.selectionModel()->selectedIndexes().count() > 0); + QVERIFY(view.selectionModel()->selectedIndexes().size() > 0); view.setCurrentIndex(QModelIndex()); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 0); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 0); } void tst_QColumnView::clicked() @@ -536,7 +536,7 @@ void tst_QColumnView::clicked() QPoint localPoint = view.visualRect(m_fakeDirHomeIndex).center(); QTest::mouseClick(view.viewport(), Qt::LeftButton, {}, localPoint); - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); QCoreApplication::processEvents(); if (sizeof(qreal) != sizeof(double)) @@ -631,7 +631,7 @@ void tst_QColumnView::moveGrip_basic() view.setMinimumWidth(200); grip->moveGrip(-800); QCOMPARE(view.width(), 200); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); } void tst_QColumnView::moveGrip_data() @@ -687,7 +687,7 @@ void tst_QColumnView::doubleClick() QCOMPARE(view.width(), 200); QTest::mouseDClick(grip, Qt::LeftButton); QCOMPARE(view.width(), view.sizeHint().width()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QColumnView::gripMoved() @@ -711,7 +711,7 @@ void tst_QColumnView::gripMoved() QCoreApplication::processEvents(); QTest::mouseRelease(grip, Qt::LeftButton); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QCOMPARE(view.width(), oldWidth + 65); } diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index bcc7cccf50..d94b2c97b6 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp @@ -254,22 +254,22 @@ void tst_QDataWidgetMapper::currentIndexChanged() QSignalSpy spy(&mapper, &QDataWidgetMapper::currentIndexChanged); mapper.toFirst(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.takeFirst().at(0).toInt(), 0); mapper.toNext(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.takeFirst().at(0).toInt(), 1); mapper.setCurrentIndex(7); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.takeFirst().at(0).toInt(), 7); mapper.setCurrentIndex(-1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); mapper.setCurrentIndex(42); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QDataWidgetMapper::changingValues() @@ -426,21 +426,21 @@ void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305() int closeEditorSpyCount = 0; const QString textEditContents = textEdit->toPlainText(); - QCOMPARE(closeEditorSpy.count(), closeEditorSpyCount); + QCOMPARE(closeEditorSpy.size(), closeEditorSpyCount); QVERIFY(lineEdit->hasFocus()); QVERIFY(!textEdit->hasFocus()); // this will generate a closeEditor for the tab key, and another for the focus out QTest::keyClick(QApplication::focusWidget(), Qt::Key_Tab); closeEditorSpyCount += 2; - QTRY_COMPARE(closeEditorSpy.count(), closeEditorSpyCount); + QTRY_COMPARE(closeEditorSpy.size(), closeEditorSpyCount); QTRY_VERIFY(textEdit->hasFocus()); QVERIFY(!lineEdit->hasFocus()); // now that the text edit is focused, a tab keypress will insert a tab, not change focus QTest::keyClick(QApplication::focusWidget(), Qt::Key_Tab); - QTRY_COMPARE(closeEditorSpy.count(), closeEditorSpyCount); + QTRY_COMPARE(closeEditorSpy.size(), closeEditorSpyCount); QVERIFY(!lineEdit->hasFocus()); QVERIFY(textEdit->hasFocus()); @@ -451,7 +451,7 @@ void tst_QDataWidgetMapper::textEditDoesntChangeFocusOnTab_qtbug3305() QTRY_VERIFY(lineEdit->hasFocus()); QVERIFY(!textEdit->hasFocus()); ++closeEditorSpyCount; - QCOMPARE(closeEditorSpy.count(), closeEditorSpyCount); + QCOMPARE(closeEditorSpy.size(), closeEditorSpyCount); } QTEST_MAIN(tst_QDataWidgetMapper) diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 85edd09d44..e6807d8876 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -475,7 +475,7 @@ void tst_QHeaderView::init() QSignalSpy spy(view, &QHeaderView::sectionCountChanged); view->setModel(model); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); view->resize(200,200); } @@ -796,10 +796,10 @@ void tst_QHeaderView::visualIndexAt() for (int i : hidden) view->setSectionHidden(i, true); - for (int j = 0; j < from.count(); ++j) + for (int j = 0; j < from.size(); ++j) view->moveSection(from.at(j), to.at(j)); - for (int k = 0; k < coordinate.count(); ++k) + for (int k = 0; k < coordinate.size(); ++k) QTRY_COMPARE(view->visualIndexAt(coordinate.at(k)), visual.at(k)); } @@ -911,14 +911,14 @@ void tst_QHeaderView::swapSections() QCOMPARE(view->sectionsMoved(), true); for (int i = 0; i < view->count(); ++i) QCOMPARE(view->logicalIndex(i), logical.at(i)); - QCOMPARE(spy1.count(), 4); + QCOMPARE(spy1.size(), 4); logical = { 3, 1, 2, 0 }; view->swapSections(3, 0); QCOMPARE(view->sectionsMoved(), true); for (int j = 0; j < view->count(); ++j) QCOMPARE(view->logicalIndex(j), logical.at(j)); - QCOMPARE(spy1.count(), 6); + QCOMPARE(spy1.size(), 6); } void tst_QHeaderView::moveSection_data() @@ -964,9 +964,9 @@ void tst_QHeaderView::moveSection() QFETCH(const IntList, logical); QFETCH(int, count); - QCOMPARE(from.count(), to.count()); - QCOMPARE(from.count(), moved.count()); - QCOMPARE(view->count(), logical.count()); + QCOMPARE(from.size(), to.size()); + QCOMPARE(from.size(), moved.size()); + QCOMPARE(view->count(), logical.size()); QSignalSpy spy1(view, &QHeaderView::sectionMoved); QCOMPARE(view->sectionsMoved(), false); @@ -974,7 +974,7 @@ void tst_QHeaderView::moveSection() for (int h : hidden) view->setSectionHidden(h, true); - for (int i = 0; i < from.count(); ++i) { + for (int i = 0; i < from.size(); ++i) { view->moveSection(from.at(i), to.at(i)); QCOMPARE(view->sectionsMoved(), moved.at(i)); } @@ -982,7 +982,7 @@ void tst_QHeaderView::moveSection() for (int j = 0; j < view->count(); ++j) QCOMPARE(view->logicalIndex(j), logical.at(j)); - QCOMPARE(spy1.count(), count); + QCOMPARE(spy1.size(), count); } void tst_QHeaderView::resizeAndMoveSection_data() @@ -1167,14 +1167,14 @@ void tst_QHeaderView::resizeWithResizeModes() QFETCH(const IntList, expected); view->setStretchLastSection(false); - for (int i = 0; i < sections.count(); ++i) { + for (int i = 0; i < sections.size(); ++i) { view->resizeSection(i, sections.at(i)); view->setSectionResizeMode(i, modes.at(i)); } topLevel->show(); QVERIFY(QTest::qWaitForWindowExposed(topLevel)); view->resize(size, size); - for (int j = 0; j < expected.count(); ++j) + for (int j = 0; j < expected.size(); ++j) QCOMPARE(view->sectionSize(j), expected.at(j)); } @@ -1201,7 +1201,7 @@ void tst_QHeaderView::moveAndInsertSection() view->moveSection(from, to); model->insertRow(insert); - for (int i = 0; i < mapping.count(); ++i) + for (int i = 0; i < mapping.size(); ++i) QCOMPARE(view->logicalIndex(i), mapping.at(i)); } @@ -1272,21 +1272,21 @@ void tst_QHeaderView::resizeSection() view->setSectionsMovable(true); view->setStretchLastSection(false); - for (int i = 0; i < logical.count(); ++i) + for (int i = 0; i < logical.size(); ++i) if (logical.at(i) > -1 && logical.at(i) < view->count()) // for now view->setSectionResizeMode(logical.at(i), mode.at(i)); - for (int j = 0; j < logical.count(); ++j) + for (int j = 0; j < logical.size(); ++j) view->resizeSection(logical.at(j), initial); QSignalSpy spy(view, &QHeaderView::sectionResized); - for (int k = 0; k < logical.count(); ++k) + for (int k = 0; k < logical.size(); ++k) view->resizeSection(logical.at(k), size.at(k)); - QCOMPARE(spy.count(), resized); + QCOMPARE(spy.size(), resized); - for (int l = 0; l < logical.count(); ++l) + for (int l = 0; l < logical.size(); ++l) QCOMPARE(view->sectionSize(logical.at(l)), expected.at(l)); } @@ -1339,19 +1339,19 @@ void tst_QHeaderView::clearSectionSorting() QSignalSpy sectionClickedSpy(&h, &QHeaderView::sectionClicked); QVERIFY(sectionClickedSpy.isValid()); - QCOMPARE(sectionClickedSpy.count(), 0); + QCOMPARE(sectionClickedSpy.size(), 0); QSignalSpy sortIndicatorChangedSpy(&h, &QHeaderView::sortIndicatorChanged); QVERIFY(sortIndicatorChangedSpy.isValid()); - QCOMPARE(sortIndicatorChangedSpy.count(), 0); + QCOMPARE(sortIndicatorChangedSpy.size(), 0); enum { Count = 30 }; // normal behavior: clicking multiple times will just toggle the sort indicator for (int i = 0; i < Count; ++i) { QTest::mouseClick(h.viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QCOMPARE(sectionClickedSpy.count(), i + 1); - QCOMPARE(sortIndicatorChangedSpy.count(), i + 1); + QCOMPARE(sectionClickedSpy.size(), i + 1); + QCOMPARE(sortIndicatorChangedSpy.size(), i + 1); QCOMPARE(h.sortIndicatorSection(), 0); const auto expectedOrder = (i % 2) == 0 ? Qt::AscendingOrder : Qt::DescendingOrder; QCOMPARE(h.sortIndicatorOrder(), expectedOrder); @@ -1368,8 +1368,8 @@ void tst_QHeaderView::clearSectionSorting() // clearing behavior: clicking multiple times will be tristate (asc, desc, nothing) for (int i = 0; i < Count; ++i) { QTest::mouseClick(h.viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QCOMPARE(sectionClickedSpy.count(), i + 1); - QCOMPARE(sortIndicatorChangedSpy.count(), i + 1); + QCOMPARE(sectionClickedSpy.size(), i + 1); + QCOMPARE(sortIndicatorChangedSpy.size(), i + 1); switch (i % 3) { case 0: QCOMPARE(h.sortIndicatorSection(), 0); @@ -1737,7 +1737,7 @@ static void saveRestoreImpl(const QByteArray &state, SaveRestoreOption option) h2.setModel(&m); QVERIFY(h2.restoreState(state)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toInt(), 2); QCOMPARE(h2.logicalIndex(0), 2); @@ -2041,9 +2041,9 @@ void tst_QHeaderView::sectionPressedSignal() QSignalSpy spy(&h, &QHeaderView::sectionPressed); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QTest::mousePress(h.viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QCOMPARE(spy.count(), count); + QCOMPARE(spy.size(), count); } void tst_QHeaderView::sectionClickedSignal() @@ -2063,19 +2063,19 @@ void tst_QHeaderView::sectionClickedSignal() QSignalSpy spy(&h, &QHeaderView::sectionClicked); QSignalSpy spy2(&h, &QHeaderView::sortIndicatorChanged); - QCOMPARE(spy.count(), 0); - QCOMPARE(spy2.count(), 0); + QCOMPARE(spy.size(), 0); + QCOMPARE(spy2.size(), 0); QTest::mouseClick(h.viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QCOMPARE(spy.count(), count); - QCOMPARE(spy2.count(), count); + QCOMPARE(spy.size(), count); + QCOMPARE(spy2.size(), count); //now let's try with the sort indicator hidden (the result should be the same spy.clear(); spy2.clear(); h.setSortIndicatorShown(false); QTest::mouseClick(h.viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QCOMPARE(spy.count(), count); - QCOMPARE(spy2.count(), count); + QCOMPARE(spy.size(), count); + QCOMPARE(spy2.size(), count); } void tst_QHeaderView::defaultSectionSize_data() @@ -2256,7 +2256,7 @@ void tst_QHeaderView::task236450_hidden() for (int i : hide1) view.hideSection(i); - QCOMPARE(view.hiddenSectionCount(), hide1.count()); + QCOMPARE(view.hiddenSectionCount(), hide1.size()); for (int i = 0; i < 6; i++) QCOMPARE(!view.isSectionHidden(i), !hide1.contains(i)); @@ -2264,13 +2264,13 @@ void tst_QHeaderView::task236450_hidden() view.scheduleDelayedItemsLayout(); view.executeDelayedItemsLayout(); //force to do a relayout - QCOMPARE(view.hiddenSectionCount(), hide1.count()); + QCOMPARE(view.hiddenSectionCount(), hide1.size()); for (int i = 0; i < 6; i++) { QCOMPARE(!view.isSectionHidden(i), !hide1.contains(i)); view.setSectionHidden(i, hide2.contains(i)); } - QCOMPARE(view.hiddenSectionCount(), hide2.count()); + QCOMPARE(view.hiddenSectionCount(), hide2.size()); for (int i = 0; i < 6; i++) QCOMPARE(!view.isSectionHidden(i), !hide2.contains(i)); } @@ -2302,10 +2302,10 @@ void tst_QHeaderView::task248050_hideRow() //returns 0 if everything is fine. static int checkHeaderViewOrder(const QHeaderView *view, const IntList &expected) { - if (view->count() != expected.count()) + if (view->count() != expected.size()) return 1; - for (int i = 0; i < expected.count(); i++) { + for (int i = 0; i < expected.size(); i++) { if (view->logicalIndex(i) != expected.at(i)) return i + 10; if (view->visualIndex(expected.at(i)) != i) @@ -2396,8 +2396,8 @@ void tst_QHeaderView::QTBUG7833_sectionClicked() QTest::mouseClick(tv.horizontalHeader()->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(tv.horizontalHeader()->sectionViewportPosition(11) + tv.horizontalHeader()->sectionSize(11) / 2, 5)); - QCOMPARE(clickedSpy.count(), 1); - QCOMPARE(pressedSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); + QCOMPARE(pressedSpy.size(), 1); QCOMPARE(clickedSpy.at(0).at(0).toInt(), 11); QCOMPARE(pressedSpy.at(0).at(0).toInt(), 11); @@ -2405,8 +2405,8 @@ void tst_QHeaderView::QTBUG7833_sectionClicked() QPoint(tv.horizontalHeader()->sectionViewportPosition(8) + tv.horizontalHeader()->sectionSize(0) / 2, 5)); - QCOMPARE(clickedSpy.count(), 2); - QCOMPARE(pressedSpy.count(), 2); + QCOMPARE(clickedSpy.size(), 2); + QCOMPARE(pressedSpy.size(), 2); QCOMPARE(clickedSpy.at(1).at(0).toInt(), 8); QCOMPARE(pressedSpy.at(1).at(0).toInt(), 8); @@ -2414,8 +2414,8 @@ void tst_QHeaderView::QTBUG7833_sectionClicked() QPoint(tv.horizontalHeader()->sectionViewportPosition(0) + tv.horizontalHeader()->sectionSize(0) / 2, 5)); - QCOMPARE(clickedSpy.count(), 3); - QCOMPARE(pressedSpy.count(), 3); + QCOMPARE(clickedSpy.size(), 3); + QCOMPARE(pressedSpy.size(), 3); QCOMPARE(clickedSpy.at(2).at(0).toInt(), 0); QCOMPARE(pressedSpy.at(2).at(0).toInt(), 0); } @@ -2542,7 +2542,7 @@ public: void insertRowAtBeginning() { Q_EMIT layoutAboutToBeChanged(); - m_displayNames.insert(0, QStringLiteral("Item %1").arg(m_displayNames.count())); + m_displayNames.insert(0, QStringLiteral("Item %1").arg(m_displayNames.size())); // Rows are always inserted at the beginning, so move all others. const auto pl = persistentIndexList(); // The vertical header view will have a persistent index stored here on the second call to insertRowAtBeginning. @@ -2558,7 +2558,7 @@ public: QModelIndex index(int row, int column, const QModelIndex &) const override { return createIndex(row, column); } QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); } - int rowCount(const QModelIndex &) const override { return m_displayNames.count(); } + int rowCount(const QModelIndex &) const override { return m_displayNames.size(); } int columnCount(const QModelIndex &) const override { return 1; } private: diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 5ec35391cd..11f0f7440f 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -673,33 +673,33 @@ void tst_QItemDelegate::testEventFilter() //For each test we send a key event and check if signals were emitted. event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier); QVERIFY(delegate.eventFilter(&widget, event)); - QCOMPARE(closeEditorSpy.count(), 1); - QCOMPARE(commitDataSpy.count(), 1); + QCOMPARE(closeEditorSpy.size(), 1); + QCOMPARE(commitDataSpy.size(), 1); delete event; event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backtab, Qt::NoModifier); QVERIFY(delegate.eventFilter(&widget, event)); - QCOMPARE(closeEditorSpy.count(), 2); - QCOMPARE(commitDataSpy.count(), 2); + QCOMPARE(closeEditorSpy.size(), 2); + QCOMPARE(commitDataSpy.size(), 2); delete event; event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier); QVERIFY(delegate.eventFilter(&widget, event)); - QCOMPARE(closeEditorSpy.count(), 3); - QCOMPARE(commitDataSpy.count(), 2); + QCOMPARE(closeEditorSpy.size(), 3); + QCOMPARE(commitDataSpy.size(), 2); delete event; event = new QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier); QVERIFY(!delegate.eventFilter(&widget, event)); - QCOMPARE(closeEditorSpy.count(), 3); - QCOMPARE(commitDataSpy.count(), 2); + QCOMPARE(closeEditorSpy.size(), 3); + QCOMPARE(commitDataSpy.size(), 2); delete event; //Subtest focusEvent event = new QFocusEvent(QEvent::FocusOut); QVERIFY(!delegate.eventFilter(&widget, event)); - QCOMPARE(closeEditorSpy.count(), 4); - QCOMPARE(commitDataSpy.count(), 3); + QCOMPARE(closeEditorSpy.size(), 4); + QCOMPARE(commitDataSpy.size(), 3); delete event; } diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 0e09beb563..3c43b3fcd5 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -719,7 +719,7 @@ void tst_QListView::clicked() continue; QSignalSpy spy(&view, &QListView::clicked); QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, p); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } } @@ -1148,7 +1148,7 @@ void tst_QListView::selection() v.setSelection(selectionRect, QItemSelectionModel::ClearAndSelect); const QModelIndexList selected = v.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), expectedItems.count()); + QCOMPARE(selected.size(), expectedItems.size()); for (const auto &idx : selected) QVERIFY(expectedItems.contains(idx.row())); } @@ -1558,7 +1558,7 @@ void tst_QListView::task203585_selectAll() QVERIFY(view.selectionModel()->selectedIndexes().isEmpty()); view.setRowHidden(0, false); view.selectAll(); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1); } void tst_QListView::task228566_infiniteRelayout() @@ -1643,7 +1643,7 @@ void tst_QListView::task196118_visualRegionForSelection() view.selectionModel()->select(top1.index(), QItemSelectionModel::Select); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1); QVERIFY(view.getVisualRegionForSelection().isEmpty()); } @@ -1741,7 +1741,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes() QTRY_COMPARE(view.currentIndex(), model.index(1, 0)); QModelIndexList selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 3); + QCOMPARE(selected.size(), 3); QVERIFY(!selected.contains(model.index(0, 0))); } { // Second test: QListView::TopToBottom flow @@ -1768,7 +1768,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes() QTRY_COMPARE(view.currentIndex(), model.index(1, 0)); QModelIndexList selected = view.selectionModel()->selectedIndexes(); - QCOMPARE(selected.count(), 3); + QCOMPARE(selected.size(), 3); QVERIFY(!selected.contains(model.index(0, 0))); } } @@ -1830,7 +1830,7 @@ void tst_QListView::clickOnViewportClearsSelection() view.selectAll(); QModelIndex index = model.index(0); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1); QVERIFY(view.selectionModel()->isSelected(index)); //we try to click outside of the index @@ -1838,7 +1838,7 @@ void tst_QListView::clickOnViewportClearsSelection() QTest::mousePress(view.viewport(), Qt::LeftButton, {}, point); //at this point, the selection shouldn't have changed - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1); QVERIFY(view.selectionModel()->isSelected(index)); QTest::mouseRelease(view.viewport(), Qt::LeftButton, {}, point); @@ -1947,7 +1947,7 @@ void tst_QListView::taskQTBUG_435_deselectOnViewportClick() view.setModel(&model); view.setSelectionMode(QAbstractItemView::ExtendedSelection); view.selectAll(); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), model.rowCount()); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), model.rowCount()); const QRect itemRect = view.visualRect(model.index(model.rowCount() - 1)); @@ -1957,7 +1957,7 @@ void tst_QListView::taskQTBUG_435_deselectOnViewportClick() QVERIFY(!view.selectionModel()->hasSelection()); view.selectAll(); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), model.rowCount()); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), model.rowCount()); //and now the right button QTest::mouseClick(view.viewport(), Qt::RightButton, {}, p); @@ -3170,7 +3170,7 @@ void tst_QListView::scrollOnRemove() model.removeRow(25); // if nothing is selected now, then the view should not have scrolled - if (!view.selectionModel()->selectedIndexes().count()) + if (!view.selectionModel()->selectedIndexes().size()) QTRY_COMPARE(view.verticalScrollBar()->value(), item25Position); } diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index 5bdc3c9269..cbb0fdcc0c 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -346,7 +346,7 @@ void tst_QListWidget::addItems() QString::number(testWidget->count() + 3), label}; testWidget->addItems(stringList); - QCOMPARE(testWidget->count(), count + stringList.count()); + QCOMPARE(testWidget->count(), count + stringList.size()); QCOMPARE(testWidget->item(testWidget->count()-1)->text(), label); } @@ -358,30 +358,30 @@ void tst_QListWidget::openPersistentEditor() QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->openPersistentEditor(item); - int childCount = testWidget->viewport()->children().count(); + int childCount = testWidget->viewport()->children().size(); testWidget->addItem(item); testWidget->openPersistentEditor(item); - QCOMPARE(childCount + 1, testWidget->viewport()->children().count()); + QCOMPARE(childCount + 1, testWidget->viewport()->children().size()); } void tst_QListWidget::closePersistentEditor() { // Boundary checking - int childCount = testWidget->viewport()->children().count(); + int childCount = testWidget->viewport()->children().size(); testWidget->closePersistentEditor(nullptr); QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->closePersistentEditor(item); - QCOMPARE(childCount, testWidget->viewport()->children().count()); + QCOMPARE(childCount, testWidget->viewport()->children().size()); // Create something testWidget->addItem(item); testWidget->openPersistentEditor(item); // actual test - childCount = testWidget->viewport()->children().count(); + childCount = testWidget->viewport()->children().size(); testWidget->closePersistentEditor(item); QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); - QCOMPARE(testWidget->viewport()->children().count(), childCount - 1); + QCOMPARE(testWidget->viewport()->children().size(), childCount - 1); } void tst_QListWidget::setItemHidden() @@ -531,7 +531,7 @@ void tst_QListWidget::editItem() item->setFlags(item->flags() | Qt::ItemIsEditable); testWidget->addItem(item); - int childCount = testWidget->viewport()->children().count(); + int childCount = testWidget->viewport()->children().size(); QWidget *existsAlready = testWidget->indexWidget(testWidget->model()->index(testWidget->row(item), 0)); testWidget->editItem(item); Qt::ItemFlags flags = item->flags(); @@ -547,7 +547,7 @@ void tst_QListWidget::editItem() } QVERIFY(found); } else { - QCOMPARE(testWidget->viewport()->children().count(), childCount); + QCOMPARE(testWidget->viewport()->children().size(), childCount); } } @@ -576,8 +576,8 @@ void tst_QListWidget::insertItem_data() QTest::newRow("Insert less then 0") << initialItems << -1 << "inserted" << 0; QTest::newRow("Insert at 0") << initialItems << 0 << "inserted" << 0; - QTest::newRow("Insert beyond count") << initialItems << initialItems.count()+1 << "inserted" << initialItems.count(); - QTest::newRow("Insert at count") << initialItems << initialItems.count() << "inserted" << initialItems.count(); + QTest::newRow("Insert beyond count") << initialItems << initialItems.size()+1 << "inserted" << initialItems.size(); + QTest::newRow("Insert at count") << initialItems << initialItems.size() << "inserted" << initialItems.size(); QTest::newRow("Insert in the middle") << initialItems << 1 << "inserted" << 1; } @@ -589,7 +589,7 @@ void tst_QListWidget::insertItem() QFETCH(int, expectedIndex); testWidget->insertItems(0, initialItems); - QCOMPARE(testWidget->count(), initialItems.count()); + QCOMPARE(testWidget->count(), initialItems.size()); testWidget->insertItem(insertIndex, itemLabel); @@ -598,7 +598,7 @@ void tst_QListWidget::insertItem() QCOMPARE(rcFirst[RowsInserted], expectedIndex); QCOMPARE(rcLast[RowsInserted], expectedIndex); - QCOMPARE(testWidget->count(), initialItems.count() + 1); + QCOMPARE(testWidget->count(), initialItems.size() + 1); QCOMPARE(testWidget->item(expectedIndex)->text(), itemLabel); } @@ -671,8 +671,8 @@ void tst_QListWidget::insertItems() for (int i = 0; i < testWidget->count(); ++i) QCOMPARE(testWidget->item(i)->listWidget(), testWidget); - QCOMPARE(itemChangedSpy.count(), 0); - QCOMPARE(dataChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); + QCOMPARE(dataChangedSpy.size(), 0); } void tst_QListWidget::itemAssignment() @@ -845,7 +845,7 @@ void tst_QListWidget::selectedItems() // check that the correct number of items and the expected items are there QList selectedItems = testWidget->selectedItems(); - QCOMPARE(selectedItems.size(), expectedRows.count()); + QCOMPARE(selectedItems.size(), expectedRows.size()); for (int row : expectedRows) QVERIFY(selectedItems.contains(testWidget->item(row))); @@ -941,20 +941,20 @@ void tst_QListWidget::moveItemsPriv() else QCOMPARE(testWidget->item(dstRow)->text(), QString::number(srcRow)); - QCOMPARE(beginMoveSpy.count(), 1); + QCOMPARE(beginMoveSpy.size(), 1); const QList &beginMoveArgs = beginMoveSpy.takeFirst(); QCOMPARE(beginMoveArgs.at(1).toInt(), srcRow); QCOMPARE(beginMoveArgs.at(2).toInt(), srcRow); QCOMPARE(beginMoveArgs.at(4).toInt(), dstRow); - QCOMPARE(movedSpy.count(), 1); + QCOMPARE(movedSpy.size(), 1); const QList &movedArgs = movedSpy.takeFirst(); QCOMPARE(movedArgs.at(1).toInt(), srcRow); QCOMPARE(movedArgs.at(2).toInt(), srcRow); QCOMPARE(movedArgs.at(4).toInt(), dstRow); } else { - QCOMPARE(beginMoveSpy.count(), 0); - QCOMPARE(movedSpy.count(), 0); + QCOMPARE(beginMoveSpy.size(), 0); + QCOMPARE(movedSpy.size(), 0); } } @@ -1047,7 +1047,7 @@ void tst_QListWidget::sortItems() testWidget->sortItems(order); - QCOMPARE(testWidget->count(), expectedList.count()); + QCOMPARE(testWidget->count(), expectedList.size()); for (int i = 0; i < testWidget->count(); ++i) QCOMPARE(testWidget->item(i)->text(), expectedList.at(i).toString()); @@ -1117,7 +1117,7 @@ void tst_QListWidget::sortHiddenItems() tw->setSortingEnabled(true); tw->sortItems(order); - QCOMPARE(tw->count(), expectedList.count()); + QCOMPARE(tw->count(), expectedList.size()); for (int i = 0; i < tw->count(); ++i) { QCOMPARE(tw->item(i)->text(), expectedList.at(i)); QCOMPARE(tw->item(i)->isHidden(), !expectedVisibility.at(i)); @@ -1214,17 +1214,17 @@ void tst_QListWidget::setData() QFETCH(QVariantList, values); QFETCH(int, expectedSignalCount); - QCOMPARE(roles.count(), values.count()); + QCOMPARE(roles.size(), values.size()); for (int manipulateModel = 0; manipulateModel < 2; ++manipulateModel) { testWidget->clear(); testWidget->insertItems(0, initialItems); - QCOMPARE(testWidget->count(), initialItems.count()); + QCOMPARE(testWidget->count(), initialItems.size()); QSignalSpy itemChanged(testWidget, &QListWidget::itemChanged); QSignalSpy dataChanged(testWidget->model(), &QAbstractItemModel::dataChanged); - for (int i = 0; i < roles.count(); ++i) { + for (int i = 0; i < roles.size(); ++i) { if (manipulateModel) testWidget->model()->setData( testWidget->model()->index(itemIndex, 0, testWidget->rootIndex()), @@ -1235,12 +1235,12 @@ void tst_QListWidget::setData() } // make sure the data is actually set - for (int i = 0; i < roles.count(); ++i) + for (int i = 0; i < roles.size(); ++i) QCOMPARE(testWidget->item(itemIndex)->data(roles.at(i)), values.at(i)); // make sure we get the right number of emits - QCOMPARE(itemChanged.count(), expectedSignalCount); - QCOMPARE(dataChanged.count(), expectedSignalCount); + QCOMPARE(itemChanged.size(), expectedSignalCount); + QCOMPARE(dataChanged.size(), expectedSignalCount); } } @@ -1382,7 +1382,7 @@ void tst_QListWidget::insertItemsWithSorting() w.addItem(str); break; } - QCOMPARE(w.count(), expectedItems.count()); + QCOMPARE(w.count(), expectedItems.size()); for (int i = 0; i < w.count(); ++i) QCOMPARE(w.item(i)->text(), expectedItems.at(i)); @@ -1526,7 +1526,7 @@ void tst_QListWidget::changeDataWithSorting() QListWidgetItem *item = w.item(itemIndex); item->setText(newValue); - for (int i = 0; i < expectedItems.count(); ++i) { + for (int i = 0; i < expectedItems.size(); ++i) { QCOMPARE(w.item(i)->text(), expectedItems.at(i)); for (int j = 0; j < persistent.size(); ++j) { if (persistent.at(j).row() == i) // the same toplevel row @@ -1537,8 +1537,8 @@ void tst_QListWidget::changeDataWithSorting() for (int k = 0; k < persistent.size(); ++k) QCOMPARE(persistent.at(k).row(), expectedRows.at(k)); - QCOMPARE(dataChangedSpy.count(), 1); - QCOMPARE(layoutChangedSpy.count(), reorderingExpected ? 1 : 0); + QCOMPARE(dataChangedSpy.size(), 1); + QCOMPARE(layoutChangedSpy.size(), reorderingExpected ? 1 : 0); } void tst_QListWidget::itemWidget() @@ -1617,7 +1617,7 @@ void tst_QListWidget::insertUnchanged() QListWidget w; QSignalSpy itemChangedSpy(&w, &QListWidget::itemChanged); QListWidgetItem item("foo", &w); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); } void tst_QListWidget::setSortingEnabled() @@ -1708,12 +1708,12 @@ void tst_QListWidget::QTBUG8086_currentItemChangedOnClick() QVERIFY(QTest::qWaitForWindowExposed(&win)); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QTest::mouseClick(list.viewport(), Qt::LeftButton, {}, list.visualItemRect(list.item(2)).center()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } @@ -1812,14 +1812,14 @@ void tst_QListWidget::QTBUG50891_ensureSelectionModelSignalConnectionsAreSet() QSignalSpy currentItemChangedSpy(&list, &QListWidget::currentItemChanged); QSignalSpy itemSelectionChangedSpy(&list, &QListWidget::itemSelectionChanged); - QCOMPARE(currentItemChangedSpy.count(), 0); - QCOMPARE(itemSelectionChangedSpy.count(), 0); + QCOMPARE(currentItemChangedSpy.size(), 0); + QCOMPARE(itemSelectionChangedSpy.size(), 0); QTest::mouseClick(list.viewport(), Qt::LeftButton, {}, list.visualItemRect(list.item(2)).center()); - QCOMPARE(currentItemChangedSpy.count(), 1); - QCOMPARE(itemSelectionChangedSpy.count(), 1); + QCOMPARE(currentItemChangedSpy.size(), 1); + QCOMPARE(itemSelectionChangedSpy.size(), 1); } diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 01c2e99cdf..a489d893fe 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -503,7 +503,7 @@ void tst_QTableView::emptyModel() QSignalSpy spy(&model, &QtTestTableModel::invalidIndexEncountered); view.setModel(&model); view.show(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QTableView::removeRows_data() @@ -528,10 +528,10 @@ void tst_QTableView::removeRows() view.show(); model.removeLastRow(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); model.removeAllRows(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QTableView::removeColumns_data() @@ -556,10 +556,10 @@ void tst_QTableView::removeColumns() view.show(); model.removeLastColumn(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); model.removeAllColumns(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QTableView::keyboardNavigation_data() @@ -1597,7 +1597,7 @@ void tst_QTableView::selection() view.setSelection(QRect(x, y, width, height), command); - QCOMPARE(view.selectedIndexes().count(), selectedCount); + QCOMPARE(view.selectedIndexes().size(), selectedCount); } void tst_QTableView::selectRow_data() @@ -1710,12 +1710,12 @@ void tst_QTableView::selectRow() view.setSelectionMode(mode); view.setSelectionBehavior(behavior); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 0); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 0); view.selectRow(row); //test we have 10 items selected - QCOMPARE(view.selectionModel()->selectedIndexes().count(), selectedItems); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), selectedItems); //test that all 10 items are in the same row for (int i = 0; selectedItems > 0 && i < rowCount; ++i) QCOMPARE(view.selectionModel()->selectedIndexes().at(i).row(), row); @@ -1831,11 +1831,11 @@ void tst_QTableView::selectColumn() view.setSelectionMode(mode); view.setSelectionBehavior(behavior); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), 0); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 0); view.selectColumn(column); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), selectedItems); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), selectedItems); for (int i = 0; selectedItems > 0 && i < columnCount; ++i) QCOMPARE(view.selectionModel()->selectedIndexes().at(i).column(), column); } @@ -1980,22 +1980,22 @@ void tst_QTableView::selectall() // try slot first view.clearSelection(); - QCOMPARE(view.selectedIndexes().count(), 0); + QCOMPARE(view.selectedIndexes().size(), 0); view.selectAll(); - QCOMPARE(view.selectedIndexes().count(), selectedCount); + QCOMPARE(view.selectedIndexes().size(), selectedCount); // try by key sequence view.clearSelection(); - QCOMPARE(view.selectedIndexes().count(), 0); + QCOMPARE(view.selectedIndexes().size(), 0); QTest__keySequence(&view, QKeySequence(QKeySequence::SelectAll)); - QCOMPARE(view.selectedIndexes().count(), selectedCount); + QCOMPARE(view.selectedIndexes().size(), selectedCount); // check again with no selection mode view.clearSelection(); view.setSelectionMode(QAbstractItemView::NoSelection); - QCOMPARE(view.selectedIndexes().count(), 0); + QCOMPARE(view.selectedIndexes().size(), 0); QTest__keySequence(&view, QKeySequence(QKeySequence::SelectAll)); - QCOMPARE(view.selectedIndexes().count(), 0); + QCOMPARE(view.selectedIndexes().size(), 0); } #endif // QT_CONFIG(shortcut) @@ -2188,7 +2188,7 @@ void tst_QTableView::resizeRowsToContents() QSignalSpy resizedSpy(view.verticalHeader(), &QHeaderView::sectionResized); view.resizeRowsToContents(); - QCOMPARE(resizedSpy.count(), model.rowCount()); + QCOMPARE(resizedSpy.size(), model.rowCount()); for (int r = 0; r < model.rowCount(); ++r) QCOMPARE(view.rowHeight(r), rowHeight); } @@ -2234,7 +2234,7 @@ void tst_QTableView::resizeColumnsToContents() QSignalSpy resizedSpy(view.horizontalHeader(), &QHeaderView::sectionResized); view.resizeColumnsToContents(); - QCOMPARE(resizedSpy.count(), model.columnCount()); + QCOMPARE(resizedSpy.size(), model.columnCount()); for (int c = 0; c < model.columnCount(); ++c) QCOMPARE(view.columnWidth(c), columnWidth); } @@ -2348,7 +2348,7 @@ void tst_QTableView::rowAt() for (int r = 0; r < rowCount; ++r) view.setRowHeight(r, rowHeight); - for (int i = 0; i < hiddenRows.count(); ++i) + for (int i = 0; i < hiddenRows.size(); ++i) view.hideRow(hiddenRows.at(i)); QCOMPARE(view.rowAt(coordinate), row); @@ -2511,7 +2511,7 @@ void tst_QTableView::columnAt() for (int c = 0; c < columnCount; ++c) view.setColumnWidth(c, columnWidth); - for (int i = 0; i < hiddenColumns.count(); ++i) + for (int i = 0; i < hiddenColumns.size(); ++i) view.hideColumn(hiddenColumns.at(i)); QCOMPARE(view.columnAt(coordinate), column); diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index 4a20349c00..02d93bd356 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp @@ -360,7 +360,7 @@ void tst_QTableWidget::takeItem() QCOMPARE(item->text(), QString::number(row * column + column)); delete item; - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); const QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 2); QCOMPARE(arguments.at(0).toInt(), row); @@ -542,7 +542,7 @@ void tst_QTableWidget::selectedItems() // check that the correct number of items and the expected items are there const QList selectedItems = testWidget->selectedItems(); - QCOMPARE(selectedItems.size(), expectedItems.count()); + QCOMPARE(selectedItems.size(), expectedItems.size()); for (const auto &intPair : expectedItems) QVERIFY(selectedItems.contains(testWidget->item(intPair.first, intPair.second))); @@ -1194,15 +1194,15 @@ void tst_QTableWidget::sortItems() persistent << model->index(r, sortColumn, QModelIndex()); } - for (int h = 0; h < initialHidden.count(); ++h) + for (int h = 0; h < initialHidden.size(); ++h) testWidget->hideRow(initialHidden.at(h)); - QCOMPARE(testWidget->verticalHeader()->hiddenSectionCount(), initialHidden.count()); + QCOMPARE(testWidget->verticalHeader()->hiddenSectionCount(), initialHidden.size()); testWidget->sortItems(sortColumn, sortOrder); int te = 0; - for (int i = 0; i < rows.count(); ++i) { + for (int i = 0; i < rows.size(); ++i) { for (int j = 0; j < columnCount; ++j) { QString value; QTableWidgetItem *itm = testWidget->item(i, j); @@ -1216,7 +1216,7 @@ void tst_QTableWidget::sortItems() // << "expected" << rows.at(i); } - for (int k = 0; k < expectedHidden.count(); ++k) + for (int k = 0; k < expectedHidden.size(); ++k) QVERIFY(testWidget->isRowHidden(expectedHidden.at(k))); } @@ -1404,11 +1404,11 @@ void tst_QTableWidget::setItemWithSorting() } if (i == 0) - QCOMPARE(dataChangedSpy.count(), reorderingExpected ? 0 : 1); + QCOMPARE(dataChangedSpy.size(), reorderingExpected ? 0 : 1); else - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); - QCOMPARE(layoutChangedSpy.count(), reorderingExpected ? 1 : 0); + QCOMPARE(layoutChangedSpy.size(), reorderingExpected ? 1 : 0); } } @@ -1457,7 +1457,7 @@ void tst_QTableWidget::setItemData() QTableWidgetItem *item = new QTableWidgetItem; table.setItem(0, 0, item); - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); QModelIndex idx = qvariant_cast(dataChangedSpy.takeFirst().at(0)); QMap data; @@ -1469,7 +1469,7 @@ void tst_QTableWidget::setItemData() QCOMPARE(table.model()->data(idx, Qt::DisplayRole).toString(), QLatin1String("Display")); QCOMPARE(table.model()->data(idx, Qt::EditRole).toString(), QLatin1String("Display")); QCOMPARE(table.model()->data(idx, Qt::ToolTipRole).toString(), QLatin1String("ToolTip")); - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); QCOMPARE(idx, qvariant_cast(dataChangedSpy.first().at(0))); QCOMPARE(idx, qvariant_cast(dataChangedSpy.first().at(1))); const auto roles = qvariant_cast>(dataChangedSpy.first().at(2)); @@ -1480,13 +1480,13 @@ void tst_QTableWidget::setItemData() dataChangedSpy.clear(); table.model()->setItemData(idx, data); - QCOMPARE(dataChangedSpy.count(), 0); + QCOMPARE(dataChangedSpy.size(), 0); data.clear(); data.insert(Qt::DisplayRole, QLatin1String("dizplaye")); table.model()->setItemData(idx, data); QCOMPARE(table.model()->data(idx, Qt::DisplayRole).toString(), QLatin1String("dizplaye")); - QCOMPARE(dataChangedSpy.count(), 1); + QCOMPARE(dataChangedSpy.size(), 1); QCOMPARE(QList({ Qt::DisplayRole, Qt::EditRole }), qvariant_cast>(dataChangedSpy.first().at(2))); @@ -1649,7 +1649,7 @@ void tst_QTableWidget::task262056_sortDuplicate() QSignalSpy layoutChangedSpy(testWidget->model(), &QAbstractItemModel::layoutChanged); testWidget->item(3,0)->setBackground(Qt::red); - QCOMPARE(layoutChangedSpy.count(),0); + QCOMPARE(layoutChangedSpy.size(),0); } diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index ca3d2d69da..4dabf50ac7 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -1281,7 +1281,7 @@ void tst_QTreeView::setModel() QCOMPARE(view.header()->model(), model); QCOMPARE(view.selectionModel() != oldSelectionModel, (i == 0)); } - QTRY_COMPARE(modelDestroyedSpy.count(), 0); + QTRY_COMPARE(modelDestroyedSpy.size(), 0); view.setModel(nullptr); QCOMPARE(view.model(), nullptr); @@ -1336,7 +1336,7 @@ void tst_QTreeView::setHeader() Qt::Orientation orient = x ? Qt::Vertical : Qt::Horizontal; QHeaderView *head = new QHeaderView(orient); view.setHeader(head); - QCOMPARE(destroyedSpy.count(), 1); + QCOMPARE(destroyedSpy.size(), 1); QCOMPARE(head->parent(), &view); QCOMPARE(view.header(), head); view.setHeader(head); @@ -1519,10 +1519,10 @@ void tst_QTreeView::limitedExpand() QVERIFY(spy.isValid()); view.expand(model.index(0, 0)); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); view.expand(model.index(1, 0)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } { QStringListModel model(QStringList() << "one" << "two"); @@ -1533,9 +1533,9 @@ void tst_QTreeView::limitedExpand() QVERIFY(spy.isValid()); view.expand(model.index(0, 0)); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); view.expandAll(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } } @@ -1574,58 +1574,58 @@ void tst_QTreeView::expandAndCollapse() view.expand(QModelIndex()); QCOMPARE(view.isExpanded(QModelIndex()), false); view.collapse(QModelIndex()); - QCOMPARE(expandedSpy.count(), 0); - QCOMPARE(collapsedSpy.count(), 0); + QCOMPARE(expandedSpy.size(), 0); + QCOMPARE(collapsedSpy.size(), 0); // expand a first level item QVERIFY(!view.isExpanded(a)); view.expand(a); QVERIFY(view.isExpanded(a)); - QCOMPARE(expandedSpy.count(), 1); - QCOMPARE(collapsedSpy.count(), 0); + QCOMPARE(expandedSpy.size(), 1); + QCOMPARE(collapsedSpy.size(), 0); args = expandedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), a); view.expand(a); QVERIFY(view.isExpanded(a)); - QCOMPARE(expandedSpy.count(), 0); - QCOMPARE(collapsedSpy.count(), 0); + QCOMPARE(expandedSpy.size(), 0); + QCOMPARE(collapsedSpy.size(), 0); // expand a second level item QVERIFY(!view.isExpanded(b)); view.expand(b); QVERIFY(view.isExpanded(a)); QVERIFY(view.isExpanded(b)); - QCOMPARE(expandedSpy.count(), 1); - QCOMPARE(collapsedSpy.count(), 0); + QCOMPARE(expandedSpy.size(), 1); + QCOMPARE(collapsedSpy.size(), 0); args = expandedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), b); view.expand(b); QVERIFY(view.isExpanded(b)); - QCOMPARE(expandedSpy.count(), 0); - QCOMPARE(collapsedSpy.count(), 0); + QCOMPARE(expandedSpy.size(), 0); + QCOMPARE(collapsedSpy.size(), 0); // collapse the first level item view.collapse(a); QVERIFY(!view.isExpanded(a)); QVERIFY(view.isExpanded(b)); - QCOMPARE(expandedSpy.count(), 0); - QCOMPARE(collapsedSpy.count(), 1); + QCOMPARE(expandedSpy.size(), 0); + QCOMPARE(collapsedSpy.size(), 1); args = collapsedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), a); view.collapse(a); QVERIFY(!view.isExpanded(a)); - QCOMPARE(expandedSpy.count(), 0); - QCOMPARE(collapsedSpy.count(), 0); + QCOMPARE(expandedSpy.size(), 0); + QCOMPARE(collapsedSpy.size(), 0); // expand the first level item again view.expand(a); QVERIFY(view.isExpanded(a)); QVERIFY(view.isExpanded(b)); - QCOMPARE(expandedSpy.count(), 1); - QCOMPARE(collapsedSpy.count(), 0); + QCOMPARE(expandedSpy.size(), 1); + QCOMPARE(collapsedSpy.size(), 0); args = expandedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), a); @@ -1633,8 +1633,8 @@ void tst_QTreeView::expandAndCollapse() view.collapse(b); QVERIFY(view.isExpanded(a)); QVERIFY(!view.isExpanded(b)); - QCOMPARE(expandedSpy.count(), 0); - QCOMPARE(collapsedSpy.count(), 1); + QCOMPARE(expandedSpy.size(), 0); + QCOMPARE(collapsedSpy.size(), 1); args = collapsedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), b); @@ -1642,8 +1642,8 @@ void tst_QTreeView::expandAndCollapse() view.collapse(a); QVERIFY(!view.isExpanded(a)); QVERIFY(!view.isExpanded(b)); - QCOMPARE(expandedSpy.count(), 0); - QCOMPARE(collapsedSpy.count(), 1); + QCOMPARE(expandedSpy.size(), 0); + QCOMPARE(collapsedSpy.size(), 1); args = collapsedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), a); @@ -1655,8 +1655,8 @@ void tst_QTreeView::expandAndCollapse() QVERIFY(view.isExpanded(a)); QVERIFY(view.isExpanded(b)); QVERIFY(!view.isExpanded(c)); - QCOMPARE(expandedSpy.count(), 2); - QCOMPARE(collapsedSpy.count(), 0); + QCOMPARE(expandedSpy.size(), 2); + QCOMPARE(collapsedSpy.size(), 0); args = expandedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), a); args = expandedSpy.takeFirst(); @@ -1667,8 +1667,8 @@ void tst_QTreeView::expandAndCollapse() QVERIFY(!view.isExpanded(a)); QVERIFY(!view.isExpanded(b)); QVERIFY(!view.isExpanded(c)); - QCOMPARE(expandedSpy.count(), 0); - QCOMPARE(collapsedSpy.count(), 2); + QCOMPARE(expandedSpy.size(), 0); + QCOMPARE(collapsedSpy.size(), 2); args = collapsedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), a); args = collapsedSpy.takeFirst(); @@ -1730,22 +1730,22 @@ void tst_QTreeView::expandAndCollapseAll() view.expandAll(); checkExpandState(model, view, QModelIndex(), true, &count); - QCOMPARE(collapsedSpy.count(), 0); - QCOMPARE(expandedSpy.count(), 39); // == 3 (first) + 9 (second) + 27 (third level) + QCOMPARE(collapsedSpy.size(), 0); + QCOMPARE(expandedSpy.size(), 39); // == 3 (first) + 9 (second) + 27 (third level) QCOMPARE(count, 39); collapsedSpy.clear(); expandedSpy.clear(); view.collapseAll(); checkExpandState(model, view, QModelIndex(), false, &count); - QCOMPARE(collapsedSpy.count(), 39); - QCOMPARE(expandedSpy.count(), 0); + QCOMPARE(collapsedSpy.size(), 39); + QCOMPARE(expandedSpy.size(), 0); QCOMPARE(count, 39); collapsedSpy.clear(); expandedSpy.clear(); view.expandRecursively(model.index(0, 0)); - QCOMPARE(expandedSpy.count(), 13); // 1 + 3 + 9 + QCOMPARE(expandedSpy.size(), 13); // 1 + 3 + 9 checkExpandState(model, view, model.index(0, 0), true, &count); QCOMPARE(count, 13); @@ -1757,9 +1757,9 @@ void tst_QTreeView::expandAndCollapseAll() expandedSpy.clear(); view.collapseAll(); view.expandRecursively(model.index(0, 0), 1); - QCOMPARE(expandedSpy.count(), 4); // 1 + 3 + QCOMPARE(expandedSpy.size(), 4); // 1 + 3 view.expandRecursively(model.index(0, 0), 2); - QCOMPARE(expandedSpy.count(), 13); // (1 + 3) + 9 + QCOMPARE(expandedSpy.size(), 13); // (1 + 3) + 9 checkExpandState(model, view, model.index(0, 0), true, &count); QCOMPARE(count, 13); @@ -2045,7 +2045,7 @@ void tst_QTreeView::setSelection() QVERIFY(selectionModel); const QModelIndexList selectedIndexes = selectionModel->selectedIndexes(); - QCOMPARE(selectedIndexes.count(), expectedItems.count()); + QCOMPARE(selectedIndexes.size(), expectedItems.size()); for (const QModelIndex &idx : selectedIndexes) QVERIFY(expectedItems.contains(QPoint(idx.column(), idx.row()))); } @@ -2149,7 +2149,7 @@ void tst_QTreeView::clicked() continue; QSignalSpy spy(&view, &QTreeView::clicked); QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, p); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); } } @@ -2230,7 +2230,7 @@ void tst_QTreeView::rowsAboutToBeRemoved() model.removeRows(1,1); QCOMPARE((view.state()), 0); // Should not be 5 (or any other number for that sake :) - QCOMPARE(spy1.count(), 1); + QCOMPARE(spy1.size(), 1); } @@ -2542,28 +2542,28 @@ void tst_QTreeView::selectionWithHiddenItems() //child should not be selected as it is hidden (its parent is not expanded) view.selectAll(); - QCOMPARE(view.selectionModel()->selection().count(), 1); //one range - QCOMPARE(view.selectionModel()->selectedRows().count(), 4); + QCOMPARE(view.selectionModel()->selection().size(), 1); //one range + QCOMPARE(view.selectionModel()->selectedRows().size(), 4); view.expandAll(); QVERIFY(view.isExpanded(item1.index())); - QCOMPARE(view.selectionModel()->selection().count(), 1); - QCOMPARE(view.selectionModel()->selectedRows().count(), 4); + QCOMPARE(view.selectionModel()->selection().size(), 1); + QCOMPARE(view.selectionModel()->selectedRows().size(), 4); QVERIFY( !view.selectionModel()->isSelected(model.indexFromItem(&child))); view.clearSelection(); QVERIFY(view.isExpanded(item1.index())); //child should be selected as it is visible (its parent is expanded) view.selectAll(); - QCOMPARE(view.selectionModel()->selection().count(), 2); - QCOMPARE(view.selectionModel()->selectedRows().count(), 5); //everything is selected + QCOMPARE(view.selectionModel()->selection().size(), 2); + QCOMPARE(view.selectionModel()->selectedRows().size(), 5); //everything is selected view.clearSelection(); //we hide the node with a child (there should then be 3 items selected in 2 ranges) view.setRowHidden(1, QModelIndex(), true); QVERIFY(view.isExpanded(item1.index())); view.selectAll(); - QCOMPARE(view.selectionModel()->selection().count(), 2); - QCOMPARE(view.selectionModel()->selectedRows().count(), 3); + QCOMPARE(view.selectionModel()->selection().size(), 2); + QCOMPARE(view.selectionModel()->selectedRows().size(), 3); QVERIFY(!view.selectionModel()->isSelected(model.indexFromItem(&item1))); QVERIFY(!view.selectionModel()->isSelected(model.indexFromItem(&child))); @@ -2576,8 +2576,8 @@ void tst_QTreeView::selectionWithHiddenItems() QVERIFY(view.isExpanded(item1.index())); view.selectAll(); QVERIFY(view.isExpanded(item1.index())); - QCOMPARE(view.selectionModel()->selection().count(), 3); - QCOMPARE(view.selectionModel()->selectedRows().count(), 4); + QCOMPARE(view.selectionModel()->selection().size(), 3); + QCOMPARE(view.selectionModel()->selectedRows().size(), 4); QVERIFY( !view.selectionModel()->isSelected(model.indexFromItem(&item2))); view.setRowHidden(2, QModelIndex(), false); QVERIFY(view.isExpanded(item1.index())); @@ -2592,21 +2592,21 @@ void tst_QTreeView::selectAll() view2.setSelectionMode(QAbstractItemView::ExtendedSelection); view2.selectAll(); // Should work with an empty model //everything should be selected since we are in ExtendedSelection mode - QCOMPARE(view2.selectedIndexes().count(), model.rowCount() * model.columnCount()); + QCOMPARE(view2.selectedIndexes().size(), model.rowCount() * model.columnCount()); for (int i = 0; i < model.rowCount(); ++i) model.setData(model.index(i,0), QLatin1String("row ") + QString::number(i)); QTreeView view; view.setModel(&model); - int selectedCount = view.selectedIndexes().count(); + int selectedCount = view.selectedIndexes().size(); view.selectAll(); - QCOMPARE(view.selectedIndexes().count(), selectedCount); + QCOMPARE(view.selectedIndexes().size(), selectedCount); QTreeView view3; view3.setModel(&model); view3.setSelectionMode(QAbstractItemView::NoSelection); view3.selectAll(); - QCOMPARE(view3.selectedIndexes().count(), 0); + QCOMPARE(view3.selectedIndexes().size(), 0); } void tst_QTreeView::extendedSelection_data() @@ -2632,7 +2632,7 @@ void tst_QTreeView::extendedSelection() topLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); QTest::mousePress(view.viewport(), Qt::LeftButton, {}, mousePressPos); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), selectedCount); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), selectedCount); } void tst_QTreeView::rowSizeHint() @@ -2914,7 +2914,7 @@ public: emit layoutAboutToBeChanged(); QModelIndexList oldList = persistentIndexList(); QList> oldListPath; - for (int i = 0; i < oldList.count(); ++i) { + for (int i = 0; i < oldList.size(); ++i) { QModelIndex idx = oldList.at(i); QStack path; while (idx.isValid()) { @@ -3536,7 +3536,7 @@ void tst_QTreeView::task174627_moveLeftToRoot() QSignalSpy spy(&view, &task174627_TreeView::signalCurrentChanged); QTest::keyClick(&view, Qt::Key_Left); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QTreeView::task171902_expandWith1stColHidden() @@ -4042,7 +4042,7 @@ void tst_QTreeView::task248022_changeSelection() &view, &TreeView::handleSelectionChanged); QTest::mouseClick(view.viewport(), Qt::LeftButton, {}, view.visualRect(model.index(1)).center()); - QCOMPARE(view.selectionModel()->selectedIndexes().count(), list.count()); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), list.size()); } void tst_QTreeView::task245654_changeModelAndExpandAll() @@ -4091,7 +4091,7 @@ void tst_QTreeView::doubleClickedWithSpans() QTest::mousePress(view.viewport(), Qt::LeftButton, {}, p); QTest::mouseDClick(view.viewport(), Qt::LeftButton, {}, p); QTest::mouseRelease(view.viewport(), Qt::LeftButton, {}, p); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); //let's click on the 2nd column p.setX(p.x() + view.header()->sectionSize(0)); @@ -4102,7 +4102,7 @@ void tst_QTreeView::doubleClickedWithSpans() QTest::mousePress(view.viewport(), Qt::LeftButton, {}, p); QTest::mouseDClick(view.viewport(), Qt::LeftButton, {}, p); QTest::mouseRelease(view.viewport(), Qt::LeftButton, {}, p); - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE(spy.size(), 2); } void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden() diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 3d31422bd4..03c36260c1 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -378,12 +378,12 @@ void tst_QTreeWidget::currentItem() tree.setCurrentItem(item); QCOMPARE(tree.currentItem(), item); - QCOMPARE(currentItemChangedSpy.count(), 1); + QCOMPARE(currentItemChangedSpy.size(), 1); QVariantList args = currentItemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), previous); - QCOMPARE(itemSelectionChangedSpy.count(), 1); + QCOMPARE(itemSelectionChangedSpy.size(), 1); itemSelectionChangedSpy.clear(); previous = item; @@ -396,15 +396,15 @@ void tst_QTreeWidget::currentItem() if (!currentItemChangedSpy.isEmpty()) { // ### we get a currentItemChanged() when what really // changed was just currentColumn(). Should it be like this? - QCOMPARE(currentItemChangedSpy.count(), 1); + QCOMPARE(currentItemChangedSpy.size(), 1); QVariantList args = currentItemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), item); if (tree.selectionBehavior() == QAbstractItemView::SelectItems) { - QCOMPARE(itemSelectionChangedSpy.count(), 1); + QCOMPARE(itemSelectionChangedSpy.size(), 1); itemSelectionChangedSpy.clear(); } else { - QCOMPARE(itemSelectionChangedSpy.count(), 0); + QCOMPARE(itemSelectionChangedSpy.size(), 0); } } } @@ -464,7 +464,7 @@ void tst_QTreeWidget::editItem() QTest::keyClick(editor, Qt::Key_A); QTest::keyClick(editor, Qt::Key_Enter); QCoreApplication::processEvents(); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); QVariantList args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), col); @@ -620,7 +620,7 @@ void tst_QTreeWidget::setItemHidden2() { // From Task 78587 const QStringList hl({"ID", "Desc"}); - testWidget->setColumnCount(hl.count()); + testWidget->setColumnCount(hl.size()); testWidget->setHeaderLabels(hl); testWidget->setSortingEnabled(true); @@ -821,7 +821,7 @@ void tst_QTreeWidget::selectedItems() // check selectedItems const auto sel = testWidget->selectedItems(); - QCOMPARE(sel.size(), expectedItems.count()); + QCOMPARE(sel.size(), expectedItems.size()); for (const auto &itemPath : expectedItems) { QTreeWidgetItem *item = nullptr; for (int index : itemPath) { @@ -1092,7 +1092,7 @@ void tst_QTreeWidget::findItems() Qt::MatchExactly|Qt::MatchRecursive); QCOMPARE(result.size(), resultCount); - for (int k = 0; k < result.size() && k < resultText.count(); ++k) + for (int k = 0; k < result.size() && k < resultText.size(); ++k) QCOMPARE(result.at(k)->text(column), resultText.at(k)); } @@ -1177,16 +1177,16 @@ void tst_QTreeWidget::sortItems() testWidget->sortItems(column, order); QCOMPARE(testWidget->sortColumn(), column); - for (int k = 0; k < topLevelResult.count(); ++k) { + for (int k = 0; k < topLevelResult.size(); ++k) { QTreeWidgetItem *item = testWidget->topLevelItem(k); QCOMPARE(item->text(column), topLevelResult.at(k)); - for (int l = 0; l < childResult.count(); ++l) + for (int l = 0; l < childResult.size(); ++l) QCOMPARE(item->child(l)->text(column), childResult.at(l)); } - for (int m = 0; m < tops.count(); ++m) + for (int m = 0; m < tops.size(); ++m) QCOMPARE(tops.at(m).row(), expectedTopRows.at(m)); - for (int n = 0; n < children.count(); ++n) + for (int n = 0; n < children.size(); ++n) QCOMPARE(children.at(n).row(), expectedChildRows.at(n)); } @@ -1346,17 +1346,17 @@ void tst_QTreeWidget::insertTopLevelItems_data() const QStringList insert{ "baz" }; QTest::newRow("Insert at count") << initial << insert - << initial.count() << initial.count() - << initial.count() << initial.count(); + << initial.size() << initial.size() + << initial.size() << initial.size(); QTest::newRow("Insert in the middle") << initial << insert - << (initial.count() / 2) << (initial.count() / 2) - << (initial.count() / 2) << (initial.count() / 2); + << (initial.size() / 2) << (initial.size() / 2) + << (initial.size() / 2) << (initial.size() / 2); QTest::newRow("Insert less than 0") << initial << insert << -1 << -1 << -1 << -1; QTest::newRow("Insert beyond count") << initial << insert - << initial.count() + 1 << -1 - << initial.count() + 1 << -1; + << initial.size() + 1 << -1 + << initial.size() + 1 << -1; } void tst_QTreeWidget::insertTopLevelItems() @@ -1371,26 +1371,26 @@ void tst_QTreeWidget::insertTopLevelItems() { // insert the initial items QCOMPARE(testWidget->topLevelItemCount(), 0); - for (int i = 0; i < initialText.count(); ++i) { + for (int i = 0; i < initialText.size(); ++i) { QTreeWidgetItem *top = new QTreeWidgetItem(QStringList(initialText.at(i))); testWidget->addTopLevelItem(top); QCOMPARE(testWidget->indexOfTopLevelItem(top), i); } - QCOMPARE(testWidget->topLevelItemCount(), initialText.count()); + QCOMPARE(testWidget->topLevelItemCount(), initialText.size()); } { // test adding children QTreeWidgetItem *topLevel = testWidget->topLevelItem(0); - for (int i = 0; i < initialText.count(); ++i) + for (int i = 0; i < initialText.size(); ++i) topLevel->addChild(new QTreeWidgetItem(QStringList(initialText.at(i)))); - QCOMPARE(topLevel->childCount(), initialText.count()); + QCOMPARE(topLevel->childCount(), initialText.size()); } { // test adding more top level items QTreeWidgetItem *topsy = new QTreeWidgetItem(QStringList(insertText.at(0))); testWidget->insertTopLevelItem(insertTopLevelIndex, topsy); if (expectedTopLevelIndex == -1) { - QCOMPARE(testWidget->topLevelItemCount(), initialText.count()); + QCOMPARE(testWidget->topLevelItemCount(), initialText.size()); delete topsy; } else { QTreeWidgetItem *item = testWidget->topLevelItem(expectedTopLevelIndex); @@ -1406,7 +1406,7 @@ void tst_QTreeWidget::insertTopLevelItems() QTreeWidgetItem *child = new QTreeWidgetItem(QStringList(insertText.at(0))); topLevel->insertChild(insertChildIndex, child); if (expectedChildIndex == -1) { - QCOMPARE(topLevel->childCount(), initialText.count()); + QCOMPARE(topLevel->childCount(), initialText.size()); delete child; } else { QTreeWidgetItem *item = topLevel->child(expectedChildIndex); @@ -1592,7 +1592,7 @@ void tst_QTreeWidget::scrollToItem() void tst_QTreeWidget::setSortingEnabled() { const QStringList hl{ "ID" }; - testWidget->setColumnCount(hl.count()); + testWidget->setColumnCount(hl.size()); testWidget->setHeaderLabels(hl); QTreeWidgetItem *item1 = new QTreeWidgetItem(testWidget); @@ -1719,9 +1719,9 @@ void tst_QTreeWidget::setData() QSignalSpy itemChangedSpy( testWidget, &QTreeWidget::itemChanged); headerItem->setText(0, "test"); - QCOMPARE(dataChangedSpy.count(), 0); - QCOMPARE(headerDataChangedSpy.count(), 1); - QCOMPARE(itemChangedSpy.count(), 0); // no itemChanged() signal for header item + QCOMPARE(dataChangedSpy.size(), 0); + QCOMPARE(headerDataChangedSpy.size(), 1); + QCOMPARE(itemChangedSpy.size(), 0); // no itemChanged() signal for header item headerItem->setData(-1, -1, QVariant()); } @@ -1739,24 +1739,24 @@ void tst_QTreeWidget::setData() const QString text = QLatin1String("text ") + iS; item->setText(j, text); QCOMPARE(item->text(j), text); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setText(j, text); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); QPixmap pixmap(32, 32); pixmap.fill((i == 1) ? Qt::red : Qt::green); QIcon icon(pixmap); item->setIcon(j, icon); QCOMPARE(item->icon(j), icon); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setIcon(j, icon); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); @@ -1764,94 +1764,94 @@ void tst_QTreeWidget::setData() const QString toolTip = QLatin1String("toolTip ") + iS; item->setToolTip(j, toolTip); QCOMPARE(item->toolTip(j), toolTip); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setToolTip(j, toolTip); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); const QString statusTip = QLatin1String("statusTip ") + iS; item->setStatusTip(j, statusTip); QCOMPARE(item->statusTip(j), statusTip); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setStatusTip(j, statusTip); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); const QString whatsThis = QLatin1String("whatsThis ") + iS; item->setWhatsThis(j, whatsThis); QCOMPARE(item->whatsThis(j), whatsThis); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setWhatsThis(j, whatsThis); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); QSize sizeHint(64*i, 48*i); item->setSizeHint(j, sizeHint); QCOMPARE(item->sizeHint(j), sizeHint); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setSizeHint(j, sizeHint); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); QFont font; item->setFont(j, font); QCOMPARE(item->font(j), font); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setFont(j, font); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); Qt::Alignment textAlignment((i == 1) ? Qt::AlignLeft|Qt::AlignVCenter : Qt::AlignRight); item->setTextAlignment(j, textAlignment); QCOMPARE(item->textAlignment(j), int(textAlignment)); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setTextAlignment(j, textAlignment); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); QColor backgroundColor((i == 1) ? Qt::blue : Qt::yellow); item->setBackground(j, backgroundColor); QCOMPARE(item->background(j).color(), backgroundColor); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setBackground(j, backgroundColor); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); const QColor foregroundColor((i == 1) ? Qt::green : Qt::cyan); item->setForeground(j, foregroundColor); QCOMPARE(item->foreground(j), foregroundColor); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setForeground(j, foregroundColor); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); Qt::CheckState checkState((i == 1) ? Qt::PartiallyChecked : Qt::Checked); item->setCheckState(j, checkState); QCOMPARE(item->checkState(j), checkState); - QCOMPARE(itemChangedSpy.count(), 1); + QCOMPARE(itemChangedSpy.size(), 1); args = itemChangedSpy.takeFirst(); QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setCheckState(j, checkState); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); QCOMPARE(item->text(j), text); QCOMPARE(item->icon(j), icon); @@ -1884,7 +1884,7 @@ void tst_QTreeWidget::setData() QCOMPARE(qvariant_cast(args.at(0)), item); QCOMPARE(qvariant_cast(args.at(1)), j); item->setBackground(j, pixmap); - QCOMPARE(itemChangedSpy.count(), 0); + QCOMPARE(itemChangedSpy.size(), 0); item->setData(j, Qt::DisplayRole, QVariant()); item->setData(j, Qt::DecorationRole, QVariant()); @@ -1897,7 +1897,7 @@ void tst_QTreeWidget::setData() item->setData(j, Qt::BackgroundRole, QVariant()); item->setData(j, Qt::ForegroundRole, QVariant()); item->setData(j, Qt::CheckStateRole, QVariant()); - QCOMPARE(itemChangedSpy.count(), 11); + QCOMPARE(itemChangedSpy.size(), 11); itemChangedSpy.clear(); QCOMPARE(item->data(j, Qt::DisplayRole).toString(), QString()); @@ -2033,7 +2033,7 @@ void tst_QTreeWidget::setHeaderLabels() { QStringList list = QString("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z").split(QLatin1Char(',')); testWidget->setHeaderLabels(list); - QCOMPARE(testWidget->header()->count(), list.count()); + QCOMPARE(testWidget->header()->count(), list.size()); } void tst_QTreeWidget::setHeaderItem() @@ -2263,11 +2263,11 @@ void tst_QTreeWidget::insertItemsWithSorting() w.addTopLevelItem(new QTreeWidgetItem({ txt })); break; } - QCOMPARE(w.topLevelItemCount(), expectedItems.count()); + QCOMPARE(w.topLevelItemCount(), expectedItems.size()); for (int i = 0; i < w.topLevelItemCount(); ++i) QCOMPARE(w.topLevelItem(i)->text(0), expectedItems.at(i)); - for (int k = 0; k < persistent.count(); ++k) + for (int k = 0; k < persistent.size(); ++k) QCOMPARE(persistent.at(k).row(), expectedRows.at(k)); } } @@ -2308,10 +2308,10 @@ void tst_QTreeWidget::insertExpandedItemsWithSorting() QTreeWidgetItem *child = new QTreeWidgetItem(parent, {text}); items << child; } - QCOMPARE(parent->childCount(), childTexts.count()); + QCOMPARE(parent->childCount(), childTexts.size()); QVERIFY(parent->isExpanded()); } - QCOMPARE(tree.model()->rowCount(), parentTexts.count()); + QCOMPARE(tree.model()->rowCount(), parentTexts.size()); // verify that the items are still expanded for (const QTreeWidgetItem *item : std::as_const(items)) { @@ -2332,10 +2332,10 @@ void tst_QTreeWidget::insertExpandedItemsWithSorting() PersistentModelIndexVec children; for (int i = 0; i < model->rowCount(parents.constFirst()); ++i) children.push_back(model->index(i, 0, parents.constFirst())); - for (int i = 0; i < parentResult.count(); ++i) { + for (int i = 0; i < parentResult.size(); ++i) { QTreeWidgetItem *item = tree.topLevelItem(i); QCOMPARE(item->text(0), parentResult.at(i)); - for (int j = 0; j < childResult.count(); ++j) + for (int j = 0; j < childResult.size(); ++j) QCOMPARE(item->child(j)->text(0), childResult.at(j)); } } @@ -2427,7 +2427,7 @@ void tst_QTreeWidget::changeDataWithSorting() QTreeWidgetItem *item = w.topLevelItem(itemIndex); item->setText(0, newValue); - for (int i = 0; i < expectedItems.count(); ++i) { + for (int i = 0; i < expectedItems.size(); ++i) { QCOMPARE(w.topLevelItem(i)->text(0), expectedItems.at(i)); for (const QPersistentModelIndex &p : std::as_const(persistent)) { if (p.row() == i) // the same toplevel row @@ -2435,11 +2435,11 @@ void tst_QTreeWidget::changeDataWithSorting() } } - for (int k = 0; k < persistent.count(); ++k) + for (int k = 0; k < persistent.size(); ++k) QCOMPARE(persistent.at(k).row(), expectedRows.at(k)); - QCOMPARE(dataChangedSpy.count(), 1); - QCOMPARE(layoutChangedSpy.count(), reorderingExpected ? 1 : 0); + QCOMPARE(dataChangedSpy.size(), 1); + QCOMPARE(layoutChangedSpy.size(), reorderingExpected ? 1 : 0); } void tst_QTreeWidget::changeDataWithStableSorting_data() @@ -2596,7 +2596,7 @@ void tst_QTreeWidget::changeDataWithStableSorting() item->setText(0, newValue); if (forceChange) item->emitDataChanged(); - for (int i = 0; i < expectedItems.count(); ++i) { + for (int i = 0; i < expectedItems.size(); ++i) { QCOMPARE(w.topLevelItem(i)->text(0), expectedItems.at(i)); for (const QPersistentModelIndex &p : std::as_const(persistent)) { if (p.row() == i) // the same toplevel row @@ -2604,11 +2604,11 @@ void tst_QTreeWidget::changeDataWithStableSorting() } } - for (int k = 0; k < persistent.count(); ++k) + for (int k = 0; k < persistent.size(); ++k) QCOMPARE(persistent.at(k).row(), expectedRows.at(k)); - QCOMPARE(dataChangedSpy.count(), 1); - QCOMPARE(layoutChangedSpy.count(), reorderingExpected ? 1 : 0); + QCOMPARE(dataChangedSpy.size(), 1); + QCOMPARE(layoutChangedSpy.size(), reorderingExpected ? 1 : 0); } void tst_QTreeWidget::sizeHint_data() @@ -2714,8 +2714,8 @@ void tst_QTreeWidget::sortedIndexOfChild() tw.sortItems(0, sortOrder); tw.expandAll(); - QCOMPARE(itms.size(), expectedIndexes.count()); - for (int j = 0; j < expectedIndexes.count(); ++j) + QCOMPARE(itms.size(), expectedIndexes.size()); + for (int j = 0; j < expectedIndexes.size(); ++j) QCOMPARE(top->indexOfChild(itms.at(j)), expectedIndexes.at(j)); } @@ -2740,8 +2740,8 @@ void tst_QTreeWidget::expandAndCallapse() tw.collapseItem(top); tw.collapseItem(top); - QCOMPARE(spy0.count(), 3); - QCOMPARE(spy1.count(), 2); + QCOMPARE(spy0.size(), 3); + QCOMPARE(spy1.size(), 2); } void tst_QTreeWidget::setDisabled() @@ -2854,13 +2854,13 @@ void tst_QTreeWidget::removeSelectedItem() QItemSelectionModel *selModel = w->selectionModel(); QCOMPARE(selModel->hasSelection(), true); - QCOMPARE(selModel->selectedRows().count(), 1); + QCOMPARE(selModel->selectedRows().size(), 1); const QScopedPointer taken(w->takeTopLevelItem(2)); QCOMPARE(taken->text(0), QLatin1String("C")); QCOMPARE(selModel->hasSelection(), false); - QCOMPARE(selModel->selectedRows().count(), 0); + QCOMPARE(selModel->selectedRows().size(), 0); QItemSelection sel = selModel->selection(); QCOMPARE(selModel->isSelected(w->model()->index(0,0)), false); } @@ -3285,7 +3285,7 @@ void tst_QTreeWidget::emitDataChanged() auto item = new PublicTreeItem; tree.insertTopLevelItem(0, item); item->emitDataChanged(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QTreeWidget::setCurrentItemExpandsParent() diff --git a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp index 7c1ce7c426..76ebb499f9 100644 --- a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp +++ b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp @@ -866,7 +866,7 @@ void tst_QTreeWidgetItemIterator::iteratorflags() QTreeWidgetItemIterator it(testWidget, iteratorflags); it += start; int iMatch = 0; - while (*it && iMatch < matches.count()) { + while (*it && iMatch < matches.size()) { QTreeWidgetItem *item = *it; QCOMPARE(item->text(0), matches[iMatch]); ++it; diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index cbec31c573..d9c6c02d6b 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -155,11 +155,11 @@ void tst_QAction::alternateShortcuts() act.setAutoRepeat(true); QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier); - QCOMPARE(spy.count(), 1); //act should have been triggered + QCOMPARE(spy.size(), 1); //act should have been triggered act.setAutoRepeat(false); QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier); - QCOMPARE(spy.count(), 2); //act should have been triggered a 2nd time + QCOMPARE(spy.size(), 2); //act should have been triggered a 2nd time //end of the scope of the action, it will be destroyed and removed from wid //This action should also unregister its shortcuts @@ -189,12 +189,12 @@ void tst_QAction::keysequence() act.setAutoRepeat(true); QTest::keySequence(&testWidget, ks); QCoreApplication::processEvents(); - QCOMPARE(spy.count(), 1); // act should have been triggered + QCOMPARE(spy.size(), 1); // act should have been triggered act.setAutoRepeat(false); QTest::keySequence(&testWidget, ks); QCoreApplication::processEvents(); - QCOMPARE(spy.count(), 2); //act should have been triggered a 2nd time + QCOMPARE(spy.size(), 2); //act should have been triggered a 2nd time // end of the scope of the action, it will be destroyed and removed from widget // This action should also unregister its shortcuts @@ -230,15 +230,15 @@ void tst_QAction::enabledVisibleInteraction() act.setEnabled(true); act.setVisible(false); QTest::keyClick(&testWidget, Qt::Key_T, Qt::ControlModifier); - QCOMPARE(spy.count(), 0); //act is not visible, so don't trigger + QCOMPARE(spy.size(), 0); //act is not visible, so don't trigger act.setVisible(false); act.setEnabled(true); QTest::keyClick(&testWidget, Qt::Key_T, Qt::ControlModifier); - QCOMPARE(spy.count(), 0); //act is not visible, so don't trigger + QCOMPARE(spy.size(), 0); //act is not visible, so don't trigger act.setVisible(true); act.setEnabled(true); QTest::keyClick(&testWidget, Qt::Key_T, Qt::ControlModifier); - QCOMPARE(spy.count(), 1); //act is visible and enabled, so trigger + QCOMPARE(spy.size(), 1); //act is visible and enabled, so trigger } #endif // QT_CONFIG(shortcut) @@ -256,12 +256,12 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup() QSignalSpy actionSpy(checkedAction, QOverload::of(&QAction::triggered)); QSignalSpy actionGroupSpy(&ag, QOverload::of(&QActionGroup::triggered)); - QCOMPARE(actionGroupSpy.count(), 0); - QCOMPARE(actionSpy.count(), 0); + QCOMPARE(actionGroupSpy.size(), 0); + QCOMPARE(actionSpy.size(), 0); checkedAction->trigger(); // check that both the group and the action have emitted the signal - QCOMPARE(actionGroupSpy.count(), 1); - QCOMPARE(actionSpy.count(), 1); + QCOMPARE(actionGroupSpy.size(), 1); + QCOMPARE(actionSpy.size(), 1); } #if QT_CONFIG(shortcut) @@ -284,7 +284,7 @@ void tst_QAction::repeat() act.setAutoRepeat(true); QTest::keyPress(&testWidget, Qt::Key_F); QTest::keyRelease(&testWidget, Qt::Key_F); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QTest::keyPress(&testWidget, Qt::Key_F); @@ -292,7 +292,7 @@ void tst_QAction::repeat() QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); QTest::keyRelease(&testWidget, Qt::Key_F); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); spy.clear(); act.setAutoRepeat(false); @@ -300,14 +300,14 @@ void tst_QAction::repeat() QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); QTest::keyRelease(&testWidget, Qt::Key_F); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); act.setAutoRepeat(true); QTest::keyPress(&testWidget, Qt::Key_F); QTest::simulateEvent(&testWidget, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); QTest::keyRelease(&testWidget, Qt::Key_F); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QAction::disableShortcutsWithBlockedWidgets_data() @@ -357,7 +357,7 @@ void tst_QAction::disableShortcutsWithBlockedWidgets() QSignalSpy spy(&action, &QAction::triggered); QTest::keyPress(&window, Qt::Key_1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } class ShortcutOverrideWidget : public QWidget @@ -395,7 +395,7 @@ void tst_QAction::shortcutFromKeyEvent() // shortcut route for us QKeyEvent e(QEvent::KeyPress, Qt::Key_1, Qt::NoModifier); QApplication::sendEvent(&testWidget, &e); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(testWidget.shortcutOverrideCount, 1); } @@ -434,42 +434,42 @@ void tst_QAction::disableShortcutInMenuAction() QKeyEvent event(QEvent::KeyPress, Qt::Key_A, Qt::ControlModifier); QApplication::sendEvent(&mw, &event); - QCOMPARE(spy.count(), ++expectedTriggerCount); + QCOMPARE(spy.size(), ++expectedTriggerCount); testMenu->menuAction()->setProperty(property, false); QApplication::sendEvent(&mw, &event); - QCOMPARE(spy.count(), expectedTriggerCount); + QCOMPARE(spy.size(), expectedTriggerCount); testMenu->menuAction()->setProperty(property, true); QApplication::sendEvent(&mw, &event); - QCOMPARE(spy.count(), ++expectedTriggerCount); + QCOMPARE(spy.size(), ++expectedTriggerCount); // If the action lives somewhere else, then keep firing even // if the menu has been hidden or disabled. toolBar->addAction(testAction); QApplication::sendEvent(&mw, &event); - QCOMPARE(spy.count(), ++expectedTriggerCount); + QCOMPARE(spy.size(), ++expectedTriggerCount); testMenu->menuAction()->setProperty(property, false); QApplication::sendEvent(&mw, &event); - QCOMPARE(spy.count(), ++expectedTriggerCount); + QCOMPARE(spy.size(), ++expectedTriggerCount); // unless all other widgets in which the action lives have // been hidden... toolBar->hide(); QApplication::sendEvent(&mw, &event); - QCOMPARE(spy.count(), expectedTriggerCount); + QCOMPARE(spy.size(), expectedTriggerCount); // ... or disabled toolBar->show(); toolBar->setEnabled(false); QApplication::sendEvent(&mw, &event); - QCOMPARE(spy.count(), expectedTriggerCount); + QCOMPARE(spy.size(), expectedTriggerCount); // back to normal toolBar->setEnabled(true); QApplication::sendEvent(&mw, &event); - QCOMPARE(spy.count(), ++expectedTriggerCount); + QCOMPARE(spy.size(), ++expectedTriggerCount); } #endif // QT_CONFIG(shortcut) diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 6e2e6b3e49..57bd4515ad 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -575,7 +575,7 @@ void tst_QApplication::lastWindowClosed() QTimer::singleShot(1000, dialog.data(), &QDialog::accept); dialog->exec(); QVERIFY(dialog); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QPointerwidget = new CloseWidget; widget->setWindowTitle(QLatin1String(QTest::currentTestFunction()) + QLatin1String("CloseWidget")); @@ -584,7 +584,7 @@ void tst_QApplication::lastWindowClosed() QObject::connect(&app, &QGuiApplication::lastWindowClosed, widget.data(), &QObject::deleteLater); QCoreApplication::exec(); QVERIFY(!widget); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); delete dialog; @@ -602,7 +602,7 @@ void tst_QApplication::lastWindowClosed() QTimer::singleShot(1000, &app, &QApplication::closeAllWindows); QCoreApplication::exec(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } class QuitOnLastWindowClosedDialog : public QDialog @@ -635,8 +635,8 @@ public slots: other.exec(); // verify that the eventloop ran and let the timer fire - QCOMPARE(spy.count(), 1); - QCOMPARE(appSpy.count(), 1); + QCOMPARE(spy.size(), 1); + QCOMPARE(appSpy.size(), 1); } private: @@ -661,7 +661,7 @@ public slots: timer1.setSingleShot(true); timer1.start(1000); dialog.exec(); - QCOMPARE(spy1.count(), 1); + QCOMPARE(spy1.size(), 1); show(); } @@ -682,7 +682,7 @@ void tst_QApplication::quitOnLastWindowClosed() QCoreApplication::exec(); // lastWindowClosed() signal should only be sent after the last dialog is closed - QCOMPARE(appSpy.count(), 2); + QCOMPARE(appSpy.size(), 2); } { int argc = 0; @@ -697,8 +697,8 @@ void tst_QApplication::quitOnLastWindowClosed() timer1.setSingleShot(true); timer1.start(1000); dialog.exec(); - QCOMPARE(spy1.count(), 1); - QCOMPARE(appSpy.count(), 0); + QCOMPARE(spy1.size(), 1); + QCOMPARE(appSpy.size(), 0); QTimer timer2; connect(&timer2, &QTimer::timeout, &app, &QCoreApplication::quit); @@ -707,8 +707,8 @@ void tst_QApplication::quitOnLastWindowClosed() timer2.start(1000); int returnValue = QCoreApplication::exec(); QCOMPARE(returnValue, 0); - QCOMPARE(spy2.count(), 1); - QCOMPARE(appSpy.count(), 0); + QCOMPARE(spy2.size(), 1); + QCOMPARE(appSpy.size(), 0); } { int argc = 0; @@ -739,8 +739,8 @@ void tst_QApplication::quitOnLastWindowClosed() QCoreApplication::exec(); - QCOMPARE(spy.count(), 1); - QVERIFY(spy2.count() < 15); // Should be around 10 if closing caused the quit + QCOMPARE(spy.size(), 1); + QVERIFY(spy2.size() < 15); // Should be around 10 if closing caused the quit } bool quitApplicationTriggered = false; @@ -770,7 +770,7 @@ void tst_QApplication::quitOnLastWindowClosed() QCoreApplication::exec(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(quitApplicationTriggered); } { @@ -792,8 +792,8 @@ void tst_QApplication::quitOnLastWindowClosed() QCOMPARE(returnValue, 0); // failure here means the timer above didn't fire, and the // quit was caused the dialog being closed (not the window) - QCOMPARE(timerSpy.count(), 1); - QCOMPARE(appSpy.count(), 2); + QCOMPARE(timerSpy.size(), 1); + QCOMPARE(appSpy.size(), 2); } { int argc = 0; @@ -842,7 +842,7 @@ void tst_QApplication::quitOnLastWindowClosed() QTimer::singleShot(100, &w1, &QWidget::close); QCoreApplication::exec(); - QVERIFY(timerSpy.count() < 10); + QVERIFY(timerSpy.size() < 10); } } @@ -930,8 +930,8 @@ void tst_QApplication::closeAllWindows() bool isPathListIncluded(const QStringList &l, const QStringList &r) { - int size = r.count(); - if (size > l.count()) + int size = r.size(); + if (size > l.size()) return false; #if defined (Q_OS_WIN) Qt::CaseSensitivity cs = Qt::CaseInsensitive; @@ -939,13 +939,13 @@ bool isPathListIncluded(const QStringList &l, const QStringList &r) Qt::CaseSensitivity cs = Qt::CaseSensitive; #endif int i = 0, j = 0; - for ( ; i < l.count() && j < r.count(); ++i) { + for ( ; i < l.size() && j < r.size(); ++i) { if (QDir::toNativeSeparators(l[i]).compare(QDir::toNativeSeparators(r[j]), cs) == 0) { ++j; i = -1; } } - return j == r.count(); + return j == r.size(); } #if QT_CONFIG(library) @@ -1005,7 +1005,7 @@ void tst_QApplication::libraryPaths() { qCDebug(lcTests) << "Initial library path:" << QApplication::libraryPaths(); - int count = QApplication::libraryPaths().count(); + int count = QApplication::libraryPaths().size(); #if 0 // this test doesn't work if KDE 4 is installed QCOMPARE(count, 1); // before creating QApplication, only the PluginsPath is in the libraryPaths() @@ -1014,9 +1014,9 @@ void tst_QApplication::libraryPaths() QApplication::addLibraryPath(installPathPlugins); qCDebug(lcTests) << "installPathPlugins" << installPathPlugins; qCDebug(lcTests) << "After adding plugins path:" << QApplication::libraryPaths(); - QCOMPARE(QApplication::libraryPaths().count(), count); + QCOMPARE(QApplication::libraryPaths().size(), count); QApplication::addLibraryPath(testDir); - QCOMPARE(QApplication::libraryPaths().count(), count + 1); + QCOMPARE(QApplication::libraryPaths().size(), count + 1); // creating QApplication adds the applicationDirPath to the libraryPath int argc = 1; @@ -1026,19 +1026,19 @@ void tst_QApplication::libraryPaths() // On Windows CE these are identical and might also be the case for other // systems too if (appDirPath != installPathPlugins) - QCOMPARE(QApplication::libraryPaths().count(), count + 2); + QCOMPARE(QApplication::libraryPaths().size(), count + 2); } { int argc = 1; QApplication app(argc, &argv0); qCDebug(lcTests) << "Initial library path:" << QCoreApplication::libraryPaths(); - int count = QCoreApplication::libraryPaths().count(); + int count = QCoreApplication::libraryPaths().size(); QString installPathPlugins = QLibraryInfo::path(QLibraryInfo::PluginsPath); QCoreApplication::addLibraryPath(installPathPlugins); qCDebug(lcTests) << "installPathPlugins" << installPathPlugins; qCDebug(lcTests) << "After adding plugins path:" << QCoreApplication::libraryPaths(); - QCOMPARE(QCoreApplication::libraryPaths().count(), count); + QCOMPARE(QCoreApplication::libraryPaths().size(), count); QString appDirPath = QCoreApplication::applicationDirPath(); @@ -1046,14 +1046,14 @@ void tst_QApplication::libraryPaths() QCoreApplication::addLibraryPath(appDirPath + "/.."); qCDebug(lcTests) << "appDirPath" << appDirPath; qCDebug(lcTests) << "After adding appDirPath && appDirPath + /..:" << QCoreApplication::libraryPaths(); - QCOMPARE(QCoreApplication::libraryPaths().count(), count + 1); + QCOMPARE(QCoreApplication::libraryPaths().size(), count + 1); #ifdef Q_OS_MACOS QCoreApplication::addLibraryPath(appDirPath + "/../MacOS"); #else QCoreApplication::addLibraryPath(appDirPath + "/tmp/.."); #endif qCDebug(lcTests) << "After adding appDirPath + /tmp/..:" << QCoreApplication::libraryPaths(); - QCOMPARE(QCoreApplication::libraryPaths().count(), count + 1); + QCOMPARE(QCoreApplication::libraryPaths().size(), count + 1); } } @@ -1656,11 +1656,11 @@ void tst_QApplication::focusChanged() hbox1.addWidget(&le1); hbox1.addWidget(&pb1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); parent1.show(); QApplicationPrivate::setActiveWindow(&parent1); // needs this on twm (focus follows mouse) - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).size(), 2); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); @@ -1668,10 +1668,10 @@ void tst_QApplication::focusChanged() QCOMPARE(now, QApplication::focusWidget()); QVERIFY(!old); spy.clear(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); pb1.setFocus(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); QCOMPARE(now, &pb1); @@ -1680,7 +1680,7 @@ void tst_QApplication::focusChanged() spy.clear(); lb1.setFocus(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); QCOMPARE(now, &lb1); @@ -1689,7 +1689,7 @@ void tst_QApplication::focusChanged() spy.clear(); lb1.clearFocus(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); QVERIFY(!now); @@ -1709,9 +1709,9 @@ void tst_QApplication::focusChanged() parent2.show(); QApplicationPrivate::setActiveWindow(&parent2); // needs this on twm (focus follows mouse) - QVERIFY(spy.count() > 0); // one for deactivation, one for activation on Windows - old = qvariant_cast(spy.at(spy.count()-1).at(0)); - now = qvariant_cast(spy.at(spy.count()-1).at(1)); + QVERIFY(spy.size() > 0); // one for deactivation, one for activation on Windows + old = qvariant_cast(spy.at(spy.size()-1).at(0)); + now = qvariant_cast(spy.at(spy.size()-1).at(1)); QCOMPARE(now, &le2); QCOMPARE(now, QApplication::focusWidget()); QVERIFY(!old); @@ -1736,10 +1736,10 @@ void tst_QApplication::focusChanged() tab.simulate(now); if (!tabAllControls) { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(now, QApplication::focusWidget()); } else { - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); QCOMPARE(now, &pb2); @@ -1749,11 +1749,11 @@ void tst_QApplication::focusChanged() } if (!tabAllControls) { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(now, QApplication::focusWidget()); } else { tab.simulate(now); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); QCOMPARE(now, &le2); @@ -1763,11 +1763,11 @@ void tst_QApplication::focusChanged() } if (!tabAllControls) { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(now, QApplication::focusWidget()); } else { backtab.simulate(now); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); QCOMPARE(now, &pb2); @@ -1778,12 +1778,12 @@ void tst_QApplication::focusChanged() if (!tabAllControls) { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(now, QApplication::focusWidget()); old = &pb2; } else { backtab.simulate(now); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); QCOMPARE(now, &le2); @@ -1794,10 +1794,10 @@ void tst_QApplication::focusChanged() click.simulate(old); if (!(pb2.focusPolicy() & Qt::ClickFocus)) { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(now, QApplication::focusWidget()); } else { - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); QCOMPARE(now, &pb2); @@ -1806,7 +1806,7 @@ void tst_QApplication::focusChanged() spy.clear(); click.simulate(old); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); old = qvariant_cast(spy.at(0).at(0)); now = qvariant_cast(spy.at(0).at(1)); QCOMPARE(now, &le2); @@ -1817,15 +1817,15 @@ void tst_QApplication::focusChanged() parent1.activateWindow(); QApplicationPrivate::setActiveWindow(&parent1); // needs this on twm (focus follows mouse) - QVERIFY(spy.count() == 1 || spy.count() == 2); // one for deactivation, one for activation on Windows + QVERIFY(spy.size() == 1 || spy.size() == 2); // one for deactivation, one for activation on Windows //on windows, the change of focus is made in 2 steps //(the focusChanged SIGNAL is emitted twice) - if (spy.count()==1) - old = qvariant_cast(spy.at(spy.count()-1).at(0)); + if (spy.size()==1) + old = qvariant_cast(spy.at(spy.size()-1).at(0)); else - old = qvariant_cast(spy.at(spy.count()-2).at(0)); - now = qvariant_cast(spy.at(spy.count()-1).at(1)); + old = qvariant_cast(spy.at(spy.size()-2).at(0)); + now = qvariant_cast(spy.at(spy.size()-1).at(1)); QCOMPARE(now, &le1); QCOMPARE(now, QApplication::focusWidget()); QCOMPARE(old, &le2); @@ -2060,11 +2060,11 @@ void tst_QApplication::topLevelWidgets() #endif QCoreApplication::processEvents(); QVERIFY(QApplication::topLevelWidgets().contains(w)); - QCOMPARE(QApplication::topLevelWidgets().count(), 1); + QCOMPARE(QApplication::topLevelWidgets().size(), 1); delete w; w = nullptr; QCoreApplication::processEvents(); - QCOMPARE(QApplication::topLevelWidgets().count(), 0); + QCOMPARE(QApplication::topLevelWidgets().size(), 0); } @@ -2492,10 +2492,10 @@ void tst_QApplication::wheelEventPropagation() else ++hcount; QCoreApplication::processEvents(); - QCOMPARE(innerVSpy.count(), innerScrolls ? vcount : 0); - QCOMPARE(innerHSpy.count(), innerScrolls ? hcount : 0); - QCOMPARE(outerVSpy.count(), innerScrolls ? 0 : vcount); - QCOMPARE(outerHSpy.count(), innerScrolls ? 0 : hcount); + QCOMPARE(innerVSpy.size(), innerScrolls ? vcount : 0); + QCOMPARE(innerHSpy.size(), innerScrolls ? hcount : 0); + QCOMPARE(outerVSpy.size(), innerScrolls ? 0 : vcount); + QCOMPARE(outerHSpy.size(), innerScrolls ? 0 : hcount); } } diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp index 3a7f33228b..febb517638 100644 --- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp @@ -517,14 +517,14 @@ void tst_QBoxLayout::testLayoutEngine() QHBoxLayout box; box.setSpacing(spacing); int i; - for (i = 0; i < itemDescriptions.count(); ++i) { + for (i = 0; i < itemDescriptions.size(); ++i) { Descr descr = itemDescriptions.at(i); LayoutItem *li = new LayoutItem(descr); box.addItem(li); box.setStretch(i, descr.stretch); } box.setGeometry(QRect(0,0,size,100)); - for (i = 0; i < expectedSizes.count(); ++i) { + for (i = 0; i < expectedSizes.size(); ++i) { int xSize = expectedSizes.at(i); int xPos = expectedPositions.at(i); QLayoutItem *item = box.itemAt(i); diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index 74ee186751..3871079da7 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -1030,7 +1030,7 @@ void tst_QGridLayout::styleDependentSpacingsAndMargins() widget.adjustSize(); QApplication::processEvents(); - for (int pi = 0; pi < expectedpositions.count(); ++pi) { + for (int pi = 0; pi < expectedpositions.size(); ++pi) { QCOMPARE(sizehinters.at(pi)->pos(), expectedpositions.at(pi)); } } @@ -1420,7 +1420,7 @@ void tst_QGridLayout::layoutSpacing() QLayout *layout = widget->layout(); QVERIFY(layout); - for (int pi = 0; pi < expectedpositions.count(); ++pi) { + for (int pi = 0; pi < expectedpositions.size(); ++pi) { QLayoutItem *item = layout->itemAt(pi); //qDebug() << item->widget()->pos(); QCOMPARE(item->widget()->pos(), expectedpositions.at(pi)); diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index b6b72e50bb..df4dfde0d2 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp @@ -1352,10 +1352,10 @@ void tst_QShortcut::keys() QCOMPARE(QApplication::focusWidget(), &le); QTest::keyEvent(QTest::Press, QApplication::focusWidget(), Qt::Key_Enter); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QTest::keyEvent(QTest::Press, QApplication::focusWidget(), Qt::Key_Return); - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE(spy.size(), 2); } QTEST_MAIN(tst_QShortcut) diff --git a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp index db62c6a556..967535dbc7 100644 --- a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp +++ b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp @@ -109,7 +109,7 @@ void tst_QStackedLayout::testCase() // One widget added to layout QWidget *w1 = new QWidget(testWidget); testLayout->addWidget(w1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toInt(), 0); spy.clear(); QCOMPARE(testLayout->currentIndex(), 0); @@ -126,7 +126,7 @@ void tst_QStackedLayout::testCase() // Change the current index testLayout->setCurrentIndex(1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toInt(), 1); spy.clear(); QCOMPARE(testLayout->currentIndex(), 1); @@ -140,7 +140,7 @@ void tst_QStackedLayout::testCase() // Second widget removed from layout; back to nothing testLayout->removeWidget(w2); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toInt(), -1); spy.clear(); QCOMPARE(testLayout->currentIndex(), -1); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 10ae2944d9..37a395194d 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -2716,7 +2716,7 @@ void tst_QWidget::resizePropagation() { // Capture count of latest async signals if (!checkCountIncrement) - count = spy.count(); + count = spy.size(); // Resize if required if (size.isValid()) @@ -2727,12 +2727,12 @@ void tst_QWidget::resizePropagation() // Check signal count and qDebug output for fail analysis if (checkCountIncrement) { - QTRY_VERIFY(spy.count() > count); - qDebug() << "spy count:" << spy.count() << "previous count:" << count; - count = spy.count(); + QTRY_VERIFY(spy.size() > count); + qDebug() << "spy count:" << spy.size() << "previous count:" << count; + count = spy.size(); } else { qDebug() << spy << widget.windowState() << window->windowState(); - QCOMPARE(spy.count(), count); + QCOMPARE(spy.size(), count); } // QTRY necessary because state changes are propagated async @@ -3625,7 +3625,7 @@ void tst_QWidget::raise() QObjectList list1{child1, child2, child3, child4}; QCOMPARE(parentPtr->children(), list1); - QCOMPARE(allChildren.size(), list1.count()); + QCOMPARE(allChildren.size(), list1.size()); for (UpdateWidget *child : std::as_const(allChildren)) { int expectedPaintEvents = child == child4 ? 1 : 0; @@ -3724,7 +3724,7 @@ void tst_QWidget::lower() QObjectList list1{child1, child2, child3, child4}; QCOMPARE(parent->children(), list1); - QCOMPARE(allChildren.size(), list1.count()); + QCOMPARE(allChildren.size(), list1.size()); for (UpdateWidget *child : std::as_const(allChildren)) { int expectedPaintEvents = child == child4 ? 1 : 0; @@ -6812,7 +6812,7 @@ void tst_QWidget::testWindowIconChangeEventPropagation() QWidgetList widgets; widgets << &topLevelWidget << &topLevelChild << &dialog << &dialogChild; - QCOMPARE(widgets.count(), 4); + QCOMPARE(widgets.size(), 4); topLevelWidget.show(); dialog.show(); @@ -6841,7 +6841,7 @@ void tst_QWidget::testWindowIconChangeEventPropagation() const QIcon windowIcon = qApp->style()->standardIcon(QStyle::SP_TitleBarMenuButton); qApp->setWindowIcon(windowIcon); - for (int i = 0; i < widgets.count(); ++i) { + for (int i = 0; i < widgets.size(); ++i) { // Check QEvent::ApplicationWindowIconChange EventSpyPtr spy = applicationEventSpies.at(i); QWidget *widget = spy->widget(); @@ -6858,7 +6858,7 @@ void tst_QWidget::testWindowIconChangeEventPropagation() QCOMPARE(spy->count(), 1); spy->clear(); } - for (int i = 0; i < windows.count(); ++i) { + for (int i = 0; i < windows.size(); ++i) { // Check QEvent::ApplicationWindowIconChange (sent to QWindow) // QWidgetWindows don't get this event, since the widget takes care of changing the icon WindowEventSpyPtr spy = appWindowEventSpies.at(i); @@ -6876,7 +6876,7 @@ void tst_QWidget::testWindowIconChangeEventPropagation() // Set icon on a top-level widget. topLevelWidget.setWindowIcon(QIcon()); - for (int i = 0; i < widgets.count(); ++i) { + for (int i = 0; i < widgets.size(); ++i) { // Check QEvent::ApplicationWindowIconChange EventSpyPtr spy = applicationEventSpies.at(i); QCOMPARE(spy->count(), 0); @@ -12775,7 +12775,7 @@ void tst_QWidget::deleteWindowInCloseEvent() QApplication::exec(); // It should still result in a single lastWindowClosed emit - QCOMPARE(quitSpy.count(), 1); + QCOMPARE(quitSpy.size(), 1); } /*! @@ -12796,7 +12796,7 @@ void tst_QWidget::quitOnClose() widget->close(); }); QApplication::exec(); - QCOMPARE(quitSpy.count(), 1); + QCOMPARE(quitSpy.size(), 1); widget->show(); QVERIFY(QTest::qWaitForWindowExposed(widget.get())); @@ -12804,7 +12804,7 @@ void tst_QWidget::quitOnClose() widget.reset(); }); QApplication::exec(); - QCOMPARE(quitSpy.count(), 2); + QCOMPARE(quitSpy.size(), 2); } void tst_QWidget::setParentChangesFocus_data() diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 7ccb76864d..3211edbb33 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -1644,9 +1644,9 @@ void tst_QWidget_window::resetFocusObjectOnDestruction() widget->show(); QVERIFY(QTest::qWaitForWindowActive(widget.get())); - int activeCount = focusObjectChangedSpy.count(); + int activeCount = focusObjectChangedSpy.size(); widget.reset(); - QVERIFY(focusObjectChangedSpy.count() > activeCount); + QVERIFY(focusObjectChangedSpy.size() > activeCount); QCOMPARE(focusObjectChangedSpy.last().last().value(), nullptr); focusObjectChangedSpy.clear(); @@ -1659,10 +1659,10 @@ void tst_QWidget_window::resetFocusObjectOnDestruction() widget->show(); QVERIFY(QTest::qWaitForWindowActive(widget.get())); - activeCount = focusObjectChangedSpy.count(); + activeCount = focusObjectChangedSpy.size(); widget.reset(); // we might get more than one signal emission - QVERIFY(focusObjectChangedSpy.count() > activeCount); + QVERIFY(focusObjectChangedSpy.size() > activeCount); QCOMPARE(focusObjectChangedSpy.last().last().value(), nullptr); } diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index f3c1688639..c36f3ada01 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -1709,7 +1709,7 @@ void tst_QStyleSheetStyle::toolTip() normalToolTip }; QWidgetList topLevels; - for (int i = 0; i < widgets.count() ; ++i) { + for (int i = 0; i < widgets.size() ; ++i) { QWidget *wid = widgets.at(i); QColor col = colors.at(i); diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index a4534ae243..e8ebaf1491 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -59,7 +59,7 @@ QString CsvCompleter::pathFromIndex(const QModelIndex &sourceIndex) const idx = parent.sibling(parent.row(), sourceIndex.column()); } while (idx.isValid()); - return list.count() == 1 ? list.constFirst() : list.join(QLatin1Char(',')); + return list.size() == 1 ? list.constFirst() : list.join(QLatin1Char(',')); } class tst_QCompleter : public QObject @@ -1178,10 +1178,10 @@ void tst_QCompleter::disabledItems() QAbstractItemView *view = lineEdit.completer()->popup(); QVERIFY(view->isVisible()); QTest::mouseClick(view->viewport(), Qt::LeftButton, {}, view->visualRect(view->model()->index(0, 0)).center()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QVERIFY(view->isVisible()); QTest::mouseClick(view->viewport(), Qt::LeftButton, {}, view->visualRect(view->model()->index(1, 0)).center()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(!view->isVisible()); } @@ -1195,7 +1195,7 @@ void tst_QCompleter::task178797_activatedOnReturn() auto completer = new QCompleter({"foobar1", "foobar2"}, &ledit); ledit.setCompleter(completer); QSignalSpy spy(completer, QOverload::of(&QCompleter::activated)); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); ledit.move(200, 200); ledit.show(); QApplicationPrivate::setActiveWindow(&ledit); @@ -1207,7 +1207,7 @@ void tst_QCompleter::task178797_activatedOnReturn() QCoreApplication::processEvents(); QTest::keyClick(QApplication::activePopupWidget(), Qt::Key_Return); QCoreApplication::processEvents(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } class task189564_StringListModel : public QStringListModel @@ -1289,7 +1289,7 @@ void tst_QCompleter::task246056_setCompletionPrefix() QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Down); QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Down); QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Enter); // don't crash! - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const auto index = spy.at(0).constFirst().toModelIndex(); QVERIFY(!index.isValid()); } @@ -1763,10 +1763,10 @@ void tst_QCompleter::QTBUG_52028_tabAutoCompletes() QTRY_VERIFY(cbox.completer()->popup()->isVisible()); QTest::keyClick(cbox.completer()->popup(), Qt::Key_Tab); QCOMPARE(cbox.completer()->currentCompletion(), QLatin1String("hux")); - QCOMPARE(activatedSpy.count(), 0); + QCOMPARE(activatedSpy.size(), 0); QEXPECT_FAIL("", "QTBUG-52028 will not be fixed today.", Abort); QCOMPARE(cbox.currentText(), QLatin1String("hux")); - QCOMPARE(activatedSpy.count(), 0); + QCOMPARE(activatedSpy.size(), 0); QVERIFY(!le->hasFocus()); } @@ -1807,7 +1807,7 @@ void tst_QCompleter::QTBUG_51889_activatedSentTwice() QTRY_VERIFY(cbox.completer()->popup()->isVisible()); QTest::keyClick(cbox.completer()->popup(), Qt::Key_Down); QTest::keyClick(cbox.completer()->popup(), Qt::Key_Return); - QTRY_COMPARE(activatedSpy.count(), 1); + QTRY_COMPARE(activatedSpy.size(), 1); // Navigate + enter activates only once (non-first item) cbox.lineEdit()->clear(); @@ -1817,7 +1817,7 @@ void tst_QCompleter::QTBUG_51889_activatedSentTwice() QTRY_VERIFY(cbox.completer()->popup()->isVisible()); QTest::keyClick(cbox.completer()->popup(), Qt::Key_Down); QTest::keyClick(cbox.completer()->popup(), Qt::Key_Return); - QTRY_COMPARE(activatedSpy.count(), 1); + QTRY_COMPARE(activatedSpy.size(), 1); // Full text + enter activates only once cbox.lineEdit()->clear(); @@ -1826,7 +1826,7 @@ void tst_QCompleter::QTBUG_51889_activatedSentTwice() QVERIFY(cbox.completer()->popup()); QTRY_VERIFY(cbox.completer()->popup()->isVisible()); QTest::keyClick(&cbox, Qt::Key_Return); - QTRY_COMPARE(activatedSpy.count(), 1); + QTRY_COMPARE(activatedSpy.size(), 1); } void tst_QCompleter::showPopupInGraphicsView() diff --git a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp index 5348942857..2b04fc5104 100644 --- a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp +++ b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp @@ -110,7 +110,7 @@ void tst_QSystemTrayIcon::lastWindowClosed() QTimer::singleShot(2500, &window, SLOT(close())); QTimer::singleShot(20000, qApp, SLOT(quit())); // in case the test fails qApp->exec(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } QTEST_MAIN(tst_QSystemTrayIcon) diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp index 07ca72a942..c2bcbe73f5 100644 --- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp +++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp @@ -518,24 +518,24 @@ void tst_QAbstractButton::animateClick() button.animateClick(); QVERIFY(button.isDown()); - QCOMPARE(pressedSpy.count(), 1); - QCOMPARE(releasedSpy.count(), 0); - QCOMPARE(clickedSpy.count(), 0); + QCOMPARE(pressedSpy.size(), 1); + QCOMPARE(releasedSpy.size(), 0); + QCOMPARE(clickedSpy.size(), 0); qApp->processEvents(QEventLoop::AllEvents, 10); // QAbstractButton starts a 100ms timer which performs the click. If it // took more than 100ms to get here, then the button might no longer be down. if (elapsed.elapsed() < 100) { QVERIFY(button.isDown()); - QCOMPARE(pressedSpy.count(), 1); - QCOMPARE(releasedSpy.count(), 0); - QCOMPARE(clickedSpy.count(), 0); + QCOMPARE(pressedSpy.size(), 1); + QCOMPARE(releasedSpy.size(), 0); + QCOMPARE(clickedSpy.size(), 0); } QTRY_VERIFY(!button.isDown()); // but once the button has been clicked, it must have taken at least 100ms QVERIFY(elapsed.elapsed() >= 100); - QCOMPARE(pressedSpy.count(), 1); - QCOMPARE(releasedSpy.count(), 1); - QCOMPARE(clickedSpy.count(), 1); + QCOMPARE(pressedSpy.size(), 1); + QCOMPARE(releasedSpy.size(), 1); + QCOMPARE(clickedSpy.size(), 1); } #if QT_CONFIG(shortcut) @@ -558,9 +558,9 @@ void tst_QAbstractButton::shortcutEvents() QTest::qWait(1000); // ensure animate timer is expired - QCOMPARE(pressedSpy.count(), 3); - QCOMPARE(releasedSpy.count(), 3); - QCOMPARE(clickedSpy.count(), 3); + QCOMPARE(pressedSpy.size(), 3); + QCOMPARE(releasedSpy.size(), 3); + QCOMPARE(clickedSpy.size(), 3); } #endif // QT_CONFIG(shortcut) @@ -602,14 +602,14 @@ void tst_QAbstractButton::mouseReleased() // QTBUG-53244 QSignalSpy spyRelease(&button, &QAbstractButton::released); QTest::mousePress(&button, Qt::LeftButton); - QCOMPARE(spyPress.count(), 1); + QCOMPARE(spyPress.size(), 1); QCOMPARE(button.isDown(), true); - QCOMPARE(spyRelease.count(), 0); + QCOMPARE(spyRelease.size(), 0); QTest::mouseClick(&button, Qt::RightButton); - QCOMPARE(spyPress.count(), 1); + QCOMPARE(spyPress.size(), 1); QCOMPARE(button.isDown(), true); - QCOMPARE(spyRelease.count(), 0); + QCOMPARE(spyRelease.size(), 0); QPointF posOutOfWidget = QPointF(30, 30); QMouseEvent me(QEvent::MouseMove, @@ -619,9 +619,9 @@ void tst_QAbstractButton::mouseReleased() // QTBUG-53244 qApp->sendEvent(&button, &me); // should emit released signal once mouse is dragging out of boundary - QCOMPARE(spyPress.count(), 1); + QCOMPARE(spyPress.size(), 1); QCOMPARE(button.isDown(), false); - QCOMPARE(spyRelease.count(), 1); + QCOMPARE(spyRelease.size(), 1); } #ifdef QT_KEYPAD_NAVIGATION diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp index 274f8737a6..17caa091c6 100644 --- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp @@ -1666,8 +1666,8 @@ void tst_QAbstractSlider::wheelEvent() #endif QCOMPARE(slider->sliderPosition(),expectedSliderPosition); int expectedSignalCount = (initialSliderPosition == expectedSliderPosition) ? 0 : 1; - QCOMPARE(spy1.count(), expectedSignalCount); - QCOMPARE(spy2.count(), expectedSignalCount); + QCOMPARE(spy1.size(), expectedSignalCount); + QCOMPARE(spy2.size(), expectedSignalCount); if (expectedSignalCount) QVERIFY(actionTriggeredTimeStamp < valueChangedTimeStamp); } @@ -1814,9 +1814,9 @@ void tst_QAbstractSlider::sliderPressedReleased() QTest::mousePress(slider, Qt::LeftButton, {}, QPoint(rect.center().x() + 2, rect.center().y() + 2)); - QCOMPARE(spy1.count(), expectedCount); + QCOMPARE(spy1.size(), expectedCount); QTest::mouseRelease(slider, Qt::LeftButton, {}, rect.center()); - QCOMPARE(spy2.count(), expectedCount); + QCOMPARE(spy2.size(), expectedCount); delete slider; } @@ -1885,7 +1885,7 @@ void tst_QAbstractSlider::sliderMoved() slider->setMaximum(maximum); slider->setSliderDown(sliderDown); slider->setSliderPosition(position); - QCOMPARE(spy.count(), expectedCount); + QCOMPARE(spy.size(), expectedCount); delete slider; } @@ -1957,7 +1957,7 @@ void tst_QAbstractSlider::rangeChanged() slider.setRange(minimum, maximum); QSignalSpy spy(&slider, SIGNAL(rangeChanged(int,int))); slider.setRange(newMin, newMax); - QCOMPARE(spy.count(), expectedCount); + QCOMPARE(spy.size(), expectedCount); } void tst_QAbstractSlider::setSliderPosition_data() @@ -1996,8 +1996,8 @@ void tst_QAbstractSlider::setSliderPosition() QSignalSpy spy2(slider, SIGNAL(valueChanged(int))); slider->setSliderPosition(targetPosition); QCOMPARE(slider->sliderPosition(), targetPosition); - QCOMPARE(spy1.count(), down ? 1 : 0); - QCOMPARE(spy2.count(), tracking ? 1 : 0); + QCOMPARE(spy1.size(), down ? 1 : 0); + QCOMPARE(spy2.size(), tracking ? 1 : 0); QCOMPARE(slider->value(), tracking ? targetPosition : initialValue); if (tracking && down) QVERIFY(sliderMovedTimeStamp < valueChangedTimeStamp); @@ -2025,9 +2025,9 @@ void tst_QAbstractSlider::setValue() QSignalSpy spy2(slider, SIGNAL(valueChanged(int))); QSignalSpy spy3(slider, SIGNAL(actionTriggered(int))); slider->setValue(50); - QCOMPARE(spy1.count(), down ? 1 : 0); - QCOMPARE(spy2.count(), 1); - QCOMPARE(spy3.count(), 0); + QCOMPARE(spy1.size(), down ? 1 : 0); + QCOMPARE(spy2.size(), 1); + QCOMPARE(spy3.size(), 0); QCOMPARE(slider->value(), reportedValue); QCOMPARE(slider->sliderPosition(), reportedSliderPosition); if (down) @@ -2051,37 +2051,37 @@ void tst_QAbstractSlider::setRepeatAction() // Start repeat action with initial delay of 500 ms, and then repeating // every 250 ms. slider->setRepeatAction(QAbstractSlider::SliderPageStepAdd, 500, 250); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(slider->value(), 55); QElapsedTimer t; t.start(); QTest::qWait(300); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(slider->value(), 55); waitUntilTimeElapsed(t, 550); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QCOMPARE(slider->value(), 65); QCOMPARE(spy.at(0).at(0).toUInt(), (uint)QAbstractSlider::SliderPageStepAdd); waitUntilTimeElapsed(t, 790); - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE(spy.size(), 2); QCOMPARE(slider->value(), 75); QCOMPARE(spy.at(1).at(0).toUInt(), (uint)QAbstractSlider::SliderPageStepAdd); waitUntilTimeElapsed(t, 1790); - QTRY_COMPARE(spy.count(), 6); + QTRY_COMPARE(spy.size(), 6); QCOMPARE(slider->value(), 115); QCOMPARE(spy.at(4).at(0).toUInt(), (uint)QAbstractSlider::SliderPageStepAdd); QCOMPARE(spy.at(5).at(0).toUInt(), (uint)QAbstractSlider::SliderPageStepAdd); slider->setRepeatAction(QAbstractSlider::SliderNoAction); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); QCOMPARE(slider->value(), 115); QTest::qWait(300); - QCOMPARE(spy.count(), 6); + QCOMPARE(spy.size(), 6); QCOMPARE(slider->value(), 115); } diff --git a/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp index a0a2452ae6..7ab2868e9a 100644 --- a/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp +++ b/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp @@ -351,17 +351,17 @@ void tst_QButtonGroup::testSignals() pb1.animateClick(); QTestEventLoop::instance().enterLoop(1); - QCOMPARE(clickedSpy.count(), 1); - QCOMPARE(clickedIdSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); + QCOMPARE(clickedIdSpy.size(), 1); int expectedId = -2; QCOMPARE(clickedIdSpy.takeFirst().at(0).toInt(), expectedId); - QCOMPARE(pressedSpy.count(), 1); - QCOMPARE(pressedIdSpy.count(), 1); + QCOMPARE(pressedSpy.size(), 1); + QCOMPARE(pressedIdSpy.size(), 1); QCOMPARE(pressedIdSpy.takeFirst().at(0).toInt(), expectedId); - QCOMPARE(releasedSpy.count(), 1); - QCOMPARE(releasedIdSpy.count(), 1); + QCOMPARE(releasedSpy.size(), 1); + QCOMPARE(releasedIdSpy.size(), 1); QCOMPARE(releasedIdSpy.takeFirst().at(0).toInt(), expectedId); clickedSpy.clear(); @@ -374,14 +374,14 @@ void tst_QButtonGroup::testSignals() pb2.animateClick(); QTestEventLoop::instance().enterLoop(1); - QCOMPARE(clickedSpy.count(), 1); - QCOMPARE(clickedIdSpy.count(), 1); + QCOMPARE(clickedSpy.size(), 1); + QCOMPARE(clickedIdSpy.size(), 1); QCOMPARE(clickedIdSpy.takeFirst().at(0).toInt(), 23); - QCOMPARE(pressedSpy.count(), 1); - QCOMPARE(pressedIdSpy.count(), 1); + QCOMPARE(pressedSpy.size(), 1); + QCOMPARE(pressedIdSpy.size(), 1); QCOMPARE(pressedIdSpy.takeFirst().at(0).toInt(), 23); - QCOMPARE(releasedSpy.count(), 1); - QCOMPARE(releasedIdSpy.count(), 1); + QCOMPARE(releasedSpy.size(), 1); + QCOMPARE(releasedIdSpy.size(), 1); QCOMPARE(releasedIdSpy.takeFirst().at(0).toInt(), 23); @@ -391,18 +391,18 @@ void tst_QButtonGroup::testSignals() pb1.setCheckable(true); pb2.setCheckable(true); pb1.toggle(); - QCOMPARE(toggledSpy.count(), 1); - QCOMPARE(toggledIdSpy.count(), 1); + QCOMPARE(toggledSpy.size(), 1); + QCOMPARE(toggledIdSpy.size(), 1); pb2.toggle(); - QCOMPARE(toggledSpy.count(), 3); // equals 3 since pb1 and pb2 are both toggled - QCOMPARE(toggledIdSpy.count(), 3); + QCOMPARE(toggledSpy.size(), 3); // equals 3 since pb1 and pb2 are both toggled + QCOMPARE(toggledIdSpy.size(), 3); pb1.setCheckable(false); pb2.setCheckable(false); pb1.toggle(); - QCOMPARE(toggledSpy.count(), 3); - QCOMPARE(toggledIdSpy.count(), 3); + QCOMPARE(toggledSpy.size(), 3); + QCOMPARE(toggledIdSpy.size(), 3); } void tst_QButtonGroup::task106609() @@ -442,7 +442,7 @@ void tst_QButtonGroup::task106609() radio1->setChecked(true); QTestEventLoop::instance().enterLoop(1); - QCOMPARE(spy1.count(), 2); + QCOMPARE(spy1.size(), 2); } void tst_QButtonGroup::checkedButton() @@ -527,7 +527,7 @@ void tst_QButtonGroup::task209485_removeFromGroupInEventHandler() // NOTE: Reintroducing the bug of this task will cause the following line to crash: QTest::mouseClick(button, Qt::LeftButton); - QCOMPARE(spy1.count(), signalCount); + QCOMPARE(spy1.size(), signalCount); } void tst_QButtonGroup::autoIncrementId() diff --git a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp index 064b539f22..31da429a8f 100644 --- a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp +++ b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp @@ -84,7 +84,7 @@ void tst_QCalendarWidget::getSetCheck() QDate selectedDate(2005, 7, 3); QSignalSpy spy(&object, SIGNAL(selectionChanged())); object.setSelectedDate(selectedDate); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(selectedDate, object.selectedDate()); //month and year object.setCurrentPage(2004, 1); diff --git a/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp b/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp index b0b34ee3fa..7a54a6e5e6 100644 --- a/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp +++ b/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp @@ -208,10 +208,10 @@ void tst_QCheckBox::stateChanged() QCoreApplication::processEvents(); QCOMPARE(cur_state, 1); - QCOMPARE(stateChangedSpy.count(), 3); + QCOMPARE(stateChangedSpy.size(), 3); testWidget.setCheckState(Qt::PartiallyChecked); QCoreApplication::processEvents(); - QCOMPARE(stateChangedSpy.count(), 3); + QCOMPARE(stateChangedSpy.size(), 3); } void tst_QCheckBox::isToggleButton() diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 9fba4c7566..00874882df 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -749,7 +749,7 @@ void tst_QComboBox::insertPolicy() testWidget->setInsertPolicy(insertPolicy); testWidget->addItems(initialEntries); testWidget->setEditable(true); - if (initialEntries.count() > 0) + if (initialEntries.size() > 0) testWidget->setCurrentIndex(currentIndex); // clear @@ -761,10 +761,10 @@ void tst_QComboBox::insertPolicy() // First check that there is the right number of entries, or // we may unwittingly pass - QCOMPARE((int)result.count(), testWidget->count()); + QCOMPARE((int)result.size(), testWidget->count()); // No need to compare if there are no strings to compare - if (result.count() > 0) { + if (result.size() > 0) { for (int i=0; icount(); ++i) { QCOMPARE(testWidget->itemText(i), result.at(i)); } @@ -861,18 +861,18 @@ void tst_QComboBox::autoCompletionCaseSensitivity() QTest::keyClick(testWidget->lineEdit(), Qt::Key_A); qApp->processEvents(); QCOMPARE(testWidget->currentText(), QString("aww")); - QCOMPARE(spyReturn.count(), 0); + QCOMPARE(spyReturn.size(), 0); QTest::keyClick(testWidget->lineEdit(), Qt::Key_B); qApp->processEvents(); // autocompletions preserve userkey-case from 4.2 QCOMPARE(testWidget->currentText(), QString("abCDEF")); - QCOMPARE(spyReturn.count(), 0); + QCOMPARE(spyReturn.size(), 0); QTest::keyClick(testWidget->lineEdit(), Qt::Key_Enter); qApp->processEvents(); QCOMPARE(testWidget->currentText(), QString("aBCDEF")); // case restored to item's case - QCOMPARE(spyReturn.count(), 1); + QCOMPARE(spyReturn.size(), 1); testWidget->clearEditText(); QTest::keyClick(testWidget->lineEdit(), 'c'); @@ -1171,7 +1171,7 @@ void tst_QComboBox::currentIndex() foreach(QString text, initialItems) { testWidget->addItem(text); } - QCOMPARE(testWidget->count(), initialItems.count()); + QCOMPARE(testWidget->count(), initialItems.size()); // set current index, remove and/or insert if (setCurrentIndex >= -1) { @@ -1189,11 +1189,11 @@ void tst_QComboBox::currentIndex() QCOMPARE(testWidget->currentText(), expectedCurrentText); // check that signal count is correct - QCOMPARE(indexChangedInt.count(), expectedSignalCount); + QCOMPARE(indexChangedInt.size(), expectedSignalCount); // compare with last sent signal values - if (indexChangedInt.count()) - QCOMPARE(indexChangedInt.at(indexChangedInt.count() - 1).at(0).toInt(), + if (indexChangedInt.size()) + QCOMPARE(indexChangedInt.at(indexChangedInt.size() - 1).at(0).toInt(), testWidget->currentIndex()); if (edit) { @@ -1230,8 +1230,8 @@ void tst_QComboBox::insertItems_data() QTest::newRow("prepend") << initialItems << insertedItems << 0 << 0; QTest::newRow("prepend with negative value") << initialItems << insertedItems << -1 << 0; - QTest::newRow("append") << initialItems << insertedItems << initialItems.count() << initialItems.count(); - QTest::newRow("append with too high value") << initialItems << insertedItems << 999 << initialItems.count(); + QTest::newRow("append") << initialItems << insertedItems << initialItems.size() << initialItems.size(); + QTest::newRow("append with too high value") << initialItems << insertedItems << 999 << initialItems.size(); QTest::newRow("insert") << initialItems << insertedItems << 1 << 1; } @@ -1247,12 +1247,12 @@ void tst_QComboBox::insertItems() QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); QComboBox *testWidget = topLevel.comboBox(); testWidget->insertItems(0, initialItems); - QCOMPARE(testWidget->count(), initialItems.count()); + QCOMPARE(testWidget->count(), initialItems.size()); testWidget->insertItems(insertIndex, insertedItems); - QCOMPARE(testWidget->count(), initialItems.count() + insertedItems.count()); - for (int i=0; icount(), initialItems.size() + insertedItems.size()); + for (int i=0; iitemText(expectedIndex + i), insertedItems.at(i)); } @@ -1289,14 +1289,14 @@ void tst_QComboBox::insertItem() QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); QComboBox *testWidget = topLevel.comboBox(); testWidget->insertItems(0, initialItems); - QCOMPARE(testWidget->count(), initialItems.count()); + QCOMPARE(testWidget->count(), initialItems.size()); testWidget->setEditable(true); if (editable) testWidget->setEditText("FOO"); testWidget->insertItem(insertIndex, itemLabel); - QCOMPARE(testWidget->count(), initialItems.count() + 1); + QCOMPARE(testWidget->count(), initialItems.size() + 1); QCOMPARE(testWidget->itemText(expectedIndex), itemLabel); if (editable) @@ -1364,21 +1364,21 @@ void tst_QComboBox::textpixmapdata() QFETCH(IconList, icons); QFETCH(VariantList, variant); - QVERIFY(text.count() == icons.count() && text.count() == variant.count()); + QVERIFY(text.size() == icons.size() && text.size() == variant.size()); TestWidget topLevel; topLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); QComboBox *testWidget = topLevel.comboBox(); - for (int i = 0; iinsertItem(i, text.at(i)); testWidget->setItemIcon(i, icons.at(i)); testWidget->setItemData(i, variant.at(i), Qt::UserRole); } - QCOMPARE(testWidget->count(), text.count()); + QCOMPARE(testWidget->count(), text.size()); - for (int i = 0; iitemIcon(i); QCOMPARE(icon.cacheKey(), icons.at(i).cacheKey()); QPixmap original = icons.at(i).pixmap(1024); @@ -1386,7 +1386,7 @@ void tst_QComboBox::textpixmapdata() QCOMPARE(pixmap.toImage(), original.toImage()); } - for (int i = 0; iitemText(i), text.at(i)); // ### we should test icons/pixmap as well, but I need to fix the api mismatch first QCOMPARE(testWidget->itemData(i, Qt::UserRole), variant.at(i)); @@ -1496,7 +1496,7 @@ void tst_QComboBox::currentTextChanged() QCOMPARE(testWidget->currentIndex(), 0); spy.clear(); testWidget->setCurrentText(QString("bar")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), QString("bar")); // set text not in list @@ -1505,10 +1505,10 @@ void tst_QComboBox::currentTextChanged() spy.clear(); testWidget->setCurrentText(QString("qt")); if (editable) { - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), QString("qt")); } else { - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } // item changed @@ -1516,12 +1516,12 @@ void tst_QComboBox::currentTextChanged() QCOMPARE(testWidget->currentIndex(), 0); spy.clear(); testWidget->setItemText(0, QString("ape")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), QString("ape")); // change it back spy.clear(); testWidget->setItemText(0, QString("foo")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), QString("foo")); } @@ -1546,13 +1546,13 @@ void tst_QComboBox::editTextChanged() QCOMPARE(testWidget->currentIndex(), 0); testWidget->setCurrentIndex(0); QCOMPARE(testWidget->currentIndex(), 0); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // no signal should be sent when changing to other index because we are not editable QCOMPARE(testWidget->currentIndex(), 0); testWidget->setCurrentIndex(1); QCOMPARE(testWidget->currentIndex(), 1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // now set to editable and reset current index testWidget->setEditable(true); @@ -1564,20 +1564,20 @@ void tst_QComboBox::editTextChanged() QCOMPARE(testWidget->currentIndex(), 0); testWidget->setCurrentIndex(0); QCOMPARE(testWidget->currentIndex(), 0); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // signal should be sent when changing to other index QCOMPARE(testWidget->currentIndex(), 0); testWidget->setCurrentIndex(1); QCOMPARE(testWidget->currentIndex(), 1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), QString("bar")); // insert some keys and notice they are all signaled spy.clear(); QTest::keyClicks(testWidget, "bingo"); - QCOMPARE(spy.count(), 5); + QCOMPARE(spy.size(), 5); QCOMPARE(qvariant_cast(spy.at(4).at(0)), QString("barbingo")); } @@ -1744,7 +1744,7 @@ void tst_QComboBox::setMaxCount() // insert 5 items at pos 2. Make sure only two get inserted QSignalSpy spy(box.model(), SIGNAL(rowsInserted(QModelIndex,int,int))); box.insertItems(2, items); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(1).toInt(), 2); QCOMPARE(spy.at(0).at(2).toInt(), 3); @@ -2018,7 +2018,7 @@ void tst_QComboBox::flaggedItems() if (editable) comboBox.lineEdit()->selectAll(); - for (int i = 0; i < keyMovementList.count(); ++i) { + for (int i = 0; i < keyMovementList.size(); ++i) { Qt::Key key = keyMovementList[i]; QTest::keyClick(&comboBox, key); } @@ -2239,7 +2239,7 @@ void tst_QComboBox::separatorItem() box.addItems(items); foreach(int index, separators) box.insertSeparator(index); - QCOMPARE(box.count(), (items.count() + separators.count())); + QCOMPARE(box.count(), (items.size() + separators.size())); for (int i = 0, s = 0; i < box.count(); ++i) { if (i == separators.at(s)) { QCOMPARE(box.itemText(i), QString()); @@ -2447,7 +2447,7 @@ void tst_QComboBox::task247863_keyBoardSelection() QTest::keyClick(static_cast(0), Qt::Key_Down); QTest::keyClick(static_cast(0), Qt::Key_Enter); QCOMPARE(combo.currentText(), QLatin1String("222")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QComboBox::task220195_keyBoardSelection2() @@ -2722,16 +2722,16 @@ void tst_QComboBox::resetModel() QComboBox cb; StringListModel model({"1", "2"}); QSignalSpy spy(&cb, &QComboBox::currentIndexChanged); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(cb.currentIndex(), -1); //no selection cb.setModel(&model); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(cb.currentIndex(), 0); //first item selected model.reset(); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); QCOMPARE(cb.currentIndex(), 0); //first item selected } @@ -2812,10 +2812,10 @@ void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated() QApplication::processEvents(); QTRY_VERIFY(cb.hasFocus()); QTest::keyClick(static_cast(0), '1'); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); edit.setFocus(); QTRY_VERIFY(edit.hasFocus()); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); } void tst_QComboBox::maxVisibleItems_data() @@ -3233,11 +3233,11 @@ void tst_QComboBox::respectChangedOwnershipOfItemView() QTableView *v2 = new QTableView(&box1); box1.setView(v2); // Here we do not expect v1 to be deleted QApplication::processEvents(); - QCOMPARE(spy1.count(), 0); + QCOMPARE(spy1.size(), 0); QSignalSpy spy2(v2, SIGNAL(destroyed())); box1.setView(v1); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); } void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated() @@ -3265,7 +3265,7 @@ void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated() if (scroller->isVisible()) { QSignalSpy doScrollSpy(scroller, SIGNAL(doScroll(int))); QTest::mouseMove(scroller, QPoint(5, 5), 500); - QTRY_VERIFY(doScrollSpy.count() > 0); + QTRY_VERIFY(doScrollSpy.size() > 0); } } } @@ -3422,7 +3422,7 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex() cbox.setCompleter(completer); QSignalSpy spy(&cbox, SIGNAL(activated(int))); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); cbox.move(200, 200); cbox.show(); QApplicationPrivate::setActiveWindow(&cbox); @@ -3616,11 +3616,11 @@ void tst_QComboBox::clearModel() model.setStringList({}); - QCOMPARE(indexSpy.count(), 1); + QCOMPARE(indexSpy.size(), 1); const int index = indexSpy.takeFirst().at(0).toInt(); QCOMPARE(index, -1); - QCOMPARE(textSpy.count(), 1); + QCOMPARE(textSpy.size(), 1); const QString text = textSpy.takeFirst().at(0).toString(); QCOMPARE(text, QString()); diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index d221c09e47..7db98283ce 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -1122,7 +1122,7 @@ void tst_QDateTimeEdit::enterKey() // we include this test so a change to the behaviour can't go unnoticed. QSignalSpy enterSpy(testWidget, SIGNAL(dateChanged(QDate))); QTest::keyClick(testWidget, Qt::Key_Enter); - QCOMPARE(enterSpy.count(), 1); + QCOMPARE(enterSpy.size(), 1); QVariantList list = enterSpy.takeFirst(); QCOMPARE(list.at(0).toDate(), QDate(2004, 5, 9)); } @@ -2197,7 +2197,7 @@ void tst_QDateTimeEdit::dateSignalChecking() QSignalSpy timeSpy(testWidget, SIGNAL(timeChanged(QTime))); testWidget->setDate(newDate); - QCOMPARE(dateSpy.count(), timesEmitted); + QCOMPARE(dateSpy.size(), timesEmitted); if (timesEmitted > 0) { QList list = dateSpy.takeFirst(); @@ -2205,8 +2205,8 @@ void tst_QDateTimeEdit::dateSignalChecking() d = qvariant_cast(list.at(0)); QCOMPARE(d, newDate); } - QCOMPARE(dateTimeSpy.count(), timesEmitted); - QCOMPARE(timeSpy.count(), 0); + QCOMPARE(dateTimeSpy.size(), timesEmitted); + QCOMPARE(timeSpy.size(), 0); } void tst_QDateTimeEdit::timeSignalChecking_data() @@ -2233,7 +2233,7 @@ void tst_QDateTimeEdit::timeSignalChecking() QSignalSpy timeSpy(testWidget, SIGNAL(timeChanged(QTime))); testWidget->setTime(newTime); - QCOMPARE(timeSpy.count(), timesEmitted); + QCOMPARE(timeSpy.size(), timesEmitted); if (timesEmitted > 0) { QList list = timeSpy.takeFirst(); @@ -2241,8 +2241,8 @@ void tst_QDateTimeEdit::timeSignalChecking() t = qvariant_cast(list.at(0)); QCOMPARE(t, newTime); } - QCOMPARE(dateTimeSpy.count(), timesEmitted); - QCOMPARE(dateSpy.count(), 0); + QCOMPARE(dateTimeSpy.size(), timesEmitted); + QCOMPARE(dateSpy.size(), 0); } void tst_QDateTimeEdit::dateTimeSignalChecking_data() @@ -2283,7 +2283,7 @@ void tst_QDateTimeEdit::dateTimeSignalChecking() QSignalSpy dateTimeSpy(testWidget, SIGNAL(dateTimeChanged(QDateTime))); testWidget->setDateTime(newDateTime); - QCOMPARE(dateSpy.count(), timesDateEmitted); + QCOMPARE(dateSpy.size(), timesDateEmitted); if (timesDateEmitted > 0) { QCOMPARE(timesDateEmitted, 1); QList list = dateSpy.takeFirst(); @@ -2291,14 +2291,14 @@ void tst_QDateTimeEdit::dateTimeSignalChecking() d = qvariant_cast(list.at(0)); QCOMPARE(d, newDateTime.date()); } - QCOMPARE(timeSpy.count(), timesTimeEmitted); + QCOMPARE(timeSpy.size(), timesTimeEmitted); if (timesTimeEmitted > 0) { QList list = timeSpy.takeFirst(); QTime t; t = qvariant_cast(list.at(0)); QCOMPARE(t, newDateTime.time()); } - QCOMPARE(dateTimeSpy.count(), timesDateTimeEmitted); + QCOMPARE(dateTimeSpy.size(), timesDateTimeEmitted); if (timesDateTimeEmitted > 0) { QList list = dateTimeSpy.takeFirst(); QDateTime dt; @@ -3162,22 +3162,22 @@ void tst_QDateTimeEdit::task149097() testWidget->setDisplayFormat("yyyy/MM/dd hh:mm:ss"); testWidget->setDateTime(QDateTime(QDate(2001, 02, 03), QTime(5, 1, 2))); // QTest::keyClick(testWidget, Qt::Key_Enter); - QCOMPARE(dtSpy.count(), 1); - QCOMPARE(dSpy.count(), 1); - QCOMPARE(tSpy.count(), 1); + QCOMPARE(dtSpy.size(), 1); + QCOMPARE(dSpy.size(), 1); + QCOMPARE(tSpy.size(), 1); testWidget->setCurrentSection(QDateTimeEdit::YearSection); testWidget->stepBy(1); - QCOMPARE(dtSpy.count(), 2); - QCOMPARE(dSpy.count(), 2); - QCOMPARE(tSpy.count(), 1); + QCOMPARE(dtSpy.size(), 2); + QCOMPARE(dSpy.size(), 2); + QCOMPARE(tSpy.size(), 1); testWidget->setCurrentSection(QDateTimeEdit::MinuteSection); testWidget->stepBy(1); - QCOMPARE(dtSpy.count(), 3); - QCOMPARE(dSpy.count(), 2); - QCOMPARE(tSpy.count(), 2); + QCOMPARE(dtSpy.size(), 3); + QCOMPARE(dSpy.size(), 2); + QCOMPARE(tSpy.size(), 2); } void tst_QDateTimeEdit::task148725() @@ -4555,12 +4555,12 @@ void tst_QDateTimeEdit::stepModifierPressAndHold() QStyle::CC_SpinBox, &spinBoxStyleOption, subControl, &edit); QTest::mousePress(&edit, Qt::LeftButton, modifiers, buttonRect.center()); - QTRY_VERIFY(spy.length() >= 3); + QTRY_VERIFY(spy.size() >= 3); QTest::mouseRelease(&edit, Qt::LeftButton, modifiers, buttonRect.center()); const auto value = spy.last().at(0); QVERIFY(value.userType() == QMetaType::QDate); - const QDate expectedDate = startDate.addYears(spy.length() * + const QDate expectedDate = startDate.addYears(spy.size() * expectedStepModifier); QCOMPARE(value.toDate(), expectedDate); } diff --git a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp b/tests/auto/widgets/widgets/qdial/tst_qdial.cpp index 3008714576..1d8c970ef4 100644 --- a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp +++ b/tests/auto/widgets/widgets/qdial/tst_qdial.cpp @@ -52,14 +52,14 @@ void tst_QDial::valueChanged() dial.setMaximum(100); QSignalSpy spy(&dial, SIGNAL(valueChanged(int))); dial.setValue(50); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); dial.setValue(25); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); // repeat! dial.setValue(25); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QDial::sliderMoved() @@ -88,8 +88,8 @@ void tst_QDial::sliderMoved() QMouseEvent moveevent(QEvent::MouseMove, init, dial.mapToGlobal(init), Qt::LeftButton, Qt::LeftButton, {}); qApp->sendEvent(&dial, &moveevent); - QCOMPARE( sliderspy.count(), 1); - QCOMPARE( valuespy.count(), 0); + QCOMPARE( sliderspy.size(), 1); + QCOMPARE( valuespy.size(), 0); } @@ -98,14 +98,14 @@ void tst_QDial::sliderMoved() QMouseEvent moveevent(QEvent::MouseMove, init, dial.mapToGlobal(init), Qt::LeftButton, Qt::LeftButton, {}); qApp->sendEvent(&dial, &moveevent); - QCOMPARE( sliderspy.count(), 2); - QCOMPARE( valuespy.count(), 0); + QCOMPARE( sliderspy.size(), 2); + QCOMPARE( valuespy.size(), 0); } QMouseEvent releaseevent(QEvent::MouseButtonRelease, init, dial.mapToGlobal(init), Qt::LeftButton, Qt::LeftButton, {}); qApp->sendEvent(&dial, &releaseevent); - QCOMPARE( valuespy.count(), 1); // valuechanged signal should be called at this point + QCOMPARE( valuespy.size(), 1); // valuechanged signal should be called at this point } diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index 430e5034af..df26b4c5da 100644 --- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp @@ -425,8 +425,8 @@ void tst_QDialogButtonBox::testSignalEmissionAfterDelete_QTBUG_45835() button->click(); QCOMPARE(buttonBox.buttons().size(), 0); - QCOMPARE(buttonClickedSpy.count(), 1); - QCOMPARE(buttonBoxAcceptedSpy.count(), 1); + QCOMPARE(buttonClickedSpy.size(), 1); + QCOMPARE(buttonBoxAcceptedSpy.size(), 1); } { @@ -448,8 +448,8 @@ void tst_QDialogButtonBox::testSignalEmissionAfterDelete_QTBUG_45835() button->click(); QVERIFY(buttonBox.isNull()); - QCOMPARE(buttonClickedSpy.count(), 1); - QCOMPARE(buttonBoxAcceptedSpy.count(), 0); + QCOMPARE(buttonClickedSpy.size(), 1); + QCOMPARE(buttonBoxAcceptedSpy.size(), 0); } } @@ -594,13 +594,13 @@ void tst_QDialogButtonBox::testSignals() if (clickMe) clickMe->click(); - QTRY_COMPARE(clicked2.count(), clicked2Count); - if (clicked2.count() > 0) + QTRY_COMPARE(clicked2.size(), clicked2Count); + if (clicked2.size() > 0) QCOMPARE(qvariant_cast(clicked2.at(0).at(0)), clickMe); - QTEST(int(accept.count()), "acceptCount"); - QTEST(int(reject.count()), "rejectCount"); - QTEST(int(helpRequested.count()), "helpRequestedCount"); + QTEST(int(accept.size()), "acceptCount"); + QTEST(int(reject.size()), "rejectCount"); + QTEST(int(helpRequested.size()), "helpRequestedCount"); } void tst_QDialogButtonBox::testSignalOrder() @@ -756,7 +756,7 @@ void tst_QDialogButtonBox::testRemove() button->click(); QTest::qWait(100); - QCOMPARE(clicked.count(), 0); + QCOMPARE(clicked.size(), 0); delete button; } @@ -818,7 +818,7 @@ void tst_QDialogButtonBox::task191642_default() QVERIFY(QTest::qWaitForWindowActive(&dlg)); QVERIFY(def->isDefault()); QTest::keyPress( &dlg, Qt::Key_Enter ); - QCOMPARE(clicked.count(), 1); + QCOMPARE(clicked.size(), 1); } void tst_QDialogButtonBox::testDeletedStandardButton() diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index d0827024d3..d590d69759 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -272,12 +272,12 @@ void tst_QDockWidget::features() QVERIFY(!hasFeature(&dw, QDockWidget::DockWidgetClosable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((int)*(static_cast(spy.at(0).value(0).constData())), (int)dw.features()); spy.clear(); dw.setFeatures(dw.features()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); setFeature(&dw, QDockWidget::DockWidgetClosable); @@ -285,12 +285,12 @@ void tst_QDockWidget::features() QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((int)*static_cast(spy.at(0).value(0).constData()), (int)dw.features()); spy.clear(); dw.setFeatures(dw.features()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); setFeature(&dw, QDockWidget::DockWidgetMovable, false); @@ -298,12 +298,12 @@ void tst_QDockWidget::features() QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable)); QVERIFY(!hasFeature(&dw, QDockWidget::DockWidgetMovable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((int)*static_cast(spy.at(0).value(0).constData()), (int)dw.features()); spy.clear(); dw.setFeatures(dw.features()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); setFeature(&dw, QDockWidget::DockWidgetMovable); @@ -311,12 +311,12 @@ void tst_QDockWidget::features() QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((int)*static_cast(spy.at(0).value(0).constData()), (int)dw.features()); spy.clear(); dw.setFeatures(dw.features()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); setFeature(&dw, QDockWidget::DockWidgetFloatable, false); @@ -324,12 +324,12 @@ void tst_QDockWidget::features() QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable)); QVERIFY(!hasFeature(&dw, QDockWidget::DockWidgetFloatable)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((int)*static_cast(spy.at(0).value(0).constData()), (int)dw.features()); spy.clear(); dw.setFeatures(dw.features()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); setFeature(&dw, QDockWidget::DockWidgetFloatable); @@ -337,12 +337,12 @@ void tst_QDockWidget::features() QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((int)*static_cast(spy.at(0).value(0).constData()), (int)dw.features()); spy.clear(); dw.setFeatures(dw.features()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); // set all at once @@ -351,12 +351,12 @@ void tst_QDockWidget::features() QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable)); QVERIFY(!hasFeature(&dw, QDockWidget::DockWidgetFloatable)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((int)*static_cast(spy.at(0).value(0).constData()), (int)dw.features()); spy.clear(); dw.setFeatures(dw.features()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); dw.setFeatures(QDockWidget::DockWidgetClosable); @@ -364,12 +364,12 @@ void tst_QDockWidget::features() QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable)); QVERIFY(!hasFeature(&dw, QDockWidget::DockWidgetMovable)); QVERIFY(!hasFeature(&dw, QDockWidget::DockWidgetFloatable)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((int)*static_cast(spy.at(0).value(0).constData()), (int)dw.features()); spy.clear(); dw.setFeatures(dw.features()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); dw.setFeatures(allDockWidgetFeatures); @@ -377,12 +377,12 @@ void tst_QDockWidget::features() QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetClosable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetMovable)); QVERIFY(hasFeature(&dw, QDockWidget::DockWidgetFloatable)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE((int)*static_cast(spy.at(0).value(0).constData()), (int)dw.features()); spy.clear(); dw.setFeatures(dw.features()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); } @@ -409,20 +409,20 @@ void tst_QDockWidget::setFloating() QVERIFY((dockedPosition - floatingPosition).manhattanLength() < 50); QVERIFY(dw.isFloating()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).value(0).toBool(), dw.isFloating()); spy.clear(); dw.setFloating(dw.isFloating()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); dw.setFloating(false); QVERIFY(!dw.isFloating()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).value(0).toBool(), dw.isFloating()); spy.clear(); dw.setFloating(dw.isFloating()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); } @@ -446,12 +446,12 @@ void tst_QDockWidget::allowedAreas() QVERIFY(!dw.isAreaAllowed(Qt::RightDockWidgetArea)); QVERIFY(!dw.isAreaAllowed(Qt::TopDockWidgetArea)); QVERIFY(!dw.isAreaAllowed(Qt::BottomDockWidgetArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), dw.allowedAreas()); spy.clear(); dw.setAllowedAreas(dw.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); dw.setAllowedAreas(Qt::RightDockWidgetArea); QCOMPARE(dw.allowedAreas(), Qt::RightDockWidgetArea); @@ -459,12 +459,12 @@ void tst_QDockWidget::allowedAreas() QVERIFY(dw.isAreaAllowed(Qt::RightDockWidgetArea)); QVERIFY(!dw.isAreaAllowed(Qt::TopDockWidgetArea)); QVERIFY(!dw.isAreaAllowed(Qt::BottomDockWidgetArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), dw.allowedAreas()); spy.clear(); dw.setAllowedAreas(dw.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); dw.setAllowedAreas(Qt::TopDockWidgetArea); QCOMPARE(dw.allowedAreas(), Qt::TopDockWidgetArea); @@ -472,12 +472,12 @@ void tst_QDockWidget::allowedAreas() QVERIFY(!dw.isAreaAllowed(Qt::RightDockWidgetArea)); QVERIFY(dw.isAreaAllowed(Qt::TopDockWidgetArea)); QVERIFY(!dw.isAreaAllowed(Qt::BottomDockWidgetArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), dw.allowedAreas()); spy.clear(); dw.setAllowedAreas(dw.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); dw.setAllowedAreas(Qt::BottomDockWidgetArea); QCOMPARE(dw.allowedAreas(), Qt::BottomDockWidgetArea); @@ -485,12 +485,12 @@ void tst_QDockWidget::allowedAreas() QVERIFY(!dw.isAreaAllowed(Qt::RightDockWidgetArea)); QVERIFY(!dw.isAreaAllowed(Qt::TopDockWidgetArea)); QVERIFY(dw.isAreaAllowed(Qt::BottomDockWidgetArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), dw.allowedAreas()); spy.clear(); dw.setAllowedAreas(dw.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // multiple dock window areas dw.setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); @@ -500,12 +500,12 @@ void tst_QDockWidget::allowedAreas() QVERIFY(dw.isAreaAllowed(Qt::TopDockWidgetArea)); QVERIFY(dw.isAreaAllowed(Qt::BottomDockWidgetArea)); //QVERIFY(!dw.isAreaAllowed(Qt::FloatingDockWidgetArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), dw.allowedAreas()); spy.clear(); dw.setAllowedAreas(dw.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); dw.setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); QCOMPARE(dw.allowedAreas(), Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); @@ -514,12 +514,12 @@ void tst_QDockWidget::allowedAreas() QVERIFY(!dw.isAreaAllowed(Qt::TopDockWidgetArea)); QVERIFY(!dw.isAreaAllowed(Qt::BottomDockWidgetArea)); //QVERIFY(!dw.isAreaAllowed(Qt::FloatingDockWidgetArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), dw.allowedAreas()); spy.clear(); dw.setAllowedAreas(dw.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); dw.setAllowedAreas(Qt::TopDockWidgetArea | Qt::LeftDockWidgetArea); QCOMPARE(dw.allowedAreas(), Qt::TopDockWidgetArea | Qt::LeftDockWidgetArea); @@ -528,12 +528,12 @@ void tst_QDockWidget::allowedAreas() QVERIFY(dw.isAreaAllowed(Qt::TopDockWidgetArea)); QVERIFY(!dw.isAreaAllowed(Qt::BottomDockWidgetArea)); //QVERIFY(!dw.isAreaAllowed(Qt::FloatingDockWidgetArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), dw.allowedAreas()); spy.clear(); dw.setAllowedAreas(dw.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); //dw.setAllowedAreas(Qt::BottomDockWidgetArea | Qt::FloatingDockWidgetArea); dw.setAllowedAreas(Qt::BottomDockWidgetArea); @@ -543,12 +543,12 @@ void tst_QDockWidget::allowedAreas() QVERIFY(!dw.isAreaAllowed(Qt::TopDockWidgetArea)); QVERIFY(dw.isAreaAllowed(Qt::BottomDockWidgetArea)); //QVERIFY(dw.isAreaAllowed(Qt::FloatingDockWidgetArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), dw.allowedAreas()); spy.clear(); dw.setAllowedAreas(dw.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); dw.setAllowedAreas(Qt::BottomDockWidgetArea | Qt::RightDockWidgetArea); QCOMPARE(dw.allowedAreas(), Qt::BottomDockWidgetArea | Qt::RightDockWidgetArea); @@ -557,12 +557,12 @@ void tst_QDockWidget::allowedAreas() QVERIFY(!dw.isAreaAllowed(Qt::TopDockWidgetArea)); QVERIFY(dw.isAreaAllowed(Qt::BottomDockWidgetArea)); //QVERIFY(!dw.isAreaAllowed(Qt::FloatingDockWidgetArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), dw.allowedAreas()); spy.clear(); dw.setAllowedAreas(dw.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QDockWidget::toggleViewAction() @@ -590,65 +590,65 @@ void tst_QDockWidget::visibilityChanged() mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); mw.show(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); dw.hide(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); spy.clear(); dw.hide(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); dw.show(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); dw.show(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QDockWidget dw2; mw.tabifyDockWidget(&dw, &dw2); dw2.show(); dw2.raise(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); spy.clear(); dw2.hide(); qApp->processEvents(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); dw2.show(); dw2.raise(); qApp->processEvents(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); spy.clear(); dw.raise(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); dw.raise(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); dw2.raise(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); spy.clear(); dw2.raise(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); mw.addDockWidget(Qt::RightDockWidgetArea, &dw2); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); } @@ -702,56 +702,56 @@ void tst_QDockWidget::dockLocationChanged() QSignalSpy spy(&dw, SIGNAL(dockLocationChanged(Qt::DockWidgetArea))); mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::LeftDockWidgetArea); spy.clear(); mw.addDockWidget(Qt::LeftDockWidgetArea, &dw); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::LeftDockWidgetArea); spy.clear(); mw.addDockWidget(Qt::RightDockWidgetArea, &dw); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::RightDockWidgetArea); spy.clear(); mw.removeDockWidget(&dw); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QDockWidget dw2; dw2.setObjectName("dock2"); mw.addDockWidget(Qt::TopDockWidgetArea, &dw2); mw.tabifyDockWidget(&dw2, &dw); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); mw.splitDockWidget(&dw2, &dw, Qt::Horizontal); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); dw.setFloating(true); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::NoDockWidgetArea); spy.clear(); dw.setFloating(false); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); QByteArray ba = mw.saveState(); mw.restoreState(ba); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::TopDockWidgetArea); } @@ -1022,9 +1022,9 @@ void tst_QDockWidget::task258459_visibilityChanged() QSignalSpy spy2(&dock2, SIGNAL(visibilityChanged(bool))); win.show(); QVERIFY(QTest::qWaitForWindowActive(&win)); - QCOMPARE(spy1.count(), 1); + QCOMPARE(spy1.size(), 1); QCOMPARE(spy1.first().first().toBool(), false); //dock1 is invisible - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy2.size(), 1); QCOMPARE(spy2.first().first().toBool(), true); //dock1 is visible } diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index b8b793eada..c365e09277 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -874,37 +874,37 @@ void tst_QDoubleSpinBox::editingFinished() QTest::keyClick(box, Qt::Key_Up); - QCOMPARE(editingFinishedSpy1.count(), 0); - QCOMPARE(editingFinishedSpy2.count(), 0); + QCOMPARE(editingFinishedSpy1.size(), 0); + QCOMPARE(editingFinishedSpy2.size(), 0); QTest::keyClick(box2, Qt::Key_Up); QTest::keyClick(box2, Qt::Key_Up); box2->setFocus(); - QCOMPARE(editingFinishedSpy1.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 1); box->setFocus(); - QCOMPARE(editingFinishedSpy1.count(), 1); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 1); + QCOMPARE(editingFinishedSpy2.size(), 1); QTest::keyClick(box, Qt::Key_Up); - QCOMPARE(editingFinishedSpy1.count(), 1); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 1); + QCOMPARE(editingFinishedSpy2.size(), 1); QTest::keyClick(box, Qt::Key_Enter); - QCOMPARE(editingFinishedSpy1.count(), 2); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 2); + QCOMPARE(editingFinishedSpy2.size(), 1); QTest::keyClick(box, Qt::Key_Return); - QCOMPARE(editingFinishedSpy1.count(), 3); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 3); + QCOMPARE(editingFinishedSpy2.size(), 1); box2->setFocus(); - QCOMPARE(editingFinishedSpy1.count(), 4); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 4); + QCOMPARE(editingFinishedSpy2.size(), 1); QTest::keyClick(box2, Qt::Key_Enter); - QCOMPARE(editingFinishedSpy1.count(), 4); - QCOMPARE(editingFinishedSpy2.count(), 2); + QCOMPARE(editingFinishedSpy1.size(), 4); + QCOMPARE(editingFinishedSpy2.size(), 2); QTest::keyClick(box2, Qt::Key_Return); - QCOMPARE(editingFinishedSpy1.count(), 4); - QCOMPARE(editingFinishedSpy2.count(), 3); + QCOMPARE(editingFinishedSpy1.size(), 4); + QCOMPARE(editingFinishedSpy2.size(), 3); testFocusWidget.hide(); - QCOMPARE(editingFinishedSpy1.count(), 4); - QCOMPARE(editingFinishedSpy2.count(), 4); + QCOMPARE(editingFinishedSpy1.size(), 4); + QCOMPARE(editingFinishedSpy2.size(), 4); } void tst_QDoubleSpinBox::removeAll() @@ -1760,12 +1760,12 @@ void tst_QDoubleSpinBox::stepModifierPressAndHold() QStyle::CC_SpinBox, &spinBoxStyleOption, subControl, &spin); QTest::mousePress(&spin, Qt::LeftButton, modifiers, buttonRect.center()); - QTRY_VERIFY(spy.length() >= 3); + QTRY_VERIFY(spy.size() >= 3); QTest::mouseRelease(&spin, Qt::LeftButton, modifiers, buttonRect.center()); const auto value = spy.last().at(0); QVERIFY(value.userType() == QMetaType::Double); - QCOMPARE(value.toDouble(), spy.length() * expectedStepModifier); + QCOMPARE(value.toDouble(), spy.size() * expectedStepModifier); } QTEST_MAIN(tst_QDoubleSpinBox) diff --git a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp index 6a0749d7e3..149b6586ae 100644 --- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp +++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp @@ -77,7 +77,7 @@ void tst_QFontComboBox::currentFont_data() if (!QFontDatabase::isPrivateFamily(defaultFont.family())) QTest::newRow("default2") << defaultFont; QStringList list = QFontDatabase::families(); - for (int i = 0; i < list.count(); ++i) { + for (int i = 0; i < list.size(); ++i) { QFont f = QFont(QStringList{QFontInfo(QFont(list.at(i))).family()}); if (!QFontDatabase::isPrivateFamily(f.families().first())) QTest::newRow(qPrintable(list.at(i))) << f; @@ -105,7 +105,7 @@ void tst_QFontComboBox::currentFont() if (oldCurrentFont != box.currentFont()) { //the signal may be emit twice if there is a foundry into brackets - QCOMPARE(spy0.count(),1); + QCOMPARE(spy0.size(),1); } } @@ -155,7 +155,7 @@ void tst_QFontComboBox::fontFilters() if((fontFilters & spacingMask) == spacingMask) fontFilters &= ~spacingMask; - for (int i = 0; i < list.count(); ++i) { + for (int i = 0; i < list.size(); ++i) { if (QFontDatabase::isPrivateFamily(list[i])) continue; if (fontFilters & QFontComboBox::ScalableFonts) { @@ -180,7 +180,7 @@ void tst_QFontComboBox::fontFilters() if (c == 0) QCOMPARE(box.currentFont(), QFont()); - QCOMPARE(spy0.count(), (currentFont != box.currentFont()) ? 1 : 0); + QCOMPARE(spy0.size(), (currentFont != box.currentFont()) ? 1 : 0); } // public QSize sizeHint() const @@ -221,17 +221,17 @@ void tst_QFontComboBox::writingSystem() QCOMPARE(box.writingSystem(), writingSystem); QStringList list = QFontDatabase::families(writingSystem); - int c = list.count(); - for (int i = 0; i < list.count(); ++i) { + int c = list.size(); + for (int i = 0; i < list.size(); ++i) { if (QFontDatabase::isPrivateFamily(list[i])) c--; } QCOMPARE(box.model()->rowCount(), c); - if (list.count() == 0) + if (list.size() == 0) QCOMPARE(box.currentFont(), QFont()); - QCOMPARE(spy0.count(), (currentFont != box.currentFont()) ? 1 : 0); + QCOMPARE(spy0.size(), (currentFont != box.currentFont()) ? 1 : 0); } // protected void currentFontChanged(QFont const& f) @@ -245,11 +245,11 @@ void tst_QFontComboBox::currentFontChanged() if (box->model()->rowCount() > 2) { QTest::keyPress(box, Qt::Key_Down); - QCOMPARE(spy0.count(), 1); + QCOMPARE(spy0.size(), 1); QFont f( "Sans Serif" ); box->setCurrentFont(f); - QCOMPARE(spy0.count(), 2); + QCOMPARE(spy0.size(), 2); } else qWarning("Not enough fonts installed on test system. Consider adding some"); } diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp index 35b079181b..065310398c 100644 --- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp +++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp @@ -373,8 +373,8 @@ void tst_QGroupBox::clicked() else QTest::mouseClick(&testWidget, Qt::LeftButton); - QTEST(int(spy.count()), "clickedCount"); - if (spy.count() > 0) + QTEST(int(spy.size()), "clickedCount"); + if (spy.size() > 0) QTEST(spy.at(0).at(0).toBool(), "finalCheck"); QTEST(testWidget.isChecked(), "finalCheck"); } @@ -388,9 +388,9 @@ void tst_QGroupBox::toggledVsClicked() QSignalSpy clickSpy(&groupBox, SIGNAL(clicked(bool))); groupBox.setChecked(!groupBox.isChecked()); - QCOMPARE(clickSpy.count(), 0); - QCOMPARE(toggleSpy.count(), 1); - if (toggleSpy.count() > 0) + QCOMPARE(clickSpy.size(), 0); + QCOMPARE(toggleSpy.size(), 1); + if (toggleSpy.size() > 0) QCOMPARE(toggleSpy.at(0).at(0).toBool(), groupBox.isChecked()); connect(&groupBox, SIGNAL(clicked(bool)), this, SLOT(clickTimestampSlot())); @@ -403,8 +403,8 @@ void tst_QGroupBox::toggledVsClicked() QStyle::SC_GroupBoxCheckBox, &groupBox); QTest::mouseClick(&groupBox, Qt::LeftButton, {}, rect.center()); - QCOMPARE(clickSpy.count(), 1); - QCOMPARE(toggleSpy.count(), 2); + QCOMPARE(clickSpy.size(), 1); + QCOMPARE(toggleSpy.size(), 2); QVERIFY(toggleTimeStamp < clickTimeStamp); } @@ -602,7 +602,7 @@ void tst_QGroupBox::buttonPressKeys() .value>(); for (int i = 0; i < buttonPressKeys.size(); ++i) { QTest::keyClick(&groupBox, buttonPressKeys[i]); - QCOMPARE(clickedSpy.length(), i + 1); + QCOMPARE(clickedSpy.size(), i + 1); } } diff --git a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp index a0a2fe023a..2bd0c6ed85 100644 --- a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp +++ b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp @@ -37,7 +37,7 @@ void tst_QKeySequenceEdit::testSetters() edit.clear(); QCOMPARE(edit.keySequence(), QKeySequence()); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QKeySequenceEdit::testKeys_data() @@ -99,9 +99,9 @@ void tst_QKeySequenceEdit::testKeys() QTest::keyPress(&edit, key, modifiers); QTest::keyRelease(&edit, key, modifiers); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(edit.keySequence(), keySequence); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); } void tst_QKeySequenceEdit::testLineEditContents() @@ -146,21 +146,21 @@ void tst_QKeySequenceEdit::testFinishingKeyCombinations() QKeySequenceEdit edit; QSignalSpy spy(&edit, SIGNAL(editingFinished())); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); edit.setFinishingKeyCombinations({QKeyCombination(modifiers, key)}); QTest::keyPress(&edit, key, modifiers); QTest::keyRelease(&edit, key, modifiers); QCOMPARE(edit.keySequence(), QKeySequence()); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); edit.setFinishingKeyCombinations({}); QTest::keyPress(&edit, key, modifiers); QTest::keyRelease(&edit, key, modifiers); QCOMPARE(edit.keySequence(), keySequence); - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE(spy.size(), 2); } QTEST_MAIN(tst_QKeySequenceEdit) diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index cad889341a..74a011d96d 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -919,8 +919,8 @@ void tst_QLineEdit::hasAcceptableInputValidator() qApp->sendEvent(testWidget, &lostFocus); QVERIFY(testWidget->hasAcceptableInput()); - QCOMPARE(spyChanged.count(), 2); - QCOMPARE(spyEdited.count(), 0); + QCOMPARE(spyChanged.size(), 2); + QCOMPARE(spyEdited.size(), 0); } @@ -1592,7 +1592,7 @@ void tst_QLineEdit::setText() QSignalSpy editedSpy(testWidget, SIGNAL(textEdited(QString))); QSignalSpy changedSpy(testWidget, SIGNAL(textChanged(QString))); testWidget->setText("hello"); - QCOMPARE(editedSpy.count(), 0); + QCOMPARE(editedSpy.size(), 0); QCOMPARE(changedSpy.value(0).value(0).toString(), QString("hello")); } @@ -3308,7 +3308,7 @@ void tst_QLineEdit::validateOnFocusOut() QTest::keyPress(testWidget, '0'); QCOMPARE(testWidget->text(), QString("10")); testWidget->clearFocus(); - QCOMPARE(editingFinishedSpy.count(), 0); + QCOMPARE(editingFinishedSpy.size(), 0); testWidget->setFocus(); centerOnScreen(testWidget); @@ -3321,7 +3321,7 @@ void tst_QLineEdit::validateOnFocusOut() QTRY_COMPARE(testWidget->text(), QString("100")); testWidget->clearFocus(); - QCOMPARE(editingFinishedSpy.count(), 1); + QCOMPARE(editingFinishedSpy.size(), 1); } void tst_QLineEdit::editInvalidText() @@ -3499,7 +3499,7 @@ void tst_QLineEdit::noTextEditedOnClear() testWidget->setText("Test"); QSignalSpy textEditedSpy(testWidget, SIGNAL(textEdited(QString))); testWidget->clear(); - QCOMPARE(textEditedSpy.count(), 0); + QCOMPARE(textEditedSpy.size(), 0); } void tst_QLineEdit::textMargin_data() @@ -3603,7 +3603,7 @@ void tst_QLineEdit::returnKeyClearsEditedFlag() // Focus drop with no edits shouldn't emit signal, edited flag == false testWidget.clearFocus(); // Signal not emitted QVERIFY(!testWidget.hasFocus()); - QCOMPARE(leSpy.count(), 0); + QCOMPARE(leSpy.size(), 0); // Focus drop after edits should emit signal, edited flag == true testWidget.setFocus(); @@ -3611,7 +3611,7 @@ void tst_QLineEdit::returnKeyClearsEditedFlag() QTest::keyClicks(&testWidget, "edit1 "); // edited flag set testWidget.clearFocus(); // edited flag cleared, signal emitted QVERIFY(!testWidget.hasFocus()); - QCOMPARE(leSpy.count(), 1); + QCOMPARE(leSpy.size(), 1); // Only text related keys should set edited flag testWidget.setFocus(); @@ -3621,7 +3621,7 @@ void tst_QLineEdit::returnKeyClearsEditedFlag() QTest::keyClick(&testWidget, Qt::Key_PageUp); testWidget.clearFocus(); // Signal not emitted QVERIFY(!testWidget.hasFocus()); - QCOMPARE(leSpy.count(), 1); // No change + QCOMPARE(leSpy.size(), 1); // No change // Return should always emit signal testWidget.setFocus(); @@ -3629,12 +3629,12 @@ void tst_QLineEdit::returnKeyClearsEditedFlag() QTest::keyClick(&testWidget, Qt::Key_Return); /* Without edits, signal emitted, edited flag cleared */ - QCOMPARE(leSpy.count(), 2); + QCOMPARE(leSpy.size(), 2); QTest::keyClicks(&testWidget, "edit2 "); // edited flag set QTest::keyClick(&testWidget, Qt::Key_Return); /* With edits, signal emitted, edited flag cleared */ - QCOMPARE(leSpy.count(), 3); + QCOMPARE(leSpy.size(), 3); /* After editing the line edit following a Return key press with a focus drop should not emit signal a second time since Return now @@ -3642,10 +3642,10 @@ void tst_QLineEdit::returnKeyClearsEditedFlag() QTest::keyClicks(&testWidget, "edit3 "); // edited flag set QTest::keyClick(&testWidget, Qt::Key_Return); /* signal emitted, edited flag cleared */ - QCOMPARE(leSpy.count(), 4); + QCOMPARE(leSpy.size(), 4); testWidget.clearFocus(); // Signal not emitted since edited == false QVERIFY(!testWidget.hasFocus()); - QCOMPARE(leSpy.count(), 4); // No change + QCOMPARE(leSpy.size(), 4); // No change } #ifndef QT_NO_CURSOR @@ -3721,19 +3721,19 @@ void tst_QLineEdit::task174640_editingFinished() le1->setFocus(); QTRY_VERIFY(le1->hasFocus()); - QCOMPARE(editingFinishedSpy.count(), 0); + QCOMPARE(editingFinishedSpy.size(), 0); le2->setFocus(); QTRY_VERIFY(le2->hasFocus()); // editingFinished will not be emitted anew because no editing happened - QCOMPARE(editingFinishedSpy.count(), 0); + QCOMPARE(editingFinishedSpy.size(), 0); le1->setFocus(); QTRY_VERIFY(le1->hasFocus()); QTest::keyPress(le1, Qt::Key_Plus); le2->setFocus(); QTRY_VERIFY(le2->hasFocus()); - QCOMPARE(editingFinishedSpy.count(), 1); + QCOMPARE(editingFinishedSpy.size(), 1); editingFinishedSpy.clear(); le1->setFocus(); @@ -3748,7 +3748,7 @@ void tst_QLineEdit::task174640_editingFinished() mw.activateWindow(); delete testMenu1; - QCOMPARE(editingFinishedSpy.count(), 0); + QCOMPARE(editingFinishedSpy.size(), 0); QTRY_VERIFY(le1->hasFocus()); // Ensure le1 has been edited QTest::keyPress(le1, Qt::Key_Plus); @@ -3761,7 +3761,7 @@ void tst_QLineEdit::task174640_editingFinished() QTest::qWait(20); mw.activateWindow(); delete testMenu2; - QCOMPARE(editingFinishedSpy.count(), 1); + QCOMPARE(editingFinishedSpy.size(), 1); } #if QT_CONFIG(completer) @@ -3846,7 +3846,7 @@ void tst_QLineEdit::task229938_dontEmitChangedWhenTextIsNotChanged() QTest::keyPress(&lineEdit, 'd'); QTest::keyPress(&lineEdit, 'e'); QTest::keyPress(&lineEdit, 'f'); - QCOMPARE(changedSpy.count(), 5); + QCOMPARE(changedSpy.size(), 5); } void tst_QLineEdit::task233101_cursorPosAfterInputMethod_data() @@ -4061,7 +4061,7 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut() QTRY_VERIFY(le.hasFocus()); QTest::keyClick(static_cast(0), Qt::Key_P); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() @@ -4348,14 +4348,14 @@ void tst_QLineEdit::inputMethodSelection() testWidget->setSelection(0,0); QSignalSpy selectionSpy(testWidget, SIGNAL(selectionChanged())); - QCOMPARE(selectionSpy.count(), 0); + QCOMPARE(selectionSpy.size(), 0); QCOMPARE(testWidget->selectionStart(), -1); QCOMPARE(testWidget->selectionEnd(), -1); QCOMPARE(testWidget->selectionLength(), 0); testWidget->setSelection(0,5); - QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(selectionSpy.size(), 1); QCOMPARE(testWidget->selectionStart(), 0); QCOMPARE(testWidget->selectionEnd(), 5); QCOMPARE(testWidget->selectionLength(), 5); @@ -4369,7 +4369,7 @@ void tst_QLineEdit::inputMethodSelection() QApplication::sendEvent(testWidget, &event); } - QCOMPARE(selectionSpy.count(), 2); + QCOMPARE(selectionSpy.size(), 2); QCOMPARE(testWidget->selectionStart(), 12); QCOMPARE(testWidget->selectionEnd(), 17); QCOMPARE(testWidget->selectionLength(), 5); @@ -4382,7 +4382,7 @@ void tst_QLineEdit::inputMethodSelection() QApplication::sendEvent(testWidget, &event); } - QCOMPARE(selectionSpy.count(), 3); + QCOMPARE(selectionSpy.size(), 3); QCOMPARE(testWidget->selectionStart(), -1); QCOMPARE(testWidget->selectionEnd(), -1); QCOMPARE(testWidget->selectionLength(), 0); @@ -4570,11 +4570,11 @@ void tst_QLineEdit::clearButton() QSignalSpy spyEdited(filterLineEdit, &QLineEdit::textEdited); const QPoint clearButtonCenterPos = QRect(QPoint(0, 0), clearButton->size()).center(); QTest::mouseClick(clearButton, Qt::LeftButton, {}, clearButtonCenterPos); - QCOMPARE(spyEdited.count(), 1); + QCOMPARE(spyEdited.size(), 1); QTRY_COMPARE(clearButton->cursor().shape(), filterLineEdit->cursor().shape()); QTRY_COMPARE(filterModel->rowCount(), 3); QCoreApplication::processEvents(); - QCOMPARE(spyEdited.count(), 1); + QCOMPARE(spyEdited.size(), 1); filterLineEdit->setReadOnly(true); // QTBUG-34315 QVERIFY(!clearButton->isEnabled()); @@ -4851,7 +4851,7 @@ void tst_QLineEdit::QTBUG1266_setInputMaskEmittingTextEdited() QSignalSpy spy(&lineEdit, SIGNAL(textEdited(QString))); lineEdit.setInputMask("AAAA"); lineEdit.setInputMask(QString()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } #if QT_CONFIG(shortcut) @@ -4912,7 +4912,7 @@ void tst_QLineEdit::shortcutOverrideOnReadonlyLineEdit() } const int activationCount = shouldBeHandledByQLineEdit ? 0 : 1; - QCOMPARE(spy.count(), activationCount); + QCOMPARE(spy.size(), activationCount); } #endif // QT_CONFIG(shortcut) @@ -5065,18 +5065,18 @@ void tst_QLineEdit::inputRejected() QSignalSpy spyInputRejected(testWidget, SIGNAL(inputRejected())); QTest::keyClicks(testWidget, "abcde"); - QCOMPARE(spyInputRejected.count(), 0); + QCOMPARE(spyInputRejected.size(), 0); testWidget->setText("fghij"); - QCOMPARE(spyInputRejected.count(), 0); + QCOMPARE(spyInputRejected.size(), 0); testWidget->insert("k"); - QCOMPARE(spyInputRejected.count(), 0); + QCOMPARE(spyInputRejected.size(), 0); testWidget->clear(); testWidget->setMaxLength(5); QTest::keyClicks(testWidget, "abcde"); - QCOMPARE(spyInputRejected.count(), 0); + QCOMPARE(spyInputRejected.size(), 0); QTest::keyClicks(testWidget, "fgh"); - QCOMPARE(spyInputRejected.count(), 3); + QCOMPARE(spyInputRejected.size(), 3); #if QT_CONFIG(clipboard) testWidget->clear(); spyInputRejected.clear(); @@ -5084,7 +5084,7 @@ void tst_QLineEdit::inputRejected() testWidget->paste(); // The first 5 characters are accepted, but // the last 2 are not. - QCOMPARE(spyInputRejected.count(), 1); + QCOMPARE(spyInputRejected.size(), 1); #endif testWidget->setMaxLength(INT_MAX); @@ -5093,15 +5093,15 @@ void tst_QLineEdit::inputRejected() QIntValidator intValidator(1, 100); testWidget->setValidator(&intValidator); QTest::keyClicks(testWidget, "11"); - QCOMPARE(spyInputRejected.count(), 0); + QCOMPARE(spyInputRejected.size(), 0); QTest::keyClicks(testWidget, "a#"); - QCOMPARE(spyInputRejected.count(), 2); + QCOMPARE(spyInputRejected.size(), 2); #if QT_CONFIG(clipboard) testWidget->clear(); spyInputRejected.clear(); QApplication::clipboard()->setText("a#"); testWidget->paste(); - QCOMPARE(spyInputRejected.count(), 1); + QCOMPARE(spyInputRejected.size(), 1); #endif testWidget->clear(); @@ -5109,9 +5109,9 @@ void tst_QLineEdit::inputRejected() spyInputRejected.clear(); testWidget->setInputMask("999.999.999.999;_"); QTest::keyClicks(testWidget, "11"); - QCOMPARE(spyInputRejected.count(), 0); + QCOMPARE(spyInputRejected.size(), 0); QTest::keyClicks(testWidget, "a#"); - QCOMPARE(spyInputRejected.count(), 2); + QCOMPARE(spyInputRejected.size(), 2); } QTEST_MAIN(tst_QLineEdit) diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 6996591946..91aa651bab 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -2124,14 +2124,14 @@ void tst_QMainWindow::resizeDocks() int totalFromList = 0; int actualTotal = 0; - for (int i = 0; i < docks.count(); ++i) { + for (int i = 0; i < docks.size(); ++i) { totalFromList += sizes[i]; QSize s = list[i]->size(); actualTotal += (orientation == Qt::Horizontal) ? s.width() : s.height(); // qDebug() << list[i] << list[i]->size() << sizes[i]; } - for (int i = 0; i < docks.count(); ++i) { + for (int i = 0; i < docks.size(); ++i) { QSize s = list[i]->size(); int value = (orientation == Qt::Horizontal) ? s.width() : s.height(); QCOMPARE(value, qRound(sizes[i]*actualTotal/double(totalFromList))); diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index a9a2dca611..946688f8b9 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -319,7 +319,7 @@ void tst_QMdiArea::subWindowActivated() widget->show(); qApp->processEvents(); QVERIFY( activeWindow == workspace->activeSubWindow() ); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); } @@ -348,7 +348,7 @@ void tst_QMdiArea::subWindowActivated() workspace->activeSubWindow()->close(); qApp->processEvents(); QCOMPARE(activeWindow, workspace->activeSubWindow()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); } @@ -362,14 +362,14 @@ void tst_QMdiArea::subWindowActivated() widget->setAttribute(Qt::WA_DeleteOnClose); QMdiSubWindow *window = workspace->addSubWindow(widget); widget->show(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); workspace->show(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QVERIFY( activeWindow == window ); window->close(); qApp->processEvents(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QVERIFY( activeWindow == 0 ); } @@ -381,15 +381,15 @@ void tst_QMdiArea::subWindowActivated() QMdiSubWindow *window = workspace->addSubWindow(widget); widget->showMaximized(); qApp->sendPostedEvents(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); workspace->show(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QVERIFY( activeWindow == window ); window->close(); qApp->processEvents(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QVERIFY( activeWindow == 0 ); } @@ -399,13 +399,13 @@ void tst_QMdiArea::subWindowActivated() widget->setAttribute(Qt::WA_DeleteOnClose); QMdiSubWindow *window = workspace->addSubWindow(widget); widget->showMinimized(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QVERIFY( activeWindow == window ); QCOMPARE(workspace->activeSubWindow(), window); window->close(); qApp->processEvents(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QVERIFY(!workspace->activeSubWindow()); QVERIFY(!activeWindow); @@ -433,12 +433,12 @@ void tst_QMdiArea::subWindowActivated2() QSignalSpy spy(&mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*))); for (int i = 0; i < 5; ++i) mdiArea.addSubWindow(new QWidget); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); mdiArea.show(); mdiArea.activateWindow(); QVERIFY(QTest::qWaitForWindowActive(&mdiArea)); - QTRY_COMPARE(spy.count(), 5); + QTRY_COMPARE(spy.size(), 5); QCOMPARE(mdiArea.activeSubWindow(), mdiArea.subWindowList().back()); spy.clear(); @@ -447,13 +447,13 @@ void tst_QMdiArea::subWindowActivated2() QMdiSubWindow *staysOnTopWindow = mdiArea.subWindowList().at(3); staysOnTopWindow->setWindowFlags(Qt::WindowStaysOnTopHint); mdiArea.setActiveSubWindow(staysOnTopWindow); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(mdiArea.activeSubWindow(), staysOnTopWindow); spy.clear(); QMdiSubWindow *activeSubWindow = mdiArea.subWindowList().at(2); mdiArea.setActiveSubWindow(activeSubWindow); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(mdiArea.activeSubWindow(), activeSubWindow); spy.clear(); @@ -461,7 +461,7 @@ void tst_QMdiArea::subWindowActivated2() // is unchanged after hide/show. mdiArea.hide(); QTest::qWait(100); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QVERIFY(!mdiArea.activeSubWindow()); QCOMPARE(mdiArea.currentSubWindow(), activeSubWindow); spy.clear(); @@ -489,7 +489,7 @@ void tst_QMdiArea::subWindowActivated2() #endif if (!QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive)) QSKIP("QTBUG-25298: Unstable on some X11 window managers"); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QVERIFY(!mdiArea.activeSubWindow()); QCOMPARE(mdiArea.currentSubWindow(), activeSubWindow); spy.clear(); @@ -499,7 +499,7 @@ void tst_QMdiArea::subWindowActivated2() mdiArea.showNormal(); mdiArea.activateWindow(); QVERIFY(QTest::qWaitForWindowActive(&mdiArea)); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QCOMPARE(mdiArea.activeSubWindow(), activeSubWindow); spy.clear(); } @@ -915,7 +915,7 @@ void tst_QMdiArea::setActiveSubWindow() QVERIFY(windows[i]->isHidden()); workspace.setActiveSubWindow(windows[i]); } - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QVERIFY(!activeWindow); spy.clear(); @@ -925,7 +925,7 @@ void tst_QMdiArea::setActiveSubWindow() QVERIFY(!windows[i]->isHidden()); workspace.setActiveSubWindow(windows[i]); qApp->processEvents(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(activeWindow, windows[i]); spy.clear(); } @@ -933,7 +933,7 @@ void tst_QMdiArea::setActiveSubWindow() // Deactivate active window QCOMPARE(workspace.activeSubWindow(), windows[windowCount - 1]); workspace.setActiveSubWindow(0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(!activeWindow); QVERIFY(!workspace.activeSubWindow()); @@ -1297,7 +1297,7 @@ void tst_QMdiArea::closeWindows() workspace.closeAllSubWindows(); qApp->processEvents(); QCOMPARE(workspace.subWindowList().size(), 0); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QVERIFY(!activeWindow); } @@ -1323,7 +1323,7 @@ void tst_QMdiArea::activateNextAndPreviousWindow() workspace.activateNextSubWindow(); qApp->processEvents(); QCOMPARE(workspace.activeSubWindow(), windows[i]); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); } QVERIFY(activeWindow); @@ -1335,7 +1335,7 @@ void tst_QMdiArea::activateNextAndPreviousWindow() workspace.activatePreviousSubWindow(); qApp->processEvents(); QCOMPARE(workspace.activeSubWindow(), windows[i]); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); if (i % 2 == 0) windows[i]->hide(); // 10, 8, 6, 4, 2, 0 @@ -1347,7 +1347,7 @@ void tst_QMdiArea::activateNextAndPreviousWindow() // activateNextSubWindow with every 2nd window hidden for (int i = 0; i < windowCount / 2; ++i) { workspace.activateNextSubWindow(); // 1, 3, 5, 7, 9 - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); } QCOMPARE(workspace.activeSubWindow(), windows[windowCount - 1]); @@ -1355,7 +1355,7 @@ void tst_QMdiArea::activateNextAndPreviousWindow() // activatePreviousSubWindow with every 2nd window hidden for (int i = 0; i < windowCount / 2; ++i) { workspace.activatePreviousSubWindow(); // 7, 5, 3, 1, 9 - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); } QCOMPARE(workspace.activeSubWindow(), windows[windowCount - 1]); @@ -2267,7 +2267,7 @@ void tst_QMdiArea::tabBetweenSubWindows() QCOMPARE(qApp->focusWidget(), focusWidget); QSignalSpy spy(&mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*))); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // Walk through the entire list of sub windows. #ifdef Q_OS_MAC @@ -2275,7 +2275,7 @@ void tst_QMdiArea::tabBetweenSubWindows() #endif QVERIFY(tabBetweenSubWindowsIn(&mdiArea)); QCOMPARE(mdiArea.activeSubWindow(), subWindows.back()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); mdiArea.setActiveSubWindow(subWindows.front()); QCOMPARE(mdiArea.activeSubWindow(), subWindows.front()); @@ -2284,12 +2284,12 @@ void tst_QMdiArea::tabBetweenSubWindows() // Walk through the entire list of sub windows in the opposite direction (Ctrl-Shift-Tab). QVERIFY(tabBetweenSubWindowsIn(&mdiArea, -1, true)); QCOMPARE(mdiArea.activeSubWindow(), subWindows.front()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // Ctrl-Tab-Tab-Tab QVERIFY(tabBetweenSubWindowsIn(&mdiArea, 3)); QCOMPARE(mdiArea.activeSubWindow(), subWindows.at(3)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); mdiArea.setActiveSubWindow(subWindows.at(1)); QCOMPARE(mdiArea.activeSubWindow(), subWindows.at(1)); @@ -2298,7 +2298,7 @@ void tst_QMdiArea::tabBetweenSubWindows() // Quick switch (Ctrl-Tab once) -> switch back to the previously active sub-window. QVERIFY(tabBetweenSubWindowsIn(&mdiArea, 1)); QCOMPARE(mdiArea.activeSubWindow(), subWindows.at(3)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QMdiArea::setViewMode() diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 437dad8326..9adaf81116 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -530,9 +530,9 @@ void tst_QMdiSubWindow::emittingOfSignals() int count = 0; if (signal == SIGNAL(aboutToActivate())) { - count += spy.count(); + count += spy.size(); } else { - for (int i = 0; i < spy.count(); ++i) { + for (int i = 0; i < spy.size(); ++i) { Qt::WindowStates oldState = qvariant_cast(spy.at(i).at(0)); Qt::WindowStates newState = qvariant_cast(spy.at(i).at(1)); if (watchedState != Qt::WindowNoState) { @@ -555,7 +555,7 @@ void tst_QMdiSubWindow::emittingOfSignals() spy.clear(); triggerSignal(window, &workspace, signal); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); delete window; window = nullptr; @@ -2103,7 +2103,7 @@ void tst_QMdiSubWindow::styleChange() // subWindowActivated should NOT be activated by a style change, // even if internally QMdiSubWindow un-minimizes subwindows temporarily. - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QMdiSubWindow::testFullScreenState() diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 9291601469..1df16d783e 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -1264,7 +1264,7 @@ void tst_QMenu::click_while_dismissing_submenu() //the submenu must have been hidden for the bug to be triggered QVERIFY(!sub.isVisible()); QTest::mouseRelease(menuWindow, Qt::LeftButton, {}, menu.rect().center() - QPoint(0, 2), 300); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } #endif @@ -1991,11 +1991,11 @@ void tst_QMenu::QTBUG_61039_menu_shortcuts() QSignalSpy actionKamenSpy(actionKamen, &QAction::triggered); QTest::keyClick(&widget, Qt::Key_K); - QTRY_COMPARE(actionKamenSpy.count(), 1); + QTRY_COMPARE(actionKamenSpy.size(), 1); QSignalSpy actionJoeSpy(actionJoe, &QAction::triggered); QTest::keyClick(&widget, Qt::Key_J, Qt::ControlModifier); - QTRY_COMPARE(actionJoeSpy.count(), 1); + QTRY_COMPARE(actionJoeSpy.size(), 1); } void tst_QMenu::screenOrientationChangedCloseMenu() diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 461839ebd6..86169ca1de 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -1270,9 +1270,9 @@ void tst_QMenuBar::task223138_triggered() //let's trigger the first action top->trigger(); - QCOMPARE(menubarSpy.count(), 1); - QCOMPARE(menuSpy.count(), 1); - QCOMPARE(submenuSpy.count(), 0); + QCOMPARE(menubarSpy.size(), 1); + QCOMPARE(menuSpy.size(), 1); + QCOMPARE(submenuSpy.size(), 0); menubarSpy.clear(); menuSpy.clear(); @@ -1280,9 +1280,9 @@ void tst_QMenuBar::task223138_triggered() //let's trigger the sub action action->trigger(); - QCOMPARE(menubarSpy.count(), 1); - QCOMPARE(menuSpy.count(), 1); - QCOMPARE(submenuSpy.count(), 1); + QCOMPARE(menubarSpy.size(), 1); + QCOMPARE(menuSpy.size(), 1); + QCOMPARE(submenuSpy.size(), 1); } void tst_QMenuBar::task256322_highlight() @@ -1625,7 +1625,7 @@ void tst_QMenuBar::QTBUG_65488_hiddenActionTriggered() // click center of the blank area on the menubar where Action1 resided QTest::mouseClick(win.windowHandle(), Qt::LeftButton, Qt::NoModifier, win.menuBar()->geometry().center()); QCoreApplication::sendPostedEvents(); // make sure all queued events also dispatched - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } // QTBUG-56526 @@ -1699,13 +1699,13 @@ void tst_QMenuBar::QTBUG_25669_menubarActionDoubleTriggered() QPoint posAct2 = menuBarActionWindowPos(win.menuBar(), act2); QTest::mouseClick(win.windowHandle(), Qt::LeftButton, Qt::NoModifier, posAct1); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); QTest::mouseClick(win.windowHandle(), Qt::LeftButton, Qt::NoModifier, posAct2); - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE(spy.size(), 2); QTest::mouseClick(win.windowHandle(), Qt::LeftButton, Qt::NoModifier, posAct2); - QTRY_COMPARE(spy.count(), 3); + QTRY_COMPARE(spy.size(), 3); } void tst_QMenuBar::slotForTaskQTBUG53205() diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index 708a785920..99b0720eda 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp @@ -70,7 +70,7 @@ void tst_QOpenGLWidget::create() QSignalSpy frameSwappedSpy(w.data(), SIGNAL(frameSwapped())); w->show(); QVERIFY(QTest::qWaitForWindowExposed(w.data())); - QVERIFY(frameSwappedSpy.count() > 0); + QVERIFY(frameSwappedSpy.size() > 0); QVERIFY(w->isValid()); QVERIFY(w->context()); @@ -165,7 +165,7 @@ void tst_QOpenGLWidget::createNonTopLevel() w.resize(400, 400); w.show(); QVERIFY(QTest::qWaitForWindowExposed(&w)); - QVERIFY(frameSwappedSpy.count() > 0); + QVERIFY(frameSwappedSpy.size() > 0); QVERIFY(glw->m_resizeCalled); glw->m_resizeCalled = false; @@ -326,7 +326,7 @@ void tst_QOpenGLWidget::reparentTopLevel() { QSignalSpy frameSwappedSpy(glw1, &QOpenGLWidget::frameSwapped); tabWidget.setCurrentIndex(tabWidget.addTab(glw1, "OpenGL widget 1")); - QTRY_VERIFY(frameSwappedSpy.count() > 0); + QTRY_VERIFY(frameSwappedSpy.size() > 0); } PainterWidget *glw2 = new PainterWidget; @@ -334,7 +334,7 @@ void tst_QOpenGLWidget::reparentTopLevel() { QSignalSpy frameSwappedSpy(glw2, &QOpenGLWidget::frameSwapped); tabWidget.setCurrentIndex(tabWidget.addTab(glw2, "OpenGL widget 2")); - QTRY_VERIFY(frameSwappedSpy.count() > 0); + QTRY_VERIFY(frameSwappedSpy.size() > 0); } QImage image = glw2->grabFramebuffer(); @@ -344,7 +344,7 @@ void tst_QOpenGLWidget::reparentTopLevel() { QSignalSpy frameSwappedSpy(glw1, &QOpenGLWidget::frameSwapped); delete glw2; - QTRY_VERIFY(frameSwappedSpy.count() > 0); + QTRY_VERIFY(frameSwappedSpy.size() > 0); } image = glw1->grabFramebuffer(); @@ -356,7 +356,7 @@ void tst_QOpenGLWidget::reparentTopLevel() glw1->setParent(nullptr); glw1->show(); QVERIFY(QTest::qWaitForWindowExposed(glw1)); - QTRY_VERIFY(frameSwappedSpy.count() > 0); + QTRY_VERIFY(frameSwappedSpy.size() > 0); } image = glw1->grabFramebuffer(); @@ -366,7 +366,7 @@ void tst_QOpenGLWidget::reparentTopLevel() { QSignalSpy frameSwappedSpy(glw1, &QOpenGLWidget::frameSwapped); tabWidget.setCurrentIndex(tabWidget.addTab(glw1, "Re-added OpenGL widget 1")); - QTRY_VERIFY(frameSwappedSpy.count() > 0); + QTRY_VERIFY(frameSwappedSpy.size() > 0); } image = glw1->grabFramebuffer(); diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index a051227bf8..e3ccc58867 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -393,7 +393,7 @@ void tst_QPlainTextEdit::cursorPositionChanged() spy.clear(); QTest::keyClick(ed, Qt::Key_A); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTextCursor cursor = ed->textCursor(); cursor.movePosition(QTextCursor::Start); @@ -401,18 +401,18 @@ void tst_QPlainTextEdit::cursorPositionChanged() cursor.movePosition(QTextCursor::End); spy.clear(); cursor.insertText("Test"); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); cursor.movePosition(QTextCursor::End); ed->setTextCursor(cursor); cursor.movePosition(QTextCursor::Start); spy.clear(); cursor.insertText("Test"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QTest::keyClick(ed, Qt::Key_Left); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); CursorPositionChangedRecorder spy2(ed); QVERIFY(ed->textCursor().position() > 0); @@ -434,7 +434,7 @@ void tst_QPlainTextEdit::setTextCursor() spy.clear(); ed->setTextCursor(cursor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } #ifndef QT_NO_CLIPBOARD @@ -451,7 +451,7 @@ void tst_QPlainTextEdit::undoAvailableAfterPaste() const QString txt("Test"); QApplication::clipboard()->setText(txt); ed->paste(); - QVERIFY(spy.count() >= 1); + QVERIFY(spy.size() >= 1); QCOMPARE(ed->toPlainText(), txt); } #endif @@ -712,9 +712,9 @@ void tst_QPlainTextEdit::setPlainTextShouldEmitTextChangedOnce() { QSignalSpy spy(ed, SIGNAL(textChanged())); ed->setPlainText("Yankee Doodle"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); ed->setPlainText(""); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QPlainTextEdit::overwriteMode() @@ -1026,8 +1026,8 @@ void tst_QPlainTextEdit::copyAvailable() //Compare spied signals QEXPECT_FAIL("Case7 T,A,A, <- + shift, <- + shift, <- + shift, ctrl + x, undo() | signals: true, false, true", "Wrong undo selection behaviour. Should be fixed in some future release. (See task: 132482)", Abort); - QCOMPARE(spyCopyAvailabe.count(), copyAvailable.size()); - for (int i=0;itextCursor().position(), 0); ed->moveCursor(QTextCursor::NextCharacter); QCOMPARE(ed->textCursor().position(), 1); - QCOMPARE(cursorMovedSpy.count(), 1); + QCOMPARE(cursorMovedSpy.size(), 1); ed->moveCursor(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); QCOMPARE(ed->textCursor().position(), 2); - QCOMPARE(cursorMovedSpy.count(), 2); + QCOMPARE(cursorMovedSpy.size(), 2); QCOMPARE(ed->textCursor().selectedText(), QString("e")); } @@ -1461,44 +1461,44 @@ void tst_QPlainTextEdit::selectionChanged() QTest::keyClick(ed, Qt::Key_Right); QCOMPARE(ed->textCursor().position(), 1); - QCOMPARE(selectionChangedSpy.count(), 0); + QCOMPARE(selectionChangedSpy.size(), 0); QTest::keyClick(ed, Qt::Key_Right, Qt::ShiftModifier); QCOMPARE(ed->textCursor().position(), 2); - QCOMPARE(selectionChangedSpy.count(), 1); + QCOMPARE(selectionChangedSpy.size(), 1); QTest::keyClick(ed, Qt::Key_Right, Qt::ShiftModifier); QCOMPARE(ed->textCursor().position(), 3); - QCOMPARE(selectionChangedSpy.count(), 2); + QCOMPARE(selectionChangedSpy.size(), 2); QTest::keyClick(ed, Qt::Key_Right, Qt::ShiftModifier); QCOMPARE(ed->textCursor().position(), 4); - QCOMPARE(selectionChangedSpy.count(), 3); + QCOMPARE(selectionChangedSpy.size(), 3); QTest::keyClick(ed, Qt::Key_Right); QCOMPARE(ed->textCursor().position(), 4); - QCOMPARE(selectionChangedSpy.count(), 4); + QCOMPARE(selectionChangedSpy.size(), 4); QTest::keyClick(ed, Qt::Key_Right); QCOMPARE(ed->textCursor().position(), 5); - QCOMPARE(selectionChangedSpy.count(), 4); + QCOMPARE(selectionChangedSpy.size(), 4); } void tst_QPlainTextEdit::blockCountChanged() { QSignalSpy blockCountCpangedSpy(ed, SIGNAL(blockCountChanged(int))); ed->setPlainText("Hello"); - QCOMPARE(blockCountCpangedSpy.count(), 0); + QCOMPARE(blockCountCpangedSpy.size(), 0); ed->setPlainText("Hello World"); - QCOMPARE(blockCountCpangedSpy.count(), 0); + QCOMPARE(blockCountCpangedSpy.size(), 0); ed->setPlainText("Hello \n World \n this \n has \n more \n blocks \n than \n just \n one"); - QCOMPARE(blockCountCpangedSpy.count(), 1); + QCOMPARE(blockCountCpangedSpy.size(), 1); ed->setPlainText("One"); - QCOMPARE(blockCountCpangedSpy.count(), 2); + QCOMPARE(blockCountCpangedSpy.size(), 2); ed->setPlainText("One \n Two"); - QCOMPARE(blockCountCpangedSpy.count(), 3); + QCOMPARE(blockCountCpangedSpy.size(), 3); ed->setPlainText("Three \n Four"); - QCOMPARE(blockCountCpangedSpy.count(), 3); + QCOMPARE(blockCountCpangedSpy.size(), 3); } diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index bf06675804..11cac837b9 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -613,7 +613,7 @@ void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer() QTest::qWait(300); QTest::keyClick(&dialog, Qt::Key_5, Qt::KeypadModifier); QTest::qWait(300); - QCOMPARE(spy1.count(), 2); + QCOMPARE(spy1.size(), 2); // add shortcut 'keypad 5' to button2 spy1.clear(); @@ -623,8 +623,8 @@ void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer() QTest::qWait(300); QTest::keyClick(&dialog, Qt::Key_5, Qt::KeypadModifier); QTest::qWait(300); - QCOMPARE(spy1.count(), 1); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy1.size(), 1); + QCOMPARE(spy2.size(), 1); // remove shortcut from button1 spy1.clear(); @@ -634,8 +634,8 @@ void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer() QTest::qWait(300); QTest::keyClick(&dialog, Qt::Key_5, Qt::KeypadModifier); QTest::qWait(300); - QCOMPARE(spy1.count(), 0); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy1.size(), 0); + QCOMPARE(spy2.size(), 1); } #endif // QT_CONFIG(shortcut) @@ -659,16 +659,16 @@ void tst_QPushButton::emitReleasedAfterChange() QVERIFY(button1->isDown()); QTest::keyClick(&dialog, Qt::Key_Tab); QVERIFY(!button1->isDown()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); button1->setFocus(); QTest::mousePress(button1, Qt::LeftButton); QVERIFY(button1->isDown()); button1->setEnabled(false); QVERIFY(!button1->isDown()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } /* @@ -746,22 +746,22 @@ void tst_QPushButton::mousePressAndMove() QSignalSpy releaseSpy(&button, &QAbstractButton::released); QTest::mousePress(&button, Qt::LeftButton); - QCOMPARE(pressSpy.count(), 1); - QCOMPARE(releaseSpy.count(), 0); + QCOMPARE(pressSpy.size(), 1); + QCOMPARE(releaseSpy.size(), 0); // mouse pressed and moving out QTest::mouseMove(&button, QPoint(100, 100)); // should emit released signal when the mouse is dragged out of boundary - QCOMPARE(pressSpy.count(), 1); - QCOMPARE(releaseSpy.count(), 1); + QCOMPARE(pressSpy.size(), 1); + QCOMPARE(releaseSpy.size(), 1); // mouse pressed and moving into QTest::mouseMove(&button, QPoint(10, 10)); // should emit pressed signal when the mouse is dragged into of boundary - QCOMPARE(pressSpy.count(), 2); - QCOMPARE(releaseSpy.count(), 1); + QCOMPARE(pressSpy.size(), 2); + QCOMPARE(releaseSpy.size(), 1); } QTEST_MAIN(tst_QPushButton) diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp index a6e39bf273..8b53c73361 100644 --- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp +++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp @@ -90,7 +90,7 @@ void tst_QScrollBar::task_209492() QSignalSpy spy(verticalScrollBar, SIGNAL(actionTriggered(int))); QCOMPARE(scrollArea.scrollCount, 0); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // Simulate a mouse click on the "scroll down button". const QPoint pressPoint(verticalScrollBar->width() / 2, verticalScrollBar->height() - 10); @@ -109,7 +109,7 @@ void tst_QScrollBar::task_209492() QSKIP("The result depends on system setting and is not relevant on Mac"); #endif QCOMPARE(scrollArea.scrollCount, 1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } #if QT_CONFIG(wheelevent) @@ -159,7 +159,7 @@ void tst_QScrollBar::QTBUG_42871() QSignalSpy spy(&scrollBarWidget, SIGNAL(actionTriggered(int))); QVERIFY(spy.isValid()); QCOMPARE(myHandler.updatesCount, 0); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // Simulate a mouse click on the "scroll down button". const QPoint pressPoint(scrollBarWidget.width() / 2, scrollBarWidget.height() - 10); @@ -180,7 +180,7 @@ void tst_QScrollBar::QTBUG_42871() } // Check that the action was triggered once. QCOMPARE(myHandler.updatesCount, 1); - QCOMPARE(spy.count(), myHandler.updatesCount); + QCOMPARE(spy.size(), myHandler.updatesCount); } QTEST_MAIN(tst_QScrollBar) diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index b08e2b4281..3c4ab690db 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -941,38 +941,38 @@ void tst_QSpinBox::editingFinished() QTest::keyClick(box, Qt::Key_Up); QTest::keyClick(box, Qt::Key_Up); - QCOMPARE(editingFinishedSpy1.count(), 0); - QCOMPARE(editingFinishedSpy2.count(), 0); + QCOMPARE(editingFinishedSpy1.size(), 0); + QCOMPARE(editingFinishedSpy2.size(), 0); QTest::keyClick(box2, Qt::Key_Up); QTest::keyClick(box2, Qt::Key_Up); box2->setFocus(); - QCOMPARE(editingFinishedSpy1.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 1); box->setFocus(); - QCOMPARE(editingFinishedSpy1.count(), 1); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 1); + QCOMPARE(editingFinishedSpy2.size(), 1); QTest::keyClick(box, Qt::Key_Up); - QCOMPARE(editingFinishedSpy1.count(), 1); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 1); + QCOMPARE(editingFinishedSpy2.size(), 1); QTest::keyClick(box, Qt::Key_Enter); - QCOMPARE(editingFinishedSpy1.count(), 2); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 2); + QCOMPARE(editingFinishedSpy2.size(), 1); QTest::keyClick(box, Qt::Key_Return); - QCOMPARE(editingFinishedSpy1.count(), 3); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 3); + QCOMPARE(editingFinishedSpy2.size(), 1); box2->setFocus(); - QCOMPARE(editingFinishedSpy1.count(), 4); - QCOMPARE(editingFinishedSpy2.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 4); + QCOMPARE(editingFinishedSpy2.size(), 1); QTest::keyClick(box2, Qt::Key_Enter); - QCOMPARE(editingFinishedSpy1.count(), 4); - QCOMPARE(editingFinishedSpy2.count(), 2); + QCOMPARE(editingFinishedSpy1.size(), 4); + QCOMPARE(editingFinishedSpy2.size(), 2); QTest::keyClick(box2, Qt::Key_Return); - QCOMPARE(editingFinishedSpy1.count(), 4); - QCOMPARE(editingFinishedSpy2.count(), 3); + QCOMPARE(editingFinishedSpy1.size(), 4); + QCOMPARE(editingFinishedSpy2.size(), 3); testFocusWidget.hide(); - QCOMPARE(editingFinishedSpy1.count(), 4); - QCOMPARE(editingFinishedSpy2.count(), 4); + QCOMPARE(editingFinishedSpy1.size(), 4); + QCOMPARE(editingFinishedSpy2.size(), 4); //task203285 editingFinishedSpy1.clear(); @@ -989,7 +989,7 @@ void tst_QSpinBox::editingFinished() box2->setFocus(); QTRY_VERIFY(qApp->focusWidget() != box); QCOMPARE(box->text(), QLatin1String("20")); - QCOMPARE(editingFinishedSpy1.count(), 1); + QCOMPARE(editingFinishedSpy1.size(), 1); } void tst_QSpinBox::removeAll() @@ -1259,7 +1259,7 @@ void tst_QSpinBox::lineEditReturnPressed() QSignalSpy spyCurrentChanged(spinBox.lineEdit(), SIGNAL(returnPressed())); spinBox.show(); QTest::keyClick(&spinBox, Qt::Key_Return); - QCOMPARE(spyCurrentChanged.count(), 1); + QCOMPARE(spyCurrentChanged.size(), 1); } void tst_QSpinBox::positiveSign() @@ -1849,13 +1849,13 @@ void tst_QSpinBox::stepModifierPressAndHold() qDebug() << "QGuiApplication::focusWindow():" << QGuiApplication::focusWindow(); qDebug() << "QGuiApplication::topLevelWindows():" << QGuiApplication::topLevelWindows(); QTest::mousePress(&spin, Qt::LeftButton, modifiers, buttonRect.center()); - QTRY_VERIFY2(spy.length() >= 3, qPrintable(QString::fromLatin1( - "Expected valueChanged() to be emitted 3 or more times, but it was only emitted %1 times").arg(spy.length()))); + QTRY_VERIFY2(spy.size() >= 3, qPrintable(QString::fromLatin1( + "Expected valueChanged() to be emitted 3 or more times, but it was only emitted %1 times").arg(spy.size()))); QTest::mouseRelease(&spin, Qt::LeftButton, modifiers, buttonRect.center()); const auto value = spy.last().at(0); QVERIFY(value.metaType().id() == QMetaType::Int); - QCOMPARE(value.toInt(), spy.length() * expectedStepModifier); + QCOMPARE(value.toInt(), spy.size() * expectedStepModifier); } void tst_QSpinBox::stepSelectAll_data() diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index 812bfc7441..cbc1a258de 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -1063,7 +1063,7 @@ void tst_QSplitter::taskQTBUG_102249_moveNonPressed() Qt::NoButton, Qt::MouseButtons(Qt::LeftButton), Qt::NoModifier); qApp->sendEvent(s.handle(0), &me); - QCOMPARE(spyMove.count(), 0); + QCOMPARE(spyMove.size(), 0); } void tst_QSplitter::setLayout() diff --git a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp index 353c44d6b3..418dd1c0f9 100644 --- a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp @@ -272,18 +272,18 @@ void tst_QStatusBar::messageChangedSignal() testWidget->showMessage("Ready", 0); QCOMPARE(testWidget->currentMessage(), QString("Ready")); QCOMPARE(testWidget->currentMessage(), currentMessage); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.takeFirst().at(0).toString(), currentMessage); testWidget->clearMessage(); QCOMPARE(testWidget->currentMessage(), QString()); QCOMPARE(testWidget->currentMessage(), currentMessage); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.takeFirst().at(0).toString(), currentMessage); testWidget->showMessage("Ready", 0); testWidget->showMessage("Ready", 0); QCOMPARE(testWidget->currentMessage(), QString("Ready")); QCOMPARE(testWidget->currentMessage(), currentMessage); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.takeFirst().at(0).toString(), currentMessage); } diff --git a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp index 1e19617be9..1d7e999b10 100644 --- a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp @@ -209,7 +209,7 @@ void tst_QTabBar::testCurrentChanged() QCOMPARE(tabBar.currentIndex(), 0); tabBar.setCurrentIndex(tabToSet); QCOMPARE(tabBar.currentIndex(), tabToSet); - QCOMPARE(spy.count(), expectedCount); + QCOMPARE(spy.size(), expectedCount); } class TabBar : public QTabBar @@ -283,7 +283,7 @@ void tst_QTabBar::removeTab() tabbar.setCurrentIndex(currentIndex); QSignalSpy spy(&tabbar, SIGNAL(currentChanged(int))); tabbar.removeTab(deleteIndex); - QTEST(int(spy.count()), "spyCount"); + QTEST(int(spy.size()), "spyCount"); QTEST(tabbar.currentIndex(), "finalIndex"); } @@ -314,7 +314,7 @@ void tst_QTabBar::hideTab() tabbar.setCurrentIndex(currentIndex); QSignalSpy spy(&tabbar, &QTabBar::currentChanged); tabbar.setTabVisible(hideIndex, false); - QTEST(int(spy.count()), "spyCount"); + QTEST(int(spy.size()), "spyCount"); QTEST(tabbar.currentIndex(), "finalIndex"); } @@ -458,12 +458,12 @@ void tst_QTabBar::removeLastTab() QTabBar tabbar; QSignalSpy spy(&tabbar, SIGNAL(currentChanged(int))); int index = tabbar.addTab("foo"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toInt(), index); spy.clear(); tabbar.removeTab(index); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toInt(), -1); spy.clear(); } @@ -482,7 +482,7 @@ void tst_QTabBar::removeLastVisibleTab() { QSignalSpy spy(&tabbar, SIGNAL(currentChanged(int))); tabbar.removeTab(visible); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toInt(), -1); QCOMPARE(tabbar.currentIndex(), -1); } @@ -495,7 +495,7 @@ void tst_QTabBar::removeLastVisibleTab() { QSignalSpy spy(&tabbar, SIGNAL(currentChanged(int))); tabbar.removeTab(visible); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toInt(), -1); QCOMPARE(tabbar.currentIndex(), -1); } @@ -519,7 +519,7 @@ void tst_QTabBar::closeButton() QSignalSpy spy(&tabbar, SIGNAL(tabCloseRequested(int))); button->click(); QCOMPARE(tabbar.count(), 1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } Q_DECLARE_METATYPE(QTabBar::ButtonPosition) @@ -791,36 +791,36 @@ void tst_QTabBar::tabBarClicked() QSignalSpy clickSpy(&tabBar, SIGNAL(tabBarClicked(int))); QSignalSpy doubleClickSpy(&tabBar, SIGNAL(tabBarDoubleClicked(int))); - QCOMPARE(clickSpy.count(), 0); - QCOMPARE(doubleClickSpy.count(), 0); + QCOMPARE(clickSpy.size(), 0); + QCOMPARE(doubleClickSpy.size(), 0); Qt::MouseButton button = Qt::LeftButton; while (button <= Qt::MaxMouseButton) { const QPoint tabPos = tabBar.tabRect(0).center(); QTest::mouseClick(&tabBar, button, {}, tabPos); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0); - QCOMPARE(doubleClickSpy.count(), 0); + QCOMPARE(doubleClickSpy.size(), 0); QTest::mouseDClick(&tabBar, button, {}, tabPos); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0); - QCOMPARE(doubleClickSpy.count(), 1); + QCOMPARE(doubleClickSpy.size(), 1); QCOMPARE(doubleClickSpy.takeFirst().takeFirst().toInt(), 0); QTest::mouseRelease(&tabBar, button, {}, tabPos); const QPoint barPos(tabBar.tabRect(0).right() + 5, tabBar.tabRect(0).center().y()); QTest::mouseClick(&tabBar, button, {}, barPos); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1); - QCOMPARE(doubleClickSpy.count(), 0); + QCOMPARE(doubleClickSpy.size(), 0); QTest::mouseDClick(&tabBar, button, {}, barPos); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1); - QCOMPARE(doubleClickSpy.count(), 1); + QCOMPARE(doubleClickSpy.size(), 1); QCOMPARE(doubleClickSpy.takeFirst().takeFirst().toInt(), -1); QTest::mouseRelease(&tabBar, button, {}, barPos); diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp index 0cf37ad9d0..00cb26c2d3 100644 --- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp @@ -358,12 +358,12 @@ void tst_QTabWidget::currentIndex() QCOMPARE(tw->currentIndex(), -1); tw->setCurrentIndex(-1); QCOMPARE(tw->currentIndex(), -1); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); int firstIndex = addPage(); tw->setCurrentIndex(firstIndex); QCOMPARE(tw->currentIndex(), firstIndex); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), firstIndex); @@ -371,19 +371,19 @@ void tst_QTabWidget::currentIndex() QCOMPARE(tw->currentIndex(), firstIndex); tw->setCurrentIndex(index); QCOMPARE(tw->currentIndex(), index); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), index); removePage(index); QCOMPARE(tw->currentIndex(), firstIndex); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), firstIndex); removePage(firstIndex); QCOMPARE(tw->currentIndex(), -1); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), -1); } @@ -664,8 +664,8 @@ void tst_QTabWidget::tabBarClicked() QSignalSpy clickSpy(&tabWidget, SIGNAL(tabBarClicked(int))); QSignalSpy doubleClickSpy(&tabWidget, SIGNAL(tabBarDoubleClicked(int))); - QCOMPARE(clickSpy.count(), 0); - QCOMPARE(doubleClickSpy.count(), 0); + QCOMPARE(clickSpy.size(), 0); + QCOMPARE(doubleClickSpy.size(), 0); QTabBar &tabBar = *tabWidget.tabBar(); Qt::MouseButton button = Qt::LeftButton; @@ -673,27 +673,27 @@ void tst_QTabWidget::tabBarClicked() const QPoint tabPos = tabBar.tabRect(0).center(); QTest::mouseClick(&tabBar, button, {}, tabPos); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0); - QCOMPARE(doubleClickSpy.count(), 0); + QCOMPARE(doubleClickSpy.size(), 0); QTest::mouseDClick(&tabBar, button, {}, tabPos); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0); - QCOMPARE(doubleClickSpy.count(), 1); + QCOMPARE(doubleClickSpy.size(), 1); QCOMPARE(doubleClickSpy.takeFirst().takeFirst().toInt(), 0); const QPoint barPos(tabBar.tabRect(0).right() + 5, tabBar.tabRect(0).center().y()); QTest::mouseClick(&tabBar, button, {}, barPos); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1); - QCOMPARE(doubleClickSpy.count(), 0); + QCOMPARE(doubleClickSpy.size(), 0); QTest::mouseDClick(&tabBar, button, {}, barPos); - QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.size(), 1); QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1); - QCOMPARE(doubleClickSpy.count(), 1); + QCOMPARE(doubleClickSpy.size(), 1); QCOMPARE(doubleClickSpy.takeFirst().takeFirst().toInt(), -1); button = Qt::MouseButton(button << 1); diff --git a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp index 8325146b76..8bc991a962 100644 --- a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp @@ -222,29 +222,29 @@ void tst_QTextBrowser::relativeLinks() QSignalSpy sourceChangedSpy(browser, SIGNAL(sourceChanged(QUrl))); browser->setSource(QUrl("subdir/../qtextbrowser.html")); QVERIFY(!browser->document()->isEmpty()); - QCOMPARE(sourceChangedSpy.count(), 1); + QCOMPARE(sourceChangedSpy.size(), 1); QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("subdir/../qtextbrowser.html")); browser->setSource(QUrl("subdir/index.html")); QVERIFY(!browser->document()->isEmpty()); - QCOMPARE(sourceChangedSpy.count(), 1); + QCOMPARE(sourceChangedSpy.size(), 1); QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("subdir/index.html")); browser->setSource(QUrl("anchor.html")); QVERIFY(!browser->document()->isEmpty()); - QCOMPARE(sourceChangedSpy.count(), 1); + QCOMPARE(sourceChangedSpy.size(), 1); QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("anchor.html")); browser->setSource(QUrl("subdir/index.html")); QVERIFY(!browser->document()->isEmpty()); - QCOMPARE(sourceChangedSpy.count(), 1); + QCOMPARE(sourceChangedSpy.size(), 1); QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("subdir/index.html")); // using QUrl::fromLocalFile() browser->setSource(QUrl::fromLocalFile("anchor.html")); QVERIFY(!browser->document()->isEmpty()); - QCOMPARE(sourceChangedSpy.count(), 1); + QCOMPARE(sourceChangedSpy.size(), 1); QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("file:anchor.html")); browser->setSource(QUrl("subdir/../qtextbrowser.html")); QVERIFY(!browser->document()->isEmpty()); - QCOMPARE(sourceChangedSpy.count(), 1); + QCOMPARE(sourceChangedSpy.size(), 1); QCOMPARE(sourceChangedSpy.takeFirst()[0].toUrl(), QUrl("subdir/../qtextbrowser.html")); } @@ -276,9 +276,9 @@ void tst_QTextBrowser::forwardBackwardAvailable() browser->setSource(QUrl::fromLocalFile("anchor.html")); QVERIFY(!browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(!backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(!forwardSpy.at(0).at(0).toBool()); backwardSpy.clear(); @@ -287,9 +287,9 @@ void tst_QTextBrowser::forwardBackwardAvailable() browser->setSource(QUrl::fromLocalFile("bigpage.html")); QVERIFY(browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(!forwardSpy.at(0).at(0).toBool()); backwardSpy.clear(); @@ -298,9 +298,9 @@ void tst_QTextBrowser::forwardBackwardAvailable() browser->setSource(QUrl::fromLocalFile("pagewithbg.html")); QVERIFY(browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(!forwardSpy.at(0).at(0).toBool()); backwardSpy.clear(); @@ -309,9 +309,9 @@ void tst_QTextBrowser::forwardBackwardAvailable() browser->backward(); QVERIFY(browser->isBackwardAvailable()); QVERIFY(browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(forwardSpy.at(0).at(0).toBool()); backwardSpy.clear(); @@ -320,9 +320,9 @@ void tst_QTextBrowser::forwardBackwardAvailable() browser->backward(); QVERIFY(!browser->isBackwardAvailable()); QVERIFY(browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(!backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(forwardSpy.at(0).at(0).toBool()); backwardSpy.clear(); @@ -331,9 +331,9 @@ void tst_QTextBrowser::forwardBackwardAvailable() browser->forward(); QVERIFY(browser->isBackwardAvailable()); QVERIFY(browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(forwardSpy.at(0).at(0).toBool()); backwardSpy.clear(); @@ -342,9 +342,9 @@ void tst_QTextBrowser::forwardBackwardAvailable() browser->forward(); QVERIFY(browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(!forwardSpy.at(0).at(0).toBool()); backwardSpy.clear(); @@ -362,9 +362,9 @@ void tst_QTextBrowser::clearHistory() browser->clearHistory(); QVERIFY(!browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(!backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(!forwardSpy.at(0).at(0).toBool()); QVERIFY(browser->historyTitle(-1).isEmpty()); QVERIFY(browser->historyTitle(0).isEmpty()); @@ -376,9 +376,9 @@ void tst_QTextBrowser::clearHistory() browser->setSource(QUrl::fromLocalFile("anchor.html")); QVERIFY(!browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(!backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(!forwardSpy.at(0).at(0).toBool()); backwardSpy.clear(); @@ -387,9 +387,9 @@ void tst_QTextBrowser::clearHistory() browser->setSource(QUrl::fromLocalFile("bigpage.html")); QVERIFY(browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(!forwardSpy.at(0).at(0).toBool()); backwardSpy.clear(); @@ -398,9 +398,9 @@ void tst_QTextBrowser::clearHistory() browser->clearHistory(); QVERIFY(!browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); - QCOMPARE(backwardSpy.count(), 1); + QCOMPARE(backwardSpy.size(), 1); QVERIFY(!backwardSpy.at(0).at(0).toBool()); - QCOMPARE(forwardSpy.count(), 1); + QCOMPARE(forwardSpy.size(), 1); QVERIFY(!forwardSpy.at(0).at(0).toBool()); QVERIFY(browser->historyTitle(-1).isEmpty()); QVERIFY(browser->historyTitle(1).isEmpty()); @@ -673,7 +673,7 @@ void tst_QTextBrowser::urlEncoding() browser->setEditFocus(true); #endif QTest::keyClick(browser, Qt::Key_Enter); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QUrl url = spy.at(0).at(0).toUrl(); QCOMPARE(url.toEncoded(), QByteArray("http://www.google.com/q=%22")); diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 22247969e9..241b0e64f3 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -721,7 +721,7 @@ void tst_QTextEdit::cursorPositionChanged() spy.clear(); QTest::keyClick(ed, Qt::Key_A); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QTextCursor cursor = ed->textCursor(); cursor.movePosition(QTextCursor::Start); @@ -729,18 +729,18 @@ void tst_QTextEdit::cursorPositionChanged() cursor.movePosition(QTextCursor::End); spy.clear(); cursor.insertText("Test"); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); cursor.movePosition(QTextCursor::End); ed->setTextCursor(cursor); cursor.movePosition(QTextCursor::Start); spy.clear(); cursor.insertText("Test"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); QTest::keyClick(ed, Qt::Key_Left); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); cursor.movePosition(QTextCursor::Start); ed->setTextCursor(cursor); @@ -749,7 +749,7 @@ void tst_QTextEdit::cursorPositionChanged() QTest::mouseDClick(ed->viewport(), Qt::LeftButton, {}, ed->cursorRect().center()); QVERIFY(ed->textCursor().hasSelection()); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); CursorPositionChangedRecorder spy2(ed); QVERIFY(ed->textCursor().position() > 0); @@ -771,7 +771,7 @@ void tst_QTextEdit::setTextCursor() spy.clear(); ed->setTextCursor(cursor); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } #ifndef QT_NO_CLIPBOARD @@ -788,7 +788,7 @@ void tst_QTextEdit::undoAvailableAfterPaste() const QString txt("Test"); QApplication::clipboard()->setText(txt); ed->paste(); - QVERIFY(spy.count() >= 1); + QVERIFY(spy.size() >= 1); QCOMPARE(ed->toPlainText(), txt); } #endif @@ -1063,9 +1063,9 @@ void tst_QTextEdit::setPlainTextShouldEmitTextChangedOnce() { QSignalSpy spy(ed, SIGNAL(textChanged())); ed->setPlainText("Yankee Doodle"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); ed->setPlainText(""); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QTextEdit::overwriteMode() @@ -1379,8 +1379,8 @@ void tst_QTextEdit::copyAvailable() //Compare spied signals QEXPECT_FAIL("Case7 T,A,A, <- + shift, <- + shift, <- + shift, ctrl + x, undo() | signals: true, false, true", "Wrong undo selection behaviour. Should be fixed in some future release. (See task: 132482)", Abort); - QCOMPARE(spyCopyAvailabe.count(), copyAvailable.size()); - for (int i=0;itextCursor().position(), 0); ed->moveCursor(QTextCursor::NextCharacter); QCOMPARE(ed->textCursor().position(), 1); - QCOMPARE(cursorMovedSpy.count(), 1); + QCOMPARE(cursorMovedSpy.size(), 1); ed->moveCursor(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); QCOMPARE(ed->textCursor().position(), 2); - QCOMPARE(cursorMovedSpy.count(), 2); + QCOMPARE(cursorMovedSpy.size(), 2); QCOMPARE(ed->textCursor().selectedText(), QString("e")); } @@ -1887,27 +1887,27 @@ void tst_QTextEdit::selectionChanged() QTest::keyClick(ed, Qt::Key_Right); QCOMPARE(ed->textCursor().position(), 1); - QCOMPARE(selectionChangedSpy.count(), 0); + QCOMPARE(selectionChangedSpy.size(), 0); QTest::keyClick(ed, Qt::Key_Right, Qt::ShiftModifier); QCOMPARE(ed->textCursor().position(), 2); - QCOMPARE(selectionChangedSpy.count(), 1); + QCOMPARE(selectionChangedSpy.size(), 1); QTest::keyClick(ed, Qt::Key_Right, Qt::ShiftModifier); QCOMPARE(ed->textCursor().position(), 3); - QCOMPARE(selectionChangedSpy.count(), 2); + QCOMPARE(selectionChangedSpy.size(), 2); QTest::keyClick(ed, Qt::Key_Right, Qt::ShiftModifier); QCOMPARE(ed->textCursor().position(), 4); - QCOMPARE(selectionChangedSpy.count(), 3); + QCOMPARE(selectionChangedSpy.size(), 3); QTest::keyClick(ed, Qt::Key_Right); QCOMPARE(ed->textCursor().position(), 4); - QCOMPARE(selectionChangedSpy.count(), 4); + QCOMPARE(selectionChangedSpy.size(), 4); QTest::keyClick(ed, Qt::Key_Right); QCOMPARE(ed->textCursor().position(), 5); - QCOMPARE(selectionChangedSpy.count(), 4); + QCOMPARE(selectionChangedSpy.size(), 4); } #ifndef QT_NO_CLIPBOARD @@ -2534,7 +2534,7 @@ void tst_QTextEdit::inputMethodEvent() QInputMethodEvent event; event.setCommitString("text"); QApplication::sendEvent(ed, &event); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(ed->toPlainText(), QString("text")); // test that input method gets chance to commit preedit when removing focus @@ -2564,7 +2564,7 @@ void tst_QTextEdit::inputMethodSelection() cursor.setPosition(5, QTextCursor::KeepAnchor); ed->setTextCursor(cursor); - QCOMPARE(selectionSpy.count(), 1); + QCOMPARE(selectionSpy.size(), 1); QCOMPARE(ed->textCursor().selectionStart(), 0); QCOMPARE(ed->textCursor().selectionEnd(), 5); @@ -2573,7 +2573,7 @@ void tst_QTextEdit::inputMethodSelection() QInputMethodEvent event("", attributes); QApplication::sendEvent(ed, &event); - QCOMPARE(selectionSpy.count(), 2); + QCOMPARE(selectionSpy.size(), 2); QCOMPARE(ed->textCursor().selectionStart(), 12); QCOMPARE(ed->textCursor().selectionEnd(), 17); } @@ -2673,7 +2673,7 @@ void tst_QTextEdit::countTextChangedOnRemove() QKeyEvent event(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier); QCoreApplication::instance()->notify(&edit, &event); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } #if QT_CONFIG(regularexpression) diff --git a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp index b9710487ec..670839feb6 100644 --- a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp +++ b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp @@ -139,12 +139,12 @@ void tst_QToolBar::allowedAreas() QVERIFY(!tb.isAreaAllowed(Qt::RightToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::TopToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::BottomToolBarArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.allowedAreas()); spy.clear(); tb.setAllowedAreas(tb.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setAllowedAreas(Qt::RightToolBarArea); QCOMPARE((int)tb.allowedAreas(), (int)Qt::RightToolBarArea); @@ -152,12 +152,12 @@ void tst_QToolBar::allowedAreas() QVERIFY(tb.isAreaAllowed(Qt::RightToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::TopToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::BottomToolBarArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.allowedAreas()); spy.clear(); tb.setAllowedAreas(tb.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setAllowedAreas(Qt::TopToolBarArea); QCOMPARE((int)tb.allowedAreas(), (int)Qt::TopToolBarArea); @@ -165,12 +165,12 @@ void tst_QToolBar::allowedAreas() QVERIFY(!tb.isAreaAllowed(Qt::RightToolBarArea)); QVERIFY(tb.isAreaAllowed(Qt::TopToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::BottomToolBarArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.allowedAreas()); spy.clear(); tb.setAllowedAreas(tb.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setAllowedAreas(Qt::BottomToolBarArea); QCOMPARE((int)tb.allowedAreas(), (int)Qt::BottomToolBarArea); @@ -178,12 +178,12 @@ void tst_QToolBar::allowedAreas() QVERIFY(!tb.isAreaAllowed(Qt::RightToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::TopToolBarArea)); QVERIFY(tb.isAreaAllowed(Qt::BottomToolBarArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.allowedAreas()); spy.clear(); tb.setAllowedAreas(tb.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // multiple dock window areas tb.setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); @@ -192,12 +192,12 @@ void tst_QToolBar::allowedAreas() QVERIFY(!tb.isAreaAllowed(Qt::RightToolBarArea)); QVERIFY(tb.isAreaAllowed(Qt::TopToolBarArea)); QVERIFY(tb.isAreaAllowed(Qt::BottomToolBarArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.allowedAreas()); spy.clear(); tb.setAllowedAreas(tb.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea); QCOMPARE(tb.allowedAreas(), Qt::LeftToolBarArea | Qt::RightToolBarArea); @@ -205,12 +205,12 @@ void tst_QToolBar::allowedAreas() QVERIFY(tb.isAreaAllowed(Qt::RightToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::TopToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::BottomToolBarArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.allowedAreas()); spy.clear(); tb.setAllowedAreas(tb.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setAllowedAreas(Qt::TopToolBarArea | Qt::LeftToolBarArea); QCOMPARE(tb.allowedAreas(), Qt::TopToolBarArea | Qt::LeftToolBarArea); @@ -218,12 +218,12 @@ void tst_QToolBar::allowedAreas() QVERIFY(!tb.isAreaAllowed(Qt::RightToolBarArea)); QVERIFY(tb.isAreaAllowed(Qt::TopToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::BottomToolBarArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.allowedAreas()); spy.clear(); tb.setAllowedAreas(tb.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setAllowedAreas(Qt::BottomToolBarArea | Qt::RightToolBarArea); QCOMPARE(tb.allowedAreas(), Qt::BottomToolBarArea | Qt::RightToolBarArea); @@ -231,12 +231,12 @@ void tst_QToolBar::allowedAreas() QVERIFY(tb.isAreaAllowed(Qt::RightToolBarArea)); QVERIFY(!tb.isAreaAllowed(Qt::TopToolBarArea)); QVERIFY(tb.isAreaAllowed(Qt::BottomToolBarArea)); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.allowedAreas()); spy.clear(); tb.setAllowedAreas(tb.allowedAreas()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QToolBar::orientation() @@ -248,48 +248,48 @@ void tst_QToolBar::orientation() tb.setOrientation(Qt::Vertical); QCOMPARE(tb.orientation(), Qt::Vertical); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.orientation()); spy.clear(); tb.setOrientation(tb.orientation()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setOrientation(Qt::Horizontal); QCOMPARE(tb.orientation(), Qt::Horizontal); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.orientation()); spy.clear(); tb.setOrientation(tb.orientation()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setOrientation(Qt::Vertical); QCOMPARE(tb.orientation(), Qt::Vertical); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.orientation()); spy.clear(); tb.setOrientation(tb.orientation()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setOrientation(Qt::Horizontal); QCOMPARE(tb.orientation(), Qt::Horizontal); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.orientation()); spy.clear(); tb.setOrientation(tb.orientation()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setOrientation(Qt::Vertical); QCOMPARE(tb.orientation(), Qt::Vertical); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(*static_cast(spy.at(0).value(0).constData()), tb.orientation()); spy.clear(); tb.setOrientation(tb.orientation()); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QToolBar::addAction() @@ -626,43 +626,43 @@ void tst_QToolBar::iconSize() QCOMPARE(tb.iconSize(), defaultIconSize); tb.setIconSize(defaultIconSize); QCOMPARE(tb.iconSize(), defaultIconSize); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); tb.setIconSize(largeIconSize); QCOMPARE(tb.iconSize(), largeIconSize); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.first().first().toSize(), largeIconSize); // no-op spy.clear(); tb.setIconSize(largeIconSize); QCOMPARE(tb.iconSize(), largeIconSize); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); tb.setIconSize(defaultIconSize); QCOMPARE(tb.iconSize(), defaultIconSize); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.first().first().toSize(), defaultIconSize); // no-op spy.clear(); tb.setIconSize(defaultIconSize); QCOMPARE(tb.iconSize(), defaultIconSize); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); spy.clear(); tb.setIconSize(smallIconSize); QCOMPARE(tb.iconSize(), smallIconSize); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.first().first().toSize(), smallIconSize); // no-op spy.clear(); tb.setIconSize(smallIconSize); QCOMPARE(tb.iconSize(), smallIconSize); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); // setting the icon size to an invalid QSize will reset the // iconSize property to the default @@ -690,28 +690,28 @@ void tst_QToolBar::iconSize() // explicitly set it to the default tb.setIconSize(defaultIconSize); QCOMPARE(tb.iconSize(), defaultIconSize); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); mw.addToolBar(&tb); // tb icon size should not change since it has been explicitly set QCOMPARE(tb.iconSize(), defaultIconSize); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); mw.setIconSize(largeIconSize); QCOMPARE(tb.iconSize(), defaultIconSize); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); mw.setIconSize(defaultIconSize); QCOMPARE(tb.iconSize(), defaultIconSize); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); mw.setIconSize(smallIconSize); QCOMPARE(tb.iconSize(), defaultIconSize); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); // resetting to the default should cause the toolbar to take // on the mainwindow's icon size @@ -734,51 +734,51 @@ void tst_QToolBar::toolButtonStyle() QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); tb.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setToolButtonStyle(Qt::ToolButtonTextOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextOnly); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); // no-op tb.setToolButtonStyle(Qt::ToolButtonTextOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextOnly); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); // no-op tb.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextBesideIcon); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); // no-op tb.setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextBesideIcon); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextUnderIcon); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); // no-op tb.setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonTextUnderIcon); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.setToolButtonStyle(Qt::ToolButtonFollowStyle); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonFollowStyle); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } { @@ -792,28 +792,28 @@ void tst_QToolBar::toolButtonStyle() // explicitly set the tb to the default tb.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); mw.addToolBar(&tb); // tb icon size should not change since it has been explicitly set QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); mw.setToolButtonStyle(Qt::ToolButtonIconOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); mw.setToolButtonStyle(Qt::ToolButtonTextOnly); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); mw.setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QCOMPARE(tb.toolButtonStyle(), Qt::ToolButtonIconOnly); - QCOMPARE(tbSpy.count(), 0); + QCOMPARE(tbSpy.size(), 0); // note: there is no way to clear the explicitly set tool // button style... once you explicitly set it, the toolbar @@ -927,25 +927,25 @@ void tst_QToolBar::visibilityChanged() mw.addToolBar(&tb); mw.show(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); tb.hide(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), false); spy.clear(); tb.hide(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); tb.show(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); spy.clear(); tb.show(); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_QToolBar::actionOwnership() @@ -1027,7 +1027,7 @@ void tst_QToolBar::accel() QTest::keyClick(&mw, Qt::Key_T, Qt::AltModifier); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); #ifdef Q_OS_MAC qt_set_sequence_auto_mnemonic(false); #endif diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp index e562013345..c5ed718edb 100644 --- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp +++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp @@ -124,7 +124,7 @@ void tst_QToolButton::triggered() QVERIFY(QTest::qWaitForWindowActive(&mainWidget)); defaultAction->trigger(); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), defaultAction); m_menu = menu.data(); @@ -135,7 +135,7 @@ void tst_QToolButton::triggered() timer->start(); QTimer::singleShot(10000, &mainWidget, SLOT(close())); // Emergency bail-out toolButton->showMenu(); - QTRY_COMPARE(spy.count(),2); + QTRY_COMPARE(spy.size(),2); QCOMPARE(qvariant_cast(spy.at(1).at(0)), one); } @@ -188,7 +188,7 @@ void tst_QToolButton::task176137_autoRepeatOfAction() QTest::mousePress (toolButton, Qt::LeftButton); QTest::qWait(2000); QTest::mouseRelease (toolButton, Qt::LeftButton, {}, {}); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); // try again with auto repeat toolButton->setAutoRepeat (true); @@ -198,11 +198,11 @@ void tst_QToolButton::task176137_autoRepeatOfAction() QTest::mouseRelease (toolButton, Qt::LeftButton, {}, {}); const qreal expected = (3000 - toolButton->autoRepeatDelay()) / toolButton->autoRepeatInterval() + 1; //we check that the difference is small (on some systems timers are not super accurate) - qreal diff = (expected - repeatSpy.count()) / expected; + qreal diff = (expected - repeatSpy.size()) / expected; QVERIFY2(qAbs(diff) < 0.2, qPrintable( QString("expected: %1, actual: %2, diff (fraction): %3") .arg(expected) - .arg(repeatSpy.count()) + .arg(repeatSpy.size()) .arg(diff))); } @@ -275,21 +275,21 @@ void tst_QToolButton::defaultActionSynced() tb.setChecked(true); QVERIFY(a.isChecked()); - QCOMPARE(tbSpy.count(), ++tbToggledCount); - QCOMPARE(aSpy.count(), ++aToggledCount); + QCOMPARE(tbSpy.size(), ++tbToggledCount); + QCOMPARE(aSpy.size(), ++aToggledCount); tb.setChecked(false); QVERIFY(!a.isChecked()); - QCOMPARE(tbSpy.count(), ++tbToggledCount); - QCOMPARE(aSpy.count(), ++aToggledCount); + QCOMPARE(tbSpy.size(), ++tbToggledCount); + QCOMPARE(aSpy.size(), ++aToggledCount); a.setChecked(true); QVERIFY(tb.isChecked()); - QCOMPARE(tbSpy.count(), ++tbToggledCount); - QCOMPARE(aSpy.count(), ++aToggledCount); + QCOMPARE(tbSpy.size(), ++tbToggledCount); + QCOMPARE(aSpy.size(), ++aToggledCount); a.setChecked(false); QVERIFY(!tb.isChecked()); - QCOMPARE(tbSpy.count(), ++tbToggledCount); - QCOMPARE(aSpy.count(), ++aToggledCount); + QCOMPARE(tbSpy.size(), ++tbToggledCount); + QCOMPARE(aSpy.size(), ++aToggledCount); QAction b; QSignalSpy bSpy(&b, SIGNAL(toggled(bool))); @@ -303,17 +303,17 @@ void tst_QToolButton::defaultActionSynced() QVERIFY(!a.isChecked()); QVERIFY(b.isChecked()); - QCOMPARE(tbSpy.count(), ++tbToggledCount); - QCOMPARE(aSpy.count(), aToggledCount); - QCOMPARE(bSpy.count(), ++bToggledCount); + QCOMPARE(tbSpy.size(), ++tbToggledCount); + QCOMPARE(aSpy.size(), aToggledCount); + QCOMPARE(bSpy.size(), ++bToggledCount); tb.click(); QVERIFY(!a.isChecked()); QVERIFY(!tb.isChecked()); QVERIFY(!b.isChecked()); - QCOMPARE(tbSpy.count(), ++tbToggledCount); - QCOMPARE(aSpy.count(), aToggledCount); - QCOMPARE(bSpy.count(), ++bToggledCount); + QCOMPARE(tbSpy.size(), ++tbToggledCount); + QCOMPARE(aSpy.size(), aToggledCount); + QCOMPARE(bSpy.size(), ++bToggledCount); } QTEST_MAIN(tst_QToolButton) diff --git a/tests/baseline/shared/paintcommands.cpp b/tests/baseline/shared/paintcommands.cpp index 4a3de0168b..06c420e471 100644 --- a/tests/baseline/shared/paintcommands.cpp +++ b/tests/baseline/shared/paintcommands.cpp @@ -907,7 +907,7 @@ void PaintCommands::command_import(QRegularExpressionMatch re) if (m_verboseMode) { printf(" -(lance) Command buffer now looks like:\n"); - for (int i = 0; i < m_commands.count(); ++i) + for (int i = 0; i < m_commands.size(); ++i) printf(" ---> {%s}\n", qPrintable(m_commands.at(i))); } delete file; @@ -925,7 +925,7 @@ void PaintCommands::command_begin_block(QRegularExpressionMatch re) m_commands[m_currentCommandIndex] = QLatin1String("# begin block (") + blockName + QLatin1Char(')'); QStringList newBlock; int i = m_currentCommandIndex + 1; - for (; i < m_commands.count(); ++i) { + for (; i < m_commands.size(); ++i) { const QString &nextCmd = m_commands.at(i); if (nextCmd.startsWith("end_block")) { m_commands[i] = QLatin1String("# end block (") + blockName + QLatin1Char(')'); @@ -935,10 +935,10 @@ void PaintCommands::command_begin_block(QRegularExpressionMatch re) } if (m_verboseMode) - for (int j = 0; j < newBlock.count(); ++j) + for (int j = 0; j < newBlock.size(); ++j) printf(" %d: %s\n", j, qPrintable(newBlock.at(j))); - if (i >= m_commands.count()) + if (i >= m_commands.size()) printf(" - Warning! Block doesn't have an 'end_block' marker!\n"); m_blockMap.insert(blockName, newBlock); diff --git a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp index a1abeca12a..424ff88048 100644 --- a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp +++ b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp @@ -43,9 +43,9 @@ void tst_QProcess::echoTest_performance() while (stopWatch.elapsed() < 2000) { process.write(array); while (process.bytesToWrite() > 0) { - int readCount = readyReadSpy.count(); + int readCount = readyReadSpy.size(); QVERIFY(process.waitForBytesWritten(5000)); - if (readyReadSpy.count() == readCount) + if (readyReadSpy.size() == readCount) QVERIFY(process.waitForReadyRead(5000)); } diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/tst_bench_qmimedatabase.cpp b/tests/benchmarks/corelib/mimetypes/qmimedatabase/tst_bench_qmimedatabase.cpp index 3ecc700421..0711dd9244 100644 --- a/tests/benchmarks/corelib/mimetypes/qmimedatabase/tst_bench_qmimedatabase.cpp +++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/tst_bench_qmimedatabase.cpp @@ -56,7 +56,7 @@ void tst_QMimeDatabase::inheritsPerformance() mimeTypes += mimeTypes; mimeTypes += mimeTypes; mimeTypes += mimeTypes; - QCOMPARE(mimeTypes.count(), 40); + QCOMPARE(mimeTypes.size(), 40); QMimeDatabase db; QMimeType mime = db.mimeTypeForName(QString::fromLatin1("text/x-chdr")); QVERIFY(mime.isValid()); diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp index 28c8ad6459..6ad1a4c52a 100644 --- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp +++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp @@ -7,7 +7,7 @@ QT_BEGIN_NAMESPACE size_t qHash(const Qt4String &str) { - qsizetype n = str.length(); + qsizetype n = str.size(); const QChar *p = str.unicode(); uint h = 0; diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp index e16d1f313b..066c981455 100644 --- a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp @@ -95,7 +95,7 @@ void tst_QGraphicsLayout::invalidate() QBENCHMARK { leaf->setMinimumSize(size); leaf->setMaximumSize(size); - while (setGeometryCalls->count() < depth) { + while (setGeometryCalls->size() < depth) { QApplication::sendPostedEvents(); } // force a resize on each widget, this will ensure