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
6589f2ed0c
Task-number: QTBUG-46412
Task-number: QTBUG-72167
Change-Id: I30004792667ee0581a433409ac2e20ffc645e952
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
parent
6589f2ed0c
commit
4e145de8a6
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue