Permalink
Browse files

Use QGraphicsWebView instead of QWebView

As suggested by http://trac.webkit.org/wiki/QtWebKitTiling

Works on Qt 4.6 and up.
  • Loading branch information...
aportale committed Nov 6, 2010
1 parent e8e6439 commit cda3a60c37023a27b87e9824c1edd0156a7ddd86
Showing with 20 additions and 8 deletions.
  1. +20 −8 webkit/senchatouchqtwebkit/main.cpp
@@ -1,6 +1,5 @@
-#include <QtGui/QApplication>
-#include <QtCore/QProcess>
-#include <QtWebKit/QWebView>
+#include <QtGui>
+#include <QtWebKit>
#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK)
#include <eikenv.h>
@@ -23,15 +22,28 @@ int main(int argc, char *argv[])
Q_UNUSED(error)
#endif // ORIENTATIONLOCK
- QWebView webView;
- webView.load(QString::fromLatin1("html/examples/kitchensink/index.html"));
+ const QSize screenSize(640, 360);
+
+ QGraphicsScene scene;
+
+ QGraphicsView view(&scene);
+ view.setFrameShape(QFrame::NoFrame);
+ view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ QGraphicsWebView webview;
+ webview.resize(screenSize);
+ webview.load(QString::fromLatin1("html/examples/kitchensink/index.html"));
+
+ scene.addItem(&webview);
#if defined(Q_OS_SYMBIAN)
- webView.showFullScreen();
+ view.showFullScreen();
#elif defined(Q_WS_MAEMO_5)
- webView.showMaximized();
+ view.showMaximized();
#else
- webView.show();
+ view.resize(screenSize);
+ view.show();
#endif
return app.exec();

0 comments on commit cda3a60

Please sign in to comment.