Qt Quick Controls - 图库
控件图库。
|
欢迎界面 |
侧边抽屉 |
选项菜单 |
此图库示例是一个简单的应用程序,其侧边抽屉菜单包含所有 Qt Quick Controls。每个菜单项都会打开一个页面,该页面不仅展示控件的图形外观,还允许您与控件进行交互,并说明在何种情况下使用该控件最为便捷。
当应用程序处于纵向模式时,侧边抽屉是一个交互式侧面板,可从左边缘滑动打开。它显示在内容上方,其模态背景会阻挡用户的交互操作。当应用程序处于横向模式时,侧边抽屉和内容并排显示。
应用程序的当前方向是通过比较窗口的宽高与设置中的方向模式配置来确定的:
readonly property bool portraitMode: !orientationCheckBox.checked || window.width < window.height由于本示例支持所有内置的Qt Quick Controls 样式,因此它使用运行时样式选择。
运行示例
您可以通过以下方式运行该示例:
- Qt Creator
打开Welcome 模式,并从Examples 中选择该示例。有关更多信息,请参阅Qt Creator :教程:构建和运行。
- Qt Extension for Visual Studio Code
在Command Palette 中运行Qt: Open Qt examples 命令,并从列表中选择该示例。有关更多信息,请参阅Qt Extension for Visual Studio Code :教程:构建和运行。
© 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.


