summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-06-17 07:07:39 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-06-17 09:12:03 +0200
commit4e145de8a639a3290735f59560141c7dad723af3 (patch)
tree7dfbe095158e9206ed360677be8693c4eab82b86 /src
parent6589f2ed0cf78c9b8a5bdffcdc458dc40a974c60 (diff)
Make QInputDevice::devices() return a QList
There was a decision to use QList consistently in public API, now that it's supposed to perform as well as QVector. Amends 6589f2ed0cf78c9b8a5bdffcdc458dc40a974c60 Task-number: QTBUG-46412 Task-number: QTBUG-72167 Change-Id: I30004792667ee0581a433409ac2e20ffc645e952 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qinputdevice.cpp10
-rw-r--r--src/gui/kernel/qinputdevice.h2
-rw-r--r--src/gui/kernel/qpointingdevice.cpp2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/kernel/qinputdevice.cpp b/src/gui/kernel/qinputdevice.cpp
index 1344edb09c..3027c733e7 100644
--- a/src/gui/kernel/qinputdevice.cpp
+++ b/src/gui/kernel/qinputdevice.cpp
@@ -171,8 +171,8 @@ QString QInputDevice::seatName() const
return d->seatName;
}
-typedef QVector<const QInputDevice *> InputDevicesVector;
-Q_GLOBAL_STATIC(InputDevicesVector, deviceList)
+using InputDevicesList = QList<const QInputDevice *>;
+Q_GLOBAL_STATIC(InputDevicesList, deviceList)
static QBasicMutex devicesMutex;
/*!
@@ -183,7 +183,7 @@ static QBasicMutex devicesMutex;
Platform plugins should call \l QWindowSystemInterface::registerInputDevice()
to add devices as they are discovered.
*/
-QVector<const QInputDevice *> QInputDevice::devices()
+QList<const QInputDevice *> QInputDevice::devices()
{
QMutexLocker lock(&devicesMutex);
return *deviceList();
@@ -195,7 +195,7 @@ QVector<const QInputDevice *> QInputDevice::devices()
const QInputDevice *QInputDevice::primaryKeyboard(const QString& seatName)
{
QMutexLocker locker(&devicesMutex);
- InputDevicesVector v = *deviceList();
+ InputDevicesList v = *deviceList();
locker.unlock();
const QInputDevice *ret = nullptr;
for (const QInputDevice *d : v) {
@@ -229,7 +229,7 @@ bool QInputDevicePrivate::isRegistered(const QInputDevice *dev)
if (!dev)
return false;
QMutexLocker locker(&devicesMutex);
- InputDevicesVector v = *deviceList();
+ InputDevicesList v = *deviceList();
for (const QInputDevice *d : v)
if (d && *d == *dev)
return true;
diff --git a/src/gui/kernel/qinputdevice.h b/src/gui/kernel/qinputdevice.h
index d20f76af2e..5bff29f897 100644
--- a/src/gui/kernel/qinputdevice.h
+++ b/src/gui/kernel/qinputdevice.h
@@ -107,7 +107,7 @@ public:
qint64 id() const;
QString seatName() const;
- static QVector<const QInputDevice *> devices();
+ static QList<const QInputDevice *> devices();
static const QInputDevice *primaryKeyboard(const QString& seatName = QString());
bool operator==(const QInputDevice &other) const;
diff --git a/src/gui/kernel/qpointingdevice.cpp b/src/gui/kernel/qpointingdevice.cpp
index b56c83efc4..e1a66d522b 100644
--- a/src/gui/kernel/qpointingdevice.cpp
+++ b/src/gui/kernel/qpointingdevice.cpp
@@ -356,7 +356,7 @@ const QPointingDevice *QPointingDevice::tabletDevice(QInputDevice::DeviceType de
QPointingDevice::PointerType pointerType,
QPointingDeviceUniqueId uniqueId, quint32 busId)
{
- const QVector<const QInputDevice *> devices = QInputDevice::devices();
+ const auto &devices = QInputDevice::devices();
for (const QInputDevice *dev : devices) {
if (dev->type() < DeviceType::Puck || dev->type() > DeviceType::Airbrush)
continue;