1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
| import QtQuick 2.14 import QtQuick.Window 2.14 import QtQuick.Controls 1.4 import QtQuick.Controls 2.15
Window { id: mainwindow x: Screen.width-mainwindowSizeW.value y: mainwindowYPos.value width: mainwindowSizeW.value height: mainwindowSizeH.value visible: true flags: Qt.FramelessWindowHint|Qt.Window|Qt.WindowStaysOnTopHint color: "transparent" title: qsTr("Hello World")
Item{ anchors.fill: parent
Rectangle{ id:rect1 anchors.fill: parent radius: mainwindowRadius.value color: "red" } MouseArea{ anchors.fill: rect1 hoverEnabled: true onEntered: mywindow.visible = true } Component.onCompleted: {
} }
MyWindow{ id: setting width: 640 height: 480 x: Screen.width/2-width/2 y: Screen.height/2-height/2
Grid{ columns: 2 verticalItemAlignment: Grid.AlignVCenter horizontalItemAlignment: Grid.AlignLeft columnSpacing: 100 Label{ text: "触发条位置" } Slider { id: mainwindowYPos from: 30 value: Screen.height/2-mainwindowSizeH.value/2 to: Screen.height-mainwindowSizeH.value-30 } Label{ text: "触发条宽度" } Slider { id: mainwindowSizeW from: 1 value: 15 to: 30 } Label{ text: "触发条高度" } Slider { id: mainwindowSizeH from: 50 value: 125 to: 200 } Label{ text: "触发条圆角" } Slider { id: mainwindowRadius from: 1 value: 0 to: mainwindowSizeW.value/2 } Label{ text: "快捷窗口宽度" } Slider { id: mywindowW from: 100 value: 400 to: 1000 } Label{ text: "快捷窗口高度" } Slider { id: mywindowH from: 100 value: Screen.height-50 to: Screen.height-10 } Label{ text: "快捷窗口位置" } Slider { id: mywindowX from: 100 value: mainwindow.x-mywindowW.value-20 to: Screen.width-mywindowW.value } Label{ text: "快捷窗口圆角" } Slider { id: mywindowRadius from: 1 value: 30 to: mywindowW.value/2 } } } MyWindow{ id: mywindow width: mywindowW.value height: mywindowH.value x: mywindowX.value y: Screen.height/2-mywindowH.value/2-10 flags: Qt.FramelessWindowHint|Qt.Widget color: "transparent"
Item{ anchors.fill: parent
Rectangle{ id:mainRect anchors.fill: parent color: "blue" radius: mywindowRadius.value MouseArea{ anchors.fill: mainRect hoverEnabled: true onExited: mywindow.visible = false } Rectangle{ id: settingButton anchors.right: mainRect.right anchors.top: mainRect.top anchors.margins: 10 width: 50 height: 50
MouseArea{ anchors.fill: settingButton onClicked: setting.visible = true } } } }
} }
|