From 4165b5af295f7cd2282676d836b6537ce3c76f69 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 24 Aug 2009 11:29:59 +1000 Subject: Special handling of Tab/BackTab This may need to be reconsidered with QML focus improvements, but for now, we simply ensure the webview behaves like a QWebView. --- src/declarative/fx/qfxwebview.cpp | 21 +++++++++++++++++++++ src/declarative/fx/qfxwebview.h | 1 + 2 files changed, 22 insertions(+) diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index 9fc469a..347c9c2 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -783,6 +783,27 @@ void QFxWebView::keyReleaseEvent(QKeyEvent* event) QFxPaintedItem::keyReleaseEvent(event); } +bool QFxWebView::sceneEvent(QEvent *event) +{ + Q_D(const QFxWebView); + + if (d->interactive) { + if (event->type() == QEvent::KeyPress) { + QKeyEvent *k = static_cast(event); + if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { + if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? + page()->event(event); + if (event->isAccepted()) + return true; + } + } + } + } + return QFxPaintedItem::sceneEvent(event); +} + + + /*! \qmlproperty action WebView::back This property holds the action for causing the previous URL in the history to be displayed. diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index d84a01c..40c86b4 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -215,6 +215,7 @@ protected: virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); virtual void focusChanged(bool); + virtual bool sceneEvent(QEvent *event); private: void init(); -- cgit v0.12