在 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();