簡體   English   中英

如何設置“ qml TableViewColumn”的高度?

[英]How to set “ qml TableViewColumn ” height?

我正在使用Qml開發系統,我想更改TableViewColumn的默認高度及其邊框樣式。 我只想顯示底部/右側邊框,看起來像表格。

TableView您可以定義帶有邊框和所需高度的自定義itemDelegate 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
        }
    }
}

您可以使用TableView組件的rowDelagate屬性。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM