I cannot be able to achieve Split view inside a layout. When I try to drag, the screen returning to minimum split screen width. But without layout I can able to drag and split the view properly
ColumnLayout {
anchors.fill: parent
spacing: 20
RowLayout {
spacing:20
height: 500
SplitView {
anchors.fill: parent
orientation: Qt.Horizontal
Rectangle {
SplitView.preferredWidth: 200
SplitView.fillHeight: true
color: "lightblue"
Text {
anchors.centerIn: parent
text: "View 1"
}
}
Rectangle {
id: centerItem
SplitView.preferredWidth: 200
SplitView.fillHeight: true
color: "lightgray"
Text {
anchors.centerIn: parent
text: "View 2"
}
}
Rectangle {
SplitView.fillWidth: true
SplitView.fillHeight: true
color: "lightgreen"
Text {
anchors.centerIn: parent
text: "View 3"
}
}
}
}
}
The error is in SplitView
anchors.fill: parent.SplitView component is a child of RowLayout, this means that its size must be managed with
Layoutattached properties and not set explicitly. Anchors set item size and position.Substitute SplitView
anchors.fill: parentwithLayout.fillWidth: true; Layout.fillHeight: trueBelow your working as expected code
Reference: Qt Layout QML Type
Updated:
You don't need layouts to combine different SplitViews. SplitView behaves as a layout manager.
Below the example that you have request in the comment:
This is the result: