Clock and calendar
This commit is contained in:
parent
0e037561f3
commit
bce57c101a
12 changed files with 530 additions and 4 deletions
|
|
@ -61,7 +61,7 @@ PanelWindow {
|
|||
|
||||
NSlider {}
|
||||
|
||||
|
||||
Clock {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
56
Modules/Bar/Clock.qml
Normal file
56
Modules/Bar/Clock.qml
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import QtQuick
|
||||
import qs.Services
|
||||
import qs.Theme
|
||||
import qs.Widgets
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
readonly property real scaling: Scaling.scale(screen)
|
||||
|
||||
width: textItem.paintedWidth
|
||||
height: textItem.paintedHeight
|
||||
color: "transparent"
|
||||
|
||||
Text {
|
||||
id: textItem
|
||||
text: Time.time
|
||||
font.family: Theme.fontFamily
|
||||
font.weight: Font.Bold
|
||||
font.pointSize: Style.fontSmall * scaling
|
||||
color: Theme.textPrimary
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: clockMouseArea
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
if (!calendar.visible) {
|
||||
tooltip.show()
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
tooltip.hide()
|
||||
}
|
||||
onClicked: function () {
|
||||
calendar.visible = !calendar.visible
|
||||
if (calendar.visible) {
|
||||
tooltip.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NCalendar {
|
||||
id: calendar
|
||||
visible: false
|
||||
}
|
||||
|
||||
NTooltip {
|
||||
id: tooltip
|
||||
text: Time.dateString
|
||||
target: root
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue