diff options
| author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2023-01-10 12:50:18 +0100 |
|---|---|---|
| committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2023-01-12 08:28:35 +0100 |
| commit | c5317b4b594fbc26de7fde2bc40d6c7ba092ee9b (patch) | |
| tree | cdf12e711b2b3e5535943a7ca542744e84f6d310 /src/quickcontrols/basic/VerticalHeaderView.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 <mitch.curtis@qt.io>
Diffstat (limited to 'src/quickcontrols/basic/VerticalHeaderView.qml')
| -rw-r--r-- | src/quickcontrols/basic/VerticalHeaderView.qml | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quickcontrols/basic/VerticalHeaderView.qml b/src/quickcontrols/basic/VerticalHeaderView.qml index a59e228d20..5ff9043f93 100644 --- a/src/quickcontrols/basic/VerticalHeaderView.qml +++ b/src/quickcontrols/basic/VerticalHeaderView.qml @@ -7,7 +7,12 @@ import QtQuick.Templates as T T.VerticalHeaderView { id: control - implicitWidth: contentWidth + // The contentWidth of TableView will be zero at start-up, until the delegate + // items have been loaded. This means that even if the implicit width of + // VerticalHeaderView should be the same as the content width in the end, we + // need to ensure that it has at least a width of 1 at start-up, otherwise + // TableView won't bother loading any delegates at all. + implicitWidth: Math.max(1, contentWidth) implicitHeight: syncView ? syncView.height : 0 delegate: Rectangle { |
