From 2445d7adc19bb1355cbba8361345feb9d4cf10f9 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 11 May 2010 09:21:50 +0200 Subject: Emit numFlagsChanged Task-number: QTBUG-10552 --- demos/declarative/minehunt/minehunt.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp index 93cd1c1..2a4ed10 100644 --- a/demos/declarative/minehunt/minehunt.cpp +++ b/demos/declarative/minehunt/minehunt.cpp @@ -212,6 +212,8 @@ void MinehuntGame::reset() } nMines = 12; nFlags = 0; + emit numMinesChanged(); + emit numFlagsChanged(); setPlaying(false); QTimer::singleShot(600,this, SLOT(setBoard())); } -- cgit v0.12 From 952ab3f97a77c1f15b526df13c96602f6501f8ea Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 11 May 2010 17:44:12 +1000 Subject: Cleanup and simplify the webbrowser demo. --- demos/declarative/webbrowser/content/Button.qml | 18 ++ .../webbrowser/content/FlickableWebView.qml | 2 +- demos/declarative/webbrowser/content/Header.qml | 69 ++++++++ .../webbrowser/content/RectSoftShadow.qml | 32 ---- .../content/RetractingWebBrowserHeader.qml | 113 ------------- demos/declarative/webbrowser/content/ScrollBar.qml | 66 ++++++++ demos/declarative/webbrowser/content/UrlInput.qml | 44 +++++ .../webbrowser/content/fieldtext/FieldText.qml | 157 ------------------ .../webbrowser/content/fieldtext/pics/cancel.png | Bin 1038 -> 0 bytes .../webbrowser/content/fieldtext/pics/ok.png | Bin 655 -> 0 bytes .../webbrowser/content/pics/addressbar-filled.png | Bin 694 -> 0 bytes .../webbrowser/content/pics/addressbar-filled.sci | 6 - .../webbrowser/content/pics/addressbar.png | Bin 467 -> 0 bytes .../webbrowser/content/pics/addressbar.sci | 6 - .../webbrowser/content/pics/back-disabled.png | Bin 475 -> 0 bytes demos/declarative/webbrowser/content/pics/back.png | Bin 707 -> 0 bytes .../webbrowser/content/pics/display.png | Bin 0 -> 998 bytes .../webbrowser/content/pics/edit-delete.png | Bin 0 -> 1333 bytes .../declarative/webbrowser/content/pics/footer.png | Bin 200 -> 0 bytes .../declarative/webbrowser/content/pics/footer.sci | 6 - .../webbrowser/content/pics/forward-disabled.png | Bin 471 -> 0 bytes .../webbrowser/content/pics/forward.png | Bin 682 -> 0 bytes .../webbrowser/content/pics/go-next-view.png | Bin 0 -> 1187 bytes .../webbrowser/content/pics/go-previous-view.png | Bin 0 -> 1226 bytes .../declarative/webbrowser/content/pics/header.png | Bin 193 -> 0 bytes .../declarative/webbrowser/content/pics/reload.png | Bin 1283 -> 0 bytes .../webbrowser/content/pics/scrollbar.png | Bin 0 -> 161 bytes .../webbrowser/content/pics/softshadow-bottom.png | Bin 186 -> 0 bytes .../webbrowser/content/pics/softshadow-left.png | Bin 598 -> 0 bytes .../webbrowser/content/pics/softshadow-left.sci | 5 - .../webbrowser/content/pics/softshadow-right.png | Bin 636 -> 0 bytes .../webbrowser/content/pics/softshadow-right.sci | 5 - .../webbrowser/content/pics/softshadow-top.png | Bin 186 -> 0 bytes .../webbrowser/content/pics/titlebar-bg.png | Bin 0 -> 213 bytes .../webbrowser/content/pics/view-refresh.png | Bin 0 -> 2182 bytes demos/declarative/webbrowser/webbrowser.qml | 183 +++------------------ 36 files changed, 225 insertions(+), 487 deletions(-) create mode 100644 demos/declarative/webbrowser/content/Button.qml create mode 100644 demos/declarative/webbrowser/content/Header.qml delete mode 100644 demos/declarative/webbrowser/content/RectSoftShadow.qml delete mode 100644 demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml create mode 100644 demos/declarative/webbrowser/content/ScrollBar.qml create mode 100644 demos/declarative/webbrowser/content/UrlInput.qml delete mode 100644 demos/declarative/webbrowser/content/fieldtext/FieldText.qml delete mode 100644 demos/declarative/webbrowser/content/fieldtext/pics/cancel.png delete mode 100644 demos/declarative/webbrowser/content/fieldtext/pics/ok.png delete mode 100644 demos/declarative/webbrowser/content/pics/addressbar-filled.png delete mode 100644 demos/declarative/webbrowser/content/pics/addressbar-filled.sci delete mode 100644 demos/declarative/webbrowser/content/pics/addressbar.png delete mode 100644 demos/declarative/webbrowser/content/pics/addressbar.sci delete mode 100644 demos/declarative/webbrowser/content/pics/back-disabled.png delete mode 100644 demos/declarative/webbrowser/content/pics/back.png create mode 100644 demos/declarative/webbrowser/content/pics/display.png create mode 100644 demos/declarative/webbrowser/content/pics/edit-delete.png delete mode 100644 demos/declarative/webbrowser/content/pics/footer.png delete mode 100644 demos/declarative/webbrowser/content/pics/footer.sci delete mode 100644 demos/declarative/webbrowser/content/pics/forward-disabled.png delete mode 100644 demos/declarative/webbrowser/content/pics/forward.png create mode 100644 demos/declarative/webbrowser/content/pics/go-next-view.png create mode 100644 demos/declarative/webbrowser/content/pics/go-previous-view.png delete mode 100644 demos/declarative/webbrowser/content/pics/header.png delete mode 100644 demos/declarative/webbrowser/content/pics/reload.png create mode 100644 demos/declarative/webbrowser/content/pics/scrollbar.png delete mode 100644 demos/declarative/webbrowser/content/pics/softshadow-bottom.png delete mode 100644 demos/declarative/webbrowser/content/pics/softshadow-left.png delete mode 100644 demos/declarative/webbrowser/content/pics/softshadow-left.sci delete mode 100644 demos/declarative/webbrowser/content/pics/softshadow-right.png delete mode 100644 demos/declarative/webbrowser/content/pics/softshadow-right.sci delete mode 100644 demos/declarative/webbrowser/content/pics/softshadow-top.png create mode 100644 demos/declarative/webbrowser/content/pics/titlebar-bg.png create mode 100644 demos/declarative/webbrowser/content/pics/view-refresh.png diff --git a/demos/declarative/webbrowser/content/Button.qml b/demos/declarative/webbrowser/content/Button.qml new file mode 100644 index 0000000..a1baf16 --- /dev/null +++ b/demos/declarative/webbrowser/content/Button.qml @@ -0,0 +1,18 @@ +import Qt 4.7 + +Item { + property alias image: icon.source + property variant action + + width: 40; height: parent.height + + Image { + id: icon; anchors.centerIn: parent + opacity: action.enabled ? 1.0 : 0.4 + } + + MouseArea { + anchors { fill: parent; topMargin: -10; bottomMargin: -10 } + onClicked: action.trigger() + } +} diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index 50ea97d..2862cc4 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -15,7 +15,7 @@ Flickable { 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.bottom: parent.top anchors.left: parent.left anchors.right: parent.right pressDelay: 200 diff --git a/demos/declarative/webbrowser/content/Header.qml b/demos/declarative/webbrowser/content/Header.qml new file mode 100644 index 0000000..7c93580 --- /dev/null +++ b/demos/declarative/webbrowser/content/Header.qml @@ -0,0 +1,69 @@ +import Qt 4.7 + +Image { + property alias editUrl: urlInput.url + + source: "pics/titlebar-bg.png"; fillMode: Image.TileHorizontally + + x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width + ? -webView.contentX+webView.contentWidth-webView.width : 0 + + y: { + if (webView.progress < 1.0) + return 0; + else { + webView.contentY < 0 ? -webView.contentY : webView.contentY > height ? -height : -webView.contentY + } + } + + Column { + width: parent.width + + Item { + width: parent.width; height: 20 + Text { + anchors.centerIn: parent + text: webView.title; font.pixelSize: 14; font.bold: true + color: "white"; styleColor: "black"; style: Text.Sunken + } + } + + Item { + width: parent.width; height: 40 + + Button { + id: backButton + action: webView.back; image: "pics/go-previous-view.png" + anchors { left: parent.left; bottom: parent.bottom } + } + + Button { + id: nextButton + anchors.left: backButton.right + action: webView.forward; image: "pics/go-next-view.png" + } + + UrlInput { + id: urlInput + anchors { left: nextButton.right; right: reloadButton.left } + image: "pics/display.png" + onUrlEntered: { + webBrowser.urlString = url + webBrowser.focus = true + } + } + + Button { + id: reloadButton + anchors { right: parent.right; rightMargin: 4 } + action: webView.reload; image: "pics/view-refresh.png"; visible: webView.progress == 1.0 + } + + Button { + id: stopButton + anchors { right: parent.right; rightMargin: 4 } + action: webView.stop; image: "pics/edit-delete.png"; visible: webView.progress < 1.0 + } + } + } +} diff --git a/demos/declarative/webbrowser/content/RectSoftShadow.qml b/demos/declarative/webbrowser/content/RectSoftShadow.qml deleted file mode 100644 index 53d098c..0000000 --- a/demos/declarative/webbrowser/content/RectSoftShadow.qml +++ /dev/null @@ -1,32 +0,0 @@ -import Qt 4.7 - -Item { - BorderImage { - source: "pics/softshadow-left.sci" - x: -16 - y: -16 - width: 16 - height: parent.height+32 - } - BorderImage { - source: "pics/softshadow-right.sci" - x: parent.width - y: -16 - width: 16 - height: parent.height+32 - } - Image { - source: "pics/softshadow-top.png" - x: 0 - y: -16 - width: parent.width - height: 16 - } - Image { - source: "pics/softshadow-bottom.png" - x: 0 - y: parent.height - width: parent.width - height: 16 - } -} diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml deleted file mode 100644 index b02a5bf..0000000 --- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml +++ /dev/null @@ -1,113 +0,0 @@ -import Qt 4.7 - -import "fieldtext" - -Image { - property alias editUrl: editUrl.text - - id: header - source: "pics/header.png" - width: parent.width - height: 60 - 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 - x: parent.width > headerIcon.width+headerText.width+6 ? (parent.width-headerIcon.width-headerText.width-6)/2 : 0 - spacing: 6 - - Image { - id: headerIcon - pixmap: webView.icon - } - - Text { - id: headerText - - text: webView.title!='' || webView.progress == 1.0 ? webView.title : 'Loading...' - - 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: headerTitle.bottom - anchors.topMargin: 2 - anchors.bottom: parent.bottom - - Item { - id: urlBox - height: 31 - anchors.left: parent.left - anchors.leftMargin: 12 - anchors.right: parent.right - anchors.rightMargin: 12 - anchors.top: parent.top - clip: true - property bool mouseGrabbed: false - - BorderImage { - source: "pics/addressbar.sci" - anchors.fill: urlBox - } - - BorderImage { - id: urlBoxhl - source: "pics/addressbar-filled.sci" - width: parent.width*webView.progress - height: parent.height - opacity: 1-header.progressOff - clip: true - } - - FieldText { - id: editUrl - mouseGrabbed: parent.mouseGrabbed - - text: webBrowser.urlString - label: "url:" - onConfirmed: { webBrowser.urlString = editUrl.text; webView.focus=true } - onCancelled: { webView.focus=true } - onStartEdit: { webView.focus=false } - - anchors.left: urlBox.left - anchors.right: urlBox.right - anchors.leftMargin: 6 - anchors.verticalCenter: urlBox.verticalCenter - anchors.verticalCenterOffset: 1 - } - } - } - - property real progressOff : 1 - states: [ - State { - name: "ProgressShown" - when: webView.progress < 1.0 - PropertyChanges { target: header; progressOff: 0; } - } - ] - transitions: [ - Transition { - NumberAnimation { - targets: header - properties: "progressOff" - easing.type: Easing.InOutQuad - duration: 300 - } - } - ] -} diff --git a/demos/declarative/webbrowser/content/ScrollBar.qml b/demos/declarative/webbrowser/content/ScrollBar.qml new file mode 100644 index 0000000..976297b --- /dev/null +++ b/demos/declarative/webbrowser/content/ScrollBar.qml @@ -0,0 +1,66 @@ +import Qt 4.7 + +Item { + id: container + + property variant scrollArea + property variant orientation: Qt.Vertical + + opacity: 0 + + function position() + { + var ny = 0; + if (container.orientation == Qt.Vertical) + ny = scrollArea.visibleArea.yPosition * container.height; + else + ny = scrollArea.visibleArea.xPosition * container.width; + if (ny > 2) return ny; else return 2; + } + + function size() + { + var nh, ny; + + if (container.orientation == Qt.Vertical) + nh = scrollArea.visibleArea.heightRatio * container.height; + else + nh = scrollArea.visibleArea.widthRatio * container.width; + + if (container.orientation == Qt.Vertical) + ny = scrollArea.visibleArea.yPosition * container.height; + else + ny = scrollArea.visibleArea.xPosition * container.width; + + if (ny > 3) { + var t; + if (container.orientation == Qt.Vertical) + t = Math.ceil(container.height - 3 - ny); + else + t = Math.ceil(container.width - 3 - ny); + if (nh > t) return t; else return nh; + } else return nh + ny; + } + + Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.5 } + + BorderImage { + source: "pics/scrollbar.png" + border { left: 1; right: 1; top: 1; bottom: 1 } + x: container.orientation == Qt.Vertical ? 2 : position() + width: container.orientation == Qt.Vertical ? container.width - 4 : size() + y: container.orientation == Qt.Vertical ? position() : 2 + height: container.orientation == Qt.Vertical ? size() : container.height - 4 + } + + states: State { + name: "visible" + when: scrollArea.moving + PropertyChanges { target: container; opacity: 1.0 } + } + + transitions: Transition { + from: "visible"; to: "" + NumberAnimation { properties: "opacity"; duration: 600 } + } +} diff --git a/demos/declarative/webbrowser/content/UrlInput.qml b/demos/declarative/webbrowser/content/UrlInput.qml new file mode 100644 index 0000000..9f7fc38 --- /dev/null +++ b/demos/declarative/webbrowser/content/UrlInput.qml @@ -0,0 +1,44 @@ +import Qt 4.7 + +Item { + id: container + + property alias image: bg.source + property alias url: urlText.text + + signal urlEntered(string url) + + width: parent.height; height: parent.height + + BorderImage { + id: bg; rotation: 180 + x: 8; width: parent.width - 16; height: 30; + anchors.verticalCenter: parent.verticalCenter + border { left: 10; top: 10; right: 10; bottom: 10 } + } + + Rectangle { + anchors.bottom: bg.bottom + x: 18; height: 4; color: "#63b1ed" + width: (bg.width - 20) * webView.progress + opacity: webView.progress == 1.0 ? 0.0 : 1.0 + } + + TextInput { + id: urlText + horizontalAlignment: TextEdit.AlignLeft + font.pixelSize: 14; focusOnPress: true + Keys.onEscapePressed: { + urlText.text = webView.url + webView.focus = true + } + Keys.onReturnPressed: { + container.urlEntered(urlText.text) + webView.focus = true + } + anchors { + left: parent.left; right: parent.right; leftMargin: 18; rightMargin: 18 + verticalCenter: parent.verticalCenter + } + } +} diff --git a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml deleted file mode 100644 index d1d003f..0000000 --- a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml +++ /dev/null @@ -1,157 +0,0 @@ -import Qt 4.7 - -Item { - id: fieldText - height: 30 - property string text: "" - property string label: "" - property bool mouseGrabbed: false - signal confirmed - signal cancelled - signal startEdit - - function edit() { - if (!mouseGrabbed) { - fieldText.startEdit(); - fieldText.state='editing'; - mouseGrabbed=true; - } - } - - function confirm() { - fieldText.state=''; - fieldText.text = textEdit.text; - mouseGrabbed=false; - fieldText.confirmed(); - } - - function reset() { - textEdit.text = fieldText.text; - fieldText.state=''; - mouseGrabbed=false; - fieldText.cancelled(); - } - - Image { - id: cancelIcon - width: 22 - height: 22 - anchors.right: parent.right - anchors.rightMargin: 4 - anchors.verticalCenter: parent.verticalCenter - source: "pics/cancel.png" - opacity: 0 - } - - Image { - id: confirmIcon - width: 22 - height: 22 - anchors.left: parent.left - anchors.leftMargin: 4 - anchors.verticalCenter: parent.verticalCenter - source: "pics/ok.png" - opacity: 0 - } - - TextInput { - id: textEdit - text: fieldText.text - focus: false - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.verticalCenter: parent.verticalCenter - color: "black" - font.bold: true - readOnly: true - onAccepted: confirm() - Keys.onEscapePressed: reset() - } - - Text { - id: textLabel - x: 5 - width: parent.width-10 - anchors.verticalCenter: parent.verticalCenter - horizontalAlignment: Text.AlignHCenter - color: fieldText.state == "editing" ? "#505050" : "#AAAAAA" - font.italic: true - font.bold: true - text: label - opacity: textEdit.text == '' ? 1 : 0 - Behavior on opacity { - NumberAnimation { - property: "opacity" - duration: 250 - } - } - } - - MouseArea { - anchors.fill: cancelIcon - onClicked: { reset() } - } - - MouseArea { - anchors.fill: confirmIcon - onClicked: { confirm() } - } - - MouseArea { - id: editRegion - anchors.fill: textEdit - onClicked: { edit() } - } - - states: [ - State { - name: "editing" - PropertyChanges { - target: confirmIcon - opacity: 1 - } - PropertyChanges { - target: cancelIcon - opacity: 1 - } - PropertyChanges { - target: textEdit - color: "black" - readOnly: false - focus: true - selectionStart: 0 - selectionEnd: -1 - } - PropertyChanges { - target: editRegion - opacity: 0 - } - PropertyChanges { - target: textEdit.anchors - leftMargin: 34 - } - PropertyChanges { - target: textEdit.anchors - rightMargin: 34 - } - } - ] - - transitions: [ - Transition { - from: "" - to: "*" - reversible: true - NumberAnimation { - properties: "opacity,leftMargin,rightMargin" - duration: 200 - } - ColorAnimation { - property: "color" - duration: 150 - } - } - ] -} diff --git a/demos/declarative/webbrowser/content/fieldtext/pics/cancel.png b/demos/declarative/webbrowser/content/fieldtext/pics/cancel.png deleted file mode 100644 index ecc9533..0000000 Binary files a/demos/declarative/webbrowser/content/fieldtext/pics/cancel.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/fieldtext/pics/ok.png b/demos/declarative/webbrowser/content/fieldtext/pics/ok.png deleted file mode 100644 index 5795f04..0000000 Binary files a/demos/declarative/webbrowser/content/fieldtext/pics/ok.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/addressbar-filled.png b/demos/declarative/webbrowser/content/pics/addressbar-filled.png deleted file mode 100644 index d8452ec..0000000 Binary files a/demos/declarative/webbrowser/content/pics/addressbar-filled.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/addressbar-filled.sci b/demos/declarative/webbrowser/content/pics/addressbar-filled.sci deleted file mode 100644 index 96c5efb..0000000 --- a/demos/declarative/webbrowser/content/pics/addressbar-filled.sci +++ /dev/null @@ -1,6 +0,0 @@ -border.left: 7 -border.top: 7 -border.bottom: 7 -border.right: 7 -source: addressbar-filled.png - diff --git a/demos/declarative/webbrowser/content/pics/addressbar.png b/demos/declarative/webbrowser/content/pics/addressbar.png deleted file mode 100644 index 3278f58..0000000 Binary files a/demos/declarative/webbrowser/content/pics/addressbar.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/addressbar.sci b/demos/declarative/webbrowser/content/pics/addressbar.sci deleted file mode 100644 index 8f1cd18..0000000 --- a/demos/declarative/webbrowser/content/pics/addressbar.sci +++ /dev/null @@ -1,6 +0,0 @@ -border.left: 7 -border.top: 7 -border.bottom: 7 -border.right: 7 -source: addressbar.png - diff --git a/demos/declarative/webbrowser/content/pics/back-disabled.png b/demos/declarative/webbrowser/content/pics/back-disabled.png deleted file mode 100644 index 91b9e76..0000000 Binary files a/demos/declarative/webbrowser/content/pics/back-disabled.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/back.png b/demos/declarative/webbrowser/content/pics/back.png deleted file mode 100644 index 9988dd3..0000000 Binary files a/demos/declarative/webbrowser/content/pics/back.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/display.png b/demos/declarative/webbrowser/content/pics/display.png new file mode 100644 index 0000000..9507f43 Binary files /dev/null and b/demos/declarative/webbrowser/content/pics/display.png differ diff --git a/demos/declarative/webbrowser/content/pics/edit-delete.png b/demos/declarative/webbrowser/content/pics/edit-delete.png new file mode 100644 index 0000000..351659b Binary files /dev/null and b/demos/declarative/webbrowser/content/pics/edit-delete.png differ diff --git a/demos/declarative/webbrowser/content/pics/footer.png b/demos/declarative/webbrowser/content/pics/footer.png deleted file mode 100644 index 8391a93..0000000 Binary files a/demos/declarative/webbrowser/content/pics/footer.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/footer.sci b/demos/declarative/webbrowser/content/pics/footer.sci deleted file mode 100644 index 7be58f1..0000000 --- a/demos/declarative/webbrowser/content/pics/footer.sci +++ /dev/null @@ -1,6 +0,0 @@ -border.left: 5 -border.top: 0 -border.bottom: 0 -border.right: 5 -source: footer.png - diff --git a/demos/declarative/webbrowser/content/pics/forward-disabled.png b/demos/declarative/webbrowser/content/pics/forward-disabled.png deleted file mode 100644 index cb87f4f..0000000 Binary files a/demos/declarative/webbrowser/content/pics/forward-disabled.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/forward.png b/demos/declarative/webbrowser/content/pics/forward.png deleted file mode 100644 index 83870ee..0000000 Binary files a/demos/declarative/webbrowser/content/pics/forward.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/go-next-view.png b/demos/declarative/webbrowser/content/pics/go-next-view.png new file mode 100644 index 0000000..3bce02d Binary files /dev/null and b/demos/declarative/webbrowser/content/pics/go-next-view.png differ diff --git a/demos/declarative/webbrowser/content/pics/go-previous-view.png b/demos/declarative/webbrowser/content/pics/go-previous-view.png new file mode 100644 index 0000000..3ec011e Binary files /dev/null and b/demos/declarative/webbrowser/content/pics/go-previous-view.png differ diff --git a/demos/declarative/webbrowser/content/pics/header.png b/demos/declarative/webbrowser/content/pics/header.png deleted file mode 100644 index 26588c3..0000000 Binary files a/demos/declarative/webbrowser/content/pics/header.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/reload.png b/demos/declarative/webbrowser/content/pics/reload.png deleted file mode 100644 index 45b5535..0000000 Binary files a/demos/declarative/webbrowser/content/pics/reload.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/scrollbar.png b/demos/declarative/webbrowser/content/pics/scrollbar.png new file mode 100644 index 0000000..0228dcf Binary files /dev/null and b/demos/declarative/webbrowser/content/pics/scrollbar.png differ diff --git a/demos/declarative/webbrowser/content/pics/softshadow-bottom.png b/demos/declarative/webbrowser/content/pics/softshadow-bottom.png deleted file mode 100644 index 85b0b44..0000000 Binary files a/demos/declarative/webbrowser/content/pics/softshadow-bottom.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/softshadow-left.png b/demos/declarative/webbrowser/content/pics/softshadow-left.png deleted file mode 100644 index 02926d1..0000000 Binary files a/demos/declarative/webbrowser/content/pics/softshadow-left.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/softshadow-left.sci b/demos/declarative/webbrowser/content/pics/softshadow-left.sci deleted file mode 100644 index 45c88d5..0000000 --- a/demos/declarative/webbrowser/content/pics/softshadow-left.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 0 -border.top: 16 -border.bottom: 16 -border.right: 0 -source: softshadow-left.png diff --git a/demos/declarative/webbrowser/content/pics/softshadow-right.png b/demos/declarative/webbrowser/content/pics/softshadow-right.png deleted file mode 100644 index e459f4f..0000000 Binary files a/demos/declarative/webbrowser/content/pics/softshadow-right.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/softshadow-right.sci b/demos/declarative/webbrowser/content/pics/softshadow-right.sci deleted file mode 100644 index 4d459c0..0000000 --- a/demos/declarative/webbrowser/content/pics/softshadow-right.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left: 0 -border.top: 16 -border.bottom: 16 -border.right: 0 -source: softshadow-right.png diff --git a/demos/declarative/webbrowser/content/pics/softshadow-top.png b/demos/declarative/webbrowser/content/pics/softshadow-top.png deleted file mode 100644 index 9a9e232..0000000 Binary files a/demos/declarative/webbrowser/content/pics/softshadow-top.png and /dev/null differ diff --git a/demos/declarative/webbrowser/content/pics/titlebar-bg.png b/demos/declarative/webbrowser/content/pics/titlebar-bg.png new file mode 100644 index 0000000..06961e8 Binary files /dev/null and b/demos/declarative/webbrowser/content/pics/titlebar-bg.png differ diff --git a/demos/declarative/webbrowser/content/pics/view-refresh.png b/demos/declarative/webbrowser/content/pics/view-refresh.png new file mode 100644 index 0000000..afa2a9d Binary files /dev/null and b/demos/declarative/webbrowser/content/pics/view-refresh.png differ diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index f1a6034..27da814 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -3,168 +3,39 @@ import org.webkit 1.0 import "content" -Item { +Rectangle { id: webBrowser property string urlString : "http://qt.nokia.com/" - width: 640 - height: 480 + width: 800; height: 600 + color: "#343434" + + FlickableWebView { + id: webView + url: webBrowser.urlString + anchors { top: headerSpace.bottom; left: parent.left; right: parent.right; bottom: parent.bottom } + + } Item { - id: webPanel - anchors.fill: parent - clip: true - Rectangle { - color: "#555555" - anchors.fill: parent - } - Image { - source: "content/pics/softshadow-bottom.png" - width: webPanel.width - height: 16 - } - Image { - source: "content/pics/softshadow-top.png" - width: webPanel.width - height: 16 - anchors.bottom: footer.top - } - RectSoftShadow { - x: -webView.contentX - y: -webView.contentY - width: webView.contentWidth - height: webView.contentHeight+headerSpace.height - } - Item { - id: headerSpace - width: parent.width - height: 60 - z: 1 + id: headerSpace + width: parent.width; height: 62 + } - RetractingWebBrowserHeader { id: header } - } - FlickableWebView { - id: webView - width: parent.width - anchors.top: headerSpace.bottom - anchors.bottom: footer.top - anchors.left: parent.left - anchors.right: parent.right - } - BorderImage { - id: footer - source: "content/pics/footer.sci" - width: parent.width - height: 43 - anchors.bottom: parent.bottom - Rectangle { - y: -1 - width: parent.width - height: 1 - color: "#555555" - } - Item { - id: backbutton - width: back_e.width - height: back_e.height - anchors.right: reload.left - anchors.rightMargin: 10 - anchors.verticalCenter: parent.verticalCenter - Image { - id: back_e - source: "content/pics/back.png" - anchors.fill: parent - } - Image { - id: back_d - source: "content/pics/back-disabled.png" - anchors.fill: parent - } - states: [ - State { - name: "Enabled" - when: webView.back.enabled==true - PropertyChanges { target: back_e; opacity: 1 } - PropertyChanges { target: back_d; opacity: 0 } - }, - State { - name: "Disabled" - when: webView.back.enabled==false - PropertyChanges { target: back_e; opacity: 0 } - PropertyChanges { target: back_d; opacity: 1 } - } - ] - transitions: [ - Transition { - NumberAnimation { - properties: "opacity" - easing.type: Easing.InOutQuad - duration: 300 - } - } - ] - MouseArea { - anchors.fill: back_e - onClicked: { if (webView.back.enabled) webView.back.trigger() } - } - } - Image { - id: reload - source: "content/pics/reload.png" - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - } - MouseArea { - anchors.fill: reload - onClicked: { webView.reload.trigger() } - } - Item { - id: forwardbutton - width: forward_e.width - height: forward_e.height - anchors.left: reload.right - anchors.leftMargin: 10 - anchors.verticalCenter: parent.verticalCenter - Image { - id: forward_e - source: "content/pics/forward.png" - anchors.fill: parent - anchors.verticalCenter: parent.verticalCenter - } - Image { - id: forward_d - source: "content/pics/forward-disabled.png" - anchors.fill: parent - } - states: [ - State { - name: "Enabled" - when: webView.forward.enabled==true - PropertyChanges { target: forward_e; opacity: 1 } - PropertyChanges { target: forward_d; opacity: 0 } - }, - State { - name: "Disabled" - when: webView.forward.enabled==false - PropertyChanges { target: forward_e; opacity: 0 } - PropertyChanges { target: forward_d; opacity: 1 } - } - ] - transitions: [ - Transition { - NumberAnimation { - properties: "opacity" - easing.type: Easing.InOutQuad - duration: 320 - } - } - ] - MouseArea { - anchors.fill: parent - onClicked: { if (webView.forward.enabled) webView.forward.trigger() } - } - } - } + Header { + id: header + editUrl: webBrowser.urlString + width: headerSpace.width; height: headerSpace.height } + + ScrollBar { + scrollArea: webView; width: 8 + anchors { right: parent.right; top: header.bottom; bottom: parent.bottom } + } + +// ScrollBar { +// scrollArea: webView; height: 8; orientation: Qt.Horizontal +// anchors { right: parent.right; rightMargin: 8; left: parent.left; bottom: parent.bottom } +// } } -- cgit v0.12 From dae547d26f8c7d4c75b02045e23213c798a2fa3e Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 12 May 2010 08:13:41 +1000 Subject: Clarify ListModel population via JS. Task-number: QTBUG-10457 --- doc/src/declarative/qdeclarativemodels.qdoc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 9b706a1..788d417 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -143,6 +143,28 @@ ListView { } \endcode +It is also possible to manipulate the ListModel directly via JavaScript. +In this case, the first item inserted will determine the roles available +to any views using the model. For example, if an empty ListModel is +created and populated via JavaScript the roles provided by the first +insertion are the only roles that will be shown in the view: + +\code +Item { + ListModel { + id: fruitModel + } + MouseArea { + anchors.fill: parent + onClicked: fruitModel.append({"cost": 5.95, "name":"Pizza"}) + } +} +\endcode + +When the MouseArea is clicked fruitModel will have two roles, "cost" and "name". +Even if subsequent roles are added, only the first two will be handled by views +using the model. + \section2 XmlListModel -- cgit v0.12 From c4bb04a6154931570dee72b3a1ed34af31814d17 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 12 May 2010 08:28:55 +1000 Subject: Don't store the role-property map for each individual item. C++ models share a single metaobject type, so we don't need to create role-property mappings for each individual item. Also warn on attempt to modify a role that the model is unaware of (part of QTBUG-10457) --- .../graphicsitems/qdeclarativegridview.cpp | 2 +- .../graphicsitems/qdeclarativelistview.cpp | 3 +- .../graphicsitems/qdeclarativerepeater.cpp | 2 +- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 63 ++++++++++++++-------- .../graphicsitems/qdeclarativevisualitemmodel_p.h | 6 +-- 5 files changed, 47 insertions(+), 29 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 7b413fb..305d55c 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1027,7 +1027,7 @@ void QDeclarativeGridView::setModel(const QVariant &model) d->model = vim; } else { if (!d->ownModel) { - d->model = new QDeclarativeVisualDataModel(qmlContext(this)); + d->model = new QDeclarativeVisualDataModel(qmlContext(this), this); d->ownModel = true; } if (QDeclarativeVisualDataModel *dataModel = qobject_cast(d->model)) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 416e0a8..65edb03 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -1461,7 +1462,7 @@ void QDeclarativeListView::setModel(const QVariant &model) d->model = vim; } else { if (!d->ownModel) { - d->model = new QDeclarativeVisualDataModel(qmlContext(this)); + d->model = new QDeclarativeVisualDataModel(qmlContext(this), this); d->ownModel = true; } if (QDeclarativeVisualDataModel *dataModel = qobject_cast(d->model)) diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index ca0b8c6..04076f8 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -193,7 +193,7 @@ void QDeclarativeRepeater::setModel(const QVariant &model) d->model = vim; } else { if (!d->ownModel) { - d->model = new QDeclarativeVisualDataModel(qmlContext(this)); + d->model = new QDeclarativeVisualDataModel(qmlContext(this), this); d->ownModel = true; } if (QDeclarativeVisualDataModel *dataModel = qobject_cast(d->model)) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 1038c83..0e4217e 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -138,8 +138,8 @@ public: } \endcode */ -QDeclarativeVisualItemModel::QDeclarativeVisualItemModel() - : QDeclarativeVisualModel(*(new QDeclarativeVisualItemModelPrivate)) +QDeclarativeVisualItemModel::QDeclarativeVisualItemModel(QObject *parent) + : QDeclarativeVisualModel(*(new QDeclarativeVisualItemModelPrivate), parent) { } @@ -269,7 +269,8 @@ public: } if (m_roles.count() == 1) m_roleNames.insert("modelData", m_roles.at(0)); - m_roleNames.insert("hasModelChildren", 0); + if (m_roles.count()) + m_roleNames.insert("hasModelChildren", 0); } else if (m_listAccessor) { m_roleNames.insert("modelData", 0); if (m_listAccessor->type() == QDeclarativeListAccessor::Instance) { @@ -285,15 +286,19 @@ public: } } + QHash roleToPropId; void createMetaData() { if (!m_metaDataCreated) { ensureRoles(); - QHash::const_iterator it = m_roleNames.begin(); - while (it != m_roleNames.end()) { - m_delegateDataType->createProperty(it.key()); - ++it; + if (m_roleNames.count()) { + QHash::const_iterator it = m_roleNames.begin(); + while (it != m_roleNames.end()) { + int propId = m_delegateDataType->createProperty(it.key()) - m_delegateDataType->propertyOffset(); + roleToPropId.insert(*it, propId); + ++it; + } + m_metaDataCreated = true; } - m_metaDataCreated = true; } } @@ -383,7 +388,6 @@ public: private: friend class QDeclarativeVisualDataModelData; - QHash roleToProp; }; class QDeclarativeVisualDataModelData : public QObject @@ -400,6 +404,8 @@ public: int propForRole(int) const; void setValue(int, const QVariant &); + void ensureProperties(); + Q_SIGNALS: void indexChanged(); @@ -412,9 +418,11 @@ private: int QDeclarativeVisualDataModelData::propForRole(int id) const { - QHash::const_iterator it = m_meta->roleToProp.find(id); - if (it != m_meta->roleToProp.end()) - return m_meta->roleToProp[id]; + QDeclarativeVisualDataModelPrivate *model = QDeclarativeVisualDataModelPrivate::get(m_model); + QHash::const_iterator it = model->roleToPropId.find(id); + if (it != model->roleToPropId.end()) + return *it; + return -1; } @@ -470,12 +478,10 @@ QVariant QDeclarativeVisualDataModelDataMetaObject::initialValue(int propId) model->ensureRoles(); QHash::const_iterator it = model->m_roleNames.find(propName); if (it != model->m_roleNames.end()) { - roleToProp.insert(*it, propId); QVariant value = model->m_listModelInterface->data(data->m_index, *it); return value; } else if (model->m_roles.count() == 1 && propName == "modelData") { //for compatability with other lists, assign modelData if there is only a single role - roleToProp.insert(model->m_roles.first(), propId); QVariant value = model->m_listModelInterface->data(data->m_index, model->m_roles.first()); return value; } @@ -487,7 +493,6 @@ QVariant QDeclarativeVisualDataModelDataMetaObject::initialValue(int propId) } else { QHash::const_iterator it = model->m_roleNames.find(propName); if (it != model->m_roleNames.end()) { - roleToProp.insert(*it, propId); QModelIndex index = model->m_abstractItemModel->index(data->m_index, 0, model->m_root); return model->m_abstractItemModel->data(index, *it); } @@ -502,18 +507,23 @@ QDeclarativeVisualDataModelData::QDeclarativeVisualDataModelData(int index, : m_index(index), m_model(model), m_meta(new QDeclarativeVisualDataModelDataMetaObject(this, QDeclarativeVisualDataModelPrivate::get(model)->m_delegateDataType)) { - QDeclarativeVisualDataModelPrivate *modelPriv = QDeclarativeVisualDataModelPrivate::get(model); - if (modelPriv->m_metaDataCacheable) { - if (!modelPriv->m_metaDataCreated) - modelPriv->createMetaData(); - m_meta->setCached(true); - } + ensureProperties(); } QDeclarativeVisualDataModelData::~QDeclarativeVisualDataModelData() { } +void QDeclarativeVisualDataModelData::ensureProperties() +{ + QDeclarativeVisualDataModelPrivate *modelPriv = QDeclarativeVisualDataModelPrivate::get(m_model); + if (modelPriv->m_metaDataCacheable && !modelPriv->m_metaDataCreated) { + modelPriv->createMetaData(); + if (modelPriv->m_metaDataCreated) + m_meta->setCached(true); + } +} + int QDeclarativeVisualDataModelData::index() const { return m_index; @@ -626,8 +636,8 @@ QDeclarativeVisualDataModel::QDeclarativeVisualDataModel() { } -QDeclarativeVisualDataModel::QDeclarativeVisualDataModel(QDeclarativeContext *ctxt) -: QDeclarativeVisualModel(*(new QDeclarativeVisualDataModelPrivate(ctxt))) +QDeclarativeVisualDataModel::QDeclarativeVisualDataModel(QDeclarativeContext *ctxt, QObject *parent) +: QDeclarativeVisualModel(*(new QDeclarativeVisualDataModelPrivate(ctxt)), parent) { } @@ -1212,6 +1222,13 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, QModelIndex index = d->m_abstractItemModel->index(idx, 0, d->m_root); data->setValue(propId, d->m_abstractItemModel->data(index, role)); } + } else { + QString roleName; + if (d->m_listModelInterface) + roleName = d->m_listModelInterface->toString(role); + else if (d->m_abstractItemModel) + roleName = d->m_abstractItemModel->roleNames().value(role); + qmlInfo(this) << "Changing role not present in item: " << roleName; } } } diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h index edfd387..0bdbbcf 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h @@ -72,7 +72,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeVisualModel : public QObject Q_PROPERTY(int count READ count NOTIFY countChanged) public: - QDeclarativeVisualModel() {} + QDeclarativeVisualModel(QObject *parent=0) : QObject(parent) {} virtual ~QDeclarativeVisualModel() {} enum ReleaseFlag { Referenced = 0x01, Destroyed = 0x02 }; @@ -117,7 +117,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeVisualItemModel : public QDeclarativeVisu Q_CLASSINFO("DefaultProperty", "children") public: - QDeclarativeVisualItemModel(); + QDeclarativeVisualItemModel(QObject *parent=0); virtual ~QDeclarativeVisualItemModel() {} virtual int count() const; @@ -156,7 +156,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeVisualDataModel : public QDeclarativeVisu Q_CLASSINFO("DefaultProperty", "delegate") public: QDeclarativeVisualDataModel(); - QDeclarativeVisualDataModel(QDeclarativeContext *); + QDeclarativeVisualDataModel(QDeclarativeContext *, QObject *parent=0); virtual ~QDeclarativeVisualDataModel(); QVariant model() const; -- cgit v0.12 From 1809eb091cb47c914713ecef6e514e912a4e113b Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 10 May 2010 15:38:12 +1000 Subject: Expand if available space changes. Task-number: QT-3175 --- demos/declarative/webbrowser/content/FlickableWebView.qml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index 2862cc4..7efbaa3 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -20,6 +20,12 @@ Flickable { anchors.right: parent.right pressDelay: 200 + onWidthChanged : { + // Expand (but not above 1:1) if otherwise would be smaller that available width. + if (width > webView.width*webView.contentsScale && webView.contentsScale < 1.0) + webView.contentsScale = width / webView.width * webView.contentsScale; + } + WebView { id: webView pixelCacheSize: 4000000 -- cgit v0.12 From 797d44e7415e8f9d582dd2838957cf309cea9449 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 11 May 2010 09:01:51 +1000 Subject: Temporary work-around for QTBUG-9849. May allow better experimentation and bug fixing. --- tools/qml/main.cpp | 6 ++++++ tools/qml/qmlruntime.cpp | 11 +++++++++++ tools/qml/qmlruntime.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index fb687ac..116ca71 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -231,6 +231,7 @@ int main(int argc, char ** argv) bool stayOnTop = false; bool maximized = false; bool useNativeFileBrowser = true; + bool experimentalGestures = false; WarningsConfig warningsConfig = DefaultWarnings; bool sizeToView = true; @@ -334,6 +335,8 @@ int main(int argc, char ** argv) sizeToView = false; } else if (arg == "-sizerootobjecttoview") { sizeToView = true; + } else if (arg == "-experimentalgestures") { + experimentalGestures = true; } else if (arg[0] != '-') { fileName = arg; } else if (1 || arg == "-help") { @@ -403,6 +406,9 @@ int main(int argc, char ** argv) } #endif + if (experimentalGestures) + viewer->enableExperimentalGestures(); + foreach (QString lib, imports) viewer->addLibraryPath(lib); diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 06fa004..16b0ffb 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -501,6 +501,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) } canvas = new QDeclarativeView(this); + canvas->setAttribute(Qt::WA_OpaquePaintEvent); canvas->setAttribute(Qt::WA_NoSystemBackground); @@ -550,6 +551,16 @@ QDeclarativeViewer::~QDeclarativeViewer() delete namFactory; } +void QDeclarativeViewer::enableExperimentalGestures() +{ + canvas->viewport()->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::TapAndHoldGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::PanGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::PinchGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->grabGesture(Qt::SwipeGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); + canvas->viewport()->setAttribute(Qt::WA_AcceptTouchEvents); +} + int QDeclarativeViewer::menuBarHeight() const { if (!(windowFlags() & Qt::FramelessWindowHint)) diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 9551090..b021d0d 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -112,6 +112,8 @@ public: QDeclarativeView *view() const; LoggerWidget *warningsWidget() const; + void enableExperimentalGestures(); + public slots: void sceneResized(QSize size); bool open(const QString&); -- cgit v0.12 From 355bacaa767f48014478d91e3d79f19f966c9756 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 11 May 2010 16:50:24 +1000 Subject: Ensure QPixmapCache does not flush pixmaps that are still in use. Task-number: QTBUG-10576 Reviewed-by: Alexis Menard --- src/gui/image/qpixmapcache.cpp | 43 ++++++++++++++++++++++++++-- src/gui/image/qpixmapcache.h | 10 +++++++ src/gui/image/qpixmapcache_p.h | 2 ++ tests/auto/qpixmapcache/tst_qpixmapcache.cpp | 34 +++++++++++++++------- 4 files changed, 77 insertions(+), 12 deletions(-) diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 5fc605a..7a6a73f 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#define Q_TEST_QPIXMAPCACHE #include "qpixmapcache.h" #include "qobject.h" #include "qdebug.h" @@ -194,6 +195,9 @@ public: static QPixmapCache::KeyData* getKeyData(QPixmapCache::Key *key); + QList< QPair > allPixmaps() const; + void flushDetachedPixmaps(bool nt); + private: int *keyArray; int theid; @@ -235,10 +239,9 @@ QPMCache::~QPMCache() When the last pixmap has been deleted from the cache, kill the timer so Qt won't keep the CPU from going into sleep mode. */ -void QPMCache::timerEvent(QTimerEvent *) +void QPMCache::flushDetachedPixmaps(bool nt) { int mc = maxCost(); - bool nt = totalCost() == ps; setMaxCost(nt ? totalCost() * 3 / 4 : totalCost() -1); setMaxCost(mc); ps = totalCost(); @@ -252,6 +255,12 @@ void QPMCache::timerEvent(QTimerEvent *) ++it; } } +} + +void QPMCache::timerEvent(QTimerEvent *) +{ + bool nt = totalCost() == ps; + flushDetachedPixmaps(nt); if (!size()) { killTimer(theid); @@ -263,6 +272,7 @@ void QPMCache::timerEvent(QTimerEvent *) } } + QPixmap *QPMCache::object(const QString &key) const { QPixmapCache::Key cacheKey = cacheKeys.value(key); @@ -422,6 +432,20 @@ QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key) return key->d; } +QList< QPair > QPMCache::allPixmaps() const +{ + QList< QPair > r; + QHash::const_iterator it = cacheKeys.begin(); + while (it != cacheKeys.end()) { + QPixmap *ptr = QCache::object(it.value()); + if (ptr) + r.append(QPair(it.key(),*ptr)); + ++it; + } + return r; +} + + Q_GLOBAL_STATIC(QPMCache, pm_cache) int Q_AUTOTEST_EXPORT q_QPixmapCache_keyHashSize() @@ -633,4 +657,19 @@ void QPixmapCache::clear() } } +void QPixmapCache::flushDetachedPixmaps() +{ + pm_cache()->flushDetachedPixmaps(true); +} + +int QPixmapCache::totalUsed() +{ + return (pm_cache()->totalCost()+1023) / 1024; +} + +QList< QPair > QPixmapCache::allPixmaps() +{ + return pm_cache()->allPixmaps(); +} + QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h index 50a9369..e9c8c15 100644 --- a/src/gui/image/qpixmapcache.h +++ b/src/gui/image/qpixmapcache.h @@ -44,6 +44,10 @@ #include +#ifdef Q_TEST_QPIXMAPCACHE +#include +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -83,6 +87,12 @@ public: static void remove(const QString &key); static void remove(const Key &key); static void clear(); + +#ifdef Q_TEST_QPIXMAPCACHE + static void flushDetachedPixmaps(); + static int totalUsed(); + static QList< QPair > allPixmaps(); +#endif }; QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h index 86a1b78..825f272 100644 --- a/src/gui/image/qpixmapcache_p.h +++ b/src/gui/image/qpixmapcache_p.h @@ -95,6 +95,8 @@ public: QPixmapCache::Key key; }; +inline bool qIsDetached(QPixmapCacheEntry &t) { return t.isDetached(); } + QT_END_NAMESPACE #endif // QPIXMAPCACHE_P_H diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp index f8951f5..70f2ac3 100644 --- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#define Q_TEST_QPIXMAPCACHE #include @@ -152,6 +153,7 @@ void tst_QPixmapCache::setCacheLimit() p1 = new QPixmap(2, 3); key = QPixmapCache::insert(*p1); QVERIFY(QPixmapCache::find(key, p1) != 0); + p1->detach(); // dectach so that the cache thinks no-one is using it. QPixmapCache::setCacheLimit(0); QVERIFY(QPixmapCache::find(key, p1) == 0); QPixmapCache::setCacheLimit(1000); @@ -169,6 +171,8 @@ void tst_QPixmapCache::setCacheLimit() key = QPixmapCache::insert(*p1); QVERIFY(QPixmapCache::find(key, &p2) != 0); //we flush the cache + p1->detach(); + p2.detach(); QPixmapCache::setCacheLimit(0); QPixmapCache::setCacheLimit(1000); QPixmapCache::Key key2 = QPixmapCache::insert(*p1); @@ -180,21 +184,25 @@ void tst_QPixmapCache::setCacheLimit() delete p1; //Here we simulate the flushing when the app is idle - /*QPixmapCache::clear(); + QPixmapCache::clear(); QPixmapCache::setCacheLimit(originalCacheLimit); p1 = new QPixmap(300, 300); key = QPixmapCache::insert(*p1); + p1->detach(); QCOMPARE(getPrivate(key)->key, 1); key2 = QPixmapCache::insert(*p1); + p1->detach(); key2 = QPixmapCache::insert(*p1); + p1->detach(); QPixmapCache::Key key3 = QPixmapCache::insert(*p1); - QTest::qWait(32000); + p1->detach(); + QPixmapCache::flushDetachedPixmaps(); key2 = QPixmapCache::insert(*p1); QCOMPARE(getPrivate(key2)->key, 1); //This old key is not valid anymore after the flush QCOMPARE(getPrivate(key)->isValid, false); QVERIFY(QPixmapCache::find(key, &p2) == 0); - delete p1;*/ + delete p1; } void tst_QPixmapCache::find() @@ -225,12 +233,14 @@ void tst_QPixmapCache::find() QPixmapCache::clear(); QPixmapCache::setCacheLimit(128); - key = QPixmapCache::insert(p1); + QPixmap p4(10,10); + key = QPixmapCache::insert(p4); + p4.detach(); - //The int part of the API + QPixmap p5(10,10); QList keys; for (int i = 0; i < 4000; ++i) - QPixmapCache::insert(p1); + QPixmapCache::insert(p5); //at that time the first key has been erase because no more place in the cache QVERIFY(QPixmapCache::find(key, &p1) == 0); @@ -257,8 +267,10 @@ void tst_QPixmapCache::insert() QPixmapCache::insert("0", p1); // ditto - for (int j = 0; j < numberOfKeys; ++j) - QPixmapCache::insert(QString::number(j), p1); + for (int j = 0; j < numberOfKeys; ++j) { + QPixmap p3(10, 10); + QPixmapCache::insert(QString::number(j), p3); + } int num = 0; for (int k = 0; k < numberOfKeys; ++k) { @@ -286,8 +298,10 @@ void tst_QPixmapCache::insert() //The int part of the API // make sure it doesn't explode QList keys; - for (int i = 0; i < numberOfKeys; ++i) - keys.append(QPixmapCache::insert(p1)); + for (int i = 0; i < numberOfKeys; ++i) { + QPixmap p3(10,10); + keys.append(QPixmapCache::insert(p3)); + } num = 0; for (int k = 0; k < numberOfKeys; ++k) { -- cgit v0.12 From 0f9f07c52310c33433dcdf5db3e9d02c695b85af Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 12 May 2010 08:45:12 +1000 Subject: Document Component::createObject() parent argument. Task-number: QTBUG-10617 --- src/declarative/QmlChanges.txt | 4 ++-- src/declarative/qml/qdeclarativecomponent.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index dfc4244..9f618d8 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -7,7 +7,7 @@ Component: isReady, isLoading, isError and isNull properties removed, use QList models no longer provide properties in model object. The properties are now updated when the object changes. An object's property "foo" may now be accessed as "foo", modelData.foo" or model.modelData.foo" - +component.createObject has gained a mandatory "parent" argument C++ API ------- @@ -15,7 +15,7 @@ QDeclarativeExpression::value() has been renamed to QDeclarativeExpression::evaluate() ============================================================================= -The changes below are pre Qt 4.7.0 beta +The changes below are pre Qt 4.7.0 beta 1 TextEdit: wrap property is replaced by wrapMode enumeration. Text: wrap property is replaced by wrapMode enumeration. diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index afdaee8..e757675 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -545,7 +545,7 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q } /*! - \qmlmethod object Component::createObject() + \qmlmethod object Component::createObject(parent) Returns an object instance from this component, or null if object creation fails. The object will be created in the same context as the one in which the component -- cgit v0.12 From 6527735ff53a8ec593f5f85b037de46059e1207e Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 12 May 2010 09:24:30 +1000 Subject: Ensure PathView "attribute" attached properties are created correctly If an item was created spontaneously (i.e. delegate is a package and some other view created the item), ensure its attached properties are correctly initialized. Task-number: QTBUG-10527 --- src/declarative/graphicsitems/qdeclarativepath.cpp | 11 +++ .../graphicsitems/qdeclarativepathview.cpp | 42 ++++++++--- .../graphicsitems/qdeclarativepathview_p.h | 1 + .../qdeclarativepathview/data/pathview_package.qml | 88 ++++++++++++++++++++++ .../tst_qdeclarativepathview.cpp | 17 +++++ 5 files changed, 147 insertions(+), 12 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index 4d8b619..3d0df87 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -322,6 +322,17 @@ QPainterPath QDeclarativePath::path() const QStringList QDeclarativePath::attributes() const { Q_D(const QDeclarativePath); + if (!d->componentComplete) { + QSet attrs; + + // First gather up all the attributes + foreach (QDeclarativePathElement *pathElement, d->_pathElements) { + if (QDeclarativePathAttribute *attribute = + qobject_cast(pathElement)) + attrs.insert(attribute->name()); + } + return attrs.toList(); + } return d->_attributes; } diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 040fc98..503d096 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -98,9 +98,8 @@ QDeclarativeItem *QDeclarativePathViewPrivate::getItem(int modelIndex) if (!attType) { // pre-create one metatype to share with all attached objects attType = new QDeclarativeOpenMetaObjectType(&QDeclarativePathViewAttached::staticMetaObject, qmlEngine(q)); - foreach(const QString &attr, path->attributes()) { + foreach(const QString &attr, path->attributes()) attType->createProperty(attr.toUtf8()); - } } qPathViewAttachedType = attType; QDeclarativePathViewAttached *att = static_cast(qmlAttachedPropertiesObject(item)); @@ -418,7 +417,7 @@ void QDeclarativePathView::setModel(const QVariant &model) d->model = vim; } else { if (!d->ownModel) { - d->model = new QDeclarativeVisualDataModel(qmlContext(this)); + d->model = new QDeclarativeVisualDataModel(qmlContext(this), this); d->ownModel = true; } if (QDeclarativeVisualDataModel *dataModel = qobject_cast(d->model)) @@ -471,12 +470,14 @@ void QDeclarativePathView::setPath(QDeclarativePath *path) disconnect(d->path, SIGNAL(changed()), this, SLOT(refill())); d->path = path; connect(d->path, SIGNAL(changed()), this, SLOT(refill())); - d->clear(); - if (d->attType) { - d->attType->release(); - d->attType = 0; + if (d->isValid() && isComponentComplete()) { + d->clear(); + if (d->attType) { + d->attType->release(); + d->attType = 0; + } + d->regenerate(); } - d->regenerate(); emit pathChanged(); } @@ -1119,7 +1120,8 @@ void QDeclarativePathView::refill() while ((pos > startPos || !d->items.count()) && d->items.count() < count) { // qDebug() << "append" << idx; QDeclarativeItem *item = d->getItem(idx); - item->setZValue(idx+1); + if (d->model->completePending()) + item->setZValue(idx+1); if (d->currentIndex == idx) { item->setFocus(true); if (QDeclarativePathViewAttached *att = d->attached(item)) @@ -1132,7 +1134,8 @@ void QDeclarativePathView::refill() d->firstIndex = idx; d->items.append(item); d->updateItem(item, pos); - d->model->completeItem(); + if (d->model->completePending()) + d->model->completeItem(); ++idx; if (idx >= d->model->count()) idx = 0; @@ -1146,7 +1149,8 @@ void QDeclarativePathView::refill() while (pos >= 0.0 && pos < startPos) { // qDebug() << "prepend" << idx; QDeclarativeItem *item = d->getItem(idx); - item->setZValue(idx+1); + if (d->model->completePending()) + item->setZValue(idx+1); if (d->currentIndex == idx) { item->setFocus(true); if (QDeclarativePathViewAttached *att = d->attached(item)) @@ -1157,7 +1161,8 @@ void QDeclarativePathView::refill() } d->items.prepend(item); d->updateItem(item, pos); - d->model->completeItem(); + if (d->model->completePending()) + d->model->completeItem(); d->firstIndex = idx; idx = d->firstIndex - 1; if (idx < 0) @@ -1269,6 +1274,19 @@ void QDeclarativePathView::createdItem(int index, QDeclarativeItem *item) { Q_D(QDeclarativePathView); if (d->requestedIndex != index) { + if (!d->attType) { + // pre-create one metatype to share with all attached objects + d->attType = new QDeclarativeOpenMetaObjectType(&QDeclarativePathViewAttached::staticMetaObject, qmlEngine(this)); + foreach(const QString &attr, d->path->attributes()) + d->attType->createProperty(attr.toUtf8()); + } + qPathViewAttachedType = d->attType; + QDeclarativePathViewAttached *att = static_cast(qmlAttachedPropertiesObject(item)); + qPathViewAttachedType = 0; + if (att) { + att->m_view = this; + att->setOnPath(false); + } item->setParentItem(this); d->updateItem(item, index < d->firstIndex ? 0.0 : 1.0); } diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 7240578..85f47fd 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -215,6 +215,7 @@ Q_SIGNALS: private: friend class QDeclarativePathViewPrivate; + friend class QDeclarativePathView; QDeclarativePathView *m_view; QDeclarativeOpenMetaObject *m_metaobject; bool m_onPath : 1; diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml new file mode 100644 index 0000000..082da13 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml @@ -0,0 +1,88 @@ +import Qt 4.7 + +Item { + width: 800; height: 600 + Component { + id: photoDelegate + Package { + Item { id: pathItem; objectName: "pathItem"; Package.name: 'path'; width: 85; height: 85; scale: pathItem.PathView.scale } + Item { id: linearItem; Package.name: 'linear'; width: 85; height: 85 } + Rectangle { + id: wrapper + width: 85; height: 85; color: lColor + + transform: Rotation { + id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2 + axis.y: 1; axis.z: 0 + } + state: 'path' + states: [ + State { + name: 'path' + ParentChange { target: wrapper; parent: pathItem; x: 0; y: 0 } + PropertyChanges { target: wrapper; opacity: pathItem.PathView.onPath ? 1.0 : 0 } + } + ] + } + } + } + ListModel { + id: rssModel + ListElement { lColor: "red" } + ListElement { lColor: "green" } + ListElement { lColor: "yellow" } + ListElement { lColor: "blue" } + ListElement { lColor: "purple" } + ListElement { lColor: "gray" } + ListElement { lColor: "brown" } + ListElement { lColor: "thistle" } + } + VisualDataModel { id: visualModel; model: rssModel; delegate: photoDelegate } + + PathView { + id: photoPathView + objectName: "photoPathView" + width: 800; height: 330; pathItemCount: 4; offset: 1 + dragMargin: 24 + preferredHighlightBegin: 0.50 + preferredHighlightEnd: 0.50 + + path: Path { + startX: -50; startY: 40; + + PathAttribute { name: "scale"; value: 0.5 } + PathAttribute { name: "angle"; value: -45 } + + PathCubic { + x: 400; y: 220 + control1X: 140; control1Y: 40 + control2X: 210; control2Y: 220 + } + + PathAttribute { name: "scale"; value: 1.2 } + PathAttribute { name: "angle"; value: 0 } + + PathCubic { + x: 850; y: 40 + control2X: 660; control2Y: 40 + control1X: 590; control1Y: 220 + } + + PathAttribute { name: "scale"; value: 0.5 } + PathAttribute { name: "angle"; value: 45 } + } + + model: visualModel.parts.path + } + + PathView { + y: 400; width: 800; height: 330; pathItemCount: 8 + + path: Path { + startX: 0; startY: 40; + PathLine { x: 800; y: 40 } + } + + model: visualModel.parts.linear + } +} diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index c32e9cc..62d0b89 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -78,6 +78,7 @@ private slots: void componentChanges(); void modelChanges(); void pathUpdateOnStartChanged(); + void package(); private: @@ -695,6 +696,22 @@ void tst_QDeclarativePathView::pathUpdateOnStartChanged() delete canvas; } +void tst_QDeclarativePathView::package() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview_package.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild("photoPathView"); + QVERIFY(pathView); + + QDeclarativeItem *item = findItem(pathView, "pathItem"); + QVERIFY(item); + QVERIFY(item->scale() != 1.0); + + delete canvas; +} + QDeclarativeView *tst_QDeclarativePathView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); -- cgit v0.12 From 6a3bbb128046942b169a3f7e6c0cf14397662d83 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 7 May 2010 15:58:10 +1000 Subject: Clean up --- doc/src/declarative/qdeclarativeintro.qdoc | 5 ++++- examples/declarative/xmldata/daringfireball.qml | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index a98c9e1..acf4ec9 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -60,10 +60,13 @@ technologies like HTML and CSS, but it's not required. QML looks like this: \code +import Qt 4.7 + Rectangle { width: 200 height: 200 - color: "white" + color: "blue" + Image { source: "pics/logo.png" anchors.centerIn: parent diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml index a1df809..480b13c 100644 --- a/examples/declarative/xmldata/daringfireball.qml +++ b/examples/declarative/xmldata/daringfireball.qml @@ -1,7 +1,6 @@ import Qt 4.7 Rectangle { - color: "white" width: 600; height: 600 XmlListModel { -- cgit v0.12 From ef23de2b16f3eaf6621c9407f7d921d55e380982 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 11 May 2010 11:53:25 +1000 Subject: QDeclarativeViewPrivate should subclass QGraphicsViewPrivate Task-number: QTBUG-10528 --- src/declarative/util/qdeclarativeview.cpp | 45 ++++++++++++++++++++++--------- src/declarative/util/qdeclarativeview.h | 3 +-- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 833e284..e68ef94 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -128,19 +128,18 @@ void FrameBreakAnimation::updateCurrentTime(int msecs) server->frameBreak(); } -class QDeclarativeViewPrivate : public QDeclarativeItemChangeListener +class QDeclarativeViewPrivate : public QGraphicsViewPrivate, public QDeclarativeItemChangeListener { + Q_DECLARE_PUBLIC(QDeclarativeView) public: - QDeclarativeViewPrivate(QDeclarativeView *view) - : q(view), root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {} + QDeclarativeViewPrivate() + : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {} ~QDeclarativeViewPrivate() { delete root; } void execute(); void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); void initResize(); void updateSize(); - inline QSize rootObjectSize(); - - QDeclarativeView *q; + inline QSize rootObjectSize() const; QDeclarativeGuard root; QDeclarativeGuard declarativeItemRoot; @@ -162,6 +161,7 @@ public: void QDeclarativeViewPrivate::execute() { + Q_Q(QDeclarativeView); if (root) { delete root; root = 0; @@ -182,6 +182,7 @@ void QDeclarativeViewPrivate::execute() void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry) { + Q_Q(QDeclarativeView); if (resizeItem == root && resizeMode == QDeclarativeView::SizeViewToRootObject) { // wait for both width and height to be changed resizetimer.start(0,q); @@ -250,8 +251,9 @@ void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, Constructs a QDeclarativeView with the given \a parent. */ QDeclarativeView::QDeclarativeView(QWidget *parent) -: QGraphicsView(parent), d(new QDeclarativeViewPrivate(this)) + : QGraphicsView(*(new QDeclarativeViewPrivate), parent) { + Q_D(QDeclarativeView); setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); d->init(); } @@ -262,8 +264,9 @@ QDeclarativeView::QDeclarativeView(QWidget *parent) Constructs a QDeclarativeView with the given QML \a source and \a parent. */ QDeclarativeView::QDeclarativeView(const QUrl &source, QWidget *parent) -: QGraphicsView(parent), d(new QDeclarativeViewPrivate(this)) + : QGraphicsView(*(new QDeclarativeViewPrivate), parent) { + Q_D(QDeclarativeView); setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); d->init(); setSource(source); @@ -271,6 +274,7 @@ QDeclarativeView::QDeclarativeView(const QUrl &source, QWidget *parent) void QDeclarativeViewPrivate::init() { + Q_Q(QDeclarativeView); q->setScene(&scene); q->setOptimizationFlags(QGraphicsView::DontSavePainterState); @@ -288,12 +292,10 @@ void QDeclarativeViewPrivate::init() } /*! - The destructor clears the view's \l {QGraphicsObject} {items} and - deletes the internal representation. + Destroys the view. */ QDeclarativeView::~QDeclarativeView() { - delete d; } /*! \property QDeclarativeView::source @@ -316,6 +318,7 @@ QDeclarativeView::~QDeclarativeView() */ void QDeclarativeView::setSource(const QUrl& url) { + Q_D(QDeclarativeView); d->source = url; d->execute(); } @@ -327,6 +330,7 @@ void QDeclarativeView::setSource(const QUrl& url) */ QUrl QDeclarativeView::source() const { + Q_D(const QDeclarativeView); return d->source; } @@ -336,6 +340,7 @@ QUrl QDeclarativeView::source() const */ QDeclarativeEngine* QDeclarativeView::engine() { + Q_D(QDeclarativeView); return &d->engine; } @@ -348,6 +353,7 @@ QDeclarativeEngine* QDeclarativeView::engine() */ QDeclarativeContext* QDeclarativeView::rootContext() { + Q_D(QDeclarativeView); return d->engine.rootContext(); } @@ -376,6 +382,7 @@ QDeclarativeContext* QDeclarativeView::rootContext() QDeclarativeView::Status QDeclarativeView::status() const { + Q_D(const QDeclarativeView); if (!d->component) return QDeclarativeView::Null; @@ -388,6 +395,7 @@ QDeclarativeView::Status QDeclarativeView::status() const */ QList QDeclarativeView::errors() const { + Q_D(const QDeclarativeView); if (d->component) return d->component->errors(); return QList(); @@ -410,6 +418,7 @@ QList QDeclarativeView::errors() const void QDeclarativeView::setResizeMode(ResizeMode mode) { + Q_D(QDeclarativeView); if (d->resizeMode == mode) return; @@ -433,6 +442,7 @@ void QDeclarativeView::setResizeMode(ResizeMode mode) void QDeclarativeViewPrivate::initResize() { + Q_Q(QDeclarativeView); if (declarativeItemRoot) { if (resizeMode == QDeclarativeView::SizeViewToRootObject) { QDeclarativeItemPrivate *p = @@ -449,6 +459,7 @@ void QDeclarativeViewPrivate::initResize() void QDeclarativeViewPrivate::updateSize() { + Q_Q(QDeclarativeView); if (!root) return; if (declarativeItemRoot) { @@ -479,7 +490,7 @@ void QDeclarativeViewPrivate::updateSize() q->updateGeometry(); } -QSize QDeclarativeViewPrivate::rootObjectSize() +QSize QDeclarativeViewPrivate::rootObjectSize() const { QSize rootObjectSize(0,0); int widthCandidate = -1; @@ -500,6 +511,7 @@ QSize QDeclarativeViewPrivate::rootObjectSize() QDeclarativeView::ResizeMode QDeclarativeView::resizeMode() const { + Q_D(const QDeclarativeView); return d->resizeMode; } @@ -508,7 +520,7 @@ QDeclarativeView::ResizeMode QDeclarativeView::resizeMode() const */ void QDeclarativeView::continueExecute() { - + Q_D(QDeclarativeView); disconnect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute())); if (d->component->isError()) { @@ -541,6 +553,7 @@ void QDeclarativeView::continueExecute() */ void QDeclarativeView::setRootObject(QObject *obj) { + Q_D(QDeclarativeView); if (d->root == obj) return; if (QDeclarativeItem *declarativeItem = qobject_cast(obj)) { @@ -590,6 +603,7 @@ void QDeclarativeView::setRootObject(QObject *obj) */ void QDeclarativeView::timerEvent(QTimerEvent* e) { + Q_D(QDeclarativeView); if (!e || e->timerId() == d->resizetimer.timerId()) { d->updateSize(); d->resizetimer.stop(); @@ -599,6 +613,7 @@ void QDeclarativeView::timerEvent(QTimerEvent* e) /*! \reimp */ bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e) { + Q_D(QDeclarativeView); if (watched == d->root && d->resizeMode == SizeViewToRootObject) { if (d->graphicsWidgetRoot) { if (e->type() == QEvent::GraphicsSceneResize) { @@ -615,6 +630,7 @@ bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e) */ QSize QDeclarativeView::sizeHint() const { + Q_D(const QDeclarativeView); QSize rootObjectSize = d->rootObjectSize(); if (rootObjectSize.isEmpty()) { return size(); @@ -628,6 +644,7 @@ QSize QDeclarativeView::sizeHint() const */ QGraphicsObject *QDeclarativeView::rootObject() const { + Q_D(const QDeclarativeView); return d->root; } @@ -638,6 +655,7 @@ QGraphicsObject *QDeclarativeView::rootObject() const */ void QDeclarativeView::resizeEvent(QResizeEvent *e) { + Q_D(QDeclarativeView); if (d->resizeMode == SizeRootObjectToView) { d->updateSize(); } @@ -657,6 +675,7 @@ void QDeclarativeView::resizeEvent(QResizeEvent *e) */ void QDeclarativeView::paintEvent(QPaintEvent *event) { + Q_D(QDeclarativeView); int time = 0; if (frameRateDebug() || QDeclarativeViewDebugServer::isDebuggingEnabled()) time = d->frameTimer.restart(); diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h index 3513c04..e9cff32 100644 --- a/src/declarative/util/qdeclarativeview.h +++ b/src/declarative/util/qdeclarativeview.h @@ -106,9 +106,8 @@ protected: virtual bool eventFilter(QObject *watched, QEvent *e); private: - friend class QDeclarativeViewPrivate; - QDeclarativeViewPrivate *d; Q_DISABLE_COPY(QDeclarativeView) + Q_DECLARE_PRIVATE(QDeclarativeView) }; QT_END_NAMESPACE -- cgit v0.12 From 0b715811609b86f9332ffd49aea08f4a4b634d21 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 11 May 2010 13:47:08 +1000 Subject: Improve XmlListModel::namespaceDeclarations() docs Task-number: QTBUG-10522 --- src/declarative/util/qdeclarativexmllistmodel.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index ae3b5d7..b9afa1f 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -479,7 +479,6 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty Date: Tue, 11 May 2010 17:23:11 +1000 Subject: Doc improvements --- doc/src/declarative/advtutorial.qdoc | 2 +- doc/src/declarative/codingconventions.qdoc | 1 - doc/src/declarative/extending-examples.qdoc | 8 +-- doc/src/declarative/qmlruntime.qdoc | 2 +- src/declarative/util/qdeclarativexmllistmodel.cpp | 68 +++++++++++++++++------ 5 files changed, 55 insertions(+), 26 deletions(-) diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 8f95190..47504ae 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -105,7 +105,7 @@ is the \l SystemPalette item. This provides access to the Qt system palette and is used to give the button a more native look-and-feel. Notice the anchors for the \c Item, \c Button and \c Text elements are set using -\l {codingconventions.html#Grouped-properties}{group notation} for readability. +\l {qdeclarativeintroduction.html#dot-properties}{group notation} for readability. \section2 Adding \c Button and \c Block components diff --git a/doc/src/declarative/codingconventions.qdoc b/doc/src/declarative/codingconventions.qdoc index d0f873d..4fa7d0c 100644 --- a/doc/src/declarative/codingconventions.qdoc +++ b/doc/src/declarative/codingconventions.qdoc @@ -72,7 +72,6 @@ For example, a hypothetical \e photo QML object would look like this: \snippet doc/src/snippets/declarative/codingconventions/photo.qml 0 -\target Grouped properties \section1 Grouped properties If using multiple properties from a group of properties, diff --git a/doc/src/declarative/extending-examples.qdoc b/doc/src/declarative/extending-examples.qdoc index 307162e..611dac1 100644 --- a/doc/src/declarative/extending-examples.qdoc +++ b/doc/src/declarative/extending-examples.qdoc @@ -64,8 +64,8 @@ element, the C++ class can be named differently, or appear in a namespace. The Person class implementation is quite basic. The property accessors simply return members of the object instance. -The implementation must also be registered using the QML_REGISTER_TYPE() macro. This macro -registers the Person class with QML as a type in the People library version 1.0, +The \c main.cpp file also calls the \c qmlRegisterType() function to +register the \c Person type with QML as a type in the People library version 1.0, and defines the mapping between the C++ and QML class names. \section1 Running the example @@ -159,9 +159,7 @@ directly - an explicit Boy or Girl should be instantiated instead. While we want to disallow instantiating Person from within QML, it still needs to be registered with the QML engine, so that it can be used as a property type -and other types can be coerced to it. To register a type, without defining a -named mapping into QML, we call the QML_REGISTER_NOCREATE_TYPE() macro instead of -the QML_REGISTER_TYPE() macro used previously. +and other types can be coerced to it. \section2 Define Boy and Girl diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index 23c5c32..10aeac0 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -123,7 +123,7 @@ Such files can be created using \l{Qt Linguist}. - See \l{scripting.html#internationalization} for information about how to make + See the \l{scripting.html#internationalization}{Qt Internationalization} documentation for information about how to make the JavaScript in QML files use translatable strings. Additionally, the QML runtime will load translation files specified on the diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index b9afa1f..f02ed16 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -472,39 +472,71 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty + + ... + + + Item A + Sat, 07 Sep 2010 10:00:01 GMT + + + Item B + Sat, 07 Sep 2010 15:35:01 GMT + + + + \endcode + + Then it could be used to create the following model: - Here is an example of a model containing news from a Yahoo RSS feed: \qml XmlListModel { - source: "http://rss.news.yahoo.com/rss/oceania" + source: "http://www.mysite.com/feed.xml" query: "/rss/channel/item" XmlRole { name: "title"; query: "title/string()" } XmlRole { name: "pubDate"; query: "pubDate/string()" } - XmlRole { name: "description"; query: "description/string()" } } \endqml - You can also define certain roles as "keys" so that the model only adds data - that contains new values for these keys when reload() is called. + The \l {XmlListModel::query}{query} value of "/rss/channel/item" specifies that the XmlListModel should generate + a model item for each \c in the XML document. The XmlRole objects define the + model item attributes; here, each model item will have \c title and \c pubDate + attributes that match the \c title and \c pubDate values of its corresponding \c . - For example, if the roles above were defined like this: + + \section2 Using key XML roles + + You can define certain roles as "keys" so that when reload() is called, + the model will only add and refresh data that contains new values for + these keys. + + For example, if above role for "pubDate" was defined like this instead: \qml - XmlRole { name: "title"; query: "title/string()"; isKey: true } XmlRole { name: "pubDate"; query: "pubDate/string()"; isKey: true } \endqml - Then when reload() is called, the model will only add new items with a - "title" and "pubDate" value combination that is not already present in - the model. + Then when reload() is called, the model will only add and reload + items with a "pubDate" value that is not already + present in the model. - This is useful to provide incremental updates and avoid repainting an - entire model in a view. + This is useful when displaying the contents of XML documents that + are incrementally updated (such as RSS feeds) to avoid repainting the + entire contents of a model in a view. - \sa {QtDeclarative} + If multiple key roles are specified, the model only adds and reload items + with a combined value of all key roles that is not already present in + the model. + + \sa {declarative/xmldata}{XML data example} */ QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent) @@ -625,8 +657,8 @@ void QDeclarativeXmlListModel::setXml(const QString &xml) /*! \qmlproperty string XmlListModel::query - An absolute XPath query representing the base query for the model items. The query should start with - '/' or '//'. + An absolute XPath query representing the base query for creating model items + from this model's XmlRole objects. The query should start with '/' or '//'. */ QString QDeclarativeXmlListModel::query() const { @@ -747,7 +779,7 @@ void QDeclarativeXmlListModel::componentComplete() Otherwise, items are only added if the model does not already contain items with matching key role values. - \sa XmlRole::isKey + \sa {Using key XML roles}, XmlRole::isKey */ void QDeclarativeXmlListModel::reload() { -- cgit v0.12 From 1b2b9ba6b4cea31d679aeae915e590ddbf1da945 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 11 May 2010 03:23:21 +0200 Subject: Don't use Q_UNUSED if you use parameters. That's many "use" in the sentence. Task-number:QT-1652 Reviewed-by:TrustMe --- src/gui/graphicsview/qgraphicsview.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 0bba7e9..9519ca0 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1819,8 +1819,6 @@ void QGraphicsView::centerOn(const QGraphicsItem *item) void QGraphicsView::ensureVisible(const QRectF &rect, int xmargin, int ymargin) { Q_D(QGraphicsView); - Q_UNUSED(xmargin); - Q_UNUSED(ymargin); qreal width = viewport()->width(); qreal height = viewport()->height(); QRectF viewRect = d->matrix.mapRect(rect); -- cgit v0.12 From 855368e447a1db8f72c1ad135b9edfb9c373a01d Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 12 May 2010 11:33:56 +1000 Subject: Qt.widgets was removed, point to graphics layouts example --- doc/src/declarative/integrating.qdoc | 50 ++---------------- .../declarative/graphicswidgets/bluecircle.h | 55 ------------------- .../graphicswidgets/graphicswidgets.pro | 13 ----- .../snippets/declarative/graphicswidgets/main.qml | 32 ------------ .../snippets/declarative/graphicswidgets/qmldir | 1 - .../declarative/graphicswidgets/redsquare.h | 54 ------------------- .../declarative/graphicswidgets/shapesplugin.cpp | 61 ---------------------- 7 files changed, 5 insertions(+), 261 deletions(-) delete mode 100644 doc/src/snippets/declarative/graphicswidgets/bluecircle.h delete mode 100644 doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro delete mode 100644 doc/src/snippets/declarative/graphicswidgets/main.qml delete mode 100644 doc/src/snippets/declarative/graphicswidgets/qmldir delete mode 100644 doc/src/snippets/declarative/graphicswidgets/redsquare.h delete mode 100644 doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index 1c07f8e..972976f 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -110,51 +110,11 @@ of QML UIs: \section2 Loading QGraphicsWidget objects in QML An alternative approach is to expose your existing QGraphicsWidget objects to -QML and construct your scene in QML instead. To do this, you need to register -any custom C++ types and create a plugin that registers the custom types -so that they can be used from your QML file. +QML and construct your scene in QML instead. See the \l {declarative/layouts/graphicsLayouts}{graphics layouts example} +which shows how to expose Qt's graphics layout classes to QML in order +to use QGraphicsWidget with classes like QGraphicsLinearLayout and QGraphicsGridLayout. -Here is an example. Suppose you have two classes, \c RedSquare and \c BlueCircle, -that both inherit from QGraphicsWidget: - -\c [graphicswidgets/redsquare.h] -\snippet doc/src/snippets/declarative/graphicswidgets/redsquare.h 0 - -\c [graphicswidgets/bluecircle.h] -\snippet doc/src/snippets/declarative/graphicswidgets/bluecircle.h 0 - -Then, create a plugin by subclassing QDeclarativeExtensionPlugin, and register the -types by calling qmlRegisterType(). Also export the plugin with Q_EXPORT_PLUGIN2. - -\c [graphicswidgets/shapesplugin.cpp] -\snippet doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp 0 - -Now write a project file that creates the plugin: - -\c [graphicswidgets/graphicswidgets.pro] -\quotefile doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro - -And add a \c qmldir file that includes the \c graphicswidgets plugin from the \c lib -subdirectory (as defined in the project file): - -\c [graphicswidgets/qmldir] -\quotefile doc/src/snippets/declarative/graphicswidgets/qmldir - -Now, we can write a QML file that uses the \c RedSquare and \c BlueCircle widgets. -(As an example, we can also create \c QGraphicsWidget items if we import the \c Qt.widgets -module.) - -\c [main.qml] -\quotefile doc/src/snippets/declarative/graphicswidgets/main.qml - -Here is a screenshot of the result: - -\image declarative-integrating-graphicswidgets.png - - -Note this approach of creating your graphics objects from QML does not work -with QGraphicsItems that are not QGraphicsObject-based, since they are not QObjects. - -See \l{Extending QML in C++} for further information on using C++ types. +To expose your existing QGraphicsWidget classes to QML, use \l {qmlRegisterType()}. +See \l{Extending QML in C++} for further information on using C++ types in QML. */ diff --git a/doc/src/snippets/declarative/graphicswidgets/bluecircle.h b/doc/src/snippets/declarative/graphicswidgets/bluecircle.h deleted file mode 100644 index 73d66b7..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/bluecircle.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -#include -#include - -class BlueCircle : public QGraphicsWidget -{ - Q_OBJECT -public: - void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) - { - painter->setPen(QColor(Qt::blue)); - painter->drawEllipse(0, 0, size().width(), size().height()); - } -}; -//![0] diff --git a/doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro b/doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro deleted file mode 100644 index 21c8a37..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/graphicswidgets.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += declarative - -HEADERS += redsquare.h \ - bluecircle.h - -SOURCES += shapesplugin.cpp - -DESTDIR = lib -OBJECTS_DIR = tmp -MOC_DIR = tmp - diff --git a/doc/src/snippets/declarative/graphicswidgets/main.qml b/doc/src/snippets/declarative/graphicswidgets/main.qml deleted file mode 100644 index ffcf79d..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/main.qml +++ /dev/null @@ -1,32 +0,0 @@ -import Qt 4.7 -import Qt.widgets 4.7 - -Rectangle { - width: 200 - height: 200 - - RedSquare { - id: square - width: 80 - height: 80 - } - - BlueCircle { - anchors.left: square.right - width: 80 - height: 80 - } - - QGraphicsWidget { - anchors.top: square.bottom - size.width: 80 - size.height: 80 - layout: QGraphicsLinearLayout { - LayoutItem { - preferredSize: "100x100" - Rectangle { color: "yellow"; anchors.fill: parent } - } - } - } -} - diff --git a/doc/src/snippets/declarative/graphicswidgets/qmldir b/doc/src/snippets/declarative/graphicswidgets/qmldir deleted file mode 100644 index f94dad2..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin graphicswidgets lib diff --git a/doc/src/snippets/declarative/graphicswidgets/redsquare.h b/doc/src/snippets/declarative/graphicswidgets/redsquare.h deleted file mode 100644 index 3050662..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/redsquare.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -#include -#include - -class RedSquare : public QGraphicsWidget -{ - Q_OBJECT -public: - void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) - { - painter->fillRect(0, 0, size().width(), size().height(), QColor(Qt::red)); - } -}; -//![0] diff --git a/doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp b/doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp deleted file mode 100644 index 4c18ef3..0000000 --- a/doc/src/snippets/declarative/graphicswidgets/shapesplugin.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -//![0] -#include "redsquare.h" -#include "bluecircle.h" - -#include -#include - -class ShapesPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT -public: - void registerTypes(const char *uri) { - qmlRegisterType(uri, 1, 0, "RedSquare"); - qmlRegisterType(uri, 1, 0, "BlueCircle"); - } -}; - -#include "shapesplugin.moc" - -Q_EXPORT_PLUGIN2(shapesplugin, ShapesPlugin); -//![0] -- cgit v0.12 From 34f9f08dd290710512fb7dc8a4d473b6e08c84b4 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 12 May 2010 11:40:23 +1000 Subject: Remove unused image --- .../images/declarative-integrating-graphicswidgets.png | Bin 1061 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 doc/src/images/declarative-integrating-graphicswidgets.png diff --git a/doc/src/images/declarative-integrating-graphicswidgets.png b/doc/src/images/declarative-integrating-graphicswidgets.png deleted file mode 100644 index d57f4b9..0000000 Binary files a/doc/src/images/declarative-integrating-graphicswidgets.png and /dev/null differ -- cgit v0.12 From f303375383ff405afbbe78ec2c951f2e24a121be Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 12 May 2010 10:36:34 +1000 Subject: Apply signal handler changes immediately. Fix regression in bindinganimation visual test introduced in 129940723d9145a4380f7e44c06cbaa88ee4053b. --- src/declarative/util/qdeclarativepropertychanges.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 94780c4..a22c756 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -161,20 +161,15 @@ public: QDeclarativeExpression *rewindExpression; QDeclarativeGuard ownedExpression; - virtual bool changesBindings() { return true; } - virtual void clearBindings() { - ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, 0); - } - virtual void execute(Reason) { - QDeclarativePropertyPrivate::setSignalExpression(property, expression); + ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, expression); if (ownedExpression == expression) ownedExpression = 0; } virtual bool isReversable() { return true; } virtual void reverse(Reason) { - QDeclarativePropertyPrivate::setSignalExpression(property, reverseExpression); + ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, reverseExpression); if (ownedExpression == reverseExpression) ownedExpression = 0; } @@ -198,7 +193,7 @@ public: } virtual void rewind() { - QDeclarativePropertyPrivate::setSignalExpression(property, rewindExpression); + ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, rewindExpression); if (ownedExpression == rewindExpression) ownedExpression = 0; } -- cgit v0.12 From 43db14d83279566cdd5626321251efc5da8acc1d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 12 May 2010 11:06:55 +1000 Subject: Correctly resize TextInput in the presence of preedit text. Task-number: QTBUG-10466 Reviewed-by: alexis --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 604f508..4d89887 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1233,9 +1233,7 @@ void QDeclarativeTextInput::updateSize(bool needsRedraw) int cursorWidth = d->control->cursorWidth(); if(d->cursorItem) cursorWidth = d->cursorItem->width(); - //### Is QFontMetrics too slow? - QFontMetricsF fm(d->font); - setImplicitWidth(fm.width(d->control->displayText())+cursorWidth); + setImplicitWidth(d->control->naturalTextWidth() + cursorWidth); setContentsSize(QSize(width(), height()));//Repaints if changed if(w==width() && h==height() && needsRedraw){ clearCache(); -- cgit v0.12 From 7827b791828c3efa96143ed7a9af354883c8d926 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 12 May 2010 11:14:39 +1000 Subject: Correctly position any input method popups for TextInput. Reviewed-by: alexis --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 4d89887..8f86aa0 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1018,6 +1018,8 @@ QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property) { Q_D(const QDeclarativeTextInput); switch(property) { + case Qt::ImMicroFocus: + return d->control->cursorRect(); case Qt::ImFont: return font(); case Qt::ImCursorPosition: -- cgit v0.12 From 5e843ec092e2d236bd51f015b136db3fca5c10ba Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 12 May 2010 11:46:15 +1000 Subject: Bail out early if the same target value is reassigned to a Behavior. Task-number: QTBUG-10586 Reviewed-by: leo --- src/declarative/util/qdeclarativebehavior.cpp | 6 + .../animation/qtbug10586/data/qtbug10586.0.png | Bin 0 -> 1149 bytes .../animation/qtbug10586/data/qtbug10586.1.png | Bin 0 -> 1173 bytes .../animation/qtbug10586/data/qtbug10586.2.png | Bin 0 -> 1173 bytes .../animation/qtbug10586/data/qtbug10586.3.png | Bin 0 -> 1149 bytes .../animation/qtbug10586/data/qtbug10586.qml | 1151 ++++++++++++++++++++ .../qmlvisual/animation/qtbug10586/qtbug10586.qml | 27 + tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp | 5 +- 8 files changed, 1187 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.0.png create mode 100644 tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.1.png create mode 100644 tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.2.png create mode 100644 tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.3.png create mode 100644 tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.qml create mode 100644 tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index ba90007..90e0ca3 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -62,6 +62,7 @@ public: QDeclarativeProperty property; QVariant currentValue; + QVariant targetValue; QDeclarativeGuard animation; bool enabled; bool finalized; @@ -162,10 +163,15 @@ void QDeclarativeBehavior::write(const QVariant &value) qmlExecuteDeferred(this); if (!d->animation || !d->enabled || !d->finalized) { QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + d->targetValue = value; return; } + if (value == d->targetValue) + return; + d->currentValue = d->property.read(); + d->targetValue = value; if (d->animation->qtAnimation()->duration() != -1) d->animation->qtAnimation()->stop(); diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.0.png b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.0.png new file mode 100644 index 0000000..d8be67b Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.0.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.1.png b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.1.png new file mode 100644 index 0000000..249e0dd Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.1.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.2.png b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.2.png new file mode 100644 index 0000000..044f823 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.2.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.3.png b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.3.png new file mode 100644 index 0000000..d8be67b Binary files /dev/null and b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.3.png differ diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.qml b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.qml new file mode 100644 index 0000000..dc8e2e2 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.qml @@ -0,0 +1,1151 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 32 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 48 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 64 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 80 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 96 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 112 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 128 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 144 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 160 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 176 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 192 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 208 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 224 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 240 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 256 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 272 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 288 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 304 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 320 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 336 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 352 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 368 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 384 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 400 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 416 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 432 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 448 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 464 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 480 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 496 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 512 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 528 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 544 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 560 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 576 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 592 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 608 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 624 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 640 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 656 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 672 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 688 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 704 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 720 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 736 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 752 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 768 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 784 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 800 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 816 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 832 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 848 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 864 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 880 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 896 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 912 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 928 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 944 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 960 + image: "qtbug10586.0.png" + } + Frame { + msec: 976 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 992 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1008 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1024 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1040 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1056 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1072 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1088 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1104 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1120 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1136 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1152 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1168 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1184 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1200 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1216 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1232 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1248 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1264 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1280 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1296 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1312 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 174; y: 204 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1328 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1344 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1360 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1376 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1392 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 170; y: 204 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1408 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 156; y: 204 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1424 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1440 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 130; y: 204 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 130; y: 204 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1456 + hash: "8b7dd0f0a3881f10d76b47cbec4754c3" + } + Frame { + msec: 1472 + hash: "b6fc4990acb245e015c35261a3c6fd75" + } + Frame { + msec: 1488 + hash: "849fa4174134804dadc000323141b341" + } + Frame { + msec: 1504 + hash: "35f2d6405ed7d992bb62eb6e24478492" + } + Frame { + msec: 1520 + hash: "673ebb4499522c3f27b775dff1dbbe44" + } + Frame { + msec: 1536 + hash: "96945f5489ffd0dc8ab995c96eb5da43" + } + Frame { + msec: 1552 + hash: "2e4543754429ac3db831a2432098c063" + } + Frame { + msec: 1568 + hash: "02253fe8a9fd5009a07265c2c6ffc8e4" + } + Frame { + msec: 1584 + hash: "200a89949df1e9ef58d005a139857d2c" + } + Frame { + msec: 1600 + hash: "ceb28be34c7ea8eff5fa00fdea087439" + } + Frame { + msec: 1616 + hash: "a9ece475c51f126094c5eff4e20f4a19" + } + Frame { + msec: 1632 + hash: "aa0776f84aef87d6971affdfa2d8dd82" + } + Frame { + msec: 1648 + hash: "4c74661e1c73fefc9c5154b257239352" + } + Frame { + msec: 1664 + hash: "c10d23df3a75966aad5016bd8ba8e9d8" + } + Frame { + msec: 1680 + hash: "41692977d654a55d3b1d037aea9f2c03" + } + Frame { + msec: 1696 + hash: "2f1835a1de94f962eb5dc781c85b4c32" + } + Frame { + msec: 1712 + hash: "7cb78e2e5f6d35d456c95f2bd8652eb5" + } + Frame { + msec: 1728 + hash: "4388aee9b1c8b4fde43634ad08f03557" + } + Frame { + msec: 1744 + hash: "1cdc71100fd11cb6e60c9ab7e65e95bf" + } + Frame { + msec: 1760 + hash: "feddbf269adfc8bb1b1a3656b5b5736d" + } + Frame { + msec: 1776 + hash: "76b39ce0ee9b9b4af8aa0141577b8460" + } + Frame { + msec: 1792 + hash: "bac963d3df2841ab7a3770a371f3a94d" + } + Frame { + msec: 1808 + hash: "403007bb6c0782fece1cedbd40994550" + } + Frame { + msec: 1824 + hash: "72076c743fdd33fab2ac789c7c22973a" + } + Frame { + msec: 1840 + hash: "662be553c32b0145b3f4fee9bb0d659d" + } + Frame { + msec: 1856 + hash: "e6b9049949a0ee4ff8a0fcaf5464f479" + } + Frame { + msec: 1872 + hash: "eb1939458851780b7bb51ee50f0a3bd7" + } + Frame { + msec: 1888 + hash: "41c8d2686ddb882981a7d3a5c8c69005" + } + Frame { + msec: 1904 + hash: "7d3b1fc34082a160cbea4409af85fc9c" + } + Frame { + msec: 1920 + image: "qtbug10586.1.png" + } + Frame { + msec: 1936 + hash: "17be4a9c3d4d19e93bf1fc3a13a374a2" + } + Frame { + msec: 1952 + hash: "d449593024a59487eb92195ee6b77a64" + } + Frame { + msec: 1968 + hash: "c6ccbc2acec8e32f043f2cfb7b7848a9" + } + Frame { + msec: 1984 + hash: "cef9f8e8cdd5e2d33b86a9a6fb64ecb4" + } + Frame { + msec: 2000 + hash: "2a8956de5ce417431bdb156144985370" + } + Frame { + msec: 2016 + hash: "73721425a9c658bd9d40eac3fcbe8e25" + } + Frame { + msec: 2032 + hash: "9a9cf8eee0bf2f09944a4fb3b1c139d5" + } + Frame { + msec: 2048 + hash: "3673cdee04343ce679ec2cebadc9f512" + } + Frame { + msec: 2064 + hash: "eedd62019867e3189f9cf6e2b4149c6d" + } + Frame { + msec: 2080 + hash: "7a66bc37f5cf917e8b121003af0530b0" + } + Frame { + msec: 2096 + hash: "401667ed0f38858553de27164e9cadb5" + } + Frame { + msec: 2112 + hash: "b391699437c4092de3ad1684a35bfd30" + } + Frame { + msec: 2128 + hash: "109c91215f075292910095a25eaded49" + } + Frame { + msec: 2144 + hash: "c44d3f6ce1fa1ab324dd9ef394f37f87" + } + Frame { + msec: 2160 + hash: "299d43cb3dcf7b95af8803df3eb17a46" + } + Frame { + msec: 2176 + hash: "7ddd97266383d954a008fbe7b95a3169" + } + Frame { + msec: 2192 + hash: "941f2837ff5145a26df9a0d9f6d20bd9" + } + Frame { + msec: 2208 + hash: "d99d76cba43f3ae953605d7732d6ce21" + } + Frame { + msec: 2224 + hash: "929f49416f7ca80d7f5f2be3b13b849e" + } + Frame { + msec: 2240 + hash: "929f49416f7ca80d7f5f2be3b13b849e" + } + Frame { + msec: 2256 + hash: "fff9bbf16d1c3f7510ddfc44af616a5e" + } + Frame { + msec: 2272 + hash: "70b6cdb95ad6723d18c623e1dc79a8db" + } + Frame { + msec: 2288 + hash: "70b6cdb95ad6723d18c623e1dc79a8db" + } + Frame { + msec: 2304 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2320 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2336 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2352 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2368 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2384 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2400 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2416 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2432 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2448 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2464 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2480 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2496 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2512 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2528 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2544 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2560 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2576 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2592 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2608 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2624 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2640 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2656 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2672 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2688 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2704 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2720 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2736 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 29; y: 239 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2752 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2768 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2784 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2800 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2816 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 35; y: 241 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2832 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 63; y: 243 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2848 + hash: "2732b282b8ac482033694cd04c6f5b7e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 106; y: 244 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2864 + hash: "7d253797885f8b304d8fb3ba727a3c5d" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 158; y: 243 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 158; y: 243 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2880 + image: "qtbug10586.2.png" + } + Frame { + msec: 2896 + hash: "d85a416e4ddf59dfd0723b0be0e2b418" + } + Frame { + msec: 2912 + hash: "f1934f6ca6a3c5ac5df3451596b8d8ba" + } + Frame { + msec: 2928 + hash: "28fc74a76f9eaeeccbd3063dc55a1000" + } + Frame { + msec: 2944 + hash: "eb8ad8dae734b624664fcf584cda6ba0" + } + Frame { + msec: 2960 + hash: "a6d0f4aba3e5ae1e003520f45b75d6dd" + } + Frame { + msec: 2976 + hash: "4e5a4d04dfa5f06292774e6bf4f86508" + } + Frame { + msec: 2992 + hash: "fc9e16fd8c7379d774a09fe50d4259dc" + } + Frame { + msec: 3008 + hash: "721ea322d9a5e9d48117336476f568cb" + } + Frame { + msec: 3024 + hash: "5930448341bce1c50de7acaba1f64ca1" + } + Frame { + msec: 3040 + hash: "7194bacd56906f83948844224ce6a3e7" + } + Frame { + msec: 3056 + hash: "fcf11cf70b8ac210d4bb2bc716942053" + } + Frame { + msec: 3072 + hash: "767d707db4dbb02b6f97153b3822a1d1" + } + Frame { + msec: 3088 + hash: "f8eb75b97f5233aa82b887aab34a38e3" + } + Frame { + msec: 3104 + hash: "1d3beb06b39fa1d5cabd31ec4297f59f" + } + Frame { + msec: 3120 + hash: "cadc775e0764afa7b50c5bab782035dd" + } + Frame { + msec: 3136 + hash: "385f5a6e80da0d3ddf24539a64f26eb9" + } + Frame { + msec: 3152 + hash: "34204871a684ea251c9d07fb125436da" + } + Frame { + msec: 3168 + hash: "bc3e496535e66ff0d1e800092b7c78ca" + } + Frame { + msec: 3184 + hash: "d6c4ff5bf223361be42c78d6d81248c3" + } + Frame { + msec: 3200 + hash: "cb09d41612df66a8d099153026adcbf3" + } + Frame { + msec: 3216 + hash: "f82180b8c0389ddc3623107a049c3366" + } + Frame { + msec: 3232 + hash: "1b0f65e4599c65b8a603abd8da718d48" + } + Frame { + msec: 3248 + hash: "897391a8206178356858139b3d1a4ce8" + } + Frame { + msec: 3264 + hash: "b66d268dc7a42a7b1172b1ff566f4eb8" + } + Frame { + msec: 3280 + hash: "0fe5d38a253dbd1ebcc67cca7ea86dc7" + } + Frame { + msec: 3296 + hash: "b788f8a7e1e42f768fd1fe1198ca0344" + } + Frame { + msec: 3312 + hash: "4f7f8b7f5bb78bb9327b6fa8142ce3a2" + } + Frame { + msec: 3328 + hash: "30f041278c08174671568a0dfb7cbdf7" + } + Frame { + msec: 3344 + hash: "6ecd90fc89ab9b6c4813fa6a6e9dffdb" + } + Frame { + msec: 3360 + hash: "6ecd90fc89ab9b6c4813fa6a6e9dffdb" + } + Frame { + msec: 3376 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3392 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3408 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3424 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3440 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3456 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3472 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3488 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3504 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3520 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3536 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3552 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3568 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3584 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3600 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3616 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3632 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3648 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3664 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3680 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3696 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3712 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3728 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3744 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3760 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3776 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3792 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3808 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3824 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3840 + image: "qtbug10586.3.png" + } + Frame { + msec: 3856 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3872 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3888 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3904 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3920 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3936 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3952 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3968 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3984 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4000 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4016 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4032 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4048 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4064 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 4080 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4096 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4112 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4128 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4144 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4160 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4176 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4192 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml b/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml new file mode 100644 index 0000000..f1a3ef7 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml @@ -0,0 +1,27 @@ +import Qt 4.7 + +Rectangle { + width: 200 + height: 400 + Flickable { + id: flick + anchors.fill: parent + contentWidth: 1000; contentHeight: parent.height + Rectangle { + border.color: "black" + border.width: 10 + width: 1000; height: 1000 + rotation: 90 + gradient: Gradient { + GradientStop { position: 0; color: "black" } + GradientStop { position: 1; color: "white" } + } + } + } + Rectangle { + color: "red" + width: 100; height: 100 + y: flick.contentX < 10 ? 300 : 0 + Behavior on y { NumberAnimation {} } + } +} diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index 5f25882..0f33a07 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -101,9 +101,8 @@ void tst_qmlvisual::visual_data() files << findQmlFiles(QDir(QT_TEST_SOURCE_DIR)); else { //these are newly added tests we want to try out in CI (then move to the stable list) - files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/borders.qml"; + files << QT_TEST_SOURCE_DIR "/animation/qtbug10586/qtbug10586.qml"; files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/animated.qml"; - files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/animated-smooth.qml"; files << QT_TEST_SOURCE_DIR "/qdeclarativeflipable/test-flipable.qml"; files << QT_TEST_SOURCE_DIR "/qdeclarativepositioners/usingRepeater.qml"; @@ -123,6 +122,8 @@ void tst_qmlvisual::visual_data() //these reliably fail in CI, for unknown reasons //files << QT_TEST_SOURCE_DIR "/animation/easing/easing.qml"; //files << QT_TEST_SOURCE_DIR "/animation/pauseAnimation/pauseAnimation-visual.qml"; + //files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/borders.qml"; + //files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/animated-smooth.qml"; //these reliably fail on Linux because of color interpolation (different float rounding) #if !defined(Q_WS_X11) && !defined(Q_WS_QWS) -- cgit v0.12 From 84ae0d5c700b9b7396585301e7ef129ee0a2696d Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 12 May 2010 13:17:13 +1000 Subject: Sorted the tests list in declarative.pro Also removed the #Cover tag, which is not used anymore. --- tests/auto/declarative/declarative.pro | 130 ++++++++++++++++----------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index a9b069c..2520bcd 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -1,74 +1,74 @@ TEMPLATE = subdirs SUBDIRS += \ examples \ - parserstress \ # Cover - qmetaobjectbuilder \ # Cover - qdeclarativeanimations \ # Cover - qdeclarativebehaviors \ # Cover - qdeclarativebinding \ # Cover - qdeclarativecomponent \ # Cover - qdeclarativeconnection \ # Cover - qdeclarativecontext \ # Cover - qdeclarativedebug \ # Cover - qdeclarativedebugclient \ # Cover - qdeclarativedebugservice \ # Cover - qdeclarativedom \ # Cover - qdeclarativeecmascript \ # Cover - qdeclarativeengine \ # Cover - qdeclarativeerror \ # Cover - qdeclarativefontloader \ # Cover - qdeclarativeanchors \ # Cover - qdeclarativeanimatedimage \ # Cover - qdeclarativeimage \ # Cover - qdeclarativeborderimage \ # Cover - qdeclarativeflickable \ # Cover - qdeclarativeflipable \ # Cover - qdeclarativefocusscope \ # Cover - qdeclarativegridview \ # Cover - qdeclarativeitem \ # Cover - qdeclarativelistview \ # Cover - qdeclarativeloader \ # Cover - qdeclarativemousearea \ # Cover - qdeclarativeparticles \ # Cover - qdeclarativepathview \ # Cover - qdeclarativepositioners \ # Cover - qdeclarativetext \ # Cover - qdeclarativetextedit \ # Cover - qdeclarativetextinput \ # Cover - qdeclarativeinfo \ # Cover - qdeclarativeinstruction \ # Cover - qdeclarativelanguage \ # Cover - qdeclarativelistreference \ # Cover - qdeclarativelistmodel \ # Cover - qdeclarativeproperty \ # Cover - qdeclarativemetatype \ # Cover - qdeclarativemoduleplugin \ # Cover - qdeclarativepixmapcache \ # Cover - qdeclarativepropertymap \ # Cover - qdeclarativeqt \ # Cover - qdeclarativesmoothedanimation \ # Cover - qdeclarativesmoothedfollow\ # Cover - qdeclarativespringfollow \ # Cover - qdeclarativestates \ # Cover - qdeclarativesystempalette \ # Cover - qdeclarativetimer \ # Cover - qdeclarativexmllistmodel \ # Cover - qpacketprotocol \ # Cover - qdeclarativerepeater \ # Cover - qdeclarativeworkerscript \ # Cover - qdeclarativevaluetypes \ # Cover - qdeclarativeview \ # Cover - qdeclarativexmlhttprequest \ # Cover - qdeclarativeimageprovider \ # Cover - qdeclarativestyledtext \ # Cover - qdeclarativesqldatabase \ # Cover - qdeclarativevisualdatamodel \ # Cover - qdeclarativeviewer \ # Cover - qmlvisual # Cover + parserstress \ + qdeclarativeanchors \ + qdeclarativeanimatedimage \ + qdeclarativeanimations \ + qdeclarativebehaviors \ + qdeclarativebinding \ + qdeclarativeborderimage \ + qdeclarativecomponent \ + qdeclarativeconnection \ + qdeclarativecontext \ + qdeclarativedebug \ + qdeclarativedebugclient \ + qdeclarativedebugservice \ + qdeclarativedom \ + qdeclarativeecmascript \ + qdeclarativeengine \ + qdeclarativeerror \ + qdeclarativefontloader \ + qdeclarativeflickable \ + qdeclarativeflipable \ + qdeclarativefocusscope \ + qdeclarativegridview \ + qdeclarativeimage \ + qdeclarativeimageprovider \ + qdeclarativeinfo \ + qdeclarativeinstruction \ + qdeclarativeitem \ + qdeclarativelanguage \ + qdeclarativelistmodel \ + qdeclarativelistreference \ + qdeclarativelistview \ + qdeclarativeloader \ + qdeclarativemetatype \ + qdeclarativemoduleplugin \ + qdeclarativemousearea \ + qdeclarativeparticles \ + qdeclarativepathview \ + qdeclarativepixmapcache \ + qdeclarativepositioners \ + qdeclarativeproperty \ + qdeclarativepropertymap \ + qdeclarativeqt \ + qdeclarativerepeater \ + qdeclarativesmoothedanimation \ + qdeclarativesmoothedfollow\ + qdeclarativespringfollow \ + qdeclarativesqldatabase \ + qdeclarativestates \ + qdeclarativestyledtext \ + qdeclarativesystempalette \ + qdeclarativetext \ + qdeclarativetextedit \ + qdeclarativetextinput \ + qdeclarativetimer \ + qdeclarativevaluetypes \ + qdeclarativeview \ + qdeclarativeviewer \ + qdeclarativevisualdatamodel \ + qdeclarativeworkerscript \ + qdeclarativexmlhttprequest \ + qdeclarativexmllistmodel \ + qmlvisual \ + qpacketprotocol \ + qmetaobjectbuilder contains(QT_CONFIG, webkit) { SUBDIRS += \ - qdeclarativewebview # Cover + qdeclarativewebview } # Tests which should run in Pulse -- cgit v0.12 From 9e84653e20b20ea32a789deaef9d5d4acd5d68ea Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 12 May 2010 13:21:16 +1000 Subject: Add missing test, qdeclarativelayoutitem, to declarative.pro --- tests/auto/declarative/declarative.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 2520bcd..3496906 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -29,6 +29,7 @@ SUBDIRS += \ qdeclarativeinstruction \ qdeclarativeitem \ qdeclarativelanguage \ + qdeclarativelayoutitem \ qdeclarativelistmodel \ qdeclarativelistreference \ qdeclarativelistview \ -- cgit v0.12 From d412a77d1e9a1c6810e10dfa4a0a35a81391cf29 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 12 May 2010 13:27:55 +1000 Subject: Use raster graphicssystem for qml.app on OS X. Task-number: QTBUG-10544 --- tools/qml/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 116ca71..003716e 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -184,7 +184,7 @@ int main(int argc, char ** argv) atexit(showWarnings); #endif -#if defined (Q_WS_X11) +#if defined (Q_WS_X11) || defined(Q_WS_MAC) //### default to using raster graphics backend for now bool gsSpecified = false; for (int i = 0; i < argc; ++i) { -- cgit v0.12 From 1e992df9dfa4abcd5073f94da765c5e47b2f0319 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 12 May 2010 12:20:00 +1000 Subject: Stop GIF handler claiming it can report Size for sequential devices, since it scans the entire image to do so (and then can't read the image). Task-number: QTBUG-10621 --- src/plugins/imageformats/gif/qgifhandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index 25d3dfa..8abc2d1 100644 --- a/src/plugins/imageformats/gif/qgifhandler.cpp +++ b/src/plugins/imageformats/gif/qgifhandler.cpp @@ -1119,8 +1119,11 @@ bool QGifHandler::write(const QImage &image) bool QGifHandler::supportsOption(ImageOption option) const { - return option == Size - || option == Animation; + if (!device() || device()->isSequential()) + return option == Animation; + else + return option == Size + || option == Animation; } QVariant QGifHandler::option(ImageOption option) const -- cgit v0.12 From b3a06e47bc66c36de8558ab7bc9817ed2518ae9c Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 12 May 2010 13:18:32 +1000 Subject: Don't pass sequential (QNetworkReply) to image reader, it doesn't work well enough. Work around QTBUG-10622 --- src/declarative/util/qdeclarativepixmapcache.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index dbca326..d9ce42c 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -342,7 +343,10 @@ void QDeclarativeImageRequestHandler::networkRequestDone() errorString = reply->errorString(); } else { QSize read_impsize; - if (readImage(reply->url(), reply, &image, &errorString, &read_impsize, job->forcedWidth(), job->forcedHeight())) { + QByteArray all = reply->readAll(); + QBuffer buff(&all); + buff.open(QIODevice::ReadOnly); + if (readImage(reply->url(), &buff, &image, &errorString, &read_impsize, job->forcedWidth(), job->forcedHeight())) { qmlOriginalSizes()->insert(reply->url(), read_impsize); error = QDeclarativeImageReaderEvent::NoError; } else { -- cgit v0.12 From 29450fd82c2c8efdc296a051f6a8fac2bd3fa76a Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 12 May 2010 13:56:44 +1000 Subject: Avoid warning (and possible future crash) upon reload. Task-number: QTBUG-10555 --- src/declarative/util/qdeclarativexmllistmodel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index f02ed16..f1a00989 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -796,8 +796,11 @@ void QDeclarativeXmlListModel::reload() if (d->reply) { d->reply->abort(); - d->reply->deleteLater(); - d->reply = 0; + if (d->reply) { + // abort will generally have already done this (and more) + d->reply->deleteLater(); + d->reply = 0; + } } if (!d->xml.isEmpty()) { -- cgit v0.12 From 798bdb4543f84d427659b950a3a1643ae4987b8b Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 12 May 2010 07:12:34 +0200 Subject: Reset the dragDropItem to 0 when the item dies while dragging on top it. If you drag something on top of an item and the former is deleted then we need to reset the dragDropItem pointer to 0. Task-number:KDE BUG 232182 Reviewed-by:leo --- src/gui/graphicsview/qgraphicsscene.cpp | 4 ++++ tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 0d4e48a..dacdbfe 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -690,6 +690,10 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) if (item == lastMouseGrabberItem) lastMouseGrabberItem = 0; + // Reset the current drop item + if (item == dragDropItem) + dragDropItem = 0; + // Reenable selectionChanged() for individual items --selectionChanging; if (!selectionChanging && selectedItems.size() != oldSelectedItemsSize) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 81097be..5a5a821 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -447,6 +448,7 @@ private slots: void QT_2649_focusScope(); void sortItemsWhileAdding(); void doNotMarkFullUpdateIfNotInScene(); + void itemDiesDuringDraggingOperation(); private: QList paintedItems; @@ -10484,5 +10486,27 @@ void tst_QGraphicsItem::doNotMarkFullUpdateIfNotInScene() QTRY_COMPARE(item3->painted, 3); } +void tst_QGraphicsItem::itemDiesDuringDraggingOperation() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 100, 100)); + item->setFlag(QGraphicsItem::ItemIsMovable); + item->setAcceptDrops(true); + scene.addItem(item); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view); + QGraphicsSceneDragDropEvent dragEnter(QEvent::GraphicsSceneDragEnter); + dragEnter.setScenePos(item->boundingRect().center()); + QApplication::sendEvent(&scene, &dragEnter); + QGraphicsSceneDragDropEvent event(QEvent::GraphicsSceneDragMove); + event.setScenePos(item->boundingRect().center()); + QApplication::sendEvent(&scene, &event); + QVERIFY(QGraphicsScenePrivate::get(&scene)->dragDropItem == item); + delete item; + QVERIFY(QGraphicsScenePrivate::get(&scene)->dragDropItem == 0); +} QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v0.12 From 71187a1f0d26ff61c033a7c2d46892f48816fc45 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 11 May 2010 13:33:48 +1000 Subject: Flickable small API changes. - Split moving into movingHorizontally anf movingVertically - Split flicking into flickingHorizontally and flickingVertically - Rename flickDirection to flickableDirection - onMovementStarted, onMovementEnded, onFlickStarted and onFlickEnded signals removed Task-number: QTBUG-10572 Reviewed-by: Martin Jones --- demos/declarative/flickr/common/ScrollBar.qml | 2 +- demos/declarative/flickr/mobile/ImageDetails.qml | 4 +- demos/declarative/webbrowser/content/ScrollBar.qml | 2 +- demos/declarative/webbrowser/webbrowser.qml | 14 +- examples/declarative/listview/dynamic.qml | 2 +- examples/declarative/scrollbar/display.qml | 2 +- src/declarative/QmlChanges.txt | 7 +- .../graphicsitems/qdeclarativeflickable.cpp | 213 ++++++++++++--------- .../graphicsitems/qdeclarativeflickable_p.h | 43 +++-- .../graphicsitems/qdeclarativeflickable_p_p.h | 10 +- .../graphicsitems/qdeclarativegridview.cpp | 44 +++-- .../graphicsitems/qdeclarativelistview.cpp | 42 ++-- .../tst_qdeclarativeflickable.cpp | 28 +++ 13 files changed, 257 insertions(+), 156 deletions(-) diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml index 4022d23..d70cd3c 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/common/ScrollBar.qml @@ -19,7 +19,7 @@ Item { states: [ State { name: "show" - when: flickableArea.moving + when: flickableArea.movingVertically PropertyChanges { target: container opacity: 1 diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index caf1571..79d7cab 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -70,7 +70,7 @@ Flipable { Image { id: bigImage; source: container.photoUrl; scale: slider.value - anchors.centerIn: parent; smooth: !flickable.moving + anchors.centerIn: parent; smooth: !flickable.movingVertically onStatusChanged : { // Default scale shows the entire image. if (status == Image.Ready && width != 0) { @@ -119,7 +119,7 @@ Flipable { SequentialAnimation { PropertyAction { target: bigImage; property: "smooth"; value: false } NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: 500 } - PropertyAction { target: bigImage; property: "smooth"; value: !flickable.moving } + PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically } } } } diff --git a/demos/declarative/webbrowser/content/ScrollBar.qml b/demos/declarative/webbrowser/content/ScrollBar.qml index 976297b..aa79d35 100644 --- a/demos/declarative/webbrowser/content/ScrollBar.qml +++ b/demos/declarative/webbrowser/content/ScrollBar.qml @@ -55,7 +55,7 @@ Item { states: State { name: "visible" - when: scrollArea.moving + when: container.orientation == Qt.Vertical ? scrollArea.movingVertically : scrollArea.movingHorizontally PropertyChanges { target: container; opacity: 1.0 } } diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index 27da814..f539e21 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -15,13 +15,9 @@ Rectangle { id: webView url: webBrowser.urlString anchors { top: headerSpace.bottom; left: parent.left; right: parent.right; bottom: parent.bottom } - } - Item { - id: headerSpace - width: parent.width; height: 62 - } + Item { id: headerSpace; width: parent.width; height: 62 } Header { id: header @@ -34,8 +30,8 @@ Rectangle { anchors { right: parent.right; top: header.bottom; bottom: parent.bottom } } -// ScrollBar { -// scrollArea: webView; height: 8; orientation: Qt.Horizontal -// anchors { right: parent.right; rightMargin: 8; left: parent.left; bottom: parent.bottom } -// } + ScrollBar { + scrollArea: webView; height: 8; orientation: Qt.Horizontal + anchors { right: parent.right; rightMargin: 8; left: parent.left; bottom: parent.bottom } + } } diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml index 9b05ad5..64f324e 100644 --- a/examples/declarative/listview/dynamic.qml +++ b/examples/declarative/listview/dynamic.qml @@ -151,7 +151,7 @@ Rectangle { // Only show the scrollbar when the view is moving. states: State { - name: "ShowBars"; when: view.moving + name: "ShowBars"; when: view.movingVertically PropertyChanges { target: verticalScrollBar; opacity: 1 } } transitions: Transition { diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index b8a5e36..6b12d85 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -20,7 +20,7 @@ Rectangle { // Only show the scrollbars when the view is moving. states: State { name: "ShowBars" - when: view.moving + when: view.movingVertically || view.movingHorizontally PropertyChanges { target: verticalScrollBar; opacity: 1 } PropertyChanges { target: horizontalScrollBar; opacity: 1 } } diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 9f618d8..9ab3f08 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,7 +1,12 @@ ============================================================================= The changes below are pre Qt 4.7.0 RC -Flickable: overShoot is replaced by boundsBehavior enumeration. +Flickable: + - overShoot is replaced by boundsBehavior enumeration + - flicking is replaced by flickingHorizontally and flickingVertically + - moving is replaced by movingHorizontally and movingVertically + - flickDirection is renamed flickableDirection + - onMovementStarted, onMovementEnded, onFlickStarted and onFlickEnded signals removed Component: isReady, isLoading, isError and isNull properties removed, use status property instead QList models no longer provide properties in model object. The diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 34b0606..a7a8983 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -125,12 +125,14 @@ QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate() : viewport(new QDeclarativeItem) , hData(this, &QDeclarativeFlickablePrivate::setRoundedViewportX) , vData(this, &QDeclarativeFlickablePrivate::setRoundedViewportY) - , flicked(false), moving(false), stealMouse(false) - , pressed(false) + , flickingHorizontally(false), flickingVertically(false) + , hMoved(false), vMoved(false) + , movingHorizontally(false), movingVertically(false) + , stealMouse(false), pressed(false) , interactive(true), deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100) , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(600) , vTime(0), visibleArea(0) - , flickDirection(QDeclarativeFlickable::AutoFlickDirection) + , flickableDirection(QDeclarativeFlickable::AutoFlickDirection) , boundsBehavior(QDeclarativeFlickable::DragAndOvershootBounds) { } @@ -226,10 +228,15 @@ void QDeclarativeFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal timeline.reset(data.move); timeline.accel(data.move, v, deceleration, maxDistance); timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); - if (!flicked) { - flicked = true; - emit q->flickingChanged(); - emit q->flickStarted(); + if (!flickingHorizontally && q->xflick()) { + flickingHorizontally = true; + emit q->flickingChanged(); // deprecated + emit q->flickingHorizontallyChanged(); + } + if (!flickingVertically && q->yflick()) { + flickingVertically = true; + emit q->flickingChanged(); // deprecated + emit q->flickingVerticallyChanged(); } } else { timeline.reset(data.move); @@ -274,7 +281,6 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal q->viewportMoved(); } } - //emit flickingChanged(); } else if (data.move.value() < maxExtent) { timeline.reset(data.move); if (fixupDuration) { @@ -285,11 +291,7 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal data.move.setValue(maxExtent); q->viewportMoved(); } - //emit flickingChanged(); - } else { - flicked = false; } - vTime = timeline.time(); } @@ -363,37 +365,6 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() */ /*! - \qmlsignal Flickable::onMovementStarted() - - This handler is called when the view begins moving due to user - interaction. -*/ - -/*! - \qmlsignal Flickable::onMovementEnded() - - This handler is called when the view stops moving due to user - interaction. If a flick was generated, this handler will - be triggered once the flick stops. If a flick was not - generated, the handler will be triggered when the - user stops dragging - i.e. a mouse or touch release. -*/ - -/*! - \qmlsignal Flickable::onFlickStarted() - - This handler is called when the view is flicked. A flick - starts from the point that the mouse or touch is released, - while still in motion. -*/ - -/*! - \qmlsignal Flickable::onFlickEnded() - - This handler is called when the view stops moving due to a flick. -*/ - -/*! \qmlproperty real Flickable::visibleArea.xPosition \qmlproperty real Flickable::visibleArea.widthRatio \qmlproperty real Flickable::visibleArea.yPosition @@ -498,12 +469,14 @@ void QDeclarativeFlickable::setInteractive(bool interactive) Q_D(QDeclarativeFlickable); if (interactive != d->interactive) { d->interactive = interactive; - if (!interactive && d->flicked) { + if (!interactive && (d->flickingHorizontally || d->flickingVertically)) { d->timeline.clear(); d->vTime = d->timeline.time(); - d->flicked = false; - emit flickingChanged(); - emit flickEnded(); + d->flickingHorizontally = false; + d->flickingVertically = false; + emit flickingChanged(); // deprecated + emit flickingHorizontallyChanged(); + emit flickingVerticallyChanged(); } emit interactiveChanged(); } @@ -582,7 +555,7 @@ QDeclarativeFlickableVisibleArea *QDeclarativeFlickable::visibleArea() } /*! - \qmlproperty enumeration Flickable::flickDirection + \qmlproperty enumeration Flickable::flickableDirection This property determines which directions the view can be flicked. @@ -596,21 +569,33 @@ QDeclarativeFlickableVisibleArea *QDeclarativeFlickable::visibleArea() \o Flickable.HorizontalAndVerticalFlick - allows flicking in both directions. \endlist */ -QDeclarativeFlickable::FlickDirection QDeclarativeFlickable::flickDirection() const +QDeclarativeFlickable::FlickableDirection QDeclarativeFlickable::flickableDirection() const { Q_D(const QDeclarativeFlickable); - return d->flickDirection; + return d->flickableDirection; } -void QDeclarativeFlickable::setFlickDirection(FlickDirection direction) +void QDeclarativeFlickable::setFlickableDirection(FlickableDirection direction) { Q_D(QDeclarativeFlickable); - if (direction != d->flickDirection) { - d->flickDirection = direction; - emit flickDirectionChanged(); + if (direction != d->flickableDirection) { + d->flickableDirection = direction; + emit flickableDirectionChanged(); } } +QDeclarativeFlickable::FlickableDirection QDeclarativeFlickable::flickDirection() const +{ + qmlInfo(this) << "'flickDirection' is deprecated. Please use 'flickableDirection' instead."; + return flickableDirection(); +} + +void QDeclarativeFlickable::setFlickDirection(FlickableDirection direction) +{ + qmlInfo(this) << "'flickDirection' is deprecated. Please use 'flickableDirection' instead."; + setFlickableDirection(direction); +} + void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) { if (interactive && timeline.isActive() && (qAbs(hData.velocity) > 10 || qAbs(vData.velocity) > 10)) @@ -626,7 +611,8 @@ void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEven pressPos = event->pos(); hData.pressPos = hData.move.value(); vData.pressPos = vData.move.value(); - flicked = false; + flickingHorizontally = false; + flickingVertically = false; QDeclarativeItemPrivate::start(pressTime); QDeclarativeItemPrivate::start(velocityTime); } @@ -638,7 +624,6 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent return; bool rejectY = false; bool rejectX = false; - bool moved = false; if (q->yflick()) { int dy = int(event->pos().y() - pressPos.y()); @@ -660,7 +645,7 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent } if (!rejectY && stealMouse) { vData.move.setValue(qRound(newY)); - moved = true; + vMoved = true; } if (qAbs(dy) > QApplication::startDragDistance()) stealMouse = true; @@ -687,7 +672,7 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent } if (!rejectX && stealMouse) { hData.move.setValue(qRound(newX)); - moved = true; + hMoved = true; } if (qAbs(dx) > QApplication::startDragDistance()) @@ -717,7 +702,7 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent if (rejectY) vData.velocity = 0; if (rejectX) hData.velocity = 0; - if (moved) { + if (hMoved || vMoved) { q->movementStarting(); q->viewportMoved(); } @@ -812,9 +797,9 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) d->vData.velocity = qMax(event->delta() - d->vData.smoothVelocity.value(), qreal(250.0)); else d->vData.velocity = qMin(event->delta() - d->vData.smoothVelocity.value(), qreal(-250.0)); - d->flicked = false; + d->flickingVertically = false; d->flickY(d->vData.velocity); - if (d->flicked) + if (d->flickingVertically) movementStarting(); event->accept(); } else if (xflick()) { @@ -822,9 +807,9 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) d->hData.velocity = qMax(event->delta() - d->hData.smoothVelocity.value(), qreal(250.0)); else d->hData.velocity = qMin(event->delta() - d->hData.smoothVelocity.value(), qreal(-250.0)); - d->flicked = false; + d->flickingHorizontally = false; d->flickX(d->hData.velocity); - if (d->flicked) + if (d->flickingHorizontally) movementStarting(); event->accept(); } else { @@ -1091,7 +1076,7 @@ void QDeclarativeFlickable::setContentWidth(qreal w) else d->viewport->setWidth(w); // Make sure that we're entirely in view. - if (!d->pressed && !d->moving) { + if (!d->pressed && !d->movingHorizontally && !d->movingVertically) { int oldDuration = d->fixupDuration; d->fixupDuration = 0; d->fixupX(); @@ -1118,7 +1103,7 @@ void QDeclarativeFlickable::setContentHeight(qreal h) else d->viewport->setHeight(h); // Make sure that we're entirely in view. - if (!d->pressed && !d->moving) { + if (!d->pressed && !d->movingHorizontally && !d->movingVertically) { int oldDuration = d->fixupDuration; d->fixupDuration = 0; d->fixupY(); @@ -1149,17 +1134,17 @@ qreal QDeclarativeFlickable::vHeight() const bool QDeclarativeFlickable::xflick() const { Q_D(const QDeclarativeFlickable); - if (d->flickDirection == QDeclarativeFlickable::AutoFlickDirection) + if (d->flickableDirection == QDeclarativeFlickable::AutoFlickDirection) return vWidth() != width(); - return d->flickDirection & QDeclarativeFlickable::HorizontalFlick; + return d->flickableDirection & QDeclarativeFlickable::HorizontalFlick; } bool QDeclarativeFlickable::yflick() const { Q_D(const QDeclarativeFlickable); - if (d->flickDirection == QDeclarativeFlickable::AutoFlickDirection) + if (d->flickableDirection == QDeclarativeFlickable::AutoFlickDirection) return vHeight() != height(); - return d->flickDirection & QDeclarativeFlickable::VerticalFlick; + return d->flickableDirection & QDeclarativeFlickable::VerticalFlick; } bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) @@ -1281,16 +1266,30 @@ void QDeclarativeFlickable::setFlickDeceleration(qreal deceleration) emit flickDecelerationChanged(); } +bool QDeclarativeFlickable::isFlicking() const +{ + Q_D(const QDeclarativeFlickable); + qmlInfo(this) << "'flicking' is deprecated. Please use 'flickingHorizontally' and 'flickingVertically' instead."; + return d->flickingHorizontally || d->flickingVertically; +} + /*! - \qmlproperty bool Flickable::flicking + \qmlproperty bool Flickable::flickingHorizontally + \qmlproperty bool Flickable::flickingVertically - This property holds whether the view is currently moving due to - the user flicking the view. + These properties hold whether the view is currently moving horizontally + or vertically due to the user flicking the view. */ -bool QDeclarativeFlickable::isFlicking() const +bool QDeclarativeFlickable::isFlickingHorizontally() const { Q_D(const QDeclarativeFlickable); - return d->flicked; + return d->flickingHorizontally; +} + +bool QDeclarativeFlickable::isFlickingVertically() const +{ + Q_D(const QDeclarativeFlickable); + return d->flickingVertically; } /*! @@ -1319,40 +1318,72 @@ void QDeclarativeFlickable::setPressDelay(int delay) emit pressDelayChanged(); } + +bool QDeclarativeFlickable::isMoving() const +{ + Q_D(const QDeclarativeFlickable); + qmlInfo(this) << "'moving' is deprecated. Please use 'movingHorizontally' or 'movingVertically' instead."; + return d->movingHorizontally || d->movingVertically; +} + /*! - \qmlproperty bool Flickable::moving + \qmlproperty bool Flickable::movingHorizontally + \qmlproperty bool Flickable::movingVertically - This property holds whether the view is currently moving due to - the user either dragging or flicking the view. + These properties hold whether the view is currently moving horizontally + or vertically due to the user either dragging or flicking the view. */ -bool QDeclarativeFlickable::isMoving() const +bool QDeclarativeFlickable::isMovingHorizontally() const +{ + Q_D(const QDeclarativeFlickable); + return d->movingHorizontally; +} + +bool QDeclarativeFlickable::isMovingVertically() const { Q_D(const QDeclarativeFlickable); - return d->moving; + return d->movingVertically; } void QDeclarativeFlickable::movementStarting() { Q_D(QDeclarativeFlickable); - if (!d->moving) { - d->moving = true; - emit movingChanged(); - emit movementStarted(); + if (d->hMoved && !d->movingHorizontally) { + d->movingHorizontally = true; + emit movingChanged(); // deprecated + emit movingHorizontallyChanged(); + } + if (d->vMoved && !d->movingVertically) { + d->movingVertically = true; + emit movingChanged(); // deprecated + emit movingVerticallyChanged(); } } void QDeclarativeFlickable::movementEnding() { Q_D(QDeclarativeFlickable); - if (d->moving) { - d->moving = false; - emit movingChanged(); - emit movementEnded(); + if (d->flickingHorizontally) { + d->flickingHorizontally = false; + emit flickingChanged(); // deprecated + emit flickingHorizontallyChanged(); + } + if (d->flickingVertically) { + d->flickingVertically = false; + emit flickingChanged(); // deprecated + emit flickingVerticallyChanged(); + } + if (d->movingHorizontally) { + d->movingHorizontally = false; + d->hMoved = false; + emit movingChanged(); // deprecated + emit movingHorizontallyChanged(); } - if (d->flicked) { - d->flicked = false; - emit flickingChanged(); - emit flickEnded(); + if (d->movingVertically) { + d->movingVertically = false; + d->vMoved = false; + emit movingChanged(); // deprecated + emit movingVerticallyChanged(); } d->hData.smoothVelocity.setValue(0); d->vData.smoothVelocity.setValue(0); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index f031a24..7944e2b 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -68,9 +68,14 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem Q_PROPERTY(BoundsBehavior boundsBehavior READ boundsBehavior WRITE setBoundsBehavior NOTIFY boundsBehaviorChanged) Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged) Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged) - Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) - Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) - Q_PROPERTY(FlickDirection flickDirection READ flickDirection WRITE setFlickDirection NOTIFY flickDirectionChanged) + Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) // deprecated + Q_PROPERTY(bool movingHorizontally READ isMovingHorizontally NOTIFY movingHorizontallyChanged) + Q_PROPERTY(bool movingVertically READ isMovingVertically NOTIFY movingVerticallyChanged) + Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) // deprecated + Q_PROPERTY(bool flickingHorizontally READ isFlickingHorizontally NOTIFY flickingHorizontallyChanged) + Q_PROPERTY(bool flickingVertically READ isFlickingVertically NOTIFY flickingVerticallyChanged) + Q_PROPERTY(FlickableDirection flickDirection READ flickDirection WRITE setFlickDirection NOTIFY flickableDirectionChanged) // deprecated + Q_PROPERTY(FlickableDirection flickableDirection READ flickableDirection WRITE setFlickableDirection NOTIFY flickableDirectionChanged) Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged) Q_PROPERTY(int pressDelay READ pressDelay WRITE setPressDelay NOTIFY pressDelayChanged) @@ -86,7 +91,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem Q_PROPERTY(QDeclarativeListProperty flickableChildren READ flickableChildren) Q_CLASSINFO("DefaultProperty", "flickableData") - Q_ENUMS(FlickDirection) + Q_ENUMS(FlickableDirection) Q_ENUMS(BoundsBehavior) public: @@ -115,8 +120,12 @@ public: qreal contentY() const; void setContentY(qreal pos); - bool isMoving() const; - bool isFlicking() const; + bool isMoving() const; // deprecated + bool isMovingHorizontally() const; + bool isMovingVertically() const; + bool isFlicking() const; // deprecated + bool isFlickingHorizontally() const; + bool isFlickingVertically() const; int pressDelay() const; void setPressDelay(int delay); @@ -140,26 +149,28 @@ public: QDeclarativeItem *viewport(); - enum FlickDirection { AutoFlickDirection=0x00, HorizontalFlick=0x01, VerticalFlick=0x02, HorizontalAndVerticalFlick=0x03 }; - FlickDirection flickDirection() const; - void setFlickDirection(FlickDirection); + enum FlickableDirection { AutoFlickDirection=0x00, HorizontalFlick=0x01, VerticalFlick=0x02, HorizontalAndVerticalFlick=0x03 }; + FlickableDirection flickDirection() const; // deprecated + void setFlickDirection(FlickableDirection); // deprecated + FlickableDirection flickableDirection() const; + void setFlickableDirection(FlickableDirection); Q_SIGNALS: void contentWidthChanged(); void contentHeightChanged(); void contentXChanged(); void contentYChanged(); - void movingChanged(); - void flickingChanged(); - void movementStarted(); - void movementEnded(); - void flickStarted(); - void flickEnded(); + void movingChanged(); // deprecated + void movingHorizontallyChanged(); + void movingVerticallyChanged(); + void flickingChanged(); // deprecated + void flickingHorizontallyChanged(); + void flickingVerticallyChanged(); void horizontalVelocityChanged(); void verticalVelocityChanged(); void isAtBoundaryChanged(); void pageChanged(); - void flickDirectionChanged(); + void flickableDirectionChanged(); void interactiveChanged(); void overShootChanged(); void boundsBehaviorChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index 01cfb18..b467ed2 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -131,8 +131,12 @@ public: AxisData vData; QDeclarativeTimeLine timeline; - bool flicked : 1; - bool moving : 1; + bool flickingHorizontally : 1; + bool flickingVertically : 1; + bool hMoved : 1; + bool vMoved : 1; + bool movingHorizontally : 1; + bool movingVertically : 1; bool stealMouse : 1; bool pressed : 1; bool interactive : 1; @@ -158,7 +162,7 @@ public: int vTime; QDeclarativeTimeLine velocityTimeline; QDeclarativeFlickableVisibleArea *visibleArea; - QDeclarativeFlickable::FlickDirection flickDirection; + QDeclarativeFlickable::FlickableDirection flickableDirection; QDeclarativeFlickable::BoundsBehavior boundsBehavior; void handleMousePressEvent(QGraphicsSceneMouseEvent *); diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 305d55c..396acd0 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -347,9 +347,10 @@ public: void QDeclarativeGridViewPrivate::init() { Q_Q(QDeclarativeGridView); - QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped())); + QObject::connect(q, SIGNAL(movingHorizontallyChanged()), q, SLOT(animStopped())); + QObject::connect(q, SIGNAL(movingVerticallyChanged()), q, SLOT(animStopped())); q->setFlag(QGraphicsItem::ItemIsFocusScope); - q->setFlickDirection(QDeclarativeFlickable::VerticalFlick); + q->setFlickableDirection(QDeclarativeFlickable::VerticalFlick); addItemChangeListener(this, Geometry); } @@ -692,7 +693,7 @@ void QDeclarativeGridViewPrivate::updateHighlight() { if ((!currentItem && highlight) || (currentItem && !highlight)) createHighlight(); - if (currentItem && autoHighlight && highlight && !moving) { + if (currentItem && autoHighlight && highlight && !movingHorizontally && !movingVertically) { // auto-update highlight highlightXAnimator->to = currentItem->item->x(); highlightYAnimator->to = currentItem->item->y(); @@ -806,7 +807,8 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m Q_Q(QDeclarativeGridView); moveReason = Mouse; - if ((!haveHighlightRange || highlightRange != QDeclarativeGridView::StrictlyEnforceRange) && snapMode == QDeclarativeGridView::NoSnap) { + if ((!haveHighlightRange || highlightRange != QDeclarativeGridView::StrictlyEnforceRange) + && snapMode == QDeclarativeGridView::NoSnap) { QDeclarativeFlickablePrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity); return; } @@ -874,9 +876,16 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m timeline.reset(data.move); timeline.accel(data.move, v, accel, maxDistance + overshootDist); timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); - flicked = true; - emit q->flickingChanged(); - emit q->flickStarted(); + if (!flickingHorizontally && q->xflick()) { + flickingHorizontally = true; + emit q->flickingChanged(); // deprecated + emit q->flickingHorizontallyChanged(); + } + if (!flickingVertically && q->yflick()) { + flickingVertically = true; + emit q->flickingChanged(); // deprecated + emit q->flickingVerticallyChanged(); + } } else { timeline.reset(data.move); fixup(data, minExtent, maxExtent); @@ -1371,10 +1380,10 @@ void QDeclarativeGridView::setFlow(Flow flow) d->flow = flow; if (d->flow == LeftToRight) { setContentWidth(-1); - setFlickDirection(QDeclarativeFlickable::VerticalFlick); + setFlickableDirection(QDeclarativeFlickable::VerticalFlick); } else { setContentHeight(-1); - setFlickDirection(QDeclarativeFlickable::HorizontalFlick); + setFlickableDirection(QDeclarativeFlickable::HorizontalFlick); } d->clear(); d->updateGrid(); @@ -1530,7 +1539,7 @@ void QDeclarativeGridView::viewportMoved() Q_D(QDeclarativeGridView); QDeclarativeFlickable::viewportMoved(); d->lazyRelease = true; - if (d->flicked) { + if (d->flickingHorizontally || d->flickingVertically) { if (yflick()) { if (d->vData.velocity > 0) d->bufferMode = QDeclarativeGridViewPrivate::BufferBefore; @@ -1546,7 +1555,7 @@ void QDeclarativeGridView::viewportMoved() } } refill(); - if (isFlicking() || d->moving) + if (d->flickingHorizontally || d->flickingVertically || d->movingHorizontally || d->movingVertically) d->moveReason = QDeclarativeGridViewPrivate::Mouse; if (d->moveReason != QDeclarativeGridViewPrivate::SetIndex) { if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) { @@ -1885,7 +1894,8 @@ void QDeclarativeGridView::trackedPositionChanged() Q_D(QDeclarativeGridView); if (!d->trackedItem || !d->currentItem) return; - if (!isFlicking() && !d->moving && d->moveReason == QDeclarativeGridViewPrivate::SetIndex) { + if (!d->flickingHorizontally && !d->flickingVertically && !d->movingHorizontally && !d->movingVertically + && d->moveReason == QDeclarativeGridViewPrivate::SetIndex) { const qreal trackedPos = d->trackedItem->rowPos(); const qreal viewPos = d->position(); if (d->haveHighlightRange) { @@ -2301,9 +2311,13 @@ void QDeclarativeGridView::destroyingItem(QDeclarativeItem *item) void QDeclarativeGridView::animStopped() { Q_D(QDeclarativeGridView); - d->bufferMode = QDeclarativeGridViewPrivate::NoBuffer; - if (d->haveHighlightRange && d->highlightRange == QDeclarativeGridView::StrictlyEnforceRange) - d->updateHighlight(); + if ((!d->movingVertically && d->flow == QDeclarativeGridView::LeftToRight) + || (!d->movingHorizontally && d->flow == QDeclarativeGridView::TopToBottom)) + { + d->bufferMode = QDeclarativeGridViewPrivate::NoBuffer; + if (d->haveHighlightRange && d->highlightRange == QDeclarativeGridView::StrictlyEnforceRange) + d->updateHighlight(); + } } void QDeclarativeGridView::refill() diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 65edb03..20106cb 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -525,8 +525,9 @@ void QDeclarativeListViewPrivate::init() Q_Q(QDeclarativeListView); q->setFlag(QGraphicsItem::ItemIsFocusScope); addItemChangeListener(this, Geometry); - QObject::connect(q, SIGNAL(movementEnded()), q, SLOT(animStopped())); - q->setFlickDirection(QDeclarativeFlickable::VerticalFlick); + QObject::connect(q, SIGNAL(movingHorizontallyChanged()), q, SLOT(animStopped())); + QObject::connect(q, SIGNAL(movingVerticallyChanged()), q, SLOT(animStopped())); + q->setFlickableDirection(QDeclarativeFlickable::VerticalFlick); ::memset(sectionCache, 0, sizeof(QDeclarativeItem*) * sectionCacheSize); } @@ -869,7 +870,7 @@ void QDeclarativeListViewPrivate::updateHighlight() { if ((!currentItem && highlight) || (currentItem && !highlight)) createHighlight(); - if (currentItem && autoHighlight && highlight && !moving) { + if (currentItem && autoHighlight && highlight && !movingHorizontally && !movingVertically) { // auto-update highlight highlightPosAnimator->to = currentItem->position(); highlightSizeAnimator->to = currentItem->size(); @@ -1209,7 +1210,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m else v = maxVelocity; } - if (!flicked) { + if (!flickingHorizontally && !flickingVertically) { // the initial flick - estimate boundary qreal accel = deceleration; qreal v2 = v * v; @@ -1257,9 +1258,16 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m timeline.reset(data.move); timeline.accel(data.move, v, accel, maxDistance + overshootDist); timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); - flicked = true; - emit q->flickingChanged(); - emit q->flickStarted(); + if (!flickingHorizontally && q->xflick()) { + flickingHorizontally = true; + emit q->flickingChanged(); // deprecated + emit q->flickingHorizontallyChanged(); + } + if (!flickingVertically && q->yflick()) { + flickingVertically = true; + emit q->flickingChanged(); // deprecated + emit q->flickingVerticallyChanged(); + } correctFlick = true; } else { // reevaluate the target boundary. @@ -1805,10 +1813,10 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie d->orient = orientation; if (d->orient == QDeclarativeListView::Vertical) { setContentWidth(-1); - setFlickDirection(VerticalFlick); + setFlickableDirection(VerticalFlick); } else { setContentHeight(-1); - setFlickDirection(HorizontalFlick); + setFlickableDirection(HorizontalFlick); } d->clear(); d->setPosition(0); @@ -2107,7 +2115,7 @@ void QDeclarativeListView::viewportMoved() QDeclarativeFlickable::viewportMoved(); d->lazyRelease = true; refill(); - if (isFlicking() || d->moving) + if (d->flickingHorizontally || d->flickingVertically || d->movingHorizontally || d->movingVertically) d->moveReason = QDeclarativeListViewPrivate::Mouse; if (d->moveReason != QDeclarativeListViewPrivate::SetIndex) { if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) { @@ -2127,7 +2135,7 @@ void QDeclarativeListView::viewportMoved() } } - if (d->flicked && d->correctFlick && !d->inFlickCorrection) { + if ((d->flickingHorizontally || d->flickingVertically) && d->correctFlick && !d->inFlickCorrection) { d->inFlickCorrection = true; // Near an end and it seems that the extent has changed? // Recalculate the flick so that we don't end up in an odd position. @@ -2447,7 +2455,8 @@ void QDeclarativeListView::trackedPositionChanged() Q_D(QDeclarativeListView); if (!d->trackedItem || !d->currentItem) return; - if (!isFlicking() && !d->moving && d->moveReason == QDeclarativeListViewPrivate::SetIndex) { + if (!d->flickingHorizontally && !d->flickingVertically && !d->movingHorizontally && !d->movingVertically + && d->moveReason == QDeclarativeListViewPrivate::SetIndex) { const qreal trackedPos = qCeil(d->trackedItem->position()); const qreal viewPos = d->position(); if (d->haveHighlightRange) { @@ -2881,9 +2890,12 @@ void QDeclarativeListView::destroyingItem(QDeclarativeItem *item) void QDeclarativeListView::animStopped() { Q_D(QDeclarativeListView); - d->bufferMode = QDeclarativeListViewPrivate::NoBuffer; - if (d->haveHighlightRange && d->highlightRange == QDeclarativeListView::StrictlyEnforceRange) - d->updateHighlight(); + if ((!d->movingVertically && d->orient == QDeclarativeListView::Vertical) || (!d->movingHorizontally && d->orient == QDeclarativeListView::Horizontal)) + { + d->bufferMode = QDeclarativeListViewPrivate::NoBuffer; + if (d->haveHighlightRange && d->highlightRange == QDeclarativeListView::StrictlyEnforceRange) + d->updateHighlight(); + } } QDeclarativeListViewAttached *QDeclarativeListView::qmlAttachedProperties(QObject *obj) diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index 9ce9c49..2c6890e 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -61,6 +61,7 @@ private slots: void maximumFlickVelocity(); void flickDeceleration(); void pressDelay(); + void flickableDirection(); private: QDeclarativeEngine engine; @@ -224,6 +225,33 @@ void tst_qdeclarativeflickable::pressDelay() QCOMPARE(spy.count(),1); } +void tst_qdeclarativeflickable::flickableDirection() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.7; Flickable { flickableDirection: Flickable.VerticalFlick; }", QUrl::fromLocalFile("")); + QDeclarativeFlickable *flickable = qobject_cast(component.create()); + QSignalSpy spy(flickable, SIGNAL(flickableDirectionChanged())); + + QVERIFY(flickable); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::VerticalFlick); + + flickable->setFlickableDirection(QDeclarativeFlickable::HorizontalAndVerticalFlick); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::HorizontalAndVerticalFlick); + QCOMPARE(spy.count(),1); + + flickable->setFlickableDirection(QDeclarativeFlickable::AutoFlickDirection); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::AutoFlickDirection); + QCOMPARE(spy.count(),2); + + flickable->setFlickableDirection(QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(spy.count(),3); + + flickable->setFlickableDirection(QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(spy.count(),3); +} + QTEST_MAIN(tst_qdeclarativeflickable) #include "tst_qdeclarativeflickable.moc" -- cgit v0.12 From 9a45f780a24625f8f1104a6e2442f00874ab296f Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 12 May 2010 16:27:34 +1000 Subject: Improve Image docs. Move all fillMode image examples to fillMode property docs and remove the animated gif. --- doc/src/images/declarative-image_fillMode.gif | Bin 79561 -> 0 bytes .../declarative-qtlogo-preserveaspectcrop.png | Bin 0 -> 6440 bytes .../declarative-qtlogo-preserveaspectfit.png | Bin 0 -> 4076 bytes doc/src/images/declarative-qtlogo-stretch.png | Bin 0 -> 5584 bytes doc/src/images/declarative-qtlogo-tile.png | Bin 0 -> 3940 bytes .../images/declarative-qtlogo-tilehorizontally.png | Bin 0 -> 5544 bytes .../images/declarative-qtlogo-tilevertically.png | Bin 0 -> 6288 bytes doc/src/images/declarative-qtlogo.png | Bin 0 -> 3436 bytes doc/src/images/declarative-qtlogo1.png | Bin 3436 -> 0 bytes doc/src/images/declarative-qtlogo2.png | Bin 11023 -> 0 bytes doc/src/images/declarative-qtlogo3.png | Bin 4783 -> 0 bytes doc/src/images/declarative-qtlogo4.png | Bin 11241 -> 0 bytes doc/src/images/declarative-qtlogo5.png | Bin 3553 -> 0 bytes doc/src/images/declarative-qtlogo6.png | Bin 4763 -> 0 bytes .../graphicsitems/qdeclarativeimage.cpp | 193 ++++++++++++--------- 15 files changed, 109 insertions(+), 84 deletions(-) delete mode 100644 doc/src/images/declarative-image_fillMode.gif create mode 100644 doc/src/images/declarative-qtlogo-preserveaspectcrop.png create mode 100644 doc/src/images/declarative-qtlogo-preserveaspectfit.png create mode 100644 doc/src/images/declarative-qtlogo-stretch.png create mode 100644 doc/src/images/declarative-qtlogo-tile.png create mode 100644 doc/src/images/declarative-qtlogo-tilehorizontally.png create mode 100644 doc/src/images/declarative-qtlogo-tilevertically.png create mode 100644 doc/src/images/declarative-qtlogo.png delete mode 100644 doc/src/images/declarative-qtlogo1.png delete mode 100644 doc/src/images/declarative-qtlogo2.png delete mode 100644 doc/src/images/declarative-qtlogo3.png delete mode 100644 doc/src/images/declarative-qtlogo4.png delete mode 100644 doc/src/images/declarative-qtlogo5.png delete mode 100644 doc/src/images/declarative-qtlogo6.png diff --git a/doc/src/images/declarative-image_fillMode.gif b/doc/src/images/declarative-image_fillMode.gif deleted file mode 100644 index eb0a9af..0000000 Binary files a/doc/src/images/declarative-image_fillMode.gif and /dev/null differ diff --git a/doc/src/images/declarative-qtlogo-preserveaspectcrop.png b/doc/src/images/declarative-qtlogo-preserveaspectcrop.png new file mode 100644 index 0000000..64fb086 Binary files /dev/null and b/doc/src/images/declarative-qtlogo-preserveaspectcrop.png differ diff --git a/doc/src/images/declarative-qtlogo-preserveaspectfit.png b/doc/src/images/declarative-qtlogo-preserveaspectfit.png new file mode 100644 index 0000000..2585fa5 Binary files /dev/null and b/doc/src/images/declarative-qtlogo-preserveaspectfit.png differ diff --git a/doc/src/images/declarative-qtlogo-stretch.png b/doc/src/images/declarative-qtlogo-stretch.png new file mode 100644 index 0000000..32a0114 Binary files /dev/null and b/doc/src/images/declarative-qtlogo-stretch.png differ diff --git a/doc/src/images/declarative-qtlogo-tile.png b/doc/src/images/declarative-qtlogo-tile.png new file mode 100644 index 0000000..7d1b9d0 Binary files /dev/null and b/doc/src/images/declarative-qtlogo-tile.png differ diff --git a/doc/src/images/declarative-qtlogo-tilehorizontally.png b/doc/src/images/declarative-qtlogo-tilehorizontally.png new file mode 100644 index 0000000..367a8c7 Binary files /dev/null and b/doc/src/images/declarative-qtlogo-tilehorizontally.png differ diff --git a/doc/src/images/declarative-qtlogo-tilevertically.png b/doc/src/images/declarative-qtlogo-tilevertically.png new file mode 100644 index 0000000..68afafa Binary files /dev/null and b/doc/src/images/declarative-qtlogo-tilevertically.png differ diff --git a/doc/src/images/declarative-qtlogo.png b/doc/src/images/declarative-qtlogo.png new file mode 100644 index 0000000..940d159 Binary files /dev/null and b/doc/src/images/declarative-qtlogo.png differ diff --git a/doc/src/images/declarative-qtlogo1.png b/doc/src/images/declarative-qtlogo1.png deleted file mode 100644 index 940d159..0000000 Binary files a/doc/src/images/declarative-qtlogo1.png and /dev/null differ diff --git a/doc/src/images/declarative-qtlogo2.png b/doc/src/images/declarative-qtlogo2.png deleted file mode 100644 index b1d128a..0000000 Binary files a/doc/src/images/declarative-qtlogo2.png and /dev/null differ diff --git a/doc/src/images/declarative-qtlogo3.png b/doc/src/images/declarative-qtlogo3.png deleted file mode 100644 index d516524..0000000 Binary files a/doc/src/images/declarative-qtlogo3.png and /dev/null differ diff --git a/doc/src/images/declarative-qtlogo4.png b/doc/src/images/declarative-qtlogo4.png deleted file mode 100644 index 7c8aa64..0000000 Binary files a/doc/src/images/declarative-qtlogo4.png and /dev/null differ diff --git a/doc/src/images/declarative-qtlogo5.png b/doc/src/images/declarative-qtlogo5.png deleted file mode 100644 index b7b3513..0000000 Binary files a/doc/src/images/declarative-qtlogo5.png and /dev/null differ diff --git a/doc/src/images/declarative-qtlogo6.png b/doc/src/images/declarative-qtlogo6.png deleted file mode 100644 index 07a078f..0000000 Binary files a/doc/src/images/declarative-qtlogo6.png and /dev/null differ diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index aeddb15..88e8520 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -54,79 +54,36 @@ QT_BEGIN_NAMESPACE \brief The Image element allows you to add bitmaps to a scene. \inherits Item - Displays the image from the specified \l source. If a size is not specified explicitly, - the Image element will be sized to the loaded image. + An Image element displays a specified \l source image: - If the source resolves to a network resource, the image will be loaded asynchronously, - updating the \l progress and \l status properties appropriately. + \table + \o + \image declarative-qtlogo.png + \o + \qml + import Qt 4.7 + + Image { source: "qtlogo.png" } + \endqml + \endtable + + If a size is not specified explicitly, the Image element is sized to the loaded image. + Image elements can be stretched and tiled using the \l fillMode property. - Images which are available locally - will be loaded immediately, blocking the user interface. This is typically the - correct behavior for user interface elements. For large local images, which do not need - to be visible immediately, it may be preferable to enable \l asynchronous loading. - This will load the image in the background using a low priority thread. + If the image \l source is a network resource, the image is loaded asynchronous and the + \l progress and \l status properties are updated appropriately. Otherwise, if the image is + available locally, it is loaded immediately and the user interface is blocked until loading is + complete. (This is typically the correct behavior for user interface elements.) + For large local images, which do not need to be visible immediately, it may be preferable to + enable \l asynchronous loading. This loads the image in the background using a low priority thread. Images are cached and shared internally, so if several Image elements have the same source only one copy of the image will be loaded. - \bold Note: Images are often the greatest user of memory in QML UIs. It is recommended + \bold Note: Images are often the greatest user of memory in QML user interfaces. It is recommended that images which do not form part of the user interface have their size bounded via the \l sourceSize property. This is especially important for content that is loaded from external sources or provided by the user. - - The Image element supports untransformed, stretched and tiled images. - - For an explanation of stretching and tiling, see the fillMode property description. - - Examples: - \table - \row - \o \image declarative-qtlogo1.png - \o Untransformed - \qml - Image { source: "pics/qtlogo.png" } - \endqml - \row - \o \image declarative-qtlogo2.png - \o fillMode: Stretch (default) - \qml - Image { - width: 160 - height: 160 - source: "pics/qtlogo.png" - } - \endqml - \row - \o \image declarative-qtlogo3.png - \o fillMode: Tile - \qml - Image { - fillMode: Image.Tile - width: 160; height: 160 - source: "pics/qtlogo.png" - } - \endqml - \row - \o \image declarative-qtlogo6.png - \o fillMode: TileVertically - \qml - Image { - fillMode: Image.TileVertically - width: 160; height: 160 - source: "pics/qtlogo.png" - } - \endqml - \row - \o \image declarative-qtlogo5.png - \o fillMode: TileHorizontally - \qml - Image { - fillMode: Image.TileHorizontally - width: 160; height: 160 - source: "pics/qtlogo.png" - } - \endqml - \endtable */ /*! @@ -207,7 +164,77 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) \o Image.TileHorizontally - the image is stretched vertically and tiled horizontally \endlist - \image declarative-image_fillMode.gif + \table + + \row + \o \image declarative-qtlogo-stretch.png + \o Stretch (default) + \qml + Image { + width: 130; height: 100 + smooth: true + source: "qtlogo.png" + } + \endqml + + \row + \o \image declarative-qtlogo-preserveaspectfit.png + \o PreserveAspectFit + \qml + Image { + width: 130; height: 100 + fillMode: Image.PreserveAspectFit + smooth: true + source: "qtlogo.png" + } + \endqml + + \row + \o \image declarative-qtlogo-preserveaspectcrop.png + \o PreserveAspectCrop + \qml + Image { + width: 130; height: 100 + fillMode: Image.PreserveAspectCrop + smooth: true + source: "qtlogo.png" + } + \endqml + + \row + \o \image declarative-qtlogo-tile.png + \o Tile + \qml + Image { + width: 120; height: 120 + fillMode: Image.Tile + source: "qtlogo.png" + } + \endqml + + \row + \o \image declarative-qtlogo-tilevertically.png + \o TileVertically + \qml + Image { + width: 120; height: 120 + fillMode: Image.TileVertically + source: "qtlogo.png" + } + \endqml + + \row + \o \image declarative-qtlogo-tilehorizontally.png + \o TileHorizontally + \qml + Image { + width: 120; height: 120 + fillMode: Image.TileHorizontally + source: "qtlogo.png" + } + \endqml + + \endtable */ QDeclarativeImage::FillMode QDeclarativeImage::fillMode() const { @@ -290,32 +317,30 @@ qreal QDeclarativeImage::paintedHeight() const /*! \qmlproperty QSize Image::sourceSize - This properties is the size of the loaded image, in pixels. + This property holds the size of the loaded image, in pixels. - If you set this property explicitly, you can to control the storage - used by a loaded image. The image will be scaled down if its intrinsic size - is greater than this value. - - If only one dimension of the size is set (and the other left at 0), the - unset dimension will be set in proportion to the set dimension to preserve - the source image aspect ratio. The fillMode is independent of this. - - Unlike setting the width and height properties, which merely scale the painting - of the image, this property affects the number of pixels stored. - - \e{Changing this property dynamically will lead to the image source being reloaded, - potentially even from the network if it is not in the disk cache.} + This is used to control the storage used by a loaded image. Unlike + the width and height properties, which scale the painting of the image, this property + affects the number of pixels stored. + If the image's actual size is larger than the sourceSize, the image is scaled down. + If only one dimension of the size is set to greater than 0, the + other dimension is set in proportion to preserve the source image's aspect ratio. + (The \l fillMode is independent of this.) + If the source is an instrinsically scalable image (eg. SVG), this property - determines the size of the loaded image regardless of intrinsic size. You should - avoid changing this property dynamically - rendering an SVG is \e slow compared + determines the size of the loaded image regardless of intrinsic size. + Avoid changing this property dynamically; rendering an SVG is \e slow compared to an image. If the source is a non-scalable image (eg. JPEG), the loaded image will be no greater than this property specifies. For some formats (currently only JPEG), the whole image will never actually be loaded into memory. + + \note \e{Changing this property dynamically will lead to the image source being reloaded, + potentially even from the network if it is not in the disk cache.} - The example below will ensure that the size of the image in memory is + Here is an example that ensures the size of the image in memory is no larger than 1024x1024 pixels, regardless of the size of the Image element. \code @@ -327,8 +352,8 @@ qreal QDeclarativeImage::paintedHeight() const } \endcode - The example below will ensure that the memory used by the image is - no more than necessary to display the image at the size of the Image element. + The example below ensures the memory used by the image is no more than necessary + to display the image at the size of the Image element. Of course if the Image element is resized a costly reload will be required, so use this technique \e only when the Image size is fixed. -- cgit v0.12 From 01fbf55727678509f87523ef2ddda1d21d4ac2ab Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 12 May 2010 17:02:14 +1000 Subject: Correctly assign bool to variant properties QTBUG-10623 --- src/declarative/qml/qdeclarativecompiler.cpp | 4 ++++ src/declarative/qml/qdeclarativeinstruction.cpp | 3 +++ src/declarative/qml/qdeclarativeinstruction_p.h | 1 + src/declarative/qml/qdeclarativevme.cpp | 10 ++++++++++ .../qdeclarativelanguage/data/assignLiteralToVariant.qml | 2 ++ .../qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 6d420a7..a43b9ac 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -352,6 +352,10 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, instr.storeDouble.propertyIndex = prop.propertyIndex(); instr.storeDouble.value = n; } + } else if(v->value.isBoolean()) { + instr.type = QDeclarativeInstruction::StoreVariantBool; + instr.storeBool.propertyIndex = prop.propertyIndex(); + instr.storeBool.value = v->value.asBoolean(); } else { instr.type = QDeclarativeInstruction::StoreVariant; instr.storeString.propertyIndex = prop.propertyIndex(); diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp index 99f1cc8..0236950 100644 --- a/src/declarative/qml/qdeclarativeinstruction.cpp +++ b/src/declarative/qml/qdeclarativeinstruction.cpp @@ -136,6 +136,9 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx) case QDeclarativeInstruction::StoreVariantDouble: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value; break; + case QDeclarativeInstruction::StoreVariantBool: + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value; + break; case QDeclarativeInstruction::StoreObject: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex; break; diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index c09b157..dc5f2f8 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -116,6 +116,7 @@ public: StoreVariant, /* storeString */ StoreVariantInteger, /* storeInteger */ StoreVariantDouble, /* storeDouble */ + StoreVariantBool, /* storeBool */ StoreObject, /* storeObject */ StoreVariantObject, /* storeObject */ StoreInterface, /* storeObject */ diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 3e63e24..8ba79a6 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -360,6 +360,16 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, } break; + case QDeclarativeInstruction::StoreVariantBool: + { + QObject *target = stack.top(); + QVariant v(instr.storeBool.value); + void *a[] = { &v, 0, &status, &flags }; + QMetaObject::metacall(target, QMetaObject::WriteProperty, + instr.storeString.propertyIndex, a); + } + break; + case QDeclarativeInstruction::StoreString: { QObject *target = stack.top(); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml index 5af3d6e..bac704e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml @@ -10,5 +10,7 @@ QtObject { property variant test7: "10x10" property variant test8: "100,100,100" property variant test9: String("#FF008800") + property variant test10: true + property variant test11: false } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index ff03005..6b070f5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -536,6 +536,8 @@ void tst_qdeclarativelanguage::assignLiteralToVariant() QCOMPARE(object->property("test7").userType(), (int)QVariant::SizeF); QCOMPARE(object->property("test8").userType(), (int)QVariant::Vector3D); QCOMPARE(object->property("test9").userType(), (int)QVariant::String); + QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool); + QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool); QVERIFY(object->property("test1") == QVariant(1)); QVERIFY(object->property("test2") == QVariant((double)1.7)); @@ -546,6 +548,8 @@ void tst_qdeclarativelanguage::assignLiteralToVariant() QVERIFY(object->property("test7") == QVariant(QSizeF(10, 10))); QVERIFY(object->property("test8") == QVariant(QVector3D(100, 100, 100))); QVERIFY(object->property("test9") == QVariant(QString(QLatin1String("#FF008800")))); + QVERIFY(object->property("test10") == QVariant(bool(true))); + QVERIFY(object->property("test11") == QVariant(bool(false))); delete object; } -- cgit v0.12 From 7894bbb901a2ba74284bd6c0544b06c6a41f6b6f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 12 May 2010 14:44:06 +0200 Subject: Possibly fix autotest It's unclear why the autotest failed on a platform I can't test on right now, but this might clear it up. --- .../declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp b/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp index 2207635..c0c5abc 100644 --- a/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp +++ b/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp @@ -75,7 +75,7 @@ void tst_qdeclarativelayoutitem::test_resizing() view.setScene(&scene); //Add the QML snippet into the layout QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl(SRCDIR "/data/layoutItem.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/layoutItem.qml")); QDeclarativeLayoutItem* obj = static_cast(c.create()); layout->addItem(obj); layout->setContentsMargins(0,0,0,0); -- cgit v0.12 From 386b658ce39bfab16ea14b232c61ad4703f11619 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 13 May 2010 10:08:48 +1000 Subject: Fix broken benchmarks. --- src/declarative/qml/qdeclarativeengine.cpp | 11 ++++++----- tests/benchmarks/declarative/creation/tst_creation.cpp | 4 ++-- tests/benchmarks/declarative/painting/painting.pro | 1 + .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 6 +++--- .../benchmarks/declarative/script/data/slot_complex_js.js | 8 ++++++++ .../benchmarks/declarative/script/data/slot_complex_js.qml | 14 ++------------ tests/benchmarks/declarative/script/data/slot_simple_js.js | 3 +++ .../benchmarks/declarative/script/data/slot_simple_js.qml | 10 ++-------- 8 files changed, 27 insertions(+), 30 deletions(-) create mode 100644 tests/benchmarks/declarative/script/data/slot_complex_js.js create mode 100644 tests/benchmarks/declarative/script/data/slot_simple_js.js diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 9f5cafe..94e6771 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -327,11 +327,12 @@ Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); void QDeclarativePrivate::qdeclarativeelement_destructor(QObject *o) { QObjectPrivate *p = QObjectPrivate::get(o); - Q_ASSERT(p->declarativeData); - QDeclarativeData *d = static_cast(p->declarativeData); - if (d->ownContext && d->context) { - d->context->destroy(); - d->context = 0; + if (p->declarativeData) { + QDeclarativeData *d = static_cast(p->declarativeData); + if (d->ownContext && d->context) { + d->context->destroy(); + d->context = 0; + } } } diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 6f00473..99324f4 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -203,7 +203,7 @@ void tst_creation::qobject_10tree_cpp() void tst_creation::qobject_qmltype() { - QDeclarativeType *t = QDeclarativeMetaType::qmlType("Qt/QtObject", 4, 6); + QDeclarativeType *t = QDeclarativeMetaType::qmlType("Qt/QtObject", 4, 7); QBENCHMARK { QObject *obj = t->create(); @@ -347,7 +347,7 @@ void tst_creation::elements_data() void tst_creation::elements() { QFETCH(QByteArray, type); - QDeclarativeType *t = QDeclarativeMetaType::qmlType(type, 4, 6); + QDeclarativeType *t = QDeclarativeMetaType::qmlType(type, 4, 7); if (!t || !t->isCreatable()) QSKIP("Non-creatable type", SkipSingle); diff --git a/tests/benchmarks/declarative/painting/painting.pro b/tests/benchmarks/declarative/painting/painting.pro index 2f98e8b..a228ea7 100644 --- a/tests/benchmarks/declarative/painting/painting.pro +++ b/tests/benchmarks/declarative/painting/painting.pro @@ -11,3 +11,4 @@ INCLUDEPATH += . SOURCES += paintbenchmark.cpp QT += opengl CONFIG += console +macx:CONFIG -= app_bundle diff --git a/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 4bba022..e2e8c8a 100644 --- a/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -68,7 +68,7 @@ private: void tst_qmlgraphicsimage::qmlgraphicsimage() { int x = 0; - QUrl url("image.png"); + QUrl url(SRCDIR "/image.png"); QBENCHMARK { QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); QDeclarativeImage *image = new QDeclarativeImage; @@ -80,7 +80,7 @@ void tst_qmlgraphicsimage::qmlgraphicsimage() void tst_qmlgraphicsimage::qmlgraphicsimage_file() { int x = 0; - QUrl url("image.png"); + QUrl url(SRCDIR "/image.png"); QBENCHMARK { QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); QDeclarativeImage *image = new QDeclarativeImage; @@ -93,7 +93,7 @@ void tst_qmlgraphicsimage::qmlgraphicsimage_file() void tst_qmlgraphicsimage::qmlgraphicsimage_url() { int x = 0; - QUrl url("image.png"); + QUrl url(SRCDIR "/image.png"); QBENCHMARK { QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); QDeclarativeImage *image = new QDeclarativeImage; diff --git a/tests/benchmarks/declarative/script/data/slot_complex_js.js b/tests/benchmarks/declarative/script/data/slot_complex_js.js new file mode 100644 index 0000000..64a1f65 --- /dev/null +++ b/tests/benchmarks/declarative/script/data/slot_complex_js.js @@ -0,0 +1,8 @@ +function myCustomFunction(n) { + var a = 1; + while (n > 0) { + a = a * n; + n--; + } + return a; +} diff --git a/tests/benchmarks/declarative/script/data/slot_complex_js.qml b/tests/benchmarks/declarative/script/data/slot_complex_js.qml index ed4f78b..7bda48b 100644 --- a/tests/benchmarks/declarative/script/data/slot_complex_js.qml +++ b/tests/benchmarks/declarative/script/data/slot_complex_js.qml @@ -1,18 +1,8 @@ import Qt.test 1.0 +import "slot_complex_js.js" as Logic TestObject { - Script { - function myCustomFunction(n) { - var a = 1; - while (n > 0) { - a = a * n; - n--; - } - return a; - } - } - - onMySignal: { for (var ii = 0; ii < 10000; ++ii) { myCustomFunction(10); } } + onMySignal: { for (var ii = 0; ii < 10000; ++ii) { Logic.myCustomFunction(10); } } } diff --git a/tests/benchmarks/declarative/script/data/slot_simple_js.js b/tests/benchmarks/declarative/script/data/slot_simple_js.js new file mode 100644 index 0000000..d6e6060 --- /dev/null +++ b/tests/benchmarks/declarative/script/data/slot_simple_js.js @@ -0,0 +1,3 @@ +function myCustomFunction() { + return 0; +} diff --git a/tests/benchmarks/declarative/script/data/slot_simple_js.qml b/tests/benchmarks/declarative/script/data/slot_simple_js.qml index a88265c..7ea3177 100644 --- a/tests/benchmarks/declarative/script/data/slot_simple_js.qml +++ b/tests/benchmarks/declarative/script/data/slot_simple_js.qml @@ -1,13 +1,7 @@ import Qt.test 1.0 +import "slot_simple_js.js" as Logic TestObject { - - Script { - function myCustomFunction() { - return 0; - } - } - - onMySignal: { for (var ii = 0; ii < 10000; ++ii) { myCustomFunction(); } } + onMySignal: { for (var ii = 0; ii < 10000; ++ii) { Logic.myCustomFunction(); } } } -- cgit v0.12 From f17c706db16aae93f024e88208e139063f5b2c7c Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 12 May 2010 16:28:57 +1000 Subject: Fix for graphics widget in the background stealing declarative item's focus Task-number: QTBUG-10584 Reviewed-by: Warwick Allison --- src/gui/graphicsview/qgraphicsscene.cpp | 4 +-- .../qdeclarativeitem/data/mouseFocus.qml | 20 ++++++++++++ .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 37 ++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index dacdbfe..7abd5f6 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1320,10 +1320,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou setFocus = true; break; } - if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { + if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable))) { if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { setFocus = true; - if (item != q->focusItem()) + if (item != q->focusItem() && item->d_ptr->mouseSetsFocus) q->setFocusItem(item, Qt::MouseFocusReason); break; } diff --git a/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml b/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml new file mode 100644 index 0000000..a562b8b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml @@ -0,0 +1,20 @@ +import Qt 4.7 + +QGraphicsWidget { + size: "200x100" + focusPolicy: QGraphicsWidget.ClickFocus + Item { + objectName: "declarativeItem" + id: item + width: 200 + height: 100 + MouseArea { + anchors.fill: parent + onPressed: { + if (!item.focus) { + item.focus = true; + } + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index e0ca746..f4edeb2 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -45,6 +45,7 @@ #include #include #include +#include "../../../shared/util.h" class tst_QDeclarativeItem : public QObject @@ -67,6 +68,7 @@ private slots: void childrenProperty(); void resourcesProperty(); + void mouseFocus(); private: template @@ -466,6 +468,41 @@ void tst_QDeclarativeItem::resourcesProperty() delete o; } +void tst_QDeclarativeItem::mouseFocus() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mouseFocus.qml")); + canvas->show(); + QVERIFY(canvas->rootObject()); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(canvas)); + + QDeclarativeItem *item = findItem(canvas->rootObject(), "declarativeItem"); + QVERIFY(item); + QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool))); + + QTest::mouseClick(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(item->scenePos())); + QApplication::processEvents(); + QCOMPARE(focusSpy.count(), 1); + QVERIFY(item->hasFocus()); + + // make sure focusable graphics widget underneath does not steal focus + QTest::mouseClick(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(item->scenePos())); + QApplication::processEvents(); + QCOMPARE(focusSpy.count(), 1); + QVERIFY(item->hasFocus()); + + item->setFocus(false); + QVERIFY(!item->hasFocus()); + QCOMPARE(focusSpy.count(), 2); + item->setFocus(true); + QCOMPARE(focusSpy.count(), 3); + + delete canvas; +} + void tst_QDeclarativeItem::propertyChanges() { QDeclarativeView *canvas = new QDeclarativeView(0); -- cgit v0.12 From d45c45432ccd0a74c67e70ce5fc3a09f35923c26 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 12 May 2010 18:20:18 +1000 Subject: Fix TextEdit and TextInput input panel support for mode RSIP_OnMouseClickAndAlreadyFocused Task-number: Reviewed-by: Warwick Allison --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 11 ++++++++--- src/declarative/graphicsitems/qdeclarativetextedit_p_p.h | 3 ++- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 16 ++++++++++++---- .../graphicsitems/qdeclarativetextinput_p_p.h | 3 ++- .../qdeclarativelistview/tst_qdeclarativelistview.cpp | 2 -- .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 11 ++++++++--- .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 11 ++++++++--- 7 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 6d86e58..db20da8 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -899,6 +899,7 @@ Handles the given mouse \a event. void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextEdit); + bool hadFocus = hasFocus(); if (d->focusOnPress){ QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope? while(p) { @@ -910,6 +911,8 @@ void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) } setFocus(true); } + if (!hadFocus && hasFocus()) + d->clickCausedFocus = true; d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) QDeclarativePaintedItem::mousePressEvent(event); @@ -924,11 +927,12 @@ void QDeclarativeTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_D(QDeclarativeTextEdit); QWidget *widget = event->widget(); if (widget && (d->control->textInteractionFlags() & Qt::TextEditable) && boundingRect().contains(event->pos())) - qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->focusOnPress); + qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus); + d->clickCausedFocus = false; d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) - QDeclarativePaintedItem::mousePressEvent(event); + QDeclarativePaintedItem::mouseReleaseEvent(event); } /*! @@ -952,7 +956,8 @@ void QDeclarativeTextEdit::mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_D(QDeclarativeTextEdit); d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) - QDeclarativePaintedItem::mousePressEvent(event); + QDeclarativePaintedItem::mouseMoveEvent(event); + event->setAccepted(true); } /*! diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h index 8d4b611..5e19c3d 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h @@ -70,7 +70,7 @@ public: QDeclarativeTextEditPrivate() : color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop), imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true), - persistentSelection(true), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), + persistentSelection(true), clickCausedFocus(false), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0), wrapMode(QDeclarativeTextEdit::NoWrap) { @@ -100,6 +100,7 @@ public: bool cursorVisible : 1; bool focusOnPress : 1; bool persistentSelection : 1; + bool clickCausedFocus : 1; qreal textMargin; int lastSelectionStart; int lastSelectionEnd; diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 8f86aa0..afbaaac 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -882,6 +882,7 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextInput); + bool hadFocus = hasFocus(); if(d->focusOnPress){ QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope? while(p) { @@ -893,15 +894,20 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) } setFocus(true); } + if (!hadFocus && hasFocus()) + d->clickCausedFocus = true; + bool mark = event->modifiers() & Qt::ShiftModifier; int cursor = d->xToPos(event->pos().x()); d->control->moveCursor(cursor, mark); + event->setAccepted(true); } void QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextInput); d->control->moveCursor(d->xToPos(event->pos().x()), true); + event->setAccepted(true); } /*! @@ -913,8 +919,10 @@ void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_D(QDeclarativeTextInput); QWidget *widget = event->widget(); if (widget && !d->control->isReadOnly() && boundingRect().contains(event->pos())) - qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->focusOnPress); - d->control->processEvent(event); + qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus); + d->clickCausedFocus = false; + if (!event->isAccepted()) + QDeclarativePaintedItem::mouseReleaseEvent(event); } bool QDeclarativeTextInput::event(QEvent* ev) @@ -935,8 +943,8 @@ bool QDeclarativeTextInput::event(QEvent* ev) updateSize(); } if(!handled) - return QDeclarativePaintedItem::event(ev); - return true; + handled = QDeclarativePaintedItem::event(ev); + return handled; } void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry, diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index 26cf78c..99866b8 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -72,7 +72,7 @@ public: color((QRgb)0), style(QDeclarativeText::Normal), styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft), hscroll(0), oldScroll(0), focused(false), focusOnPress(true), - cursorVisible(false), autoScroll(true) + cursorVisible(false), autoScroll(true), clickCausedFocus(false) { } @@ -116,6 +116,7 @@ public: bool focusOnPress; bool cursorVisible; bool autoScroll; + bool clickCausedFocus; }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 22eb734..ec2afae 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1432,8 +1432,6 @@ void tst_QDeclarativeListView::QTBUG_9791() { QDeclarativeView *canvas = createView(); - QDeclarativeContext *ctxt = canvas->rootContext(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/strictlyenforcerange.qml")); qApp->processEvents(); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index b92024f..c65c883 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -793,8 +793,6 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() view.viewport()->setInputContext(&ic); QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); - if ((behavior != QStyle::RSIP_OnMouseClick)) - QSKIP("This test need to have a style with RSIP_OnMouseClick", SkipSingle); QDeclarativeTextEdit edit; edit.setText("Hello world"); edit.setPos(0, 0); @@ -806,7 +804,14 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); + if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) { + QCOMPARE(ic.softwareInputPanelEventReceived, false); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } else if (behavior == QStyle::RSIP_OnMouseClick) { + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } } void tst_qdeclarativetextedit::geometrySignals() diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index c00390d..ac80edb 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -743,8 +743,6 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() view.viewport()->setInputContext(&ic); QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); - if ((behavior != QStyle::RSIP_OnMouseClick)) - QSKIP("This test need to have a style with RSIP_OnMouseClick", SkipSingle); QDeclarativeTextInput input; input.setText("Hello world"); input.setPos(0, 0); @@ -756,7 +754,14 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); + if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) { + QCOMPARE(ic.softwareInputPanelEventReceived, false); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } else if (behavior == QStyle::RSIP_OnMouseClick) { + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } } class MyTextInput : public QDeclarativeTextInput -- cgit v0.12