diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-11-17 12:14:49 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-11-19 15:48:23 (GMT) |
commit | e5dcb042d6e803daa38a04ecadb71ce42187194a (patch) | |
tree | c1bdfcbea382c46bb96343de9119670b6a8e129d /examples | |
parent | 1a3f6c9d613bde07345a416b5efc39913d285acd (diff) | |
download | Qt-e5dcb042d6e803daa38a04ecadb71ce42187194a.zip Qt-e5dcb042d6e803daa38a04ecadb71ce42187194a.tar.gz Qt-e5dcb042d6e803daa38a04ecadb71ce42187194a.tar.bz2 |
fancybrowser example: make sure that images are rotated for loaded pages
See QTBUG-5532.
Reviewed-by: Jedrzej Nowacki
(cherry picked from commit 9f5dea393da4428685f1a1fd26b0e27f90dca340)
Diffstat (limited to 'examples')
-rw-r--r-- | examples/webkit/fancybrowser/mainwindow.cpp | 8 | ||||
-rw-r--r-- | examples/webkit/fancybrowser/mainwindow.h | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index 3884fef..91fb522 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -82,7 +82,7 @@ MainWindow::MainWindow() QMenu *effectMenu = menuBar()->addMenu(tr("&Effect")); effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks())); - QAction *rotateAction = new QAction(this); + rotateAction = new QAction(this); rotateAction->setIcon(style()->standardIcon(QStyle::SP_FileDialogDetailedView)); rotateAction->setCheckable(true); rotateAction->setText(tr("Turn images upside down")); @@ -136,6 +136,8 @@ void MainWindow::finishLoading(bool) progress = 100; adjustTitle(); view->page()->mainFrame()->evaluateJavaScript(jQuery); + + rotateImages(rotateAction->isChecked()); } //! [6] @@ -148,10 +150,10 @@ void MainWindow::highlightAllLinks() //! [7] //! [8] -void MainWindow::rotateImages(bool toggle) +void MainWindow::rotateImages(bool invert) { QString code; - if (toggle) + if (invert) code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s'); $(this).css('-webkit-transform', 'rotate(180deg)') } )"; else code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s'); $(this).css('-webkit-transform', 'rotate(0deg)') } )"; diff --git a/examples/webkit/fancybrowser/mainwindow.h b/examples/webkit/fancybrowser/mainwindow.h index a6152ff..b93be4b 100644 --- a/examples/webkit/fancybrowser/mainwindow.h +++ b/examples/webkit/fancybrowser/mainwindow.h @@ -63,7 +63,7 @@ protected slots: void finishLoading(bool); void highlightAllLinks(); - void rotateImages(bool toggle); + void rotateImages(bool invert); void removeGifImages(); void removeInlineFrames(); void removeObjectElements(); @@ -73,6 +73,7 @@ private: QString jQuery; QWebView *view; QLineEdit *locationEdit; + QAction *rotateAction; int progress; //! [1] }; |