qt - How to drag / slide a element in QML without changing its x,y position? -


i working on development of ui required implement similar effect of dragging status bar in smart phone.

this should slide element downwards on click.(which means height increased)

i tried using following code take of " no x,y values change " of element

mousearea{     id : zone2mousearea     anchors.fill : parent      drag.target: zone2id     drag.axis: drag.yaxis     drag.minimumy: 0     drag.maximumy: 0.1  } 

and onychanged () increased height.

however not suffice requirement. need slide element changing view interms of height without changing x,y values

i have made basic example. hope helps. dont have ide me of now, please check syntax errors

import qtquick 1.1  rectangle {     width: 560     height: 560     color: "blue"      rectangle     {        id: slider        width: parent.width        height: parent.height        y: - parent.height * .90        color: "yellow"         property bool isattop: true         behavior on y { numberanimation { duration: 300 } }         text        {            text: qstr("12:34 pm")            anchors.bottom: parent.bottom            color: "black"        }         text        {            text: qstr("battery | wifi | updates")            anchors.centerin: parent            color: "black"            font.pixelsize: 25        }         mousearea        {            id: draggingmouse            anchors.fill : parent            drag.target: parent            drag.axis: drag.yaxis            drag.minimumy: - parent.height * .90            drag.maximumy: 0             onreleased:            {                if ( true == slider.isattop )                {                    if( slider.y < - parent.height * .80 )                        slider.y = - parent.height * .90                    else                    {                        slider.y = 0                        slider.isattop = false                    }                }                 else                {                    if( slider.y < - parent.height * .20 )                    {                        slider.y = - parent.height * .90                        slider.isattop = true                    }                     else                    {                        slider.y = 0                    }                }             }        }     } } 

Comments