import QtQuick
import QtQuick.Shapes
Window {
id: root
width: 400
height: 400
visible: true
Rectangle {
id: rect1
width: 60
height: 40
Canvas {
anchors.fill: parent
onPaint: {
let context = getContext("2d")
context.strokeStyle = Qt.rgba(0, 0, 0, 1)
context.setLineDash([1, 1])
context.beginPath()
context.rect(0.5, 0.5, width - 1, height - 1)
context.stroke()
}
}
}
Rectangle {
id: rect2
x: 100
width: 60
height: 40
Shape {
ShapePath {
id: shapePath
strokeColor: "#000000"
strokeStyle: ShapePath.DashLine
dashPattern: [1, 1]
fillColor: "transparent"
PathSvg {
path: `m 0.5,0.5 h ${rect2.width - 1} v ${rect2.height - 1} h ${-(rect2.width - 1)} v ${-(rect2.height - 1)}`
}
}
}
}
}