QML 动态视图排序教程

本教程演示了如何在不修改源模型的情况下重新排列ListView 中的项目。它展示了如何通过拖放操作调整视图中单个项目的位置,以及如何利用模型数据对视图中的所有项目进行动态排序。

教程章节:

  1. 一个简单的ListView和委托
  2. 拖动视图项
  3. 移动被拖拽的项目
  4. 对项目进行排序

本教程中的所有代码均位于 Qt XML 的examples/quick/tutorials/dynamicview 目录中。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.