aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/universal/HorizontalHeaderViewDelegate.qml
diff options
context:
space:
mode:
authorMohammadHossein Qanbari <[email protected]>2024-12-06 12:15:40 +0100
committerMohammadHossein Qanbari <[email protected]>2025-03-06 03:08:26 +0100
commit9601b74dabed53e93a7a5144d4c1fadb7876db18 (patch)
tree0b5f05771108c78c91e644e80d02601ec8b8c672 /src/quickcontrols/universal/HorizontalHeaderViewDelegate.qml
parent79947ea6d5c104f3253f6fbd7ef7244c4015acac (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/universal/HorizontalHeaderViewDelegate.qml')
-rw-r--r--src/quickcontrols/universal/HorizontalHeaderViewDelegate.qml33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/quickcontrols/universal/HorizontalHeaderViewDelegate.qml b/src/quickcontrols/universal/HorizontalHeaderViewDelegate.qml
new file mode 100644
index 0000000000..fcfbdd6deb
--- /dev/null
+++ b/src/quickcontrols/universal/HorizontalHeaderViewDelegate.qml
@@ -0,0 +1,33 @@
+// Copyright (C) 2025 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+import QtQuick
+import QtQuick.Controls.impl as ControlsImpl
+import QtQuick.Controls.Universal
+import QtQuick.Templates as T
+
+T.HeaderViewDelegate {
+ id: control
+
+ // same as AbstractButton.qml
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
+ padding: 8
+
+ highlighted: selected
+
+ background: Rectangle {
+ color: control.Universal.background
+ }
+
+ contentItem: Label {
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: ControlsImpl.Color.transparent(control.Universal.foreground,
+ enabled ? 1.0 : 0.2)
+ text: control.model[control.headerView.textRole]
+ }
+}