Provides a background matching with the application style and theme. 更多...
import 语句: | import QtQuick.Controls 2.5 |
Since: | Qt 5.7 |
继承: | Control |
继承者: | Frame , Page , ScrollView ,和 ToolBar |
Pane provides a background color that matches with the application style and theme. Pane does not provide a layout of its own, but requires you to position its contents, for instance by creating a RowLayout 或 ColumnLayout .
Items declared as children of a Pane are automatically parented to the Pane's contentItem . Items created dynamically need to be explicitly parented to the contentItem.
If only a single item is used within a Pane, it will resize to fit the implicit size of its contained item. This makes it particularly suitable for use together with layouts.
Pane { ColumnLayout { anchors.fill: parent CheckBox { text: qsTr("E-mail") } CheckBox { text: qsTr("Calendar") } CheckBox { text: qsTr("Contacts") } } }
Sometimes there might be two items within the pane:
Pane { SwipeView { // ... } PageIndicator { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom } }
In this case, Pane cannot calculate a sensible implicit size. Since we're anchoring the PageIndicator over the SwipeView , we can simply set the content size to the view's implicit size:
Pane { contentWidth: view.implicitWidth contentHeight: view.implicitHeight SwipeView { id: view // ... } PageIndicator { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom } }
If the contentItem has no implicit size and only one child, Pane will use the implicit size of that child. For example, in the following code, the Pane will assume the size of the Rectangle:
Pane { Item { Rectangle { implicitWidth: 200 implicitHeight: 200 color: "salmon" } } }
另请参阅 Customizing Pane , 容器控件 , Focus Management in Qt Quick Controls 2 ,和 事件处理 .
This property holds the list of content children.
The list contains all items that have been declared in QML as children of the pane.
注意:
不像
contentData
,
contentChildren
does not include non-visual QML objects.
另请参阅 Item::children and contentData .
[default] contentData : list < 对象 > |
This property holds the list of content data.
The list contains all objects that have been declared in QML as children of the pane.
注意:
不像
contentChildren
,
contentData
does include non-visual QML objects.
另请参阅 Item::data and contentChildren .
contentHeight : real |
This property holds the content height. It is used for calculating the total implicit height of the pane.
更多信息,见 Content Sizing .
另请参阅 contentWidth .
contentWidth : real |
This property holds the content width. It is used for calculating the total implicit width of the pane.
更多信息,见 Content Sizing .
另请参阅 contentHeight .