qtwebkit_goes_mobile_snippets.cpp [plain text]
#if 0
int main(int argc, char **argv)
{
QApplication app(argc, argv);
const int width = 640;
const int height = 480;
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setFrameShape(QFrame::NoFrame);
view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
QGraphicsWebView webview;
webview.resize(width, height);
webview.load(QUrl("http://doc.qt.nokia.com/"));
scene.addItem(&webview);
view.resize(width, height);
view.show();
return app.exec();
}
webview.setResizesToContents(true);
class MobileWebView : public QGraphicsWidget {
Q_OBJECT
public:
MobileWebView(QGraphicsItem *parent = 0);
~MobileWebView();
bool mousePress(const QPoint &value);
void mouseMove(const QPoint &value);
void mouseRelease(const QPoint &value);
private:
QGraphicsWebView* webView;
};
webview.page()->setPreferredContentsSize(QSize(desiredWidth, desiredHeight));
QWebSettings::globalSettings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
QWebSettings::globalSettings()->setAttribute(QWebSettings::FrameFlatteningEnable, true);
#endif