diff options
author | Richard Moe Gustavsen <[email protected]> | 2023-01-10 12:50:18 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <[email protected]> | 2023-01-12 08:28:35 +0100 |
commit | c5317b4b594fbc26de7fde2bc40d6c7ba092ee9b (patch) | |
tree | cdf12e711b2b3e5535943a7ca542744e84f6d310 /src/quickcontrols/basic/HorizontalHeaderView.qml | |
parent | 84d69e4695c179e595d24928a6480852d7f5186f (diff) |
HeaderView: ensure that the implicit size is greater than zero
HorizontalHeaderView should have the same implicit height as the
delegate items it contains. And this height is reflected by
contentHeight. The problem is that the content height is zero at
start-up, before the view gets populated with delegate items.
The result is that the height of the view will then be zero at
start-up, which can lead to TableView not loading any
items at all.
This patch will therefore ensure that the implicit height of
HeaderView is 1 at start-up, so that the delegate items will be
loaded. Once loaded, the implicit height of the view will be
adjusted to the correct value.
Pick-to: 6.5
Change-Id: I5181840665f648275e28dd8fe943e759797388fa
Reviewed-by: Mitch Curtis <[email protected]>
Diffstat (limited to 'src/quickcontrols/basic/HorizontalHeaderView.qml')
-rw-r--r-- | src/quickcontrols/basic/HorizontalHeaderView.qml | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quickcontrols/basic/HorizontalHeaderView.qml b/src/quickcontrols/basic/HorizontalHeaderView.qml index 140c9f3ae8..a46cf31f49 100644 --- a/src/quickcontrols/basic/HorizontalHeaderView.qml +++ b/src/quickcontrols/basic/HorizontalHeaderView.qml @@ -8,7 +8,12 @@ T.HorizontalHeaderView { id: control implicitWidth: syncView ? syncView.width : 0 - implicitHeight: contentHeight + // The contentHeight of TableView will be zero at start-up, until the delegate + // items have been loaded. This means that even if the implicit height of + // HorizontalHeaderView should be the same as the content height in the end, we + // need to ensure that it has at least a height of 1 at start-up, otherwise + // TableView won't bother loading any delegates at all. + implicitHeight: Math.max(1, contentHeight) delegate: Rectangle { // Qt6: add cellPadding (and font etc) as public API in headerview |