QML List 动画的相对位置移动

在 QML 中想要实现,Item 从实际位置上或下一定距离相对滑入,重点在于如何获取相对位置的坐标

这里需要使用到 ViewTransition 这个类

举例

add: Transition {

    id: test

    NumberAnimation { properties: "y", from: test.Viewtransition.destination.y; duration: 500}

}

这里只是引申

上下移动:

beginMoveRow(QModelIndex(), sourceRow, sourceRow, QModelIndex(), (newRow > sourceRow) ? (newRow+1):newRow);

具体操作

endMoveRows();

发布了120 篇原创文章 · 获赞 27 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/qq_24890953/article/details/103190938
QML