16,235
社区成员
发帖
与我相关
我的任务
分享
Canvas {
anchors.fill: parent
contextType: "2d";
property string menuBak: "images/icons/menuBak.png";
onPaint: {
context.lineWidth=4;
context.strokeStyle="#494444";
context.reset();
context.beginPath();
context.moveTo(0,parent.height);
context.lineTo(0,10);
context.arc(10,10,10,Math.PI,Math.PI*3/2,false);
context.lineTo(parent.width-10,0);
context.arc(parent.width-10,10,10,Math.PI*3/2,0,false);
context.lineTo(parent.width,parent.height);
context.clip();
context.drawImage(menuBak,0,0,parent.width,parent.height);
context.stroke();
context.restore();
}
Component.onCompleted: loadImage(menuBak);
onImageLoaded: requestPaint();
}
MouseArea {
id: topLeft
cursorShape: Qt.SizeFDiagCursor;
height: 8
width: 8
anchors.left: parent.left
anchors.leftMargin: 0
anchors.top: parent.top
anchors.topMargin: 0
onPressed: {
clickPos = Qt.point(mouse.x,mouse.y);
}
onPositionChanged: {
var delta = Qt.point(mouse.x-clickPos.x,mouse.y-clickPos.y);
mainwindow.setX(mainwindow.x+delta.x);
mainwindow.setY(mainwindow.y+delta.y);
mainwindow.setWidth(mainwindow.width-delta.x);
mainwindow.setHeight(mainwindow.height-delta.y);
}
}