Skip to content

Instantly share code, notes, and snippets.

@kimmoli
Created May 24, 2015 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimmoli/1fb197f91c0c47aa8294 to your computer and use it in GitHub Desktop.
Save kimmoli/1fb197f91c0c47aa8294 to your computer and use it in GitHub Desktop.
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