From 836c0b5a24f5ceb8ed7dce0129f433bf23f58c25 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 30 Jun 2020 12:06:37 +0200 Subject: Make QDebug operator<< polymorphic for QPointingDevice At least it will look polymorphic by doing dispatch internally. Adding pointingDeviceType avoids the need for qobject_cast, and will probably also be useful in other contexts. Change-Id: I3b6d13765bdf3add9a8208de6f0e98018e40cc42 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qinputdevice.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gui/kernel/qinputdevice.cpp') diff --git a/src/gui/kernel/qinputdevice.cpp b/src/gui/kernel/qinputdevice.cpp index e70b0d61be..d64f2c4ddc 100644 --- a/src/gui/kernel/qinputdevice.cpp +++ b/src/gui/kernel/qinputdevice.cpp @@ -39,6 +39,7 @@ #include "qinputdevice.h" #include "qinputdevice_p.h" +#include "qpointingdevice.h" #include #include #include @@ -278,6 +279,9 @@ bool QInputDevice::operator==(const QInputDevice &other) const #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug debug, const QInputDevice *device) { + const QInputDevicePrivate *d = QInputDevicePrivate::get(device); + if (d->pointingDeviceType) + return operator<<(debug, static_cast(device)); QDebugStateSaver saver(debug); debug.nospace(); debug.noquote(); -- cgit v1.2.3