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. resizeColumnsToContents has no effect in my tableView...
Qt 6.11 is out! See what's new in the release blog

resizeColumnsToContents has no effect in my tableView...

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 370 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.
  • F Offline
    F Offline
    filipdns
    wrote on last edited by filipdns
    #1

    Hello,
    Using QT 5.10.1 I'm trying to use resizeColumnsToContents() but nothing happened...
    What I'm doing wrong?...

    thanks a lot for your help!!

    here my code:

                TableView {
                    id:listView
                    width: parent.width
                    height: parent.height
                    onRowCountChanged:listModel.resizeColumnsToContents()
                    model: ListModel {
                        id: listModel
                        Component.onCompleted: {
                            JS.dbpart(stringVariable, stringVariable2)
                            listView.resizeColumnsToContents()
                        }
                    }
                    TableViewColumn {
                        role: "description"
                        title: "Description"
                        width:100
                    }
                    TableViewColumn {
                        role: "task"
                        title: "Operation"
                        //width:150
                    }
                    TableViewColumn {
                        role: "part"
                        title: "Part Number"
                        visible: stringVariable2 === "05" ? false : true
                        //width:200
                    }
                    TableViewColumn {
                        role: "serial"
                        title: "Serial Number"
                        visible: stringVariable2 === "05" ? false : true
                        //width:175
                    }
    }
    
    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