Commit c5124274 authored by Marco Martin's avatar Marco Martin
Browse files

add a twin form layout

parent 6b17b566
......@@ -33,91 +33,104 @@ Kirigami.ScrollablePage {
component: "FormLayoutGallery"
}
Kirigami.FormLayout {
id: layout
TextField {
Kirigami.FormData.label: "Label:"
}
TextField {
}
TextField {
Kirigami.FormData.label:"Lo&nger label:"
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
}
TextField {
Kirigami.FormData.label: "After separator:"
}
ComboBox {
Kirigami.FormData.label: "Combo:"
model: ["First", "Second", "Third"]
}
CheckBox {
checked: true
text: "Option"
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: "Section title"
}
TextField {
Kirigami.FormData.label: "Label:"
}
Item {
Kirigami.FormData.isSection: true
}
TextField {
Kirigami.FormData.label: "Section without line:"
}
Button {
text: qsTr("Expanding Button")
ColumnLayout {
Kirigami.FormLayout {
id: layout
Layout.fillWidth: true
}
Item {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: "Section with title without line"
}
TextField {
Kirigami.FormData.label: "Title:"
}
TextField {
Kirigami.FormData.label: "Checkable label"
Kirigami.FormData.checkable: true
enabled: Kirigami.FormData.checked
}
ColumnLayout {
Layout.rowSpan: 3
Kirigami.FormData.label: "Label for radios:"
Kirigami.FormData.buddyFor: firstRadio
RadioButton {
id: firstRadio
twinFormLayouts: layout2
TextField {
Kirigami.FormData.label: "Label:"
}
TextField {
}
TextField {
Kirigami.FormData.label:"Lo&nger label:"
}
Kirigami.Separator {
Kirigami.FormData.isSection: true
}
TextField {
Kirigami.FormData.label: "After separator:"
}
ComboBox {
Kirigami.FormData.label: "Combo:"
model: ["First", "Second", "Third"]
}
CheckBox {
checked: true
text: "One"
text: "Option"
}
RadioButton {
text: "Two"
Kirigami.Separator {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: "Section title"
}
RadioButton {
text: "Three"
TextField {
Kirigami.FormData.label: "Label:"
}
}
Button {
text: item ? "Remove Field" : "Add Field"
property TextField item
onClicked: {
if (item) {
item.destroy();
} else {
item = dyncomponent.createObject(layout);
Item {
Kirigami.FormData.isSection: true
}
TextField {
Kirigami.FormData.label: "Section without line:"
}
Button {
text: qsTr("Expanding Button")
Layout.fillWidth: true
}
Item {
Kirigami.FormData.isSection: true
Kirigami.FormData.label: "Section with title without line"
}
TextField {
Kirigami.FormData.label: "Title:"
}
TextField {
Kirigami.FormData.label: "Checkable label"
Kirigami.FormData.checkable: true
enabled: Kirigami.FormData.checked
}
ColumnLayout {
Layout.rowSpan: 3
Kirigami.FormData.label: "Label for radios:"
Kirigami.FormData.buddyFor: firstRadio
RadioButton {
id: firstRadio
checked: true
text: "One"
}
RadioButton {
text: "Two"
}
RadioButton {
text: "Three"
}
}
Component {
id: dyncomponent
TextField {
Kirigami.FormData.label: "Generated Title:"
Button {
text: item ? "Remove Field" : "Add Field"
property TextField item
onClicked: {
if (item) {
item.destroy();
} else {
item = dyncomponent.createObject(layout);
}
}
Component {
id: dyncomponent
TextField {
Kirigami.FormData.label: "Generated Title:"
}
}
}
}
Kirigami.FormLayout {
id: layout2
Layout.fillWidth: true
twinFormLayouts: layout
TextField {
Kirigami.FormData.label: qsTr("Twin Layout:")
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment