Important: Please read the Qt Code of Conduct -

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 : --> PropertyChanges x , y), but It was not working properly

    Please give me the tip.

  • @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.

    item.x = mouse.x
    item.y = mouse.y

    Thanks a lot!

Log in to reply