diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-05-26 15:54:35 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-05-26 15:54:35 (GMT) |
commit | f1ba0329a90fe62a850e4b00bf3bd13011dbe4fa (patch) | |
tree | 6078b37432b1663deb379c0854d149eba4129608 /src/imports | |
parent | f777fccd2db2d2dccd32fe42d0a0cd5c65c6347c (diff) | |
download | Qt-f1ba0329a90fe62a850e4b00bf3bd13011dbe4fa.zip Qt-f1ba0329a90fe62a850e4b00bf3bd13011dbe4fa.tar.gz Qt-f1ba0329a90fe62a850e4b00bf3bd13011dbe4fa.tar.bz2 |
Add key event handling to the declarative web view
This is a very simple approach, I don't know if a more nuanced system
would be appropriate.
Task-number: QTBUG-11025
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/webkit/qdeclarativewebview.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp index 36a25f6..050e2b7 100644 --- a/src/imports/webkit/qdeclarativewebview.cpp +++ b/src/imports/webkit/qdeclarativewebview.cpp @@ -150,6 +150,9 @@ public: The item includes no scrolling, scaling, toolbars, etc., those must be implemented around WebView. See the WebBrowser example for a demonstration of this. + + When this item has keyboard focus, all keyboard input will be sent directly to the + web page within. */ /*! @@ -701,20 +704,12 @@ void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) QDeclarativeItem::hoverMoveEvent(event); } -bool QDeclarativeWebView::sceneEvent(QEvent *event) -{ - if (event->type() == QEvent::KeyPress) { - QKeyEvent *k = static_cast<QKeyEvent *>(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; - } - } - } +bool QDeclarativeWebView::sceneEvent(QEvent *event) +{ + if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)//Key events go to the page + return page()->event(event); return QDeclarativeItem::sceneEvent(event); -} +} /*! |