fixed the clicked event
This commit is contained in:
parent
8c1835950b
commit
a75bd07cd8
1 changed files with 89 additions and 81 deletions
|
@ -34,6 +34,8 @@ Item {
|
||||||
|
|
||||||
state: "closed"
|
state: "closed"
|
||||||
|
|
||||||
|
Drag.active: dragArea.drag.active
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: draw2Background
|
id: draw2Background
|
||||||
|
|
||||||
|
@ -46,6 +48,22 @@ Item {
|
||||||
border.width: 1
|
border.width: 1
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: fullArea
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: (root.state === "expanded" || root.state === "opened")
|
||||||
|
onClicked: {
|
||||||
|
if (root.state === "expanded") {
|
||||||
|
root.state = "collapsed"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root.state === "opened") {
|
||||||
|
root.state = "closed"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: semiArea
|
id: semiArea
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -58,6 +76,7 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: contentArea
|
id: contentArea
|
||||||
|
|
||||||
anchors.top: semiArea.bottom
|
anchors.top: semiArea.bottom
|
||||||
height: contentHeight
|
height: contentHeight
|
||||||
radius: 16
|
radius: 16
|
||||||
|
@ -75,28 +94,6 @@ Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
color: parent.color
|
color: parent.color
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: fullArea
|
|
||||||
anchors.fill: parent
|
|
||||||
enabled: (root.state === "expanded" || root.state === "opened")
|
|
||||||
onClicked: {
|
|
||||||
if (root.state === "expanded") {
|
|
||||||
root.state = "collapsed"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (root.state === "opened") {
|
|
||||||
root.state = "closed"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Drag.active: dragArea.drag.active
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: dragArea
|
id: dragArea
|
||||||
|
@ -106,10 +103,10 @@ Item {
|
||||||
cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor
|
cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
drag.target: parent
|
drag.target: root
|
||||||
drag.axis: Drag.YAxis
|
drag.axis: Drag.YAxis
|
||||||
drag.maximumY: parent.height
|
drag.maximumY: root.height
|
||||||
drag.minimumY: parent.height - root.height
|
drag.minimumY: root.height - root.height
|
||||||
|
|
||||||
/** If drag area is released at any point other than min or max y, transition to the other state */
|
/** If drag area is released at any point other than min or max y, transition to the other state */
|
||||||
onReleased: {
|
onReleased: {
|
||||||
|
@ -146,6 +143,17 @@ Item {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// onEntered: {
|
||||||
|
// fullArea.enabled = false
|
||||||
|
// }
|
||||||
|
|
||||||
|
// onExited: {
|
||||||
|
// fullArea.enabled = true
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onStateChanged: {
|
onStateChanged: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue