summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-25 10:51:25 +0100
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-25 10:51:25 +0100
commit447576ef99f57c6a03850a7ed5bf598f33a64802 (patch)
tree8b4c690034e6ae78479b94f19bce62a98aabc418 /examples
parentd51c590b8443d5d6dadf76a678439c990213d848 (diff)
parentb2a87b03bdad9f3f038ce6d19db71eb6074842e2 (diff)
downloadqt4-tools-447576ef99f57c6a03850a7ed5bf598f33a64802.tar.gz
Merge remote branch 'mainline/4.6' into 4.6
Diffstat (limited to 'examples')
-rw-r--r--examples/itemviews/frozencolumn/freezetablewidget.cpp9
-rw-r--r--examples/itemviews/frozencolumn/freezetablewidget.h1
-rw-r--r--examples/itemviews/frozencolumn/grades.txt3
-rw-r--r--examples/webkit/domtraversal/window.h2
-rw-r--r--examples/webkit/framecapture/framecapture.cpp40
-rw-r--r--examples/webkit/framecapture/framecapture.h2
-rw-r--r--examples/webkit/framecapture/main.cpp2
7 files changed, 33 insertions, 26 deletions
diff --git a/examples/itemviews/frozencolumn/freezetablewidget.cpp b/examples/itemviews/frozencolumn/freezetablewidget.cpp
index ee50ae189b..72dc2a1d10 100644
--- a/examples/itemviews/frozencolumn/freezetablewidget.cpp
+++ b/examples/itemviews/frozencolumn/freezetablewidget.cpp
@@ -84,7 +84,8 @@ void FreezeTableWidget::init()
//! [init part2]
frozenTableView->setStyleSheet("QTableView { border: none;"
- "background-color: #8EDE21;}"); //for demo purposes
+ "background-color: #8EDE21;"
+ "selection-background-color: #999}"); //for demo purposes
frozenTableView->setSelectionModel(selectionModel());
for(int col=1; col<model()->columnCount(); col++)
frozenTableView->setColumnHidden(col, true);
@@ -146,6 +147,12 @@ QModelIndex FreezeTableWidget::moveCursor(CursorAction cursorAction,
}
//! [navigate]
+void FreezeTableWidget::scrollTo (const QModelIndex & index, ScrollHint hint){
+ if(index.column()>0)
+ QTableView::scrollTo(index, hint);
+}
+
+
//! [geometry]
void FreezeTableWidget::updateFrozenTableGeometry()
diff --git a/examples/itemviews/frozencolumn/freezetablewidget.h b/examples/itemviews/frozencolumn/freezetablewidget.h
index 403890fb34..d236d40a0e 100644
--- a/examples/itemviews/frozencolumn/freezetablewidget.h
+++ b/examples/itemviews/frozencolumn/freezetablewidget.h
@@ -56,6 +56,7 @@ public:
protected:
virtual void resizeEvent(QResizeEvent *event);
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
+ void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible);
private:
QTableView *frozenTableView;
diff --git a/examples/itemviews/frozencolumn/grades.txt b/examples/itemviews/frozencolumn/grades.txt
index 4b55b47348..e1c6fcc49e 100644
--- a/examples/itemviews/frozencolumn/grades.txt
+++ b/examples/itemviews/frozencolumn/grades.txt
@@ -32,4 +32,5 @@
9a+ , , 5.15a , , , XI+ , , , , 12a
9b , , 5.15b , , , , , , , 12b
-# Wikipedia contributors. Grade (climbing). Wikipedia, The Free Encyclopedia. May 15, 2009, 20:42 UTC. Available at: http://en.wikipedia.org/w/index.php?title=Grade_(climbing)&oldid=290165724. Accessed May 28, 2009.
+# Wikipedia contributors. Grade (climbing). Wikipedia, The Free Encyclopedia. May 15, 2009, 20:42 UTC.
+# Available at: http://en.wikipedia.org/w/index.php?title=Grade_(climbing)&oldid=290165724. Accessed May 28, 2009.
diff --git a/examples/webkit/domtraversal/window.h b/examples/webkit/domtraversal/window.h
index 5988df9cbb..2795976ad3 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/framecapture/framecapture.cpp b/examples/webkit/framecapture/framecapture.cpp
index 2c2e11b506..ef49e9365c 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 9de9c4301a..7a6d5f32e9 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 050947ae60..65c002634c 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);