版本控制方案
版本
Qt Quick Controls 2.0 版本首次出现在 Qt 5.7 中。此后,Qt 的每次次要版本发布都会将Qt Quick Controls 模块的导入版本号递增 1,直到 Qt 5.12 为止,此时模块的导入版本号与 Qt 的次要版本号保持一致。
在 Qt 6 中,主版本号和次版本号保持一致,且在 Qml 的导入语句中可以省略版本号。如果省略版本号,则将使用最新版本。
实验性的 Qt Labs 模块使用导入版本 1.0。
Qt | QtQuick | QtQuick.Controls,QtQuick.Controls.Material,QtQuick.Controls.Universal,QtQuick.Templates | Qt.labs.platform |
|---|---|---|---|
| 5.7 | 2.7 | 2.0 | 1.0 |
| 5.8 | 2.8 | 2.1 | 1.0 |
| 5.9 | 2.9 | 2.2 | 1.0 |
| 5.10 | 2.10 | 2.3 | 1.0 |
| 5.11 | 2.11 | 2.4 | 1.0 |
| 5.12 | 2.12 | 2.12 | 1.0 |
| 6.0 | 6.0 | 6.0 | 1.0 |
| ... | ... | ... | ... |
修订
由于Qt Quick Controls 的实现方式,新增的属性可能会与任何同名的用户自定义属性发生冲突。例如,以下代码片段将导致错误:
import QtQuick.Controls 2.13
ApplicationWindow {
// ...
ComboBox {
anchors.centerIn: parent
// As currentValue was added in 2.14, the versioned import above
// should cause this property to be used, but instead an error is produced:
// "Cannot override FINAL property"
property int currentValue: 0
}
}应重命名这些属性以避免冲突。
© 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.