Не заполнение полной высоты столбца в ColumnLayout - PullRequest
0 голосов
/ 11 декабря 2018

У меня есть простой дизайн QML, который состоит из двух компонентов, расположенных рядом, а затем еще одного компонента (называемого HUD).HUD должен заполнить оставшуюся высоту, но вместо этого он оставляет зазор.

Как я могу заставить HUD заполнить всю доступную ширину.Я пытаюсь добиться второго изображения.

enter image description here

enter image description here

Page {
    width: parent.width
    height: parent.height

    title: qsTr("Home")

    ColumnLayout {
        anchors.fill: parent

        RowLayout {
            Layout.fillWidth: true;

            StatusBar {
                width: parent.width * 0.5;
                height: parent.height * 0.1
                anchors.left: parent.left;
            }

            MenuBar {
                width: parent.width * 0.5;
                height: parent.height * 0.1
                anchors.right: parent.right;
            }
        }

        // The below should fill the remaining height but its not?
        HUD {
            Layout.fillWidth: true;
            Layout.fillHeight: true;
        }

    }
}

1 Ответ

0 голосов
/ 11 декабря 2018

Добавьте Layout.fillHeight: false к вашему RowLayout, и вам будет хорошо идти.По умолчанию для макетов Layout.fillHeight и Layout.fillWidth имеют значение true.

    RowLayout {
        Layout.fillWidth: true;
        Layout.fillHeight: false;

        StatusBar {
            width: parent.width * 0.5;
            height: parent.height * 0.1
            anchors.left: parent.left;
        }

        MenuBar {
            width: parent.width * 0.5;
            height: parent.height * 0.1
            anchors.right: parent.right;
        }
    }
...