QML SplitView does not resize its content when the window shrinks

422 Views Asked by At

I have a QML vertical SplitView, split into 2 elements:

  • The top element is a green rectangle
  • The bottom element is a red rectangle

Both have a minimum height of 200. Inside the bottom element there is a blue rectangle anchored to the bottom with a fixed height of 50.

It looks like this 1 :

The issue is this: when I manually resize (shrink) the window from the bottom, the bottom item does not scale properly so the blue rectangle disappears under the window.

Steps to reproduce the issue:

  • Move the handle a few hundred pixels to the top
  • Resize the window from the bottom side to the top until the bottom item start becoming smaller

I get this result 2, and as soon as I move the handle, everything goes back to a normal state and the bottom item is resized as it should be 3.

Here is the QML code :

import QtQuick.Controls 2.15
import QtQuick.Window 2.15

ApplicationWindow {
    id: root

    title: testSplitView
    visible: true
    x: 100; y: 100
    width: 1300; minimumWidth: 900;// maximumWidth: 1300
    height: 900; minimumHeight: 550;// maximumHeight: 900

    Rectangle{
        id: rectangle
        anchors.fill: parent
        color: "darkGrey"

        SplitView{
            id: verticalSplitView
            anchors.fill: parent
            orientation: Qt.Vertical

            Rectangle{
                id: topRectangle
                SplitView.fillHeight: true
                SplitView.minimumHeight: 200
                color: "red"
            }

            Rectangle{
                id: bottomRectangle
                SplitView.minimumHeight:200
                color: "green"
                Rectangle{
                    anchors.bottom: parent.bottom
                    height: 50
                    width: parent.width
                    color: "blue"
                }
            }
        }
    }
}
0

There are 0 best solutions below