aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/macos/TreeViewDelegate.qml
blob: c357f97a89bb94ad20e0b2b11c928c55df6aed2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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.highlighted ? 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
    }
}