使用状态
要为组件和组件实例设置状态,请进入View >Views >States ,然后选择
。

在2D 视图中选择新状态切换到该状态,然后在Properties 中修改组件或组件实例的属性值。
例如,要更改按钮的外观,您可以在按钮组件中定义状态,以隐藏按钮图像并显示其他图像,或更改按钮背景或文本颜色。在其他组件中使用按钮实例时,您可以定义状态,通过隐藏或显示按钮组件实例来创建不同的屏幕。Components > > 中的预设按钮控件具有预定义的正常和不正常状态。 Qt Quick Controls>Controls 中的预设按钮控件具有预定义的正常和向下状态。
要为屏幕添加动态效果,可以在2D 视图中改变组件实例的位置,然后为状态之间的变化添加动画。
在状态中更改的属性会以蓝色高亮显示。在Code 视图或Edit 模式中,您可以看到记录在基本状态中的变化。

注意: 如果您已在Navigator 中锁定了一个组件,并试图移除改变其属性值的状态,系统会提示您确认移除。
有关使用状态的更多信息,请观看以下视频:
另请参阅 如何设计Qt Quick UI,如何使用状态?使用状态,Qt Quick UI 设计,以及设计Qt Quick UI。
Copyright © The Qt Company Ltd. and other contributors. 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.