blob: ae18a537cd386d937e4ef79d400a625c1507cb66 (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
// Copyright (C) 2024 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
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Controls.Material
import QtQuick.Controls.impl
import QtQuick.Dialogs.quickimpl as DialogsQuickImpl
DialogsQuickImpl.SideBar {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
contentWidth: (contentItem as ListView)?.contentWidth
background: Rectangle {
color: control.Material.backgroundColor
}
contentItem: ListView {
id: listView
currentIndex: control.currentIndex
model: control.contentModel
clip: true
boundsBehavior: Flickable.StopAtBounds
}
buttonDelegate: Button {
id: buttonDelegateRoot
flat: true
highlighted: control.currentIndex === index
width: listView.width
contentItem: IconLabel {
spacing: 5
leftPadding: 10
topPadding: 3
bottomPadding: 3
icon: buttonDelegateRoot.icon
text: buttonDelegateRoot.folderName
font: buttonDelegateRoot.font
alignment: Qt.AlignLeft
}
required property int index
required property string folderName
Accessible.name: folderName
}
separatorDelegate: Item {
implicitWidth: control.width
implicitHeight: 9
Rectangle {
id: separatorDelegate
color: Qt.lighter(Material.darkShade, 1.06)
anchors.centerIn: parent
radius: 1
height: 1
width: parent.width - 10
}
}
addFavoriteDelegate: Button {
id: addFavoriteDelegateRoot
text: qsTr("Add Favorite")
flat: true
width: control.width
contentItem: IconLabel {
spacing: 5
leftPadding: 10
topPadding: 3
bottomPadding: 3
icon: addFavoriteDelegateRoot.icon
text: addFavoriteDelegateRoot.labelText
font: addFavoriteDelegateRoot.font
opacity: addFavoriteDelegateRoot.dragHovering ? 0.2 : 1.0
alignment: Qt.AlignLeft
}
required property string labelText
required property bool dragHovering
}
}
|