Qml 将GridLayout行移到顶部

Qml 将GridLayout行移到顶部,qml,row,grid-layout,Qml,Row,Grid Layout,我有一个GridLayout,当没有足够的项目来填充可用空间时,行似乎会均匀地隔开以填充垂直空间。但是我希望这些行被强制到GridLayout的顶部 如果我移除下锚并设置Layout.maximumHeight,则我的容器会收缩,使项目显示在顶部,但我不确定这是正确的方法。将GridLayout放置在一个带有扩展项目的ColumnLayout中。例如 ColumnLayout { // anchors or Layout settings to size it. GridLay

我有一个GridLayout,当没有足够的项目来填充可用空间时,行似乎会均匀地隔开以填充垂直空间。但是我希望这些行被强制到GridLayout的顶部


如果我移除下锚并设置Layout.maximumHeight,则我的容器会收缩,使项目显示在顶部,但我不确定这是正确的方法。

将GridLayout放置在一个带有扩展项目的ColumnLayout中。例如

ColumnLayout {
    // anchors or Layout settings to size it.

    GridLayout {
        // Let it size itself vertically implicitly.
    }

    Item {
        // Use this to fill the space below it.
        Layout.fillHeight: true
    }
}