diff options
author | Tapani Mikola <tapani.mikola@nokia.com> | 2009-08-05 08:51:18 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-08-13 05:19:26 (GMT) |
commit | 54b28d3db32fdda768ec0561a5694c8fcd07685f (patch) | |
tree | f247513a22b83c6da375a500f05e6978c06e7f3b /demos/declarative/webbrowser/webbrowser.qml | |
parent | 8a27eaaa9ca35e1a7ad3ac92c75b6541b7c9db00 (diff) | |
download | Qt-54b28d3db32fdda768ec0561a5694c8fcd07685f.zip Qt-54b28d3db32fdda768ec0561a5694c8fcd07685f.tar.gz Qt-54b28d3db32fdda768ec0561a5694c8fcd07685f.tar.bz2 |
Made the url input text field to work with the FieldText component copied and slightly modified from contacts demo.
Diffstat (limited to 'demos/declarative/webbrowser/webbrowser.qml')
-rw-r--r-- | demos/declarative/webbrowser/webbrowser.qml | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 7a7d9e2..9943011 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -1,11 +1,12 @@ import Qt 4.6 import "content" +import "fieldtext" Item { id: WebBrowser - property var url : "http://www.qtsoftware.com" + property string url : "http://www.qtsoftware.com/" width: 640 height: 480 @@ -57,6 +58,13 @@ Item { height: 60 z: 1 + Rect { + id: HeaderSpaceTint + color: "black" + opacity: 0 + anchors.fill: parent + } + Image { id: Header source: "content/pics/header.png" @@ -104,10 +112,13 @@ Item { anchors.rightMargin: 12 anchors.top: parent.top clip: true + property bool mouseGrabbed: false + Image { source: "content/pics/addressbar.sci" anchors.fill: UrlBox } + Image { id: UrlBoxhl source: "content/pics/addressbar-filled.sci" @@ -116,27 +127,23 @@ Item { opacity: 1-Header.progressOff clip: true } - - /* - KeyProxy { - id: proxy - anchors.left: UrlBox.left - anchors.fill: UrlBox - targets: [keyActions,EditUrl] - } - KeyActions { - id: keyActions - keyReturn: "WebBrowser.url = EditUrl.text; proxy.focus=false;" - } - */ - TextEdit { + + FieldText { id: EditUrl + mouseGrabbed: parent.mouseGrabbed + /*<<<<<<< HEAD:demos/declarative/webbrowser/webbrowser.qml text: MyWebView.url == '' ? ' ' : MyWebView.url wrap: false font.size: 11 color: "#555555" focusOnPress: true + =======*/ + text: WebBrowser.url + label: "url:" + onConfirmed: { print ('OnConfirmed: '+EditUrl.text); WebBrowser.url = EditUrl.text; print (EditUrl.text); MyWebView.focus=true } + onCancelled: { MyWebView.focus=true } + onStartEdit: { print (EditUrl.text); MyWebView.focus=false } anchors.left: UrlBox.left anchors.right: UrlBox.right @@ -198,7 +205,7 @@ Item { idealHeight: Flick.height/scale scale: (width > 0) ? Flick.width/width*zoomedOut+(1-zoomedOut) : 1 - onUrlChanged: { Flick.xPosition=0; Flick.yPosition=0; zoomOut() } + onUrlChanged: { print ('OnUrlChanged: '+url); WebBrowser.url = url.toString(); print ('Moved to url: ' + WebBrowser.url) } onDoubleClick: { toggleZoom() } property real zoomedOut : 1 @@ -208,10 +215,10 @@ Item { color: "black" opacity: 0 anchors.fill: MyWebView - MouseRegion { + /*MouseRegion { anchors.fill: WebViewTint onClicked: { proxy.focus=false } - } + }*/ } } Image { |