diff options
Diffstat (limited to 'src/quickwidgets')
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 2120be768c..11e7953e93 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -1049,7 +1049,8 @@ void QQuickWidget::resizeEvent(QResizeEvent *e) void QQuickWidget::keyPressEvent(QKeyEvent *e) { Q_D(QQuickWidget); - Q_QUICK_INPUT_PROFILE(addEvent<QQuickProfiler::Key>()); + Q_QUICK_INPUT_PROFILE(QQuickProfiler::Key, QQuickProfiler::InputKeyPress, e->key(), + e->modifiers()); QCoreApplication::sendEvent(d->offscreenWindow, e); } @@ -1058,7 +1059,8 @@ void QQuickWidget::keyPressEvent(QKeyEvent *e) void QQuickWidget::keyReleaseEvent(QKeyEvent *e) { Q_D(QQuickWidget); - Q_QUICK_INPUT_PROFILE(addEvent<QQuickProfiler::Key>()); + Q_QUICK_INPUT_PROFILE(QQuickProfiler::Key, QQuickProfiler::InputKeyRelease, e->key(), + e->modifiers()); QCoreApplication::sendEvent(d->offscreenWindow, e); } @@ -1067,7 +1069,8 @@ void QQuickWidget::keyReleaseEvent(QKeyEvent *e) void QQuickWidget::mouseMoveEvent(QMouseEvent *e) { Q_D(QQuickWidget); - Q_QUICK_INPUT_PROFILE(addEvent<QQuickProfiler::Mouse>()); + Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseMove, e->localPos().x(), + e->localPos().y()); // Use the constructor taking localPos and screenPos. That puts localPos into the // event's localPos and windowPos, and screenPos into the event's screenPos. This way @@ -1082,7 +1085,8 @@ void QQuickWidget::mouseMoveEvent(QMouseEvent *e) void QQuickWidget::mouseDoubleClickEvent(QMouseEvent *e) { Q_D(QQuickWidget); - Q_QUICK_INPUT_PROFILE(addEvent<QQuickProfiler::Mouse>()); + Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseDoubleClick, + e->button(), e->buttons()); // As the second mouse press is suppressed in widget windows we emulate it here for QML. // See QTBUG-25831 @@ -1130,7 +1134,8 @@ void QQuickWidget::hideEvent(QHideEvent *) void QQuickWidget::mousePressEvent(QMouseEvent *e) { Q_D(QQuickWidget); - Q_QUICK_INPUT_PROFILE(addEvent<QQuickProfiler::Mouse>()); + Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMousePress, e->button(), + e->buttons()); QMouseEvent mappedEvent(e->type(), e->localPos(), e->screenPos(), e->button(), e->buttons(), e->modifiers()); QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent); @@ -1141,7 +1146,8 @@ void QQuickWidget::mousePressEvent(QMouseEvent *e) void QQuickWidget::mouseReleaseEvent(QMouseEvent *e) { Q_D(QQuickWidget); - Q_QUICK_INPUT_PROFILE(addEvent<QQuickProfiler::Mouse>()); + Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseRelease, e->button(), + e->buttons()); QMouseEvent mappedEvent(e->type(), e->localPos(), e->screenPos(), e->button(), e->buttons(), e->modifiers()); QCoreApplication::sendEvent(d->offscreenWindow, &mappedEvent); @@ -1153,7 +1159,8 @@ void QQuickWidget::mouseReleaseEvent(QMouseEvent *e) void QQuickWidget::wheelEvent(QWheelEvent *e) { Q_D(QQuickWidget); - Q_QUICK_INPUT_PROFILE(addEvent<QQuickProfiler::Mouse>()); + Q_QUICK_INPUT_PROFILE(QQuickProfiler::Mouse, QQuickProfiler::InputMouseWheel, + e->angleDelta().x(), e->angleDelta().y()); // Wheel events only have local and global positions, no need to map. QCoreApplication::sendEvent(d->offscreenWindow, e); @@ -1282,6 +1289,14 @@ void QQuickWidget::triggerUpdate() Q_D(QQuickWidget); d->updatePending = true; if (!d->eventPending) { + // There's no sense in immediately kicking a render off now, as + // there may be a number of triggerUpdate calls to come from a multitude + // of different sources (network, touch/mouse/keyboard, timers, + // animations, ...), and we want to batch them all into single frames as + // much as possible for the sake of interactivity and responsiveness. + // + // To achieve this, we set a timer and only perform the rendering when + // this is complete. const int exhaustDelay = 5; d->updateTimer.start(exhaustDelay, Qt::PreciseTimer, this); d->eventPending = true; |