Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kalendar
Commits
62119132
Commit
62119132
authored
Nov 12, 2021
by
Claudio Cambra
Browse files
Week view hour label now adjusts to font and format
parent
a0981f1b
Pipeline
#96953
canceled with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/contents/ui/WeekView.qml
View file @
62119132
...
...
@@ -43,7 +43,8 @@ Kirigami.Page {
readonly
property
real
dayWidth
:
((
root
.
width
-
hourLabelWidth
-
leftPadding
-
scrollbarWidth
)
/
daysToShow
)
-
gridLineWidth
readonly
property
real
incidenceSpacing
:
Kirigami
.
Units
.
smallSpacing
/
2
readonly
property
real
gridLineWidth
:
1.0
readonly
property
real
hourLabelWidth
:
Kirigami
.
Units
.
gridUnit
*
3.5
readonly
property
real
hourLabelWidth
:
fontMetrics
.
boundingRect
(
new
Date
(
0
,
0
,
0
,
2
,
0
,
0
,
0
).
toLocaleTimeString
(
Qt
.
locale
(),
Locale
.
NarrowFormat
)).
width
+
Kirigami
.
Units
.
largeSpacing
*
2
readonly
property
real
periodHeight
:
Kirigami
.
Units
.
gridUnit
/
2
Kirigami.Theme.inherit
:
false
...
...
@@ -111,6 +112,10 @@ Kirigami.Page {
padding
:
0
FontMetrics
{
id
:
fontMetrics
}
PathView
{
id
:
pathView
...
...
@@ -204,10 +209,6 @@ Kirigami.Page {
delegate
:
Kirigami.Heading
{
id
:
dayHeading
FontMetrics
{
id
:
dayTitleMetrics
}
property
date
headingDate
:
DateUtils
.
addDaysToDate
(
viewLoader
.
startDate
,
index
)
property
bool
isToday
:
headingDate
.
getDate
()
===
root
.
currentDay
&&
headingDate
.
getMonth
()
===
root
.
currentMonth
&&
...
...
@@ -223,9 +224,9 @@ Kirigami.Page {
const
shortText
=
mediumText
.
slice
(
0
,
1
)
+
"
"
+
headingDate
.
toLocaleDateString
(
Qt
.
locale
(),
"
<b>dd</b>
"
);
if
(
dayTitle
Metrics
.
boundingRect
(
longText
).
width
<
width
)
{
if
(
font
Metrics
.
boundingRect
(
longText
).
width
<
width
)
{
return
longText
;
}
else
if
(
dayTitle
Metrics
.
boundingRect
(
mediumText
).
width
<
width
)
{
}
else
if
(
font
Metrics
.
boundingRect
(
mediumText
).
width
<
width
)
{
return
mediumText
;
}
else
{
return
shortText
;
...
...
@@ -614,10 +615,6 @@ Kirigami.Page {
anchors.bottom
:
parent
.
bottom
width
:
root
.
hourLabelWidth
FontMetrics
{
id
:
fontMetrics
}
Loader
{
id
:
currentTimeLabelLoader
...
...
Claudio Cambra
@clau-cambra
mentioned in issue
#70 (closed)
·
Nov 12, 2021
mentioned in issue
#70 (closed)
mentioned in issue #70
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment