Quantcast
Channel: Active questions tagged qtquick2 - Stack Overflow
Viewing all articles
Browse latest Browse all 107

How to implement QML SplitView for three or more elements

$
0
0

I'm trying to user PyQt6 to build Desktop app. I need to build a UI presentation with three logical sections which can be resizable by horizontal axis. Looks like SplitView is a perfect component for my goal. Unfortunately I can't make it works as desired.

I found a simple example in official documentation for Qt version 5 that describes exact UI result I'm looking for.
enter image description here

So I decided to reuse the code under Qt version 6

import QtQuick 2.15import QtQuick.Controls 2.15import QtQuick.LayoutsApplicationWindow {    height: 600    visible: true    width: 1200    SplitView {        anchors.fill: parent        orientation: Qt.Horizontal        Rectangle {            Layout.maximumWidth: 400            color: "lightblue"            width: 200            Text {                anchors.centerIn: parent                text: "View 1"            }        }        Rectangle {            id: centerItem            Layout.fillWidth: true            Layout.minimumWidth: 50            color: "lightgray"            Text {                anchors.centerIn: parent                text: "View 2"            }        }        Rectangle {            color: "lightgreen"            width: 200            Text {                anchors.centerIn: parent                text: "View 3"            }        }    }}

But I get a different result

enter image description here

Looks like first two sections width are squeezed to 0

Any ideas?


Viewing all articles
Browse latest Browse all 107

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>