summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2022-09-30 10:23:45 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2022-10-04 08:11:52 +0300
commitc3a265592d7d4709998e5bf12d14a143aa0bf14f (patch)
treedf3fb44a6049105f1e062d62d0b52f6e407c0180 /src
parenta83541566473ce7f362eced21d12ac245a28f431 (diff)
Change from count() to size() with Qt containers
As the preferred method. Potentially may be deprecated similar to QString/QByteArray Fixes: QTBUG-107068 Change-Id: I0cfc9d7f8e2e450849f1d22c5b98aa353748ecf6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/sensors/dummy/dummycommon.cpp2
-rw-r--r--src/sensors/qsensor.cpp2
-rw-r--r--src/sensors/qsensormanager.cpp8
-rw-r--r--src/sensorsquick/qmlsensor.cpp6
-rw-r--r--src/sensorsquick/qmlsensorglobal.cpp4
5 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/sensors/dummy/dummycommon.cpp b/src/plugins/sensors/dummy/dummycommon.cpp
index 772f0335..f5b63146 100644
--- a/src/plugins/sensors/dummy/dummycommon.cpp
+++ b/src/plugins/sensors/dummy/dummycommon.cpp
@@ -18,7 +18,7 @@ void dummycommon::start()
int dataRate = sensor()->dataRate();
if (dataRate == 0) {
- if (sensor()->availableDataRates().count())
+ if (sensor()->availableDataRates().size())
// Use the first available rate when -1 is chosen
dataRate = sensor()->availableDataRates().first().first;
else
diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp
index 839f7959..fbd94e76 100644
--- a/src/sensors/qsensor.cpp
+++ b/src/sensors/qsensor.cpp
@@ -814,7 +814,7 @@ void QSensor::setOutputRange(int index)
return;
}
bool warn = true;
- if (index >= 0 && index < d->outputRanges.count()) {
+ if (index >= 0 && index < d->outputRanges.size()) {
warn = false;
d->outputRange = index;
}
diff --git a/src/sensors/qsensormanager.cpp b/src/sensors/qsensormanager.cpp
index 7cdc1b24..b246aadf 100644
--- a/src/sensors/qsensormanager.cpp
+++ b/src/sensors/qsensormanager.cpp
@@ -89,7 +89,7 @@ public:
//read out setting line
line.remove(QLatin1String(" "));
QStringList pair = line.split(QStringLiteral("="));
- if (pair.count() == 2)
+ if (pair.size() == 2)
defaultIdentifierForType.insert(pair[0].toLatin1(), pair[1].toLatin1());
}
}
@@ -183,7 +183,7 @@ void QSensorManagerPrivate::loadPlugins()
if (d->loadExternalPlugins) {
SENSORLOG() << "initializing plugins";
QList<QPluginParsedMetaData> meta = d->loader->metaData();
- for (int i = 0; i < meta.count(); i++) {
+ for (int i = 0; i < meta.size(); i++) {
QObject *plugin = d->loader->instance(i);
initPlugin(plugin);
}
@@ -271,7 +271,7 @@ void QSensorManager::unregisterBackend(const QByteArray &type, const QByteArray
(void)factoryByIdentifier.take(identifier); // we don't own this pointer anyway
if (d->firstIdentifierForType[type] == identifier) {
- if (factoryByIdentifier.count()) {
+ if (factoryByIdentifier.size()) {
d->firstIdentifierForType[type] = factoryByIdentifier.begin().key();
if (d->firstIdentifierForType[type].startsWith("generic.")) {
// Don't let a generic backend be the default when some other backend exists!
@@ -287,7 +287,7 @@ void QSensorManager::unregisterBackend(const QByteArray &type, const QByteArray
(void)d->firstIdentifierForType.take(type);
}
}
- if (!factoryByIdentifier.count())
+ if (!factoryByIdentifier.size())
(void)d->backendsByType.take(type);
// Notify the app that the available sensor list has changed.
diff --git a/src/sensorsquick/qmlsensor.cpp b/src/sensorsquick/qmlsensor.cpp
index eb64f2ec..1e375415 100644
--- a/src/sensorsquick/qmlsensor.cpp
+++ b/src/sensorsquick/qmlsensor.cpp
@@ -20,7 +20,7 @@ public:
template<typename Item>
qsizetype readonlyListCount(QQmlListProperty<Item> *p)
{
- return static_cast<const QList<Item *> *>(p->data)->count();
+ return static_cast<const QList<Item *> *>(p->data)->size();
}
template<typename Item>
@@ -453,9 +453,9 @@ void QmlSensor::componentComplete()
// meta-data should become non-empty
if (!description().isEmpty())
Q_EMIT descriptionChanged();
- if (available.count())
+ if (available.size())
Q_EMIT availableDataRatesChanged();
- if (output.count())
+ if (output.size())
Q_EMIT outputRangesChanged();
connect(sensor(), SIGNAL(readingChanged()), this, SLOT(updateReading()));
diff --git a/src/sensorsquick/qmlsensorglobal.cpp b/src/sensorsquick/qmlsensorglobal.cpp
index efc86de4..73f865c4 100644
--- a/src/sensorsquick/qmlsensorglobal.cpp
+++ b/src/sensorsquick/qmlsensorglobal.cpp
@@ -50,7 +50,7 @@ QStringList QmlSensorGlobal::sensorTypes() const
{
QStringList ret;
const QList<QByteArray> sensorTypes = QSensor::sensorTypes();
- ret.reserve(sensorTypes.count());
+ ret.reserve(sensorTypes.size());
for (const QByteArray &type : sensorTypes)
ret << QString::fromLocal8Bit(type);
return ret;
@@ -66,7 +66,7 @@ QStringList QmlSensorGlobal::sensorsForType(const QString &type) const
{
QStringList ret;
const QList<QByteArray> sensors = QSensor::sensorsForType(type.toLocal8Bit());
- ret.reserve(sensors.count());
+ ret.reserve(sensors.size());
for (const QByteArray &identifier : sensors)
ret << QString::fromLocal8Bit(identifier);
return ret;