Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Possible to draw dashed line using 2d context in Canvas?
cscooper last edited by
I've got a Canvas on my window and I'm drawing a line on it:
var ctx = getContext("2d");
ctx.strokeStyle = "green";
But I would like the line to be dashed, not solid. Is there any way to do this? I tried setting the stroke style to a pattern:
var pat = ctx.createPattern("green", Qt.CrossPattern);
ctx.strokeStyle = pat;
but none of the available patterns result in a good-looking dashed line.