aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickwidgets/qquickwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickwidgets/qquickwidget.cpp')
-rw-r--r--src/quickwidgets/qquickwidget.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 6f3b685974..920b400eac 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -485,6 +485,12 @@ QImage QQuickWidgetPrivate::grabFramebuffer()
compatible however and attempting to construct a QQuickWidget will lead to
problems.
+ \section1 Tab Key Handling
+
+ On press of the \c[TAB] key, the item inside the QQuickWidget gets focus. If
+ this item can handle \c[TAB] key press, focus will change accordingly within
+ the item, otherwise the next widget in the focus chain gets focus.
+
\sa {Exposing Attributes of C++ Types to QML}, {Qt Quick Widgets Example}, QQuickView
*/
@@ -1222,6 +1228,22 @@ void QQuickWidget::resizeEvent(QResizeEvent *e)
}
/*! \reimp */
+bool QQuickWidget::focusNextPrevChild(bool next)
+{
+ Q_D(QQuickWidget);
+ QKeyEvent event(QEvent::KeyPress, next ? Qt::Key_Tab : Qt::Key_Backtab, Qt::NoModifier);
+ Q_QUICK_INPUT_PROFILE(QQuickProfiler::Key, QQuickProfiler::InputKeyPress, event.key(),
+ Qt::NoModifier);
+ QCoreApplication::sendEvent(d->offscreenWindow, &event);
+
+ QKeyEvent releaseEvent(QEvent::KeyRelease, next ? Qt::Key_Tab : Qt::Key_Backtab, Qt::NoModifier);
+ Q_QUICK_INPUT_PROFILE(QQuickProfiler::Key, QQuickProfiler::InputKeyRelease, releaseEvent.key(),
+ Qt::NoModifier);
+ QCoreApplication::sendEvent(d->offscreenWindow, &releaseEvent);
+ return event.isAccepted();
+}
+
+/*! \reimp */
void QQuickWidget::keyPressEvent(QKeyEvent *e)
{
Q_D(QQuickWidget);