summaryrefslogtreecommitdiffstats
path: root/WebKitTools/QtLauncher/webview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/QtLauncher/webview.cpp')
-rw-r--r--WebKitTools/QtLauncher/webview.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/WebKitTools/QtLauncher/webview.cpp b/WebKitTools/QtLauncher/webview.cpp
index 443fc3e..311d79b 100644
--- a/WebKitTools/QtLauncher/webview.cpp
+++ b/WebKitTools/QtLauncher/webview.cpp
@@ -48,6 +48,29 @@ WebViewGraphicsBased::WebViewGraphicsBased(QWidget* parent)
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QStateMachine* machine = new QStateMachine(this);
+ QState* s0 = new QState(machine);
+ s0->assignProperty(this, "yRotation", 0);
+
+ QState* s1 = new QState(machine);
+ s1->assignProperty(this, "yRotation", 90);
+
+ QAbstractTransition* t1 = s0->addTransition(this, SIGNAL(yFlipRequest()), s1);
+ QPropertyAnimation* yRotationAnim = new QPropertyAnimation(this, "yRotation", this);
+ yRotationAnim->setDuration(1000);
+ t1->addAnimation(yRotationAnim);
+
+ QState* s2 = new QState(machine);
+ s2->assignProperty(this, "yRotation", -90);
+ s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2);
+
+ QAbstractTransition* t2 = s2->addTransition(s0);
+ t2->addAnimation(yRotationAnim);
+
+ machine->setInitialState(s0);
+ machine->start();
+#endif
}
void WebViewGraphicsBased::resizeEvent(QResizeEvent* event)
@@ -83,6 +106,30 @@ void WebViewGraphicsBased::updateFrameRate()
m_numPaintsSinceLastMeasure = 0;
}
+void WebViewGraphicsBased::animatedFlip()
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QSizeF center = m_item->boundingRect().size() / 2;
+ QPointF centerPoint = QPointF(center.width(), center.height());
+ m_item->setTransformOriginPoint(centerPoint);
+
+ QPropertyAnimation* animation = new QPropertyAnimation(m_item, "rotation", this);
+ animation->setDuration(1000);
+
+ int rotation = int(m_item->rotation());
+
+ animation->setStartValue(rotation);
+ animation->setEndValue(rotation + 180 - (rotation % 180));
+
+ animation->start(QAbstractAnimation::DeleteWhenStopped);
+#endif
+}
+
+void WebViewGraphicsBased::animatedYFlip()
+{
+ emit yFlipRequest();
+}
+
void WebViewGraphicsBased::paintEvent(QPaintEvent* event)
{
QGraphicsView::paintEvent(event);