ListView, TableView under one tab



  • another newbie's question......

    I would like to put a few lists, and tables under a tab of a TabView. This mimics my EXCEL sheet layout. But my tries only leads to errors. Any suggestions?

    @
    Rectangle {
    width: 720
    height: 720

    TabView {
        id:frame
        focus:true
        style: tabViewStyle
        property int margins: Qt.platform.os === "osx" ? 16 : 0
    
        height: parent.height - 34
        anchors.right: parent.right
        anchors.left: parent.left
        anchors.margins: margins
    
         Tab {
            title: "Problem Data"
    
            ListView{
                model: ListModel{
                    ListElement {text: "Weight limit"; value: 20}
                    ListElement {text: "Number of items"; value: 40}
                }
            }
    
            TableView {
                id: itemlist
                model: datalist
                anchors.fill: parent
                anchors.margins: 12
                TableViewColumn {
                    role: "items"
                    title: "Items"
                    width: 150
                    resizable: true
                }
                TableViewColumn {
                    role: "weights"
                    title: "Weights (kg)"
                    width: 120
                    resizable: true
                }
                TableViewColumn {
                    role: "values"
                    title: "Values ($)"
                    width: 120
                    resizable: true
                }
            }
    
            ListModel{
                id: datalist
                ListElement{
                    capacity: 50
                    Nitem: 14
                    items: "map"
                    weights: 1
                    values: 1
                }
                ListElement{
                    items: "compass"
                    weights: 1
                    values: 1
                }
            }
        }
    

    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.