cuisy |
2017-07-01 08:04 |
Rectangle { id: titleRect; color: "#00A600"; anchors.top: parent.top; anchors.left: parent.left; anchors.right: parent.right; height: 25;
TitleButton { //关闭按钮 id: closeButtonDialog; width: 20; height: 18; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter; anchors.rightMargin: 2;
normalPath: "qrc:/Image/Close2.png"; enterPath: "qrc:/Image/Close3.png"; pressPath: "qrc:/Image/Close1.png";
onButtonClick: usrMngWnd.destroy(); }
Rectangle { id: dragDialog; anchors.top: titleRect.top; anchors.left: titleRect.left; anchors.right: closeButtonDialog.left; anchors.bottom: titleRect.bottom; color: "darkBlue";
MouseArea { anchors.fill: dragDialog; acceptedButtons: Qt.LeftButton; property point clickPos: "0,0"; onPressed: { clickPos = Qt.point(mouse.x,mouse.y); }
onPositionChanged: { //鼠标偏移量 var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y);
//如果mainwindow继承自QWidget,用setPos self.setX(self.x+delta.x); self.setY(self.y+delta.y); } }
Label { id: titleWindowLabel; anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter; color: "#fffffb"; text: qsTr("标题"); font.bold: true; } } } |
|