summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-08-13 06:01:46 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-08-13 06:01:46 (GMT)
commita7f21de784bb50d61f299eb8d6d080a8c6fac6b5 (patch)
tree5c4f33495463b759bd6fb541fcf404f5ad081095 /src/declarative/fx
parent72f565838c5d9f8ee8984d2a7b3586b1d51e656d (diff)
parent6c3a6629de59898a3ea38181a1623896810c576e (diff)
downloadQt-a7f21de784bb50d61f299eb8d6d080a8c6fac6b5.zip
Qt-a7f21de784bb50d61f299eb8d6d080a8c6fac6b5.tar.gz
Qt-a7f21de784bb50d61f299eb8d6d080a8c6fac6b5.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/fx')
-rw-r--r--src/declarative/fx/qfxitem.cpp1
-rw-r--r--src/declarative/fx/qfxitem.h1
-rw-r--r--src/declarative/fx/qfxwebview.cpp80
-rw-r--r--src/declarative/fx/qfxwebview.h1
4 files changed, 74 insertions, 9 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index c68d0da..aba6bf1 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -75,7 +75,6 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Item,QFxItem)
QML_DEFINE_NOCREATE_TYPE(QGraphicsTransform);
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Scale,QGraphicsScale)
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation3D,QGraphicsRotation3D)
/*!
\group group_animation
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index 6c317f7..f005d89 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -262,7 +262,6 @@ QML_DECLARE_TYPE(QFxItem)
QML_DECLARE_TYPE(QGraphicsTransform)
QML_DECLARE_TYPE(QGraphicsScale)
QML_DECLARE_TYPE(QGraphicsRotation)
-QML_DECLARE_TYPE(QGraphicsRotation3D)
QT_END_HEADER
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index a80152c..797e6cb 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -247,6 +247,7 @@ void QFxWebView::init()
{
Q_D(QFxWebView);
+ setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::LeftButton);
setFlag(QGraphicsItem::ItemHasNoContents, false);
@@ -632,6 +633,15 @@ static QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e)
return me;
}
+static QMouseEvent *sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent *e)
+{
+ QEvent::Type t = QEvent::MouseMove;
+
+ QMouseEvent *me = new QMouseEvent(t, e->pos().toPoint(), Qt::NoButton, Qt::NoButton, 0);
+
+ return me;
+}
+
void QFxWebView::timerEvent(QTimerEvent *event)
{
@@ -692,27 +702,56 @@ void QFxWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxWebView);
if (d->interactive) {
- d->lastPress = sceneMouseEventToMouseEvent(event);
- event->setAccepted(true);
+ QMouseEvent *me = sceneMouseEventToMouseEvent(event);
+ if (d->lastPress) delete d->lastPress;
+ d->lastPress = me;
+ page()->event(me);
+ event->setAccepted(
+ /*
+ It is not correct to send the press event upwards, if it is not accepted by WebKit
+ e.g. push button does not work, if done so as QGraohucsScene will not send the release event at all to WebKit
+ Might be a bug in WebKit, though
+ */
+#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835
+ true
+#else
+ me->isAccepted()
+#endif
+ );
} else {
event->setAccepted(false);
}
- if (!event->isAccepted())
+ if (!event->isAccepted()) {
QFxPaintedItem::mousePressEvent(event);
+ }
}
void QFxWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QFxWebView);
if (d->interactive) {
- d->lastRelease = sceneMouseEventToMouseEvent(event);
+ QMouseEvent *me = sceneMouseEventToMouseEvent(event);
+ if (d->lastRelease) delete d->lastRelease;
+ d->lastRelease = me;
+ page()->event(me);
d->dcTimer.start(MAX_DOUBLECLICK_TIME,this);
- event->setAccepted(true);
+ event->setAccepted(
+ /*
+ It is not correct to send the press event upwards, if it is not accepted by WebKit
+ e.g. push button does not work, if done so as QGraphicsScene will not send all the events to WebKit
+ */
+#if 1 //QT_VERSION <= 0x040500 // XXX see bug 230835
+ true
+#else
+ me->isAccepted()
+#endif
+ );
} else {
event->setAccepted(false);
}
- if (!event->isAccepted())
+ if (!event->isAccepted()) {
QFxPaintedItem::mouseReleaseEvent(event);
+ }
}
void QFxWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
@@ -722,7 +761,12 @@ void QFxWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QMouseEvent *me = sceneMouseEventToMouseEvent(event);
page()->event(me);
event->setAccepted(
-#if QT_VERSION <= 0x040500 // XXX see bug 230835
+ /*
+ It is not correct to send the press event upwards, if it is not accepted by WebKit
+ e.g. push button does not work, if done so as QGraphicsScene will not send the release event at all to WebKit
+ Might be a bug in WebKit, though
+ */
+#if 1 // QT_VERSION <= 0x040500 // XXX see bug 230835
true
#else
me->isAccepted()
@@ -734,6 +778,28 @@ void QFxWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
if (!event->isAccepted())
QFxPaintedItem::mouseMoveEvent(event);
+
+}
+void QFxWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event)
+{
+ Q_D(const QFxWebView);
+ if (d->interactive) {
+ QMouseEvent *me = sceneHoverMoveEventToMouseEvent(event);
+ page()->event(me);
+ event->setAccepted(
+#if QT_VERSION <= 0x040500 // XXX see bug 230835
+ true
+#else
+ me->isAccepted()
+#endif
+ );
+ delete me;
+ }
+ else {
+ event->setAccepted(false);
+ }
+ if (!event->isAccepted())
+ QFxPaintedItem::hoverMoveEvent(event);
}
void QFxWebView::keyPressEvent(QKeyEvent* event)
diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h
index 8df3d18..9003377 100644
--- a/src/declarative/fx/qfxwebview.h
+++ b/src/declarative/fx/qfxwebview.h
@@ -205,6 +205,7 @@ protected:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+ void hoverMoveEvent (QGraphicsSceneHoverEvent * event);
void keyPressEvent(QKeyEvent* event);
void keyReleaseEvent(QKeyEvent* event);
void timerEvent(QTimerEvent *event);