Unsolved Layout depending on loaded component
-
I have a TableView, and use a Button as delegate in one column.
Now the row height of the TableView should be at least the height of the Button (depending on font, etc.)
I need to set a property on the button delegate, and the only way I found how to do this was via Loader.Code of Delegate in file lpad_buttondelegate.qml (part of resources)
Item { anchors.fill: parent property Component thedelegate: actionButton Button { id: actionButton anchors.centerIn: parent width: parent.width * 0.9 text: buttonText } }
Use of delegate in TableViewColumn:
TableViewColumn { id: startButtonColumn title: Cpp.CLpad_Mls.getText("LPAD_COLUMN_START"); movable: false resizable: false width: tableView.width * 0.15 delegate: Loader { property string buttonText: "Start" source: "lpad_buttondelegate.qml" } }
Now I need to adjust the row height. Seems the rowDelegate is the way to go:
rowDelegate: Rectangle { height: 30 // Question: How to use height of button delegate? SystemPalette { id: myPalette; colorGroup: SystemPalette.Active } color: { var baseColor = styleData.alternate?myPalette.alternateBase:myPalette.base return styleData.selected?myPalette.highlight:baseColor } }
At the moment, I have the row delegate a fixed height. But I would like to set a minimumHeight to the height of the button delegate.
But how do I do that? I suppose, if I use Loader, I will have a fat button sitting in my rowDelegate. That's not what I need - I'd just like to 'peek' the height the button delegate has, so I can adjust the row height accordingly.Any ideas how to do this?