本页内容

Qt Quick Controls - 图库

控件图库。

图库欢迎界面显示可用的控制类别

欢迎界面

显示 Qt Quick Controls 列表的侧边抽屉式菜单

侧边抽屉

包含“设置”和“关于”选项的“选项”菜单

选项菜单

此图库示例是一个简单的应用程序,其侧边抽屉菜单包含所有 Qt Quick Controls。每个菜单项都会打开一个页面,该页面不仅展示控件的图形外观,还允许您与控件进行交互,并说明在何种情况下使用该控件最为便捷。

当应用程序处于纵向模式时,侧边抽屉是一个交互式侧面板,可从左边缘滑动打开。它显示在内容上方,其模态背景会阻挡用户的交互操作。当应用程序处于横向模式时,侧边抽屉和内容并排显示。

应用程序的当前方向是通过比较窗口的宽高与设置中的方向模式配置来确定的:

readonly property bool portraitMode: !orientationCheckBox.checked || window.width < window.height

由于本示例支持所有内置的Qt Quick Controls 样式,因此它使用运行时样式选择。

运行示例

您可以通过以下方式运行该示例:

示例项目 @ code.qt.io

© 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.