Skip to content

ApplicationPage: Fix random gap at the top, above header

ivan tkachenko requested to merge work/ratijas/parcour-across-a-gap into master

Ah, this is my favorite footgun of QtQuick.Layouts: if you stretch a layout in its primary direction beyond what its items actually need (say, there are no items that want to fillWidht for Row or fillHeight for Column), then instead of positioning them close to each other from left to right or from top to bottom, it will put them somewhere in the middle, kinda center aligned. "Kinda" because it's not really a center of anything. It could turn out to be random 17px at the top, and whatever is left at the bottom, like in my case; or 1-2px like what Mart has seen. The point is, either you should write Layout.alignment: Qt.AlignLeft | Qt.AlignTop inside every child item, or just don't stretch the layout in the first place. Second option works here, because ColumnLayout provides a sane implicitHeight, which is perfectly consumable by a Flickable to whose contentItem this layout will be reparented.

Merge request reports