Flip Elsewhen's time format with t and line up its weather (#13448)
* Flip Elsewhen between 24-hour and AM/PM time with t Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Line up Elsewhen's weather in one column The temperature and weather icon sat against each row's time, which is narrower for "4:06" than "10:06", and shared the name's slack. The time column now takes the widest time's width in every row, and a spacer holds the weather against it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
773e19e145
commit
25f9795221
2 files changed
+29
No files matched your search
@@ -173,6 +173,11 @@ Rectangle {
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
// Takes the slack, so the weather sits against the time column in every row.
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Caption {
|
||||
Layout.alignment: Qt.AlignBaseline
|
||||
text: Model.tempLabel(row.panel.facts[Model.factsKey(row.rowData)], row.panel.units)
|
||||
@@ -299,6 +304,8 @@ Rectangle {
|
||||
|
||||
Column {
|
||||
id: timeBlock
|
||||
// One width for every row, so the labels beside it line up.
|
||||
width: Math.max(row.panel.timeColumnWidth, implicitWidth)
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Style.spacing.rowPaddingX
|
||||
anchors.verticalCenter: rowLabels.verticalCenter
|
||||
|
||||
@@ -355,6 +355,26 @@ Panel {
|
||||
readonly property real capGap: Math.max(0,
|
||||
nameFontMetrics.height - nameFontMetrics.descent + nameCapMetrics.tightBoundingRect.y)
|
||||
|
||||
// The widest a row's time gets, so every row's weather lines up against one
|
||||
// column rather than hugging "4:06" in one row and "10:06" in the next.
|
||||
TextMetrics {
|
||||
id: widestTimeMetrics
|
||||
font.family: root.fontFamily
|
||||
font.pixelSize: Style.font.heading
|
||||
font.weight: Font.DemiBold
|
||||
text: "00:00"
|
||||
}
|
||||
|
||||
TextMetrics {
|
||||
id: meridiemMetrics
|
||||
font.family: root.fontFamily
|
||||
font.pixelSize: Style.font.caption
|
||||
text: "PM"
|
||||
}
|
||||
|
||||
readonly property real timeColumnWidth: Math.ceil(widestTimeMetrics.advanceWidth
|
||||
+ (hour24 ? 0 : Style.spacing.xs + meridiemMetrics.advanceWidth))
|
||||
|
||||
function tick() {
|
||||
nowMs = Date.now()
|
||||
localOffsetMinutes = -(new Date().getTimezoneOffset())
|
||||
@@ -738,9 +758,11 @@ Panel {
|
||||
}
|
||||
onTabRequested: function(direction) { root.switchPanel(direction) }
|
||||
// "+" searches in either view; "j" jumps on the globe, "a" adds on the list.
|
||||
// "t" flips 24-hour and AM/PM time, like clicking a row's time.
|
||||
onTextKey: function(text) {
|
||||
var key = text.toLowerCase()
|
||||
if (key === "r") root.refresh()
|
||||
else if (key === "t") root.toggleHour24()
|
||||
else if (root.globeMode && (key === "+" || key === "j")) {
|
||||
if (globeLoader.item) globeLoader.item.startJump()
|
||||
} else if (!root.globeMode && (key === "+" || key === "a")) {
|
||||
|
||||
Reference in new issue
Block a user