aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickpathview/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickpathview/data')
-rw-r--r--tests/auto/quick/qquickpathview/data/customAttribute.qml58
-rw-r--r--tests/auto/quick/qquickpathview/data/qtbug42716.qml111
2 files changed, 169 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickpathview/data/customAttribute.qml b/tests/auto/quick/qquickpathview/data/customAttribute.qml
new file mode 100644
index 0000000000..bd4c9fd1de
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/customAttribute.qml
@@ -0,0 +1,58 @@
+import QtQuick 2.4
+
+PathView {
+ width: 200
+ height: 600
+
+ pathItemCount: 7
+
+ model: ListModel {
+ ListElement { color: "salmon" }
+ ListElement { color: "seagreen" }
+ ListElement { color: "navy" }
+ ListElement { color: "goldenrod" }
+ }
+ path: Path {
+ startX: width / 2; startY: -100
+ PathAttribute { name: "BEGIN" }
+
+ PathLine { relativeX: 0; y: height / 2 }
+ PathAttribute { name: "BEGIN" }
+
+ PathLine { relativeX: 0; y: height + 100 }
+ PathAttribute { name: "BEGIN" }
+ }
+ delegate: Rectangle {
+ width: 200
+ height: 200
+ color: model.color
+ opacity: PathView.transparency
+ }
+
+ Component {
+ id: attributeComponent
+ PathAttribute {}
+ }
+
+ function addAttribute(name, values) {
+ var valueIndex = 0
+ var elements = []
+ for (var i = 0; i < path.pathElements.length; ++i) {
+ elements.push(path.pathElements[i])
+
+ if (path.pathElements[i].name === "BEGIN") {
+ if (values[valueIndex] !== undefined) {
+ var attribute = attributeComponent.createObject(this, { "name": name, "value": values[valueIndex] })
+ elements.push(attribute)
+ }
+ ++valueIndex
+ }
+ }
+
+ console.log("??")
+ path.pathElements = elements
+ console.log("!!")
+ }
+
+ Component.onCompleted: addAttribute("transparency", [0, 1, 0])
+}
diff --git a/tests/auto/quick/qquickpathview/data/qtbug42716.qml b/tests/auto/quick/qquickpathview/data/qtbug42716.qml
new file mode 100644
index 0000000000..81d52d5ea3
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/qtbug42716.qml
@@ -0,0 +1,111 @@
+import QtQuick 2.0
+
+Rectangle {
+ //Note that this file was originally the manual reproduction, MouseAreas were left in.
+ id: qmlBrowser
+
+ width: 500
+ height: 350
+
+ ListModel {
+ id: myModel
+ ListElement {
+ name: "Bill Jones 0"
+ }
+ ListElement {
+ name: "Jane Doe 1"
+ }
+ ListElement {
+ name: "John Smith 2"
+ }
+ ListElement {
+ name: "Bill Jones 3"
+ }
+ ListElement {
+ name: "Jane Doe 4"
+ }
+ ListElement {
+ name: "John Smith 5"
+ }
+ ListElement {
+ name: "John Smith 6"
+ }
+ ListElement {
+ name: "John Smith 7"
+ }
+ }
+
+ Component {
+ id: delegate
+
+ Text {
+ id: nameText
+ height: 33
+ width: parent.width
+ objectName: "delegate"+index
+
+ text: "index: " + index + " text: " + name
+ font.pointSize: 16
+ color: PathView.isCurrentItem ? "red" : "black"
+ }
+ }
+
+ PathView {
+ id: contentList
+ objectName: "pathView"
+ anchors.fill: parent
+
+ property int maxPathItemCount: 7
+ property real itemHeight: 34
+
+ delegate: delegate
+ model: myModel
+ currentIndex: 5
+ pathItemCount: maxPathItemCount
+ highlightMoveDuration: 0
+
+ path: Path {
+ startX: 30 + contentList.width / 2
+ startY: 30
+ PathLine {
+ relativeX: 0
+ relativeY: contentList.itemHeight * contentList.maxPathItemCount
+ }
+ }
+
+ focus: true
+ Keys.onLeftPressed: decrementCurrentIndex()
+ Keys.onRightPressed: incrementCurrentIndex()
+ }
+
+ Column {
+ anchors.right: parent.right
+ Text {
+ text: "Go 1"
+ font.weight: Font.Bold
+ font.pixelSize: 24
+ MouseArea {
+ anchors.fill: parent
+ onClicked: contentList.offset = 2.55882
+ }
+ }
+ Text {
+ text: "Go 2"
+ font.weight: Font.Bold
+ font.pixelSize: 24
+ MouseArea {
+ anchors.fill: parent
+ onClicked: contentList.offset = 0.0882353
+ }
+ }
+ Text {
+ text: "Go 3"
+ font.weight: Font.Bold
+ font.pixelSize: 24
+ MouseArea {
+ anchors.fill: parent
+ onClicked: contentList.offset = 0.99987
+ }
+ }
+ }
+}