diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-05-12 10:17:24 +0300 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-05-19 08:25:33 +0300 |
commit | d70a9906fced63aa1b8502dbdac58d4c244ef956 (patch) | |
tree | 0db8326ab7dd36da26e08e0825be01f631cbc3c7 /examples | |
parent | 8eb9e3dd16c0057f81fa41c001722f31af32dfdf (diff) |
Rename subclass static variable which shadowed baseclass method
The 'type' static variable shadowed the 'QSensors::type()' method of
the baseclass. While this is easy to workaround it is better to
remove such naming clash.
Task-number: QTBUG-60246
Change-Id: Id0ddae978377ea4d4d0202a572c554c2541f9364
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/sensors/grue/lib/gruesensor.cpp | 2 | ||||
-rw-r--r-- | examples/sensors/grue/lib/gruesensor.h | 4 | ||||
-rw-r--r-- | examples/sensors/grue/plugin/main.cpp | 11 |
3 files changed, 8 insertions, 9 deletions
diff --git a/examples/sensors/grue/lib/gruesensor.cpp b/examples/sensors/grue/lib/gruesensor.cpp index 1de2f4e8..23eb0ec4 100644 --- a/examples/sensors/grue/lib/gruesensor.cpp +++ b/examples/sensors/grue/lib/gruesensor.cpp @@ -113,7 +113,7 @@ void GrueSensorReading::setChanceOfBeingEaten(int chanceOfBeingEaten) \endomit */ -char const * const GrueSensor::type("GrueSensor"); +char const * const GrueSensor::sensorType("GrueSensor"); /* \omit diff --git a/examples/sensors/grue/lib/gruesensor.h b/examples/sensors/grue/lib/gruesensor.h index 90379939..31617b8c 100644 --- a/examples/sensors/grue/lib/gruesensor.h +++ b/examples/sensors/grue/lib/gruesensor.h @@ -86,10 +86,10 @@ class Q_GRUE_EXPORT GrueSensor : public QSensor Q_OBJECT Q_PROPERTY(GrueSensorReading* reading READ reading) public: - explicit GrueSensor(QObject *parent = 0) : QSensor(GrueSensor::type, parent) {} + explicit GrueSensor(QObject *parent = 0) : QSensor(GrueSensor::sensorType, parent) {} virtual ~GrueSensor() {} GrueSensorReading *reading() const { return static_cast<GrueSensorReading*>(QSensor::reading()); } - static char const * const type; + static char const * const sensorType; }; // end generated code diff --git a/examples/sensors/grue/plugin/main.cpp b/examples/sensors/grue/plugin/main.cpp index 4c5da15d..6bf86450 100644 --- a/examples/sensors/grue/plugin/main.cpp +++ b/examples/sensors/grue/plugin/main.cpp @@ -68,13 +68,13 @@ public: void sensorsChanged() override { - if (!QSensor::defaultSensorForType(QAmbientLightSensor::type).isEmpty()) { + if (!QSensor::defaultSensorForType(QAmbientLightSensor::sensorType).isEmpty()) { // There is a light sensor available. Register the backend - if (!QSensorManager::isBackendRegistered(GrueSensor::type, gruesensorimpl::id)) - QSensorManager::registerBackend(GrueSensor::type, gruesensorimpl::id, this); + if (!QSensorManager::isBackendRegistered(GrueSensor::sensorType, gruesensorimpl::id)) + QSensorManager::registerBackend(GrueSensor::sensorType, gruesensorimpl::id, this); } else { - if (QSensorManager::isBackendRegistered(GrueSensor::type, gruesensorimpl::id)) - QSensorManager::unregisterBackend(GrueSensor::type, gruesensorimpl::id); + if (QSensorManager::isBackendRegistered(GrueSensor::sensorType, gruesensorimpl::id)) + QSensorManager::unregisterBackend(GrueSensor::sensorType, gruesensorimpl::id); } } @@ -88,4 +88,3 @@ public: }; #include "main.moc" - |