Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Drawing a dashed/dotted line on a canvas element

$
0
0
Hello Everyone, I would like to draw simple dashed line on a canvas. Here is my sample code below. I had a look at properties/methods (i.e. setLineDash) for drawing the line in a “dotted” way but none of them worked for me. Am I missing something?  onPaint: {     var context = getContext("2d");          context.beginPath();      context.lineWidth = 2;      context.moveTo(currentSegment.firstPtX(), currentSegment.firstPtY());      context.strokeStyle = "white"      //context.setLineDash(5) does not work      context.lineTo(endX, endY);      context.fill();      context.stroke(); } PS: Using Qt 5.4

Viewing all articles
Browse latest Browse all 4972

Trending Articles