FormData QML Type
An attached property with information for decorating a FormLayout. More...
| Import Statement: | import org.kde.kirigami.layouts |
Attached Properties
- buddyFor : Item
- isSection : bool
- label : string
- labelAlignment : int
Detailed Description
It contains the text labels of fields and information about sections.
Some of its properties can be used with other Layout types.
import org.kde.kirigami as Kirigami
Kirigami.FormLayout {
TextField {
Kirigami.FormData.label: "User:"
}
TextField {
Kirigami.FormData.label: "Password:"
}
}
See also FormLayout.
Attached Property Documentation
FormData.buddyFor : Item [attached]
This property can only be used in conjunction with a FormData::label, often in a layout that is a child of a FormLayout.
It then turns the item specified into a "buddy" of the label, making it work as if it were a child of the FormLayout.
A buddy item is useful for instance when the label has a keyboard accelerator, which when triggered provides active keyboard focus to the buddy item.
By default buddy is the item that FormData is attached to. Custom buddy can only be a direct child of that item; nested components are not supported at the moment.
Kirigami.FormLayout {
Layouts.ColumnLayout {
// If the accelerator is in the letter S,
// pressing Alt+S gives focus to the slider.
Kirigami.FormData.label: "Slider label:"
Kirigami.FormData.buddyFor: slider
QQC2.Slider {
id: slider
from: 0
to: 100
value: 50
}
}
}
FormData.isSection : bool [attached]
If true, the child item of a FormLayout becomes a section separator, and may have different looks:
To make it just a space between two fields, just put an empty item with FormData.isSection:
TextField {
Kirigami.FormData.label: "Label:"
}
Item {
Kirigami.FormData.isSection: true
}
TextField {
Kirigami.FormData.label: "Label:"
}
To make it a space with a section title:
TextField {
Kirigami.FormData.label: "Label:"
}
Item {
Kirigami.FormData.label: "Section Title"
Kirigami.FormData.isSection: true
}
TextField {
Kirigami.FormData.label: "Label:"
}
To make it a space with a section title and a separator line:
TextField {
Kirigami.FormData.label: "Label:"
}
Kirigami.Separator {
Kirigami.FormData.label: "Section Title"
Kirigami.FormData.isSection: true
}
TextField {
Kirigami.FormData.label: "Label:"
}
FormData.label : string [attached]
The label for a FormLayout field
FormData.labelAlignment : int [attached]
The alignment for the label of a FormLayout field