12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import QtQuick 1.1
- Rectangle {
- id: root
- width:parent.width
- height:parent.height
- visible: false
- y: screen.height
- color: "transparent"
- function close() {
- root.y=screen.height
- root.visible=false
- }
- function open(){
- visible=true
- }
- MouseArea{
- anchors.fill:parent
- onClicked: root.close()
- }
- PropertyAnimation {
- id: apperAnimation
- target: root
- property: "y"
- to:screen.height-root.height
- duration : 200
- }
- onVisibleChanged: {
- if (visible==true){
- apperAnimation.running = true
- }
- }
- Rectangle{
- id:containerBackground
- color: "lightgray"
- anchors.fill:container
- }
- Column {
- id:container
- width:parent.width
- height: 0
- anchors.bottom: parent.bottom
- }
- onChildrenChanged: {
- //Connect menu items clicked signal to menu close method and calculate the height dinamically
- var numChildren = root.children.length
- var totalHeight=container.height
- for (var i = 0; i < numChildren; ++i) {
- //console.log("objname "+root.children[i].objName + root.children[i].id )
- if (root.children[i].hasOwnProperty("text")){
- root.children[i].clicked.connect(close)
- totalHeight=totalHeight+root.children[i].height
- root.children[i].parent=container
- }
- }
- container.height=totalHeight
- }
- }
|