Tweak QInputDevice logging

The logging category now silences QtWarningMsg and below by
default, so we can be more granular in our logging.

Use info logging category for registering/unregistering, to allow
filtering out the detailed debug logging while still seeing when
devices are registered/unregistered.

Log the number of buttons for pointing devices, if there are any.

Log the device for wheel events.

Change-Id: Ie046fee1659fc3967caf7eafbaf46f3ed22be5bb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 1ad00d3878271450cc55eb84d4c5f3cddd460b8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2024-11-12 12:10:37 +01:00 committed by Qt Cherry-pick Bot
parent 059cbd17ba
commit 19207456bd
4 changed files with 6 additions and 3 deletions

View File

@ -4111,6 +4111,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << "QWheelEvent(" << we->phase();
if (!we->pixelDelta().isNull() || !we->angleDelta().isNull())
dbg << ", pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta();
dbg << " dev=" << we->device() << ')';
dbg << ')';
}
break;

View File

@ -348,7 +348,7 @@ void QInputDevicePrivate::registerDevice(const QInputDevice *dev)
{
QMutexLocker lock(&devicesMutex);
deviceList()->append(dev);
qCDebug(lcQpaInputDevices) << "Registered" << dev;
qCInfo(lcQpaInputDevices) << "Registered" << dev;
}
/*!
@ -358,7 +358,7 @@ void QInputDevicePrivate::unregisterDevice(const QInputDevice *dev)
{
QMutexLocker lock(&devicesMutex);
deviceList()->removeOne(dev);
qCDebug(lcQpaInputDevices) << "Unregistered" << dev;
qCInfo(lcQpaInputDevices) << "Unregistered" << dev;
}
bool QInputDevice::operator==(const QInputDevice &other) const

View File

@ -719,6 +719,8 @@ QDebug operator<<(QDebug debug, const QPointingDevice *device)
debug << " caps=";
QtDebugUtils::formatQFlags(debug, device->capabilities());
}
if (device->buttonCount() > 0)
debug << " buttonCount=" << device->buttonCount();
if (device->maximumPoints() > 1)
debug << " maxPts=" << device->maximumPoints();
if (device->uniqueId().isValid())

View File

@ -24,7 +24,7 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices")
Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices", QtWarningMsg)
Q_CONSTINIT QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
bool QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = false;