diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-11-11 15:53:00 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-11-15 14:24:02 +0100 |
commit | f5ce8a99c75850dbd6065c86b48656b05d8c6966 (patch) | |
tree | f018c7a91d5112e0c3163f9d234f0a718bd9cfad | |
parent | ffdb0eab332aba3a049be645ac822d34161319f8 (diff) | |
download | qtwebchannel-f5ce8a99c75850dbd6065c86b48656b05d8c6966.tar.gz |
Port from container::count() and length() to size() - V5
This is a the same semantic patch (qt-port-to-std-compatible-api V5
with config Scope: 'Container') as in dev. I've re-ran it in 6.4 to
avoid cherry-pick conflicts.
Change-Id: I9621dee5ed328b47e78919a34c307105e4311903
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
-rw-r--r-- | src/webchannel/qmetaobjectpublisher.cpp | 4 | ||||
-rw-r--r-- | src/webchannel/signalhandler_p.h | 4 | ||||
-rw-r--r-- | tests/auto/webchannel/tst_webchannel.cpp | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/webchannel/qmetaobjectpublisher.cpp b/src/webchannel/qmetaobjectpublisher.cpp index c97b504..8a66897 100644 --- a/src/webchannel/qmetaobjectpublisher.cpp +++ b/src/webchannel/qmetaobjectpublisher.cpp @@ -150,7 +150,7 @@ QMetaType resultTypeOfQFuture(QByteArrayView typeName) if (!typeName.startsWith("QFuture<") || !typeName.endsWith('>')) return {}; - return QMetaType::fromName(typeName.sliced(8, typeName.length() - 9)); + return QMetaType::fromName(typeName.sliced(8, typeName.size() - 9)); } template<typename Func> @@ -300,7 +300,7 @@ QJsonObject QMetaObjectPublisher::classInfoForObject(const QObject *object, QWeb // optimize: compress the common propertyChanged notification names, just send a 1 const QByteArray ¬ifySignal = prop.notifySignal().name(); static const QByteArray changedSuffix = QByteArrayLiteral("Changed"); - if (notifySignal.length() == changedSuffix.length() + propertyName.length() && + if (notifySignal.size() == changedSuffix.size() + propertyName.size() && notifySignal.endsWith(changedSuffix) && notifySignal.startsWith(prop.name())) { signalInfo.append(1); diff --git a/src/webchannel/signalhandler_p.h b/src/webchannel/signalhandler_p.h index 876413d..f5a378a 100644 --- a/src/webchannel/signalhandler_p.h +++ b/src/webchannel/signalhandler_p.h @@ -195,9 +195,9 @@ void SignalHandler<Receiver>::dispatch(const QObject *object, const int signalId } const QList<int> &argumentTypes = *signalIt; QVariantList arguments; - arguments.reserve(argumentTypes.count()); + arguments.reserve(argumentTypes.size()); // TODO: basic overload resolution based on number of arguments? - for (int i = 0; i < argumentTypes.count(); ++i) { + for (int i = 0; i < argumentTypes.size(); ++i) { const QMetaType::Type type = static_cast<QMetaType::Type>(argumentTypes.at(i)); QVariant arg; if (type == QMetaType::QVariant) { diff --git a/tests/auto/webchannel/tst_webchannel.cpp b/tests/auto/webchannel/tst_webchannel.cpp index 6a69d73..7ea1912 100644 --- a/tests/auto/webchannel/tst_webchannel.cpp +++ b/tests/auto/webchannel/tst_webchannel.cpp @@ -997,7 +997,7 @@ void TestWebChannel::testWrapObjectWithMultipleTransports() pub->wrapResult(QVariant::fromValue(&obj), dummyTransport); pub->wrapResult(QVariant::fromValue(&obj), dummyTransport2); - QCOMPARE(pub->transportedWrappedObjects.count(), 2); + QCOMPARE(pub->transportedWrappedObjects.size(), 2); } void TestWebChannel::testJsonToVariant() @@ -1559,9 +1559,9 @@ void TestWebChannel::qtbug46548_overriddenProperties() QSignalSpy spy(&engine, &TestJSEngine::channelSetupReady); connect(&engine, &TestJSEngine::channelSetupReady, TestSubclassedFunctor(&engine)); engine.initWebChannelJS(); - if (!spy.count()) + if (!spy.size()) spy.wait(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QJSValue subclassedTestObject = engine.evaluate("channel.objects[\"subclassedTestObject\"]"); QVERIFY(subclassedTestObject.isObject()); |