2023-09-04 16:45:54 +02:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Templates as T
|
|
|
|
|
import StudioTheme as StudioTheme
|
|
|
|
|
|
|
|
|
|
T.TreeViewDelegate {
|
|
|
|
|
id: control
|
2023-09-15 09:55:47 +02:00
|
|
|
|
|
|
|
|
property StudioTheme.ControlStyle style: StudioTheme.Values.controlStyle
|
|
|
|
|
|
2023-09-04 16:45:54 +02:00
|
|
|
hoverEnabled: true
|
|
|
|
|
implicitWidth: 200
|
|
|
|
|
implicitHeight: 30
|
|
|
|
|
indentation: 12
|
|
|
|
|
leftPadding: control.leftMargin + control.__contentIndent
|
|
|
|
|
|
2023-09-11 12:45:25 +02:00
|
|
|
readonly property int customDepth: control.depth - 1
|
|
|
|
|
|
2023-09-04 16:45:54 +02:00
|
|
|
readonly property real __contentIndent: !control.isTreeNode ? 0
|
2023-09-11 12:45:25 +02:00
|
|
|
: (control.customDepth * control.indentation)
|
2023-09-04 16:45:54 +02:00
|
|
|
+ (control.indicator ? control.indicator.width + control.spacing : 0)
|
|
|
|
|
|
|
|
|
|
indicator: Item {
|
2023-09-11 12:45:25 +02:00
|
|
|
x: control.leftMargin + (control.customDepth * control.indentation)
|
2023-09-04 16:45:54 +02:00
|
|
|
width: 30
|
|
|
|
|
height: 30
|
|
|
|
|
|
|
|
|
|
Text {
|
2023-09-11 12:45:25 +02:00
|
|
|
id: icon
|
2023-09-04 16:45:54 +02:00
|
|
|
font.family: StudioTheme.Constants.iconFont.family
|
2023-09-15 09:55:47 +02:00
|
|
|
font.pixelSize: control.style.smallIconFontSize
|
|
|
|
|
color: control.hovered ? control.style.text.selectedText : control.style.text.idle
|
2023-09-04 16:45:54 +02:00
|
|
|
text: StudioTheme.Constants.sectionToggle
|
|
|
|
|
rotation: control.expanded ? 0 : -90
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
implicitWidth: 200
|
|
|
|
|
implicitHeight: 30
|
2023-09-15 09:55:47 +02:00
|
|
|
color: control.hovered ? control.style.interaction : "transparent"
|
2023-09-04 16:45:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contentItem: Text {
|
|
|
|
|
text: control.text
|
|
|
|
|
font: control.font
|
|
|
|
|
opacity: enabled ? 1.0 : 0.3
|
2023-09-15 09:55:47 +02:00
|
|
|
color: control.hovered ? control.style.text.selectedText : control.style.text.idle
|
2023-09-04 16:45:54 +02:00
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
}
|
|
|
|
|
}
|