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. ListView, TableView under one tab
Forum Updated to NodeBB v4.3 + New Features

ListView, TableView under one tab

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 579 Views 1 Watching
  • 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.
  • P Offline
    P Offline
    patiobarbecue
    wrote on last edited by
    #1

    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
                }
            }
        }
    

    }
    @

    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