GroupBox provides a group box frame with a title. 更多...
import 语句: | import QtQuick.Controls 1.4 |
Since: | Qt 5.1 |
继承: |
A group box provides a frame, a title on top and displays various other controls inside itself. Group boxes can also be checkable.
Child controls in checkable group boxes are enabled or disabled depending on whether or not the group box is checked.
You can minimize the space consumption of a group box by enabling the flat property. In most styles, enabling this property results in the removal of the left, right and bottom edges of the frame.
To add content to a group box, you can reparent it to its contentItem 特性。
The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor items inside the group box, you must specify an explicit width and height on the GroupBox itself.
The following example shows how we use a GroupBox:
GroupBox { title: "Joining for?" Column { spacing: 10 CheckBox { text: "Breakfast" checked: true } CheckBox { text: "Lunch" checked: false } CheckBox { text: "Dinner" checked: true } } }
另请参阅 CheckBox , RadioButton ,和 Layout .
checkable : bool |
This property holds whether the group box has a checkbox in its title.
If this property is true, the group box displays its title using a checkbox in place of an ordinary label. If the checkbox is checked, the group box's children are enabled; otherwise, they are disabled and inaccessible.
默认情况下,组框不可复选。
checked : bool |
This property holds whether the group box is checked.
If the group box is checkable, it is displayed with a check box. If the check box is checked, the group box's children are enabled; otherwise, the children are disabled and are inaccessible to the user.
默认情况下,可复选组框还会被复选。
[read-only] contentItem : Item |
This property holds the content Item of the group box.
Items declared as children of a GroupBox are automatically parented to the GroupBox 's contentItem. Items created dynamically need to be explicitly parented to the contentItem:
注意: The implicit size of the GroupBox is calculated based on the size of its content. If you want to anchor items inside the group box, you must specify an explicit width and height on the GroupBox 本身。
flat : bool |
This property holds whether the group box is painted flat or has a frame.
A group box usually consists of a surrounding frame with a title at the top. If this property is enabled, only the top part of the frame is drawn in most styles; otherwise, the whole frame is drawn.
By default, this property is disabled, so group boxes are not flat unless explicitly specified.
注意: In some styles, flat and non-flat group boxes have similar representations and may not be as distinguishable as they are in other styles.
title : string |
This property holds the group box title text.
没有标题文本,默认情况下。