Commit f745bdba authored by kenneth@webkit.org's avatar kenneth@webkit.org

Add a "Flip effect" to our GraphicsView based launcher.

Patch by Kenneth Rohde Christiansen <kenneth@webkit.org> on 2009-09-16
Reviewed by Simon Hausmann.

* QGVLauncher/main.cpp:
(MainView::resizeEvent):
(MainView::flip):
(MainWindow::flip):
(MainWindow::buildUI):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48416 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0efc226f
2009-09-16 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Add a "Flip effect" to our GraphicsView based launcher.
* QGVLauncher/main.cpp:
(MainView::resizeEvent):
(MainView::flip):
(MainWindow::flip):
(MainWindow::buildUI):
2009-09-16 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
Rubber-stamped by Simon Hausmann.
......
......@@ -83,12 +83,22 @@ public:
void resizeEvent(QResizeEvent* event)
{
QGraphicsView::resizeEvent(event);
QRectF rect(QRect(QPoint(0, 0), event->size()));
if (!m_mainWidget)
return;
QRectF rect(QPoint(0, 0), event->size());
m_mainWidget->setGeometry(rect);
}
public slots:
void flip()
{
QSizeF center = m_mainWidget->boundingRect().size() / 2;
QPointF centerPoint = QPointF(center.width(), center.height());
m_mainWidget->setTransformOriginPoint(centerPoint);
m_mainWidget->setRotation(m_mainWidget->rotation() ? 0 : 180);
}
private:
QGraphicsWidget* m_mainWidget;
};
......@@ -218,6 +228,11 @@ public slots:
mw->show();
}
void flip()
{
view->flip();
}
private:
void buildUI()
{
......@@ -234,13 +249,16 @@ private:
bar->addWidget(urlEdit);
QMenu* fileMenu = menuBar()->addMenu("&File");
QAction* newWindow = fileMenu->addAction("New Window", this, SLOT(newWindow()));
QAction* cloneView = fileMenu->addAction("Clone view", this, SLOT(clone()));
fileMenu->addAction("New Window", this, SLOT(newWindow()));
fileMenu->addAction("Clone view", this, SLOT(clone()));
fileMenu->addAction("Close", this, SLOT(close()));
QMenu* viewMenu = menuBar()->addMenu("&View");
viewMenu->addAction(page->action(QWebPage::Stop));
viewMenu->addAction(page->action(QWebPage::Reload));
QMenu* fxMenu = menuBar()->addMenu("&Effects");
fxMenu->addAction("Flip", this, SLOT(flip()));
}
private:
......
Markdown is supported
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