Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamutkarshtiwari/7675c0d2bc3b9370f17f98e3fd7b169e to your computer and use it in GitHub Desktop.
Save iamutkarshtiwari/7675c0d2bc3b9370f17f98e3fd7b169e to your computer and use it in GitHub Desktop.
// Lower Sample Wagon Display Area
Rectangle {
id: railCollection
color: "transparent"
visible: false
Repeater {
id: sampleList
model: 4
Flickable {
x: 2
y: (background.height / 4.7) + (index * (background.height / 6.5))
height: background.height / 7.5
width: background.width
contentWidth: contentItem.childrenRect.width//* Activity.rowWidth[index]//railCarriages.width //* 0.95 //(background.width > background.height ? background.width : background.height) * Activity.rowWidth[index]
contentHeight: height
flickableDirection: Flickable.HorizontalFlick
Row {
id: railCarriages
property real rowNo: index
anchors.margins: 1
anchors.bottomMargin: 10
spacing: background.width * 0.0025
x: parent.x
y: 0
height: background.height / 7.5
width: childrenRect.width
Repeater {
id: eachRow
model: Activity.noOfCarriages[parent.rowNo]
Image {
id: loco
readonly property int uniqueID: Activity.sum(parent.rowNo) + index
source: Activity.resourceURL + "loco" + (uniqueID + 1) + ".svg"
height: background.height / 7.5
width: ((background.width > background.height) ? background.width : background.height) / 4.66
visible: true
MouseArea {
id: mouseArea
hoverEnabled: true
enabled: true
anchors.fill: parent
onClicked: {
Activity.addWagon(parent.uniqueID + 1);
Activity.isAnswer();
}
}
states: State {
name: "carHover"
when: mouseArea.containsMouse
PropertyChanges {
target: loco
scale: 1.1
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment