IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

GroupBox QML Type

Visual frame and title for a logical group of controls.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

GroupBox QML Type

  • Import Statement: import QtQuick.Controls

  • Inherits: Frame

  • Group: GroupBox is part of qtquickcontrols-containers

Detailed Description

GroupBox is used to layout a logical group of controls together, within a titled visual frame. GroupBox does not provide a layout of its own, but requires you to position its contents, for instance by creating a RowLayout or a ColumnLayout.

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.

If only a single item is used within a GroupBox, it will resize to fit the implicit size of its contained item. This makes it particularly suitable for use together with layouts.

Image non disponible
 
Sélectionnez
GroupBox {
    title: qsTr("Synchronize")
    ColumnLayout {
        anchors.fill: parent
        CheckBox { text: qsTr("E-mail") }
        CheckBox { text: qsTr("Calendar") }
        CheckBox { text: qsTr("Contacts") }
    }
}

Checkable GroupBox

Even though GroupBox has no built-in check box, it is straightforward to create a checkable GroupBox by pairing it with a CheckBox.

Image non disponible

It is a common pattern to enable or disable the groupbox's children when its checkbox is toggled on or off, but it is up to the application to decide on the behavior of the checkbox.

 
Sélectionnez
GroupBox {
    label: CheckBox {
        id: checkBox
        checked: true
        text: qsTr("Synchronize")
    }

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

See Also

Property Documentation

 

[read-only, since QtQuick.Controls 2.5 (Qt 5.12)] implicitLabelHeight : real

This property holds the implicit label height.

The value is equal to label ? label.implicitHeight : 0.

This property was introduced in QtQuick.Controls 2.5 (Qt 5.12).

See Also

[read-only, since QtQuick.Controls 2.5 (Qt 5.12)] implicitLabelWidth : real

This property holds the implicit label width.

The value is equal to label ? label.implicitWidth : 0.

This property was introduced in QtQuick.Controls 2.5 (Qt 5.12).

See Also

label : Item

This property holds the label item that visualizes title.

See Also

title : string

This property holds the title.

The title is typically displayed above the groupbox to summarize its contents.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+