diff options
author | MohammadHossein Qanbari <[email protected]> | 2024-12-06 12:15:40 +0100 |
---|---|---|
committer | MohammadHossein Qanbari <[email protected]> | 2025-03-06 03:08:26 +0100 |
commit | 9601b74dabed53e93a7a5144d4c1fadb7876db18 (patch) | |
tree | 0b5f05771108c78c91e644e80d02601ec8b8c672 /src/quickcontrols/fusion/HorizontalHeaderView.qml | |
parent | 79947ea6d5c104f3253f6fbd7ef7244c4015acac (diff) |
QuickControls: Add vertical and horizontal header view delegates
Implement QQuickHeaderViewDelegate as the base class for header view
delegates, introducing 'headerView' and 'orientation' properties.
Separate previous delegate settings into HorizontalHeaderViewDelegate
and VerticalHeaderViewDelegate components for Basic, Fusion, and Imagine
styles.
This change improves the modularity and reusability of header view
delegates across different styles. It also allows for more consistent
behavior and easier customization of header views.
A test suite has been added to verify default property settings and
ensure the new components work without warnings.
[ChangeLog][QtQuickControls][HeaderView] Add dedicated delegate
components for vertical and horizontal header views.
Task-number: QTBUG-70326
Change-Id: I8831e77f6909bdae13c3a7262145ab156f63a59a
Reviewed-by: Mitch Curtis <[email protected]>
Diffstat (limited to 'src/quickcontrols/fusion/HorizontalHeaderView.qml')
-rw-r--r-- | src/quickcontrols/fusion/HorizontalHeaderView.qml | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/src/quickcontrols/fusion/HorizontalHeaderView.qml b/src/quickcontrols/fusion/HorizontalHeaderView.qml index dbea743aca..c9c03f322b 100644 --- a/src/quickcontrols/fusion/HorizontalHeaderView.qml +++ b/src/quickcontrols/fusion/HorizontalHeaderView.qml @@ -3,9 +3,7 @@ pragma ComponentBehavior: Bound -import QtQuick import QtQuick.Templates as T -import QtQuick.Controls.Fusion.impl T.HorizontalHeaderView { id: control @@ -18,36 +16,5 @@ T.HorizontalHeaderView { // TableView won't bother loading any delegates at all. implicitHeight: Math.max(1, contentHeight) - delegate: Rectangle { - id: delegate - - required property var model - - // Qt6: add cellPadding (and font etc) as public API in headerview - readonly property real cellPadding: 8 - - implicitWidth: text.implicitWidth + (cellPadding * 2) - implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2)) - - gradient: Gradient { - id: buttonGradient - GradientStop { - position: 0 - color: Fusion.gradientStart(control.palette.button) - } - GradientStop { - position: 1 - color: Fusion.gradientStop(control.palette.button) - } - } - - Label { - id: text - text: delegate.model[control.textRole] - width: delegate.width - height: delegate.height - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } + delegate: HorizontalHeaderViewDelegate { } } |