summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-02-26 01:54:04 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-02-26 04:15:47 (GMT)
commit93b02976b7c9c3a36cac475c1935622ebc2f1fe1 (patch)
tree7c409125557585a15aa43fa9ce6badbb1bd7baaa
parent46340f1c5f8765276701a2831d6efd45607d8ff5 (diff)
downloadQt-93b02976b7c9c3a36cac475c1935622ebc2f1fe1.zip
Qt-93b02976b7c9c3a36cac475c1935622ebc2f1fe1.tar.gz
Qt-93b02976b7c9c3a36cac475c1935622ebc2f1fe1.tar.bz2
Test, demo, and work-around bug QTBUG-8535
-rw-r--r--demos/declarative/webbrowser/content/FlickableWebView.qml1
-rw-r--r--demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml45
-rw-r--r--src/declarative/graphicsitems/qdeclarativewebview.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativewebview/data/forward.html2
-rw-r--r--tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp2
5 files changed, 34 insertions, 19 deletions
diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml
index e686d02..76a5813 100644
--- a/demos/declarative/webbrowser/content/FlickableWebView.qml
+++ b/demos/declarative/webbrowser/content/FlickableWebView.qml
@@ -2,6 +2,7 @@ import Qt 4.6
Flickable {
property alias title: webView.title
+ property alias icon: webView.icon
property alias progress: webView.progress
property alias url: webView.url
property alias back: webView.back
diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml
index e8c9208..94c94f2 100644
--- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml
+++ b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml
@@ -13,31 +13,40 @@ Image {
? -webView.contentX+webView.contentWidth-webView.width : 0
y: webView.contentY < 0 ? -webView.contentY : progressOff*
(webView.contentY>height?-height:-webView.contentY)
- Text {
- id: headerText
+ Row {
+ id: headerTitle
- text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...'
- elide: Text.ElideRight
+ anchors.top: header.top
+ anchors.topMargin: 4
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 6
- color: "white"
- styleColor: "black"
- style: Text.Raised
+ Image {
+ id: headerIcon
+ pixmap: webView.icon
+ }
- font.family: "Helvetica"
- font.pointSize: 10
- font.bold: true
+ Text {
+ id: headerText
- anchors.left: header.left
- anchors.right: header.right
- anchors.leftMargin: 4
- anchors.rightMargin: 4
- anchors.top: header.top
- anchors.topMargin: 4
- horizontalAlignment: Text.AlignHCenter
+ text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...'
+ elide: Text.ElideRight
+ //width: parent.width - headerIcon.width-4
+
+ color: "white"
+ styleColor: "black"
+ style: Text.Raised
+
+ font.family: "Helvetica"
+ font.pointSize: 10
+ font.bold: true
+
+ horizontalAlignment: Text.AlignHCenter
+ }
}
Item {
width: parent.width
- anchors.top: headerText.bottom
+ anchors.top: headerTitle.bottom
anchors.topMargin: 2
anchors.bottom: parent.bottom
diff --git a/src/declarative/graphicsitems/qdeclarativewebview.cpp b/src/declarative/graphicsitems/qdeclarativewebview.cpp
index 61b5b56..a2b16ba 100644
--- a/src/declarative/graphicsitems/qdeclarativewebview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativewebview.cpp
@@ -177,6 +177,8 @@ void QDeclarativeWebView::init()
{
Q_D(QDeclarativeWebView);
+ QWebSettings::enablePersistentStorage();
+
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::LeftButton);
setFlag(QGraphicsItem::ItemHasNoContents, false);
@@ -955,6 +957,7 @@ void QDeclarativeWebView::setPage(QWebPage *page)
connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect)));
connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SLOT(pageUrlChanged()));
connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
+ connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(iconChanged()));
connect(d->page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged()));
connect(d->page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(noteContentsSizeChanged(QSize)));
connect(d->page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout()));
diff --git a/tests/auto/declarative/qdeclarativewebview/data/forward.html b/tests/auto/declarative/qdeclarativewebview/data/forward.html
index 030446a..62ab62d 100644
--- a/tests/auto/declarative/qdeclarativewebview/data/forward.html
+++ b/tests/auto/declarative/qdeclarativewebview/data/forward.html
@@ -1,6 +1,6 @@
<html>
<head><title>Forward</title>
-<link rel="icon" sizes="48x48" href="basic.png">
+<link rel="icon" sizes="32x32" href="forward.png">
</head>
<body leftmargin="0" marginwidth="0">
<table width="123">
diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
index 2634825..6d16056 100644
--- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
+++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
@@ -277,6 +277,8 @@ void tst_qdeclarativewebview::historyNav()
wv->setUrl(QUrl::fromLocalFile(SRCDIR "/data/forward.html"));
QTRY_COMPARE(wv->progress(), 1.0);
QCOMPARE(wv->title(),QString("Forward"));
+ QTRY_COMPARE(wv->icon().width(), 32);
+ QCOMPARE(wv->icon(),QPixmap(SRCDIR "/data/forward.png"));
QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/forward.html")), strippedHtml(wv->html()));
QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/forward.html"));
QCOMPARE(wv->status(), QDeclarativeWebView::Ready);