Cursor.qml 849 Bytes
Newer Older
1
import QtQuick 2.5
luyikei's avatar
luyikei committed
2 3

Rectangle {
4
    width: 1
luyikei's avatar
luyikei committed
5
    color: "#c24a00"
6 7
    x: ftop( cursorPosition )
    visible: x < sView.flickableItem.contentX ? false : true
luyikei's avatar
luyikei committed
8

9 10
    Component.onCompleted: {
        // FIXME: Binding is lost
11
        x = Qt.binding( function() { return ftop( cursorPosition ); } );
luyikei's avatar
luyikei committed
12
    }
13

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    // Triangle
    Canvas {
        id: mycanvas
        width: 15
        height: width / 2 * 1.73
        y: - height
        x: - width / 2

        onPaint: {
            var ctx = getContext( "2d" );
            ctx.fillStyle = Qt.rgba( 0.9, 0.8, 0.25, 1 );
            ctx.strokeStyle = "transparent";
            ctx.beginPath();
            ctx.moveTo( 0, 0 );
            ctx.lineTo( width, 0 );
            ctx.lineTo( width / 2, height );
            ctx.closePath();
            ctx.fill();
            ctx.stroke();
        }
34
    }
luyikei's avatar
luyikei committed
35
}