On Wed, 2011-08-31 at 01:36 +0000, [email protected] wrote:
> Can you describe in more detail exactly what is happening? It sounds to me
> like the Flickable is flicking at the end, which would be expected .
I'm trying to implement a control a bit like a radio tuning dial where the
numbers move below a fixed marker.
I've included some code below so you can see the effect. The top slider
uses a Flickable, the lower slider uses a simple dragging mechanism.
I find it's often difficult to accurately position the slider using the
top slider which uses a Flickable. I think the problem is caused by
small position changes as you lift your finger which then get turned
into velocity by the flickable, magnifying the effect.
import QtQuick 1.0
Rectangle {
clip: true
anchors.fill: parent
color: "white"
Flickable {
id: flickable
anchors.top: parent.top; anchors.left: parent.left;
anchors.right: parent.right
height: parent.height/2
contentWidth: 100*50
Row {
height: parent.height
Repeater {
model: 100
delegate: Text {
width: 50; height: parent.height
text: index
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}
Item {
id: draggable
property int contentX: 0
anchors.bottom: parent.bottom; anchors.left: parent.left;
anchors.right: parent.right
height: parent.height/2
MouseArea {
property int xlast: 0
anchors.fill: parent
onPressed: {
xlast = mouseX;
}
onPositionChanged: {
draggable.contentX = draggable.contentX-(mouseX-xlast)
xlast = mouseX;
}
}
Item {
transform: Translate { x: -draggable.contentX }
width: 100*50
height: parent.height
Row {
height: parent.height
Repeater {
model: 100
delegate: Text {
width: 50; height: parent.height
text: index
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}
}
Rectangle {
id: marker
anchors.centerIn: parent
color: "red"; opacity: 0.5; width: 10; height: parent.height
}
}
_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml