Scaling TableView
-
Hi,
I have a TableView that is used inside a RowLayout. How do I make the TableView and it's column and row size scale with the size of the Window?Here is my code:
tableViewSpecs.qmlTableView { anchors.fill: parent clip: true boundsBehavior: Flickable.StopAtBounds id: tableView model: TableModel { id: tableModel TableModelColumn { display: "Specification" } TableModelColumn { display: "Description" } TableModelColumn { display: "Limit" } } delegate: DelegateChooser { DelegateChoice { column: 0 delegate: Rectangle { implicitHeight: 5 width: delegateWidth height: delegateHeight border.color: "black" Text { text: display } } } DelegateChoice { column: 1 delegate: Rectangle { implicitHeight: 5 width: delegateWidth height: delegateHeight border.color: "black" Text { text: display } } } DelegateChoice { column: 2 delegate: Rectangle { implicitHeight: 5 width: delegateWidth height: delegateHeight border.color: "black" Text { text: display } } } } }
part of main.qml
ColumnLayout {
anchors.fill: parentRowLayout { Layout.preferredHeight: 250 Layout.preferredWidth: 1600 Layout.minimumWidth: 900 Layout.minimumHeight: 200 Layout.fillHeight: true Layout.fillWidth: true Rectangle { Layout.preferredHeight: 250 Layout.preferredWidth: 600 Layout.fillHeight: true Layout.fillWidth: true Layout.minimumWidth: 500 TableViewSpecs{ id: tableView Layout.topMargin: 30 Layout.leftMargin: 30 Layout.preferredHeight: 250 Layout.preferredWidth: 700 Layout.minimumWidth: 600 Layout.fillHeight: true Layout.fillWidth: true visible: true } }