-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDrawerItem.qml
87 lines (67 loc) · 2.45 KB
/
DrawerItem.qml
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
import QtQuick
import QtQuick.Layouts
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.Material
import QtQuick.Controls.Material.impl
import ThemeEngine
T.ItemDelegate {
id: control
implicitWidth: parent.width
implicitHeight: Theme.componentHeightL
padding: Theme.componentMargin
spacing: Theme.componentMargin
verticalPadding: 0
property string iconSource
property string iconColor: Theme.colorIcon
property int iconSize: 24
property string textColor: Theme.colorText
property int textSize: 13
////////////////
background: Rectangle {
implicitHeight: Theme.componentHeightL
color: control.highlighted ? Theme.colorForeground : Theme.colorBackground
RippleThemed {
width: parent.width
height: parent.height
clip: visible
anchor: control
pressed: control.pressed
active: enabled && (control.down || control.visualFocus || control.hovered)
color: Qt.rgba(Theme.colorForeground.r, Theme.colorForeground.g, Theme.colorForeground.b, 0.5)
}
}
////////////////
contentItem: RowLayout {
anchors.left: parent.left
anchors.leftMargin: screenPaddingLeft + Theme.componentMargin
anchors.right: parent.right
anchors.rightMargin: screenPaddingRight + Theme.componentMargin / 2
opacity: control.enabled ? 1 : 0.4
Item {
Layout.preferredWidth: Theme.componentHeightL - screenPaddingLeft - Theme.componentMargin
Layout.preferredHeight: Theme.componentHeightL
Layout.alignment: Qt.AlignTop
IconSvg {
anchors.left: parent.left
anchors.leftMargin: (32 - control.iconSize) / 2
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: (control.height !== Theme.componentHeightL) ? -(Theme.componentMargin / 2) : 0
width: control.iconSize
height: control.iconSize
color: control.iconColor
source: control.iconSource
}
}
Text {
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
text: control.text
color: control.textColor
wrapMode: Text.WordWrap
font.bold: true
font.pixelSize: control.textSize
}
}
////////////////
}