diff options
Diffstat (limited to 'demos/declarative')
-rw-r--r-- | demos/declarative/flickr/common/ImageDetails.qml | 16 | ||||
-rw-r--r-- | demos/declarative/flickr/flickr-desktop.qml | 6 | ||||
-rw-r--r-- | demos/declarative/flickr/flickr-mobile-90.qml | 1 | ||||
-rw-r--r-- | demos/declarative/flickr/flickr-mobile.qml | 6 | ||||
-rw-r--r-- | demos/declarative/flickr/mobile/GridDelegate.qml | 6 | ||||
-rw-r--r-- | demos/declarative/flickr/mobile/ImageDetails.qml | 10 | ||||
-rw-r--r-- | demos/declarative/webbrowser/content/FlickableWebView.qml | 23 | ||||
-rw-r--r-- | demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml | 57 | ||||
-rw-r--r-- | demos/declarative/webbrowser/webbrowser.qml | 8 |
9 files changed, 71 insertions, 62 deletions
diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml index ab94d7a..9604f10 100644 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ b/demos/declarative/flickr/common/ImageDetails.qml @@ -50,7 +50,7 @@ Flipable { LikeOMeter { x: 40; y: 250; rating: container.rating } Flickable { id: flickable; x: 220; width: 480; height: 210; y: 130; clip: true - viewportWidth: 480; viewportHeight: descriptionText.height + contentWidth: 480; contentHeight: descriptionText.height WebView { id: descriptionText; width: parent.width html: "<style TYPE=\"text/css\">body {color: white;} a:link {color: cyan; text-decoration: underline; }</style>" + container.photoDescription } @@ -84,7 +84,7 @@ Flipable { Flickable { id: flick; width: container.width - 10; height: container.height - 10 x: 5; y: 5; clip: true; - viewportWidth: imageContainer.width; viewportHeight: imageContainer.height + contentWidth: imageContainer.width; contentHeight: imageContainer.height Item { id: imageContainer @@ -93,9 +93,7 @@ Flipable { Image { id: bigImage; source: container.photoUrl; scale: slider.value - // Center image if it is smaller than the flickable area. - x: imageContainer.width > width*scale ? (imageContainer.width - width*scale) / 2 : 0 - y: imageContainer.height > height*scale ? (imageContainer.height - height*scale) / 2 : 0 + anchors.centerIn: parent; smooth: !flick.moving onStatusChanged : { // Default scale shows the entire image. @@ -122,12 +120,12 @@ Flipable { id: slider; x: 25; y: 374; visible: { bigImage.status == 1 && maximum > minimum } onValueChanged: { if (bigImage.width * value > flick.width) { - var xoff = (flick.width/2 + flick.viewportX) * value / prevScale; - flick.viewportX = xoff - flick.width/2; + var xoff = (flick.width/2 + flick.contentX) * value / prevScale; + flick.contentX = xoff - flick.width/2; } if (bigImage.height * value > flick.height) { - var yoff = (flick.height/2 + flick.viewportY) * value / prevScale; - flick.viewportY = yoff - flick.height/2; + var yoff = (flick.height/2 + flick.contentY) * value / prevScale; + flick.contentY = yoff - flick.height/2; } prevScale = value; } diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml index 3a86347..99216cb 100644 --- a/demos/declarative/flickr/flickr-desktop.qml +++ b/demos/declarative/flickr/flickr-desktop.qml @@ -21,9 +21,9 @@ Item { angle: wrapper.PathView.angle ? wrapper.PathView.angle : 0 } - Connection { - sender: imageDetails; signal: "closed()" - script: { + Connections { + target: imageDetails + onClosed: { if (wrapper.state == 'Details') { wrapper.state = ''; imageDetails.photoUrl = ""; diff --git a/demos/declarative/flickr/flickr-mobile-90.qml b/demos/declarative/flickr/flickr-mobile-90.qml index 259ff10..9fec242 100644 --- a/demos/declarative/flickr/flickr-mobile-90.qml +++ b/demos/declarative/flickr/flickr-mobile-90.qml @@ -5,6 +5,7 @@ Item { Loader { y: 320; rotation: -90 + transformOrigin: Item.TopLeft source: "flickr-mobile.qml" } } diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml index 77ccd08..21e4c49 100644 --- a/demos/declarative/flickr/flickr-mobile.qml +++ b/demos/declarative/flickr/flickr-mobile.qml @@ -53,9 +53,9 @@ Item { onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true } - Connection { - sender: imageDetails; signal: "closed()" - script: { + Connections { + target: imageDetails + onClosed: { if (background.state == "DetailedView") { background.state = ''; imageDetails.photoUrl = ""; diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index 5722f10..7634573 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -33,9 +33,9 @@ Image { source: "images/gloss.png" } } - Connection { - sender: toolBar; signal: "button2Clicked()" - script: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show'; + Connections { + target: toolBar + onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show' } states: [ diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 415764e..8749b4c 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -57,7 +57,7 @@ Flipable { Common.Progress { anchors.centerIn: parent; width: 200; height: 18; progress: bigImage.progress; visible: bigImage.status!=1 } Flickable { id: flickable; anchors.fill: parent; clip: true - viewportWidth: imageContainer.width; viewportHeight: imageContainer.height + contentWidth: imageContainer.width; contentHeight: imageContainer.height Item { id: imageContainer @@ -97,12 +97,12 @@ Flipable { } onValueChanged: { if (bigImage.width * value > flickable.width) { - var xoff = (flickable.width/2 + flickable.viewportX) * value / prevScale; - flickable.viewportX = xoff - flickable.width/2; + var xoff = (flickable.width/2 + flickable.contentX) * value / prevScale; + flickable.contentX = xoff - flickable.width/2; } if (bigImage.height * value > flickable.height) { - var yoff = (flickable.height/2 + flickable.viewportY) * value / prevScale; - flickable.viewportY = yoff - flickable.height/2; + var yoff = (flickable.height/2 + flickable.contentY) * value / prevScale; + flickable.contentY = yoff - flickable.height/2; } prevScale = value; } diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index b60a95f..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 @@ -10,8 +11,8 @@ Flickable { id: flickable width: parent.width - viewportWidth: Math.max(parent.width,webView.width*webView.scale) - viewportHeight: Math.max(parent.height,webView.height*webView.scale) + contentWidth: Math.max(parent.width,webView.width*webView.scale) + contentHeight: Math.max(parent.height,webView.height*webView.scale) anchors.top: headerSpace.bottom anchors.bottom: footer.top anchors.left: parent.left @@ -53,10 +54,10 @@ Flickable { if (centerX) { var sc = zoom/contentsScale; scaleAnim.to = sc; - flickVX.from = flickable.viewportX + flickVX.from = flickable.contentX flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width)) finalX.value = flickVX.to - flickVY.from = flickable.viewportY + flickVY.from = flickable.contentY flickVY.to = Math.max(0,Math.min(centerY-flickable.height/2,webView.height*sc-flickable.height)) finalY.value = flickVY.to finalZoom.value = zoom @@ -76,8 +77,8 @@ Flickable { } onUrlChanged: { // got to topleft - flickable.viewportX = 0 - flickable.viewportY = 0 + flickable.contentX = 0 + flickable.contentY = 0 if (url != null) { header.editUrl = url.toString(); } } onDoubleClick: { @@ -110,7 +111,7 @@ Flickable { NumberAnimation { id: flickVX target: flickable - property: "viewportX" + property: "contentX" easing.type: "Linear" duration: 200 from: 0 // set before calling @@ -119,7 +120,7 @@ Flickable { NumberAnimation { id: flickVY target: flickable - property: "viewportY" + property: "contentY" easing.type: "Linear" duration: 200 from: 0 // set before calling @@ -136,19 +137,19 @@ Flickable { property: "scale" value: 1.0 } - // Have to set the viewportXY, since the above 2 + // Have to set the contentXY, since the above 2 // size changes may have started a correction if // contentsScale < 1.0. PropertyAction { id: finalX target: flickable - property: "viewportX" + property: "contentX" value: 0 // set before calling } PropertyAction { id: finalY target: flickable - property: "viewportY" + property: "contentY" value: 0 // set before calling } PropertyAction { diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml index f905150..94c94f2 100644 --- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml +++ b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml @@ -9,35 +9,44 @@ Image { source: "pics/header.png" width: parent.width height: 60 - x: webView.viewportX < 0 ? -webView.viewportX : webView.viewportX > webView.viewportWidth-webView.width - ? -webView.viewportX+webView.viewportWidth-webView.width : 0 - y: webView.viewportY < 0 ? -webView.viewportY : progressOff* - (webView.viewportY>height?-height:-webView.viewportY) - Text { - id: headerText - - text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...' - elide: Text.ElideRight - - color: "white" - styleColor: "black" - style: Text.Raised - - font.family: "Helvetica" - font.pointSize: 10 - font.bold: true - - anchors.left: header.left - anchors.right: header.right - anchors.leftMargin: 4 - anchors.rightMargin: 4 + x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width + ? -webView.contentX+webView.contentWidth-webView.width : 0 + y: webView.contentY < 0 ? -webView.contentY : progressOff* + (webView.contentY>height?-height:-webView.contentY) + Row { + id: headerTitle + anchors.top: header.top anchors.topMargin: 4 - horizontalAlignment: Text.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + spacing: 6 + + Image { + id: headerIcon + pixmap: webView.icon + } + + Text { + id: headerText + + 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/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index faafd5d..6a427f4 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -30,10 +30,10 @@ Item { anchors.bottom: footer.top } RectSoftShadow { - x: -webView.viewportX - y: -webView.viewportY - width: webView.viewportWidth - height: webView.viewportHeight+headerSpace.height + x: -webView.contentX + y: -webView.contentY + width: webView.contentWidth + height: webView.contentHeight+headerSpace.height } Item { id: headerSpace |