SUMMARY It seems to be impossible to make Kirigami.FormLayout to fill the full width of the page. In practice, in wide mode, it tends to occupy some space in the middle of the page instead of spreading itself to fill it. Example: In Kirigami Gallery: Kirigami.FormLayout { id: layout Layout.fillWidth: true is ignored. If you insert TextField { Layout.fillWidth: true } in front of it, that one will fill the column fully, as long as it is outside of the form. As it is, it does not allow to use available space even if instructed to do so. SOFTWARE/OS VERSIONS Linux/Kirigami: 5.77.0 Qt Version: several, currently on 5.15
It does fill the width, but it centers the content within the invisible box that it's filling, rather than stretching everything to fit. That's the point of it: to create a mostly-centered layout. If you want controls to literally fill the entire width, a FormLayout is probably not the right layout tool to use.
OK, so, already by design it does not allow to make a form that would fill the available width if the child elements signal that they wish to do so. Right? Any way to regulate the amount of area that is used in practice for showing data and fraction used for borders during centering?
Could you supply an example, or maybe a code snippet that shows what you're trying to do?
I want to have forms as in "Preferences" in Pure Maps and OSM Scout Server. In these forms, I would like to show Tag | setting widget description text That should fill the width of the page to make it as simple as possible to interact with the widget. Right now, if I force the width of the form, I get alignment errors as in https://github.com/rinigus/osmscout-server/issues/355 So, it is obvious that I shouldn't specify width. Minimal example I could come up with was in the first post, but let me rephrase it. If I take Kirigami Gallery and insert in front of https://github.com/KDE/kirigami-gallery/blob/4b6cf719c9dbdc0e429e6ef50862cd1c0e233d47/src/data/contents/ui/gallery/FormLayoutGallery.qml#L45 Layout.fillWidth: true, so it will become TextField { Kirigami.FormData.label: "Label:" Layout.fillWidth: true } I would expect FormLayout to fulfill the intention: 1: make itself as wide as possible. It is also asked by the Form in that demo above; 2: make text field as wide as possible. Please let me know if something is not clear and I should provide better description.
What you can do is choose one element inside the form to be the "widener" element and set `implicitWidth: [something long]` on it, which will make it stretch out the layout horizontally. Then any other elements that need the same width can have `implicitWidth: [widenerElement].implicitWidth`
Yes, I can do that. But in this case I will have to figure out the correct width of that widener element. Something which is not super trivial as you have to take into account all labels (on the left) and spacing between label corresponding element. Somehow, I've got an impression that all this work has been done already and is a part of the FormLayout. Now, when in narrow mode, the form does actually fill full width. Which is consistent with the expectations.
I see. Yeah, maybe this is a reasonable request after all.