diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-12-02 06:59:13 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-12-02 06:59:13 (GMT) |
commit | 4c8fdfca8b31916f9a130c163914ded7eb391807 (patch) | |
tree | 7e735516cbdcbd9181ce9c778c1f563afca74e06 | |
parent | 37b4fd7b6615b5e73b0fb71d56df98302ec90de3 (diff) | |
download | Qt-4c8fdfca8b31916f9a130c163914ded7eb391807.zip Qt-4c8fdfca8b31916f9a130c163914ded7eb391807.tar.gz Qt-4c8fdfca8b31916f9a130c163914ded7eb391807.tar.bz2 |
Fix initial scaling. QWebPage::setPreferredSize doesn't really work.
-rw-r--r-- | demos/declarative/webbrowser/content/FlickableWebView.qml | 6 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicswebview.cpp | 6 |
2 files changed, 3 insertions, 9 deletions
diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index 09a3c04..7c46d4c 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -67,12 +67,12 @@ Flickable { Keys.onLeftPressed: webView.contentsScale -= 0.1 Keys.onRightPressed: webView.contentsScale += 0.1 - preferredWidth: flickable.width - preferredHeight: flickable.height + preferredWidth: flickable.width*zoomFactor + preferredHeight: flickable.height*zoomFactor contentsScale: 1/zoomFactor onContentsSizeChanged: { // zoom out - contentsScale = flickable.width / contentsSize.width + contentsScale = Math.min(0.25,flickable.width / contentsSize.width) } onUrlChanged: { // got to topleft diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index c9ba37b..35dd1f0 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -317,8 +317,6 @@ void QmlGraphicsWebView::setUrl(const QUrl &url) page()->setViewportSize(QSize( d->preferredwidth>0 ? d->preferredwidth : width(), d->preferredheight>0 ? d->preferredheight : height())); - if (d->preferredwidth > 0 && d->preferredheight > 0) - page()->setPreferredContentsSize(QSize(d->preferredwidth,d->preferredheight)); QUrl seturl = url; if (seturl.isEmpty()) seturl = QUrl(QLatin1String("about:blank")); @@ -349,8 +347,6 @@ void QmlGraphicsWebView::setPreferredWidth(int iw) Q_D(QmlGraphicsWebView); if (d->preferredwidth == iw) return; d->preferredwidth = iw; - if (d->preferredwidth > 0 && d->preferredheight > 0) - page()->setPreferredContentsSize(QSize(d->preferredwidth,d->preferredheight)); //expandToWebPage(); emit preferredWidthChanged(); } @@ -370,8 +366,6 @@ void QmlGraphicsWebView::setPreferredHeight(int ih) Q_D(QmlGraphicsWebView); if (d->preferredheight == ih) return; d->preferredheight = ih; - if (d->preferredwidth > 0 && d->preferredheight > 0) - page()->setPreferredContentsSize(QSize(d->preferredwidth,d->preferredheight)); emit preferredHeightChanged(); } |