简体   繁体   中英

How to set “ qml TableViewColumn ” height?

I'am using Qml to develop a system, I want to change TableViewColumn 's default height and its border style. I just want to show the bottom/right borders, to look like table.

In your TableView you could define custom itemDelegate with borders and desired height https://doc.qt.io/qt-5/qml-qtquick-controls-tableview.html#itemDelegate-prop

TableView {
    itemDelegate: Rectangle {
        height: 30 // put your height here
        border.color: "black"
        border.width: 1
        Text {
            anchors.verticalCenter: parent.verticalCenter
            color: styleData.textColor
            elide: styleData.elideMode
            text: styleData.value
        }
    }
}

You can use rowDelagate property of TableView component.

TableView {
    id: idReadDataTableView
    anchors.fill: parent
    rowDelegate: Rectangle {
        width: parent.width
        height: 40
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM