Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML SplitView in Coltrols 2.15



  • [link text](link url)
    I'm new to Qt and starting off with a simple project. I have trouble with the SplitView object. I am running Qt 5.15 (open soruce) on Windows 10 at latest updates, using the MinGW 64-bit 8.1.0-posix-sjlj-rt_v6-rev0. I ran the example from the documentation (https://doc.qt.io/qt-5/qml-qtquick-controls-splitview.html) in a new project:

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls 2,15
    import QtQuick.Layouts 1.15
    
    Window {
        id: main_window
        width: 480
        height: 640
        visible: true
        title: qsTr("Bunker Still Interface")
    
        SplitView {
            anchors.fill: parent
            orientation: Qt.Horizontal
    
            Rectangle {
                width: 200
                Layout.maximumWidth: 400
                color: "lightblue"
                Text {
                    text: "View 1"
                    anchors.centerIn: parent
                }
            }
            Rectangle {
                id: centerItem
                Layout.minimumWidth: 50
                Layout.fillWidth: true
                color: "lightgray"
                Text {
                    text: "View 2"
                    anchors.centerIn: parent
                }
            }
            Rectangle {
                width: 200
                color: "lightgreen"
                Text {
                    text: "View 3"
                    anchors.centerIn: parent
                }
            }
        }
    }
    

    When I build and run in QtCreator the sliders are initialized to the extreme left side of the window. They otherwise work normally except that they do not honor minimumWidth or maximumWidth.
    If I change line 2 to import "QtQuick.Controls 1.6" the SplitView behaves as expected.
    Is there any known problem with SplitView in Controls 2? Any workaround? I would like to use this control but also would like to use Controls 2. Any insight would be appreciated.



  • @craigwin said in QML SplitView in Coltrols 2.15:

    [link text](link url)
    I'm new to Qt and starting off with a simple project. I have trouble with the SplitView object. I am running Qt 5.15 (open soruce) on Windows 10 at latest updates, using the MinGW 64-bit 8.1.0-posix-sjlj-rt_v6-rev0. I ran the example from the documentation (https://doc.qt.io/qt-5/qml-qtquick-controls-splitview.html) in a new project:

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls 2,15
    

    Typo in the QtQuick.Controls version number?

    import QtQuick.Layouts 1.15

    Window {
    id: main_window
    width: 480
    height: 640
    visible: true
    title: qsTr("Bunker Still Interface")

    SplitView {
        anchors.fill: parent
        orientation: Qt.Horizontal
    
        Rectangle {
            width: 200
            Layout.maximumWidth: 400
    

    The Qt Quick Controls 2 SplitView attached property is SplitView.maximumWidth. The Controls 1 SplitView attached property is Layout.maximumWidth.



  • This behavior also happens in QT6.
    I checked the bug report system but I haven't found any bugs reported on the subject.



  • @craigwin said in QML SplitView in Coltrols 2.15:

    [link text](link url)
    I'm new to Qt and starting off with a simple project. I have trouble with the SplitView object. I am running Qt 5.15 (open soruce) on Windows 10 at latest updates, using the MinGW 64-bit 8.1.0-posix-sjlj-rt_v6-rev0. I ran the example from the documentation (https://doc.qt.io/qt-5/qml-qtquick-controls-splitview.html) in a new project:

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls 2,15
    

    Typo in the QtQuick.Controls version number?

    import QtQuick.Layouts 1.15

    Window {
    id: main_window
    width: 480
    height: 640
    visible: true
    title: qsTr("Bunker Still Interface")

    SplitView {
        anchors.fill: parent
        orientation: Qt.Horizontal
    
        Rectangle {
            width: 200
            Layout.maximumWidth: 400
    

    The Qt Quick Controls 2 SplitView attached property is SplitView.maximumWidth. The Controls 1 SplitView attached property is Layout.maximumWidth.



  • @jeremy_k
    Thank you, Jeremy, for clearing that up. It fixed the problem.


Log in to reply