优化设计
您可以在目标设备上测试用户界面,以确保动画能发挥最佳性能。要解决性能问题,通常需要优化用户界面中使用的图形资源。
要针对不同的目标设备优化用户界面:
- 尽量减小图像大小。
- 谨慎使用透明效果。
有关更多信息,请参阅《QML 性能注意事项与建议》。
减小图像大小
图像 是任何用户界面的重要组成部分。遗憾的是,由于加载时间长、占用内存多以及使用方式等问题,它们也是导致问题的主要来源之一。
我们建议您在不影响图像质量的前提下,尽可能缩小图像大小。
有关如何在 UI 中高效使用图像的更多信息,请参阅《在 UI 中使用图像》。
避免使用透明效果
通常,不透明内容的绘制速度远快于透明内容,因为后者需要进行混合处理,且渲染器对不透明内容的优化效果往往更好。
即使一张图像大部分是不透明的,只要其中有一个透明像素,它也会被视为完全透明。对于边缘透明的Border Image 也是如此。
另请参阅 《如何设计Qt Quick 用户界面》、《 Qt Quick 用户界面设计》以及《 设计Qt Quick 用户界面》。
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.