* Forward the event from QWebView to QWebPage through QObject::event. This
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2008 14:48:15 +0000 (14:48 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2008 14:48:15 +0000 (14:48 +0000)
  is similar to the way QTextControl is working.

Signed-off-by: Simon
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29163 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/qt/Api/qwebpage.cpp
WebKit/qt/Api/qwebpage.h
WebKit/qt/Api/qwebview.cpp
WebKit/qt/Api/qwebview.h
WebKit/qt/ChangeLog

index 8eebf4abe394ef1b1cede34c849def79469acea0..2041861104fe71e65dbc7b07eb58f1d5df5889a7 100644 (file)
@@ -785,6 +785,59 @@ static inline Qt::DropAction dragOpToDropAction(unsigned actions)
     return result;    
 }
 
+
+bool QWebPage::event(QEvent *ev)
+{
+    switch (ev->type()) {
+    case QEvent::MouseMove:
+        mouseMoveEvent(static_cast<QMouseEvent*>(ev));
+        break;
+    case QEvent::MouseButtonPress:
+        mousePressEvent(static_cast<QMouseEvent*>(ev));
+        break;
+    case QEvent::MouseButtonDblClick:
+        mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev));
+        break;
+    case QEvent::MouseButtonRelease:
+        mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
+        break;
+    case QEvent::ContextMenu:
+        contextMenuEvent(static_cast<QContextMenuEvent*>(ev));
+        break;
+    case QEvent::Wheel:
+        wheelEvent(static_cast<QWheelEvent*>(ev));
+        break;
+    case QEvent::KeyPress:
+        keyPressEvent(static_cast<QKeyEvent*>(ev));
+        break;
+    case QEvent::KeyRelease:
+        keyReleaseEvent(static_cast<QKeyEvent*>(ev));
+        break;
+    case QEvent::FocusIn:
+        focusInEvent(static_cast<QFocusEvent*>(ev));
+        break;
+    case QEvent::FocusOut:
+        focusOutEvent(static_cast<QFocusEvent*>(ev));
+        break;
+    case QEvent::DragEnter:
+        dragEnterEvent(static_cast<QDragEnterEvent*>(ev));
+        break;
+    case QEvent::DragLeave:
+        dragLeaveEvent(static_cast<QDragLeaveEvent*>(ev));
+        break;
+    case QEvent::DragMove:
+        dragMoveEvent(static_cast<QDragMoveEvent*>(ev));
+        break;
+    case QEvent::Drop:
+        dropEvent(static_cast<QDropEvent*>(ev));
+        break;
+    default:
+        return QObject::event(ev);
+    }
+
+    return true;
+}
+
 void QWebPage::mouseMoveEvent(QMouseEvent *ev)
 {
     QWebFrame *f = d->currentFrame(ev->pos());
index a08f4a404d59e290d6d10d879fbd11e648b947d8..953143a6cffa3568ed9eecbaa6c755c7cf98801b 100644 (file)
@@ -174,6 +174,9 @@ public:
     QSize viewportSize() const;
     void setViewportSize(const QSize &size) const;
 
+    virtual bool event(QEvent*);
+    virtual bool focusNextPrevChild(bool next);
+
 Q_SIGNALS:
     /**
      * Signal is emitted when the global progress status changes.
@@ -218,22 +221,24 @@ protected:
 
     virtual QString userAgentFor(const QUrl& url) const;
 
-    virtual void mouseMoveEvent(QMouseEvent*);
-    virtual void mousePressEvent(QMouseEvent*);
-    virtual void mouseDoubleClickEvent(QMouseEvent*);
-    virtual void mouseReleaseEvent(QMouseEvent*);
-    virtual void contextMenuEvent(QContextMenuEvent*);
-    virtual void wheelEvent(QWheelEvent*);
-    virtual void keyPressEvent(QKeyEvent*);
-    virtual void keyReleaseEvent(QKeyEvent*);
-    virtual void focusInEvent(QFocusEvent*);
-    virtual void focusOutEvent(QFocusEvent*);
-    virtual bool focusNextPrevChild(bool next);
 
-    virtual void dragEnterEvent(QDragEnterEvent *);
-    virtual void dragLeaveEvent(QDragLeaveEvent *);
-    virtual void dragMoveEvent(QDragMoveEvent *);
-    virtual void dropEvent(QDropEvent *);
+
+private:
+    void mouseMoveEvent(QMouseEvent*);
+    void mousePressEvent(QMouseEvent*);
+    void mouseDoubleClickEvent(QMouseEvent*);
+    void mouseReleaseEvent(QMouseEvent*);
+    void contextMenuEvent(QContextMenuEvent*);
+    void wheelEvent(QWheelEvent*);
+    void keyPressEvent(QKeyEvent*);
+    void keyReleaseEvent(QKeyEvent*);
+    void focusInEvent(QFocusEvent*);
+    void focusOutEvent(QFocusEvent*);
+
+    void dragEnterEvent(QDragEnterEvent *);
+    void dragLeaveEvent(QDragLeaveEvent *);
+    void dragMoveEvent(QDragMoveEvent *);
+    void dropEvent(QDropEvent *);
 
 private:
     Q_PRIVATE_SLOT(d, void _q_onLoadProgressChanged(int))
index 0bd40705a4dc06b5f6759834516aaebed2798319..1439d33a496142fb5ca0ccf48a1860266f223a47 100644 (file)
@@ -395,3 +395,79 @@ void QWebView::paintEvent(QPaintEvent *ev)
     qDebug()<<"paint event on "<<ev->region()<<", took to render =  "<<elapsed;
 #endif
 }
+
+void QWebView::mouseMoveEvent(QMouseEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::mousePressEvent(QMouseEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::mouseDoubleClickEvent(QMouseEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::mouseReleaseEvent(QMouseEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::contextMenuEvent(QContextMenuEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::wheelEvent(QWheelEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::keyPressEvent(QKeyEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::keyReleaseEvent(QKeyEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::focusInEvent(QFocusEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::focusOutEvent(QFocusEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::dragEnterEvent(QDragEnterEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::dragLeaveEvent(QDragLeaveEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::dragMoveEvent(QDragMoveEvent* ev)
+{
+    d->page->event(ev);
+}
+
+void QWebView::dropEvent(QDropEvent* ev)
+{
+    d->page->event(ev);
+}
+
+bool QWebView::focusNextPrevChild(bool next)
+{
+    return d->page->focusNextPrevChild(next);
+}
+
index b3de6ef92427d174e4288724b69a71ee71978dc4..dd7d64405b66f7d01ffb076cf9c77b61e12f36a7 100644 (file)
@@ -95,6 +95,23 @@ protected:
     void resizeEvent(QResizeEvent *e);
     void paintEvent(QPaintEvent *ev);
 
+    virtual void mouseMoveEvent(QMouseEvent*);
+    virtual void mousePressEvent(QMouseEvent*);
+    virtual void mouseDoubleClickEvent(QMouseEvent*);
+    virtual void mouseReleaseEvent(QMouseEvent*);
+    virtual void contextMenuEvent(QContextMenuEvent*);
+    virtual void wheelEvent(QWheelEvent*);
+    virtual void keyPressEvent(QKeyEvent*);
+    virtual void keyReleaseEvent(QKeyEvent*);
+    virtual void dragEnterEvent(QDragEnterEvent *);
+    virtual void dragLeaveEvent(QDragLeaveEvent *);
+    virtual void dragMoveEvent(QDragMoveEvent *);
+    virtual void dropEvent(QDropEvent *);
+    virtual void focusInEvent(QFocusEvent*);
+    virtual void focusOutEvent(QFocusEvent*);
+
+    virtual bool focusNextPrevChild(bool next);
+
 private:
     QWebViewPrivate *d;
 };
index 7d5d772f3c92de8027d97b0e9ae5de942d07f2ef..9cbdd1b746eafa2503c406a41edb69819c495267 100644 (file)
@@ -1,3 +1,32 @@
+2008-01-04  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
+
+        Reviewed by Simon.
+
+        * Forward the event from QWebView to QWebPage through QObject::event. This
+        is similar to the way QTextControl is working.
+        
+
+        * Api/qwebpage.cpp:
+        (dragOpToDropAction):
+        (QWebPage::event):
+        * Api/qwebpage.h:
+        * Api/qwebview.cpp:
+        (QWebView::mouseMoveEvent):
+        (QWebView::mousePressEvent):
+        (QWebView::mouseDoubleClickEvent):
+        (QWebView::mouseReleaseEvent):
+        (QWebView::contextMenuEvent):
+        (QWebView::wheelEvent):
+        (QWebView::keyPressEvent):
+        (QWebView::keyReleaseEvent):
+        (QWebView::focusInEvent):
+        (QWebView::focusOutEvent):
+        (QWebView::dragEnterEvent):
+        (QWebView::dragLeaveEvent):
+        (QWebView::dragMoveEvent):
+        (QWebView::dropEvent):
+        * Api/qwebview.h:
+
 2008-01-04  Lars Knoll  <lars@trolltech.com>
 
         Reviewed by Simon.