import QtQuick 2.9
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Canvas{
width: 400;
height: 240;
contextType: "2d";
onPaint: {
context.lineWidth = 10;
context.strokeStyle = "red";
roundRect(context,10,10,100,100,20)
context.stroke();
}
}
function roundRect(ctx, x, y, w, h, r) {
// 开始绘制
ctx.beginPath()
// 左上角
ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5)
// 右上角
ctx.arc