Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
sliding number
Rectangle
{
color: "transparent"
height: Theme.itemSizeMedium
width: parent.width
Label
{
width: 80
id: bb
x: (polyEdges - 3)*(ma.drag.maximumX/10) + ma.drag.minimumX
text: 3 + Math.floor( 10*x /(ma.drag.maximumX ))
anchors.verticalCenter: parent.verticalCenter
onXChanged: console.log("x: " + x + " text: " + text)
onTextChanged: polyEdges = text
MouseArea
{
id: ma
anchors.fill: parent
drag.target: bb
drag.axis: Drag.XAxis
drag.minimumX: Theme.paddingLarge
drag.maximumX: geometryPopup.width - Theme.paddingLarge - bb.width
onReleased: bb.x = (polyEdges - 3)*(ma.drag.maximumX/10) + ma.drag.minimumX
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment