I'm writing a QML app using SplitView
. I want the initial space to be evenly distributed between items, but instead one item takes all the space.
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
ApplicationWindow {
id:window; visible:true
width:500; height:300
title:'Borked Layouts'
SplitView {
orientation:Qt.Horizontal
anchors.fill:parent
Rectangle { color:'red'
Layout.minimumWidth:50; Layout.fillWidth:true
Layout.preferredWidth:window.width/2
}
SplitView {
orientation:Qt.Vertical
Layout.minimumWidth:50
Layout.preferredWidth:window.width/2
Rectangle { color:'green'
Layout.minimumHeight:50; Layout.fillWidth:true
}
Rectangle { color:'blue'
Layout.minimumHeight:50; Layout.fillWidth:true
}
}
}
}
I can drag the separators between the spaces to achieve the distribution I want, and the minimum dimensions are honored. But how can I get the initial distribution to be shared between items?