aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2022-08-19 11:43:57 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-02 17:53:22 +0000
commit58c7a36f5cf5ec70433e644522e8afe4509a1eb1 (patch)
treeb8fb6a1c8dc8d7b8cc2bcae6e33633ae2fb3e318
parent761eea369ded70bbf0f9dc3e45e2e0f972e4b436 (diff)
iOS style: draw TreeViewDelegate as highlighted
When TreeView has a selection, or a cell that is otherwise highlighted, the delegate items that are affected should draw themselves as highlighted.. Change-Id: Iefa226bb774c94f22582fae481a0649a3fcf069e Reviewed-by: Doris Verria <doris.verria@qt.io> (cherry picked from commit 9b4179a98a5cd4ed366717156c090ea99ede7002) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quickcontrols2/ios/TreeViewDelegate.qml7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quickcontrols2/ios/TreeViewDelegate.qml b/src/quickcontrols2/ios/TreeViewDelegate.qml
index d30ea4d041..571fcd4a29 100644
--- a/src/quickcontrols2/ios/TreeViewDelegate.qml
+++ b/src/quickcontrols2/ios/TreeViewDelegate.qml
@@ -20,6 +20,11 @@ T.TreeViewDelegate {
topPadding: contentItem ? (height - contentItem.implicitHeight) / 2 : 0
leftPadding: !mirrored ? leftMargin + __contentIndent : width - leftMargin - __contentIndent - implicitContentWidth
+ highlighted: control.selected || control.current
+ || ((control.treeView.selectionBehavior === TableView.SelectRows
+ || control.treeView.selectionBehavior === TableView.SelectionDisabled)
+ && control.row === control.treeView.currentRow)
+
required property int row
required property var model
readonly property real __contentIndent: !isTreeNode ? 0 : (depth * indentation) + (indicator ? indicator.width + spacing : 0)
@@ -54,7 +59,7 @@ T.TreeViewDelegate {
NinePatchImage {
height: parent.height
width: parent.width
- source: control.IOS.url + "itemdelegate-background"
+ source: control.IOS.url + (control.highlighted ? "itemdelegate-background-pressed" : "itemdelegate-background")
NinePatchImageSelector on source {
states: [
{"light": control.IOS.theme === IOS.Light},