How to snap Item to center when item dragged(drag started)



  • Hello Everyone!

    I have a doubt with draggin items.

    I want to change Item position when drag started.

    If drag started, the item should be moved mouse point.
    It means If I drag item by edge of item, then Item's center should be moved mouse press point.

    How can I do ?

    I used to State( when : drag.active --> PropertyChanges x , y), but It was not working properly

    Please give me the tip.
    Regards





  • @jpnurmi Thanks for reply.
    But It doesn't work. I mean, Item should be move to touch point.

    drag.hotspot is just the point of action, Am i right?

    ++
    I solved this issue
    I use onPositionChanged.

    onPositionChanged:{
    if(drag.active){
    item.x = mouse.x
    item.y = mouse.y
    }

    Thanks a lot!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.