[PyQt] How use pathElements in a function ?

Charlie Gentil ceg at redaction-developpez.com
Sun Jan 18 20:24:07 GMT 2015


Hello,


import QtQuick 2.4

Canvas {
    id: canvas
    width: 500; height: 400
    contextType: "2d"
    transform: Rotation { origin.x: 0; origin.y: height/2; angle: 180; axis { x: 1; y: 0; z: 0 }}

    signal trace

    onTrace : {
        myCurve2.pathElements = [PathCurve { x: 75; y : 75}, PathCurve {x:200; y:150}]      //This is where I want to spend my items in my database
    }

    Path {
        id: myCurve2
        startX: 20; startY: 120
        pathElements: [
            //PathCurve { x: 75; y: 75 },
            //PathCurve { x: 200; y: 150 },
            //PathCurve { x: 325; y: 25 },
            //PathCurve { x: 400; y: 100 }
        ]

    }

    onPaint: {
        trace()
        context.strokeStyle = Qt.rgba(0,1,0);
        context.path = myCurve2;
        context.stroke();
    }
  
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150118/350d10c1/attachment.html>


More information about the PyQt mailing list