Commit bbdbe71b authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Tasks tree view decoration now highlighted with task color on hover

parent a1791bdb
Pipeline #93547 passed with stage
in 5 minutes and 52 seconds
......@@ -99,6 +99,7 @@ TreeListView {
background.anchors.right: this.right
separatorVisible: true
decoration.decorationHighlightColor: model.color
activeBackgroundColor: LabelUtils.getIncidenceBackgroundColor(model.color, root.isDark)
onActiveBackgroundColorChanged: activeBackgroundColor.a = 0.15
......
......@@ -22,6 +22,8 @@ Kirigami.AbstractListItem {
id: delegate
separatorVisible: false
property alias decoration: decoration
data: [
TreeViewDecoration {
id: decoration
......
......@@ -18,6 +18,7 @@ import org.kde.kirigami 2.14 as Kirigami
* depending on the level of the tree the item is in
*/
RowLayout {
id: decorationLayout
/**
* parentDelegate: ItemDelegate
* The delegate this decoration will live in.
......@@ -32,6 +33,8 @@ RowLayout {
*/
property KDescendantsProxyModel model
property color decorationHighlightColor
Layout.topMargin: -parentDelegate.topPadding
Layout.bottomMargin: -parentDelegate.bottomPadding
Repeater {
......@@ -58,6 +61,7 @@ RowLayout {
Layout.preferredWidth: Kirigami.Units.gridUnit
Layout.fillHeight: true
enabled: kDescendantExpandable
hoverEnabled: enabled
onClicked: model.toggleChildren(index)
contentItem: Item {
id: styleitem
......@@ -78,6 +82,10 @@ RowLayout {
width: Kirigami.Units.iconSizes.small
height: width
source: kDescendantExpanded ? "go-down-symbolic" : "go-next-symbolic"
isMask: true
color: controlRoot.hovered ? decorationLayout.decorationHighlightColor ? decorationLayout.decorationHighlightColor :
Kirigami.Theme.highlightColor : Kirigami.Theme.textColor
Behavior on color { ColorAnimation { duration: Kirigami.Units.shortDuration; easing.type: Easing.InOutQuad } }
visible: kDescendantExpandable
}
Rectangle {
......
......@@ -37,6 +37,7 @@ Kirigami.Page {
property int year: selectedDate.getFullYear()
property bool initialWeek: true
property int daysToShow: 7
readonly property int minutesFromStartOfDay: (root.currentDate.getHours() * 60) + root.currentDate.getMinutes()
Please register or sign in to reply
readonly property bool isDark: LabelUtils.isDarkColor(Kirigami.Theme.backgroundColor)
property real scrollbarWidth: 0
......@@ -156,15 +157,17 @@ Kirigami.Page {
delegate: Loader {
id: viewLoader
property date startDate: model.startDate
property int month: model.selectedMonth - 1 // Convert QDateTime month to JS month
property int year: model.selectedYear
readonly property date startDate: model.startDate
readonly property int month: model.selectedMonth - 1 // Convert QDateTime month to JS month
readonly property int year: model.selectedYear
property int index: model.index
property bool isCurrentItem: PathView.isCurrentItem
property bool isNextOrCurrentItem: index >= pathView.currentIndex -1 && index <= pathView.currentIndex + 1
readonly property int index: model.index
readonly property bool isCurrentItem: PathView.isCurrentItem
readonly property bool isNextOrCurrentItem: index >= pathView.currentIndex -1 && index <= pathView.currentIndex + 1
property int multiDayLinesShown: 0
readonly property int daysFromWeekStart: DateUtils.fullDaysBetweenDates(startDate, root.currentDate) - 1
Loader {
id: modelLoader
active: viewLoader.isNextOrCurrentItem
......@@ -547,6 +550,27 @@ Kirigami.Page {
clip: true
Loader {
id: currentTimeLabelLoader
active: root.currentDate >= viewLoader.startDate && viewLoader.daysFromWeekStart < root.daysToShow
sourceComponent: QQC2.Label {
id: currentTimeLabel
width: root.hourLabelWidth
color: Kirigami.Theme.highlightColor
font.weight: Font.Medium
horizontalAlignment: Text.AlignRight
rightPadding: Kirigami.Units.smallSpacing
x: 0
y: (root.currentDate.getHours() * root.gridLineWidth) + (hourlyView.minuteHeight * root.minutesFromStartOfDay) - (implicitHeight / 2)
z: 100
text: root.currentDate.toLocaleTimeString(Qt.locale(), Locale.NarrowFormat)
}
}
ListView {
id: hourLabelsColumn
anchors.left: parent.left
......@@ -724,28 +748,29 @@ Kirigami.Page {
}
}
Rectangle {
id: currentTimeMarker
property date currentDateTime: root.currentDate
readonly property int minutesFromStart: (currentDateTime.getHours() * 60) + currentDateTime.getMinutes()
readonly property int daysFromWeekStart: DateUtils.fullDaysBetweenDates(viewLoader.startDate, currentDateTime) - 1
Loader {
id: currentTimeMarkerLoader
width: root.dayWidth
height: root.gridLineWidth * 2
color: Kirigami.Theme.highlightColor
x: (daysFromWeekStart * root.dayWidth) + (daysFromWeekStart * root.gridLineWidth)
y: (currentDateTime.getHours() * root.gridLineWidth) + (hourlyView.minuteHeight * minutesFromStart) - (height / 2)
z: 100
visible: currentDateTime >= viewLoader.startDate && daysFromWeekStart < root.daysToShow
Rectangle {
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: -(height / 2) + (parent.height / 2)
width: height
height: parent.height * 5
radius: 100
active: root.currentDate >= viewLoader.startDate && viewLoader.daysFromWeekStart < root.daysToShow
sourceComponent: Rectangle {
id: currentTimeMarker
width: root.dayWidth
height: root.gridLineWidth * 2
color: Kirigami.Theme.highlightColor
x: (viewLoader.daysFromWeekStart * root.dayWidth) + (viewLoader.daysFromWeekStart * root.gridLineWidth)
y: (root.currentDate.getHours() * root.gridLineWidth) + (hourlyView.minuteHeight * root.minutesFromStartOfDay) - (height / 2)
z: 100
Rectangle {
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: -(height / 2) + (parent.height / 2)
width: height
height: parent.height * 5
radius: 100
color: Kirigami.Theme.highlightColor
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment