summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-03-16 10:12:22 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-03-16 13:51:45 +0000
commit229fe61f2a64359069ae891c310b56a054c0062c (patch)
treed5c8003961b275095bab325b77a6fb46ceee9ca4 /tools
parentee86f9c3651497842642dc9e166c5bdb1078c116 (diff)
downloadqtactiveqt-229fe61f2a64359069ae891c310b56a054c0062c.tar.gz
Port from container.count()/int to container.size()/qsizetype
This change is driven by the deprecation of (some) container count() in favor of size(), so the int/qsizetype fixes are limited to the vicinity of count()/size() replacements. Pick-to: 6.3 Change-Id: If6606c9d4aec9bd1cf361efe8ffdf349ac031e79 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/dumpcpp/main.cpp20
-rw-r--r--tools/testcon/changeproperties.cpp2
-rw-r--r--tools/testcon/invokemethod.cpp2
-rw-r--r--tools/testcon/mainwindow.cpp4
4 files changed, 14 insertions, 14 deletions
diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp
index e8b6568..162c6c6 100644
--- a/tools/dumpcpp/main.cpp
+++ b/tools/dumpcpp/main.cpp
@@ -124,9 +124,9 @@ void generateNameSpace(QTextStream &out, const QMetaObject *mo, const QByteArray
static QByteArray joinParameterNames(const QByteArrayList &parameterNames)
{
QByteArray slotParameters;
- for (int p = 0; p < parameterNames.count(); ++p) {
+ for (qsizetype p = 0; p < parameterNames.size(); ++p) {
slotParameters += parameterNames.at(p);
- if (p < parameterNames.count() - 1)
+ if (p < parameterNames.size() - 1)
slotParameters += ',';
}
@@ -435,19 +435,19 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo,
const auto signatureSplit = slotSignatureTruncated.split(',');
QByteArrayList parameterSplit;
if (slotParameters.isEmpty()) { // generate parameter names
- for (int i = 0; i < signatureSplit.count(); ++i)
+ for (qsizetype i = 0; i < signatureSplit.size(); ++i)
parameterSplit << QByteArray("p") + QByteArray::number(i);
} else {
parameterSplit = slotParameters.split(',');
}
- for (int i = 0; i < signatureSplit.count(); ++i) {
+ for (qsizetype i = 0; i < signatureSplit.count(); ++i) {
QByteArray parameterType = signatureSplit.at(i);
if (!parameterType.contains("::") && namespaceForType.contains(parameterType))
parameterType.prepend(namespaceForType.value(parameterType) + "::");
QByteArray arraySpec; // transform array method signature "foo(int[4])" ->"foo(int p[4])"
- const int arrayPos = parameterType.lastIndexOf('[');
+ const qsizetype arrayPos = parameterType.lastIndexOf('[');
if (arrayPos != -1) {
arraySpec = parameterType.right(parameterType.size() - arrayPos);
parameterType.truncate(arrayPos);
@@ -456,11 +456,11 @@ void generateClassDecl(QTextStream &out, const QMetaObject *mo,
slotNamedSignature += ' ';
slotNamedSignature += parameterSplit.at(i);
slotNamedSignature += arraySpec;
- if (defaultArguments >= signatureSplit.count() - i) {
+ if (defaultArguments >= signatureSplit.size() - i) {
slotNamedSignature += " = ";
slotNamedSignature += parameterType + "()";
}
- if (i + 1 < signatureSplit.count())
+ if (i + 1 < signatureSplit.size())
slotNamedSignature += ", ";
}
slotNamedSignature += ')';
@@ -774,7 +774,7 @@ bool generateTypeLibrary(QString typeLibFile, QString outname,
typeinfo->Release();
}
- for (int i = 0; i < qax_qualified_usertypes.count(); ++i) {
+ for (qsizetype i = 0; i < qax_qualified_usertypes.size(); ++i) {
QByteArray refType = qax_qualified_usertypes.at(i);
QByteArray refTypeLib;
if (refType.contains("::")) {
@@ -1096,7 +1096,7 @@ int main(int argc, char **argv)
typeLib, QSettings::NativeFormat);
typeLib.clear();
QStringList codes = settings.childGroups();
- for (int c = 0; c < codes.count(); ++c) {
+ for (qsizetype c = 0; c < codes.size(); ++c) {
const QString keyPrefix = QLatin1Char('/') + codes.at(c) + QLatin1String("/0/");
if (QT_POINTER_SIZE == 8) {
typeLib = settings.value(keyPrefix + QLatin1String("win64/.")).toString();
@@ -1160,7 +1160,7 @@ int main(int argc, char **argv)
}
settings.endGroup();
- for (int c = 0; c < codes.count(); ++c) {
+ for (qsizetype c = 0; c < codes.size(); ++c) {
const QString keyPrefix = key + QLatin1Char('/') + codes.at(c) + QLatin1Char('/');
if (QT_POINTER_SIZE == 8) {
typeLib = settings.value(keyPrefix + QLatin1String("win64/.")).toString();
diff --git a/tools/testcon/changeproperties.cpp b/tools/testcon/changeproperties.cpp
index ca609bd..1119624 100644
--- a/tools/testcon/changeproperties.cpp
+++ b/tools/testcon/changeproperties.cpp
@@ -145,7 +145,7 @@ void ChangeProperties::on_buttonSet_clicked()
{
QStringList txtList = editValue->text().split(QRegularExpression(QLatin1String("[,;]")));
QVariantList varList;
- for (int i = 0; i < txtList.count(); ++i) {
+ for (qsizetype i = 0; i < txtList.size(); ++i) {
QVariant svar(txtList.at(i));
QString str = svar.toString();
str = str.trimmed();
diff --git a/tools/testcon/invokemethod.cpp b/tools/testcon/invokemethod.cpp
index 1651537..9919a63 100644
--- a/tools/testcon/invokemethod.cpp
+++ b/tools/testcon/invokemethod.cpp
@@ -122,7 +122,7 @@ void InvokeMethod::on_comboMethods_textActivated(const QString &method)
const auto pnames = slot.parameterNames();
const auto ptypes = slot.parameterTypes();
- for (int p = 0; p < ptypes.count(); ++p) {
+ for (qsizetype p = 0; p < ptypes.size(); ++p) {
QString ptype(QString::fromLatin1(ptypes.at(p)));
if (ptype.isEmpty())
continue;
diff --git a/tools/testcon/mainwindow.cpp b/tools/testcon/mainwindow.cpp
index 8c68e32..b7bcbb1 100644
--- a/tools/testcon/mainwindow.cpp
+++ b/tools/testcon/mainwindow.cpp
@@ -349,7 +349,7 @@ void MainWindow::on_VerbMenu_aboutToShow()
return;
QStringList verbs = container->verbs();
- for (int i = 0; i < verbs.count(); ++i) {
+ for (qsizetype i = 0; i < verbs.size(); ++i) {
VerbMenu->addAction(verbs.at(i));
}
@@ -404,7 +404,7 @@ void MainWindow::on_actionScriptingRun_triggered()
// If we have only one script loaded we can use the cool dialog
QStringList scriptList = m_scripts->scriptNames();
- if (scriptList.count() == 1) {
+ if (scriptList.size() == 1) {
InvokeMethod scriptInvoke(this);
scriptInvoke.setWindowTitle(tr("Execute Script Function"));
scriptInvoke.setControl(m_scripts->script(scriptList[0])->scriptEngine());