Commit 6f9bfcfb authored by hausmann@webkit.org's avatar hausmann@webkit.org
Browse files

2008-10-23 Simon Hausmann <hausmann@webkit.org>

        Reviewed by Tor Arne.

        Fix handling of mouse events when embedding QWebView into the
        QGraphicsView.

        QWebPage accepts or ignores events to indicate whether the web page
        handled the event. However for QWebView to behave like a good widget
        it should always accept the mouse events to indicate that it handled
        them and that they should not be subject to event propagation.

        The graphics view relies on acceptance of the initial mouse click to
        make the embedded widget the focus item.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7ff09a42
......@@ -696,32 +696,44 @@ QWebView *QWebView::createWindow(QWebPage::WebWindowType type)
*/
void QWebView::mouseMoveEvent(QMouseEvent* ev)
{
if (d->page)
if (d->page) {
const bool accepted = ev->isAccepted();
d->page->event(ev);
ev->setAccepted(accepted);
}
}
/*! \reimp
*/
void QWebView::mousePressEvent(QMouseEvent* ev)
{
if (d->page)
if (d->page) {
const bool accepted = ev->isAccepted();
d->page->event(ev);
ev->setAccepted(accepted);
}
}
/*! \reimp
*/
void QWebView::mouseDoubleClickEvent(QMouseEvent* ev)
{
if (d->page)
if (d->page) {
const bool accepted = ev->isAccepted();
d->page->event(ev);
ev->setAccepted(accepted);
}
}
/*! \reimp
*/
void QWebView::mouseReleaseEvent(QMouseEvent* ev)
{
if (d->page)
if (d->page) {
const bool accepted = ev->isAccepted();
d->page->event(ev);
ev->setAccepted(accepted);
}
}
#ifndef QT_NO_CONTEXTMENU
......@@ -729,8 +741,11 @@ void QWebView::mouseReleaseEvent(QMouseEvent* ev)
*/
void QWebView::contextMenuEvent(QContextMenuEvent* ev)
{
if (d->page)
if (d->page) {
const bool accepted = ev->isAccepted();
d->page->event(ev);
ev->setAccepted(accepted);
}
}
#endif // QT_NO_CONTEXTMENU
......@@ -739,11 +754,11 @@ void QWebView::contextMenuEvent(QContextMenuEvent* ev)
*/
void QWebView::wheelEvent(QWheelEvent* ev)
{
if (d->page)
if (d->page) {
const bool accepted = ev->isAccepted();
d->page->event(ev);
if (!ev->isAccepted())
return QWidget::wheelEvent(ev);
ev->setAccepted(accepted);
}
}
#endif // QT_NO_WHEELEVENT
......
2008-10-23 Simon Hausmann <hausmann@webkit.org>
Reviewed by Tor Arne.
Fix handling of mouse events when embedding QWebView into the
QGraphicsView.
QWebPage accepts or ignores events to indicate whether the web page
handled the event. However for QWebView to behave like a good widget
it should always accept the mouse events to indicate that it handled
them and that they should not be subject to event propagation.
The graphics view relies on acceptance of the initial mouse click to
make the embedded widget the focus item.
* Api/qwebview.cpp:
(QWebView::mouseMoveEvent):
(QWebView::mousePressEvent):
(QWebView::mouseDoubleClickEvent):
(QWebView::mouseReleaseEvent):
(QWebView::contextMenuEvent):
(QWebView::wheelEvent):
2008-10-22 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon Hausmann.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment