diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-11-25 18:20:45 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-11-25 18:20:45 (GMT) |
commit | e58b7f0cc139c5fda3d472c38161be8fb718db7d (patch) | |
tree | 3c20cccfe050d125a5f4736ba11b6383e8734be4 /examples/webkit | |
parent | c2a4a1b1e06f8b0d02e7b56c9eb0c19fd2fae80a (diff) | |
parent | 4c3539dfbc65d5decdd842d4181f9aa3d38d213c (diff) | |
download | Qt-e58b7f0cc139c5fda3d472c38161be8fb718db7d.zip Qt-e58b7f0cc139c5fda3d472c38161be8fb718db7d.tar.gz Qt-e58b7f0cc139c5fda3d472c38161be8fb718db7d.tar.bz2 |
Merge branch '4.6'
Conflicts:
doc/src/modules.qdoc
examples/assistant/simpletextviewer/findfiledialog.cpp
examples/webkit/fancybrowser/mainwindow.cpp
src/gui/widgets/qtabbar.cpp
src/gui/widgets/qtabbar_p.h
tests/auto/qpixmap/tst_qpixmap.cpp
tools/assistant/compat/helpdialog.cpp
tools/assistant/compat/tabbedbrowser.cpp
translations/translations.pri
Diffstat (limited to 'examples/webkit')
-rw-r--r-- | examples/webkit/domtraversal/domtraversal.pro | 2 | ||||
-rw-r--r-- | examples/webkit/domtraversal/window.h | 2 | ||||
-rw-r--r-- | examples/webkit/fancybrowser/mainwindow.cpp | 12 | ||||
-rw-r--r-- | examples/webkit/fancybrowser/mainwindow.h | 3 | ||||
-rw-r--r-- | examples/webkit/formextractor/formextractor.pro | 2 | ||||
-rw-r--r-- | examples/webkit/framecapture/framecapture.cpp | 40 | ||||
-rw-r--r-- | examples/webkit/framecapture/framecapture.h | 2 | ||||
-rw-r--r-- | examples/webkit/framecapture/main.cpp | 2 |
8 files changed, 32 insertions, 33 deletions
diff --git a/examples/webkit/domtraversal/domtraversal.pro b/examples/webkit/domtraversal/domtraversal.pro index dda63ba..49400de 100644 --- a/examples/webkit/domtraversal/domtraversal.pro +++ b/examples/webkit/domtraversal/domtraversal.pro @@ -1,4 +1,4 @@ -QT += webkit +QT += webkit network FORMS = window.ui HEADERS = window.h SOURCES = main.cpp \ diff --git a/examples/webkit/domtraversal/window.h b/examples/webkit/domtraversal/window.h index 5988df9..2795976 100644 --- a/examples/webkit/domtraversal/window.h +++ b/examples/webkit/domtraversal/window.h @@ -46,7 +46,9 @@ #include <QUrl> #include <QWebElement> +QT_BEGIN_NAMESPACE class QTreeWidgetItem; +QT_END_NAMESPACE //! [Window class definition] #include "ui_window.h" diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index 234afba..cfc5500 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -62,7 +62,7 @@ MainWindow::MainWindow(const QUrl& url) view = new QWebView(this); view->load(url); connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); - connect(view, SIGNAL(titleChanged(const QString&)), SLOT(adjustTitle())); + connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle())); connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool))); @@ -87,7 +87,7 @@ MainWindow::MainWindow(const QUrl& url) 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")); @@ -158,8 +158,8 @@ void MainWindow::finishLoading(bool) progress = 100; adjustTitle(); view->page()->mainFrame()->evaluateJavaScript(jQuery); - // Enable this to see the dump of the internal render tree - //qDebug() << view->page()->mainFrame()->renderTreeDump(); + + rotateImages(rotateAction->isChecked()); } //! [6] @@ -172,10 +172,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 be95614..3afd0be 100644 --- a/examples/webkit/fancybrowser/mainwindow.h +++ b/examples/webkit/fancybrowser/mainwindow.h @@ -66,7 +66,7 @@ protected slots: void slotSourceDownloaded(); void highlightAllLinks(); - void rotateImages(bool toggle); + void rotateImages(bool invert); void removeGifImages(); void removeInlineFrames(); void removeObjectElements(); @@ -76,6 +76,7 @@ private: QString jQuery; QWebView *view; QLineEdit *locationEdit; + QAction *rotateAction; int progress; //! [1] }; diff --git a/examples/webkit/formextractor/formextractor.pro b/examples/webkit/formextractor/formextractor.pro index 4364b4c..51e0c45 100644 --- a/examples/webkit/formextractor/formextractor.pro +++ b/examples/webkit/formextractor/formextractor.pro @@ -1,5 +1,5 @@ QT += webkit network -TARGET = formExtractor +TARGET = formextractor TEMPLATE = app SOURCES += main.cpp \ formextractor.cpp \ diff --git a/examples/webkit/framecapture/framecapture.cpp b/examples/webkit/framecapture/framecapture.cpp index 2c2e11b..ef49e93 100644 --- a/examples/webkit/framecapture/framecapture.cpp +++ b/examples/webkit/framecapture/framecapture.cpp @@ -59,6 +59,7 @@ void FrameCapture::load(const QUrl &url, const QString &outputFileName) m_page.mainFrame()->load(url); m_page.mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); m_page.mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); + m_page.setViewportSize(QSize(1024, 768)); } void FrameCapture::printProgress(int percent) @@ -81,41 +82,36 @@ void FrameCapture::saveResult(bool ok) return; } - // save each internal frame in different image files - int frameCounter = 0; - foreach(QWebFrame *frame, m_page.mainFrame()->childFrames()) { - QString fileName(m_fileName); - int index = m_fileName.lastIndexOf('.'); - fileName = fileName.insert(index, "_frame" + QString::number(++frameCounter)); + // save each frame in different image files + saveFrame(m_page.mainFrame()); - frame->setClipRenderToViewport(false); + emit finished(); +} - QImage image(frame->contentsSize(), QImage::Format_ARGB32_Premultiplied); - image.fill(Qt::transparent); +void FrameCapture::saveFrame(QWebFrame *frame) +{ + static int frameCounter = 0; - saveFrame(frame, image, fileName); + QString fileName(m_fileName); + if (frameCounter) { + int index = m_fileName.lastIndexOf('.'); + fileName = fileName.insert(index, "_frame" + QString::number(frameCounter)); } - // save the main frame - m_page.setViewportSize(m_page.mainFrame()->contentsSize()); - QImage image(m_page.mainFrame()->contentsSize(), QImage::Format_ARGB32_Premultiplied); + QImage image(frame->contentsSize(), QImage::Format_ARGB32_Premultiplied); image.fill(Qt::transparent); - saveFrame(m_page.mainFrame(), image, m_fileName); - - emit finished(); -} -void FrameCapture::saveFrame(QWebFrame *frame, QImage image, QString fileName) -{ QPainter painter(&image); painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::TextAntialiasing, true); painter.setRenderHint(QPainter::SmoothPixmapTransform, true); - - frame->render(&painter); - + frame->documentElement().render(&painter); painter.end(); image.save(fileName); + + ++frameCounter; + foreach(QWebFrame *childFrame, frame->childFrames()) + saveFrame(childFrame); } diff --git a/examples/webkit/framecapture/framecapture.h b/examples/webkit/framecapture/framecapture.h index 9de9c43..7a6d5f3 100644 --- a/examples/webkit/framecapture/framecapture.h +++ b/examples/webkit/framecapture/framecapture.h @@ -64,7 +64,7 @@ private: QString m_fileName; int m_percent; - void saveFrame(QWebFrame *frame, QImage image, QString fileName); + void saveFrame(QWebFrame *frame); }; #endif diff --git a/examples/webkit/framecapture/main.cpp b/examples/webkit/framecapture/main.cpp index 050947a..65c0026 100644 --- a/examples/webkit/framecapture/main.cpp +++ b/examples/webkit/framecapture/main.cpp @@ -63,7 +63,7 @@ int main(int argc, char * argv[]) return 0; } - QUrl url = QWebView::guessUrlFromString(QString::fromLatin1(argv[1])); + QUrl url = QUrl::fromUserInput(QString::fromLatin1(argv[1])); QString fileName = QString::fromLatin1(argv[2]); QApplication a(argc, argv); |