summaryrefslogtreecommitdiffstats
path: root/tests/manual/diaglib
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-02-01 14:56:23 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-02-02 07:20:55 +0000
commit2bf4dd1302ad48e56925757cc9d12a252a95f6c4 (patch)
tree4075a58781cdb801438702e1f2a3ffb46e8f206e /tests/manual/diaglib
parente4fc098a53de86a8a9986d7e998d0bd56fecf93b (diff)
Diaglib: Make mouse event logging more verbose
Add information about mouse tracking/grabbing for widgets and window where applicable. Change-Id: Idfe8bef6d146ff06dfe95c0bad5e29e7a4ea7adc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/manual/diaglib')
-rw-r--r--tests/manual/diaglib/eventfilter.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/manual/diaglib/eventfilter.cpp b/tests/manual/diaglib/eventfilter.cpp
index 3874adbdeb..0646964b4a 100644
--- a/tests/manual/diaglib/eventfilter.cpp
+++ b/tests/manual/diaglib/eventfilter.cpp
@@ -195,6 +195,19 @@ static void formatApplicationState(QDebug debug)
#endif // HAVE_GUI_APPLICATION
}
+#ifdef HAVE_APPLICATION
+static void formatMouseState(QObject *o, QDebug debug)
+{
+ if (o->isWidgetType()) {
+ const QWidget *w = static_cast<const QWidget *>(o);
+ if (QWidget::mouseGrabber() == w)
+ debug << " [grabbed]";
+ if (w->hasMouseTracking())
+ debug << " [tracking]";
+ }
+}
+#endif // HAVE_APPLICATION
+
bool EventFilter::eventFilter(QObject *o, QEvent *e)
{
static int n = 0;
@@ -210,6 +223,22 @@ bool EventFilter::eventFilter(QObject *o, QEvent *e)
case QEvent::FocusIn:
formatApplicationState(debug);
break;
+#ifdef HAVE_APPLICATION
+ case QEvent::MouseButtonDblClick:
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseMove:
+ case QEvent::NonClientAreaMouseButtonDblClick:
+ case QEvent::NonClientAreaMouseButtonPress:
+ case QEvent::NonClientAreaMouseButtonRelease:
+ case QEvent::NonClientAreaMouseMove:
+# if QT_VERSION >= 0x050000
+ case QEvent::Enter:
+# endif
+ case QEvent::Leave:
+ formatMouseState(o, debug);
+ break;
+#endif // HAVE_APPLICATION
default:
break;
}