TableView row height
-
But this sets the height for all rows:
TableView { id: tableView anchors.fill: tableArea headerDelegate: headersDel rowDelegate: Rectangle { height: 30 // Height for all columns }
...
}and in your column delegate you can use:
Component { id: iconRowDelegate Image { anchors.fill: parent fillMode: Image.Pad source: "Icon.png" } }
wrote on 30 Mar 2015, 08:57 last edited by@th.thielemann
I don't want to redefine rowDelegate, i want get height from it (since it differs depending on platform and pixel density).
Question become: how to access rowDelegate's height property? -
@th.thielemann
I don't want to redefine rowDelegate, i want get height from it (since it differs depending on platform and pixel density).
Question become: how to access rowDelegate's height property?@morte Since there is no other way, for now, you can use private properties.
console.log(tableview.__currentRowItem.height) //tableview = id of TableView
-
wrote on 30 Mar 2015, 14:13 last edited by morte 4 Jan 2015, 14:22
@p3c0
I get actual height value, but first row in view not draws after that, i don't know why yet.TableView { id: view property int row_height anchors.fill: parent section.delegate: section_delegate Component.onCompleted { currentRow = 0; row_height = ____currentRowItem.height; } } Component { id: section_delegate Rectangle { width: view.width height: view.row_height } }
-
@p3c0
I get actual height value, but first row in view not draws after that, i don't know why yet.TableView { id: view property int row_height anchors.fill: parent section.delegate: section_delegate Component.onCompleted { currentRow = 0; row_height = ____currentRowItem.height; } } Component { id: section_delegate Rectangle { width: view.width height: view.row_height } }
@morte Can you explain with an example what you are trying to do ?
-
@p3c0
There is TableView with my section delegate and i want to set section delegate's height same as height of rows in view.@morte You will need to set current item in TableView. You can do this by using
currentRow
of TableView.Component.onCompleted: tableView.currentRow = 0
-
@morte You will need to set current item in TableView. You can do this by using
currentRow
of TableView.Component.onCompleted: tableView.currentRow = 0
-
@morte You will need to set current item in TableView. You can do this by using
currentRow
of TableView.Component.onCompleted: tableView.currentRow = 0
-
@p3c0
I have just tested it: anyway setting
Component.onCompleted: tableView.currentRow = 0
in view gives incorrect behavior of view@morte Do you get the height properly after setting currentRow ?
-
wrote on 1 Apr 2015, 15:34 last edited by morte 4 Jan 2015, 15:35
@p3c0
I get actual height value, but first row in view not draws after that, i don't know why yet.TableView { id: view property int row_height anchors.fill: parent section.delegate: section_delegate Component.onCompleted { currentRow = 0; row_height = __currentRowItem.height; } } Component { id: section_delegate Rectangle { width: view.width height: view.row_height } }
-
@p3c0
I get actual height value, but first row in view not draws after that, i don't know why yet.TableView { id: view property int row_height anchors.fill: parent section.delegate: section_delegate Component.onCompleted { currentRow = 0; row_height = __currentRowItem.height; } } Component { id: section_delegate Rectangle { width: view.width height: view.row_height } }
@morte What do you mean by not draws ? See if you get updated height inside the Component.
14/15