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
↧