blob: edd4aca5812fd2f137d1914e16aca96686e974ca (
plain) (
blame)
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
|
import QtQuick
import QtQuick.Layouts
import Quickshell
Rectangle {
id: root
Layout.preferredWidth: contentContainer.implicitWidth + 10
Layout.preferredHeight: 30
property Item content
property Item mouseArea: mouseArea
property string text
property bool dim: false
property bool underline
property var onClicked: function() {}
property int leftPadding
property int rightPadding
property string hoveredBgColor: "#666666"
// Background color
color: {
if (mouseArea.containsMouse)
return hoveredBgColor;
return "transparent";
}
states: [
State {
when: mouseArea.containsMouse
PropertyChanges {
target: root
}
}
]
Behavior on color {
ColorAnimation {
duration: 200
}
}
Item {
// Contents of the bar block
id: contentContainer
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight
anchors.centerIn: parent
children: content
}
MouseArea {
id: mouseArea
anchors.fill: root
hoverEnabled: true
acceptedButtons: Qt.LeftButton
onClicked: root.onClicked()
}
// While line underneath workspace
Rectangle {
id: wsLine
width: parent.width
height: 2
color: {
if (parent.underline)
return "white";
return "transparent";
}
anchors.bottom: parent.bottom
}
}
|