aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/macos/TreeViewDelegate.qml
blob: f56b88f758794ce62652a94d392e016f32b22a3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (C) 2021 The Qt Company Lt.
// 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.NativeStyle as NativeStyle

NativeStyle.DefaultTreeViewDelegate {
    id: control

    palette.highlight: "#2f64e1"
    palette.highlightedText: "white"

    background: Rectangle {
        color: control.selected || control.current
               || ((control.treeView.selectionBehavior === TableView.SelectRows
               || control.treeView.selectionBehavior === TableView.SelectionDisabled)
               && control.row === control.treeView.currentRow)
               ? control.palette.highlight
               : (control.treeView.alternatingRows && control.row % 2 !== 0
               ? control.palette.alternateBase
               : control.palette.base)
        // Ideally we want a rounded background for the whole row, also when
        // there are more than one column. But until Rectangle gains support
        // for corners with individual radii, we simplify it (QTBUG-48774)
        radius: control.row === control.treeView.currentRow && control.treeView.columns === 1 ? 5 : 0
    }
}