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>
This commit is contained in:
Friedemann Kleint 2018-02-01 14:56:23 +01:00
parent e4fc098a53
commit 2bf4dd1302

View File

@ -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;
}