Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Struggle with SplitView
Qt 6.11 is out! See what's new in the release blog

Struggle with SplitView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 516 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cbro_ot
    wrote on last edited by cbro_ot
    #1

    Following is a split view with forms on the left "panel" and a rectangle serving as main area on the right.

    import QtQuick
    import QtQuick.Controls
    import QtQuick.Layouts
    
    ApplicationWindow {
        visible: true
        minimumWidth: 640
        minimumHeight: 480
    
        SplitView {
            anchors.fill: parent
            anchors.margins: 10
    
            ScrollView {
                ColumnLayout {
                    GroupBox {
                        title: "Form 1"
                        Layout.fillWidth: true
    
                        GridLayout {
                            columns: 2
                            Text { text: "Lorem:" }
                            TextField {  }
                            Text { text: "Foo:" }
                            ComboBox { }
                        }
                    }
    
                    /* Spacer */
                    Item {
                        Layout.fillWidth: true
                        Layout.fillHeight: true
                    }
    
                    GroupBox {
                        title: "Form 2"
                        Layout.fillWidth: true
    
                        GridLayout {
                            columns: 2
                            Text { text: "Bar:" }
                            RowLayout { TextField { } Button { text: "Yes" } }
                            Text { text: "Ipsum:" }
                            TextField { }
                        }
                    }
                }
            }
    
            Rectangle {
                color: "navajowhite"
                Layout.fillWidth: true
                Layout.fillHeight: true
            }
        }
    }
    

    This has currently many issues which I'm not sure how to approach:

    1. Dragging the vertical split to the left causes a scroll to appear (which is expected), but dragging it to the right doesn't cause the group boxes to expand (the fillWidth: true seems to only work for the initial state).
    2. The spacer between the forms has no effect: I was expecting it to push the 2nd form down to the bottom of the window (it works if I remove the ScrollView)
    3. I can't find a way for the margins: 10 to work within each side of the split view (having that property in the ScrollView and the Rectangle has no effect)
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved