Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Advice on approach needed QML GridView [SOLVED]



  • !http://2.bp.blogspot.com/-hJZqgQH3fHI/TsvJ-LqWSiI/AAAAAAAAAro/hk9CQ68DE-I/s1600/editmenu.jpg(Desired result)!

    So basically task is to make Icon arrangement in GridView similar to the one in N9: user press and hold, the icon he pressed becomes draggable while the rest icons are faded, upon release if the icon being dragged moves to a new grid = GridView indexes are updated accordingly and the icon we dragged takes new position.

    The way I see it being implemented is as follows:
    -> upon press and hold (MouseArea,onPressAndHold) the MouseArea drag.active becomes true
    -> then we start checking Mouse position changes
    -> each Grid slot then has its center position Mouse coordinates
    -> Upon dragged icon released if released mouse coordinates are in proximity of such Grid slot center position => we change index of dragged icon to the index of the icon which was previously occupying that slot

    So question is - is that optimal??



  • Sorry - SOLVED of course...
    "SOLUTION":http://qt-project.org/wiki/Drag_and_Drop_within_a_GridView


Log in to reply