WeatherCard: better layout

This commit is contained in:
quadbyte 2025-08-11 21:48:17 -04:00
parent c71029487a
commit 03687f95f3

View file

@ -21,11 +21,10 @@ NBox {
anchors.margins: Style.marginMedium * scaling anchors.margins: Style.marginMedium * scaling
spacing: Style.marginMedium * scaling spacing: Style.marginMedium * scaling
RowLayout { RowLayout {
spacing: Style.marginSmall * scaling spacing: Style.marginSmall * scaling
NText { NText {
text: Location.weatherSymbolFromCode(Location.data.weather.current_weather.weathercode) text: Location.weatherSymbolFromCode(Location.data.weather.current_weather.weathercode)
font.family: "Material Symbols Outlined" font.family: "Material Symbols Outlined"
font.pointSize: Style.fontSizeXXL * 1.25 * scaling font.pointSize: Style.fontSizeXXL * 1.25 * scaling
color: Colors.accentSecondary color: Colors.accentSecondary
@ -33,13 +32,13 @@ NBox {
ColumnLayout { ColumnLayout {
RowLayout { RowLayout {
NText { NText {
text: Settings.data.location.name text: Settings.data.location.name
font.weight: Style.fontWeightBold font.weight: Style.fontWeightBold
font.pointSize: Style.fontSizeLarge * scaling font.pointSize: Style.fontSizeXL * scaling
} }
NText { NText {
text: `(${Location.data.weather.timezone_abbreviation})` text: `(${Location.data.weather.timezone_abbreviation})`
font.pointSize: Style.fontSizeTiny * scaling font.pointSize: Style.fontSizeSmall * scaling
visible: Location.data.weather visible: Location.data.weather
} }
} }
@ -48,39 +47,38 @@ NBox {
text: { text: {
var temp = Location.data.weather.current_weather.temperature var temp = Location.data.weather.current_weather.temperature
if (Settings.data.location.useFahrenheit) { if (Settings.data.location.useFahrenheit) {
temp = Location.celsiusToFahrenheit(temp) temp = Location.celsiusToFahrenheit(temp)
} }
temp = Math.round(temp) temp = Math.round(temp)
return `${temp}°` return `${temp}°`
} }
font.pointSize: Style.fontSizeXL * scaling font.pointSize: Style.fontSizeXL * scaling
font.weight: Style.fontWeightBold font.weight: Style.fontWeightBold
} }
} }
} }
Rectangle { NDivider {
height: 1 Layout.fillWidth: true
width: parent.width
color: Colors.backgroundTertiary
} }
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
spacing: Style.marginMedium * scaling Layout.alignment: Qt.AlignHCenter
spacing: Style.marginLarge* scaling
Repeater { Repeater {
model: Location.data.weather.daily.time model: Location.data.weather.daily.time
delegate: ColumnLayout { delegate: ColumnLayout {
Layout.alignment: Qt.AlignHCenter
spacing: Style.spacingSmall * scaling spacing: Style.spacingSmall * scaling
NText { NText {
text: Qt.formatDateTime(new Date(Location.data.weather.daily.time[index]), "ddd") text: Qt.formatDateTime(new Date(Location.data.weather.daily.time[index]), "ddd")
font.weight: Style.fontWeightBold color: Colors.textPrimary
} }
NText { NText {
text: Location.weatherSymbolFromCode(Location.data.weather.daily.weathercode[index]) text: Location.weatherSymbolFromCode(Location.data.weather.daily.weathercode[index])
font.family: "Material Symbols Outlined" font.family: "Material Symbols Outlined"
font.pointSize: Style.fontSizeLarge * scaling font.pointSize: Style.fontSizeXL * scaling
font.weight: Style.fontWeightBold
color: Colors.textSecondary color: Colors.textSecondary
} }
NText { NText {