本页内容

Frame QML Type

用于逻辑控件组的视觉框架。更多内容...

Import Statement: import QtQuick.Controls
Inherits:

Pane

Inherited By:

GroupBox

详细描述

Frame 用于将一组逻辑控件在视觉框架内进行布局。Frame 本身不提供布局功能,而是需要您手动定位其内容,例如通过创建RowLayout 或ColumnLayout 来实现。

声明为框架子节点的控件会自动成为该框架contentItem 的子项。动态创建的控件需要显式地将其父项设置为contentItem。

如果 Frame 中仅使用一个项目,它将自动调整大小以适应所包含项目的隐式尺寸。这使其特别适合与布局配合使用。

包含已分组控件且边框可见的框架

Frame {
    ColumnLayout {
        anchors.fill: parent
        CheckBox { text: qsTr("E-mail") }
        CheckBox { text: qsTr("Calendar") }
        CheckBox { text: qsTr("Contacts") }
    }
}

另请参阅 《自定义 Frame 和容器控件》。

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