Commit a11b088c authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

[weather applet] Have items in details list aligned at colon

parent 6894a1c9
......@@ -24,15 +24,17 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
ColumnLayout {
id: root
property alias model: repeater.model
property var model
ColumnLayout {
GridLayout {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
spacing: units.largeSpacing
rowSpacing: units.largeSpacing
Repeater {
id: repeater
id: labelRepeater
model: root.model
delegate: Loader {
readonly property int rowIndex: index
......@@ -43,17 +45,38 @@ ColumnLayout {
Layout.alignment: item.Layout.alignment
Layout.preferredWidth: item.Layout.preferredWidth
Layout.preferredHeight: item.Layout.preferredHeight
Layout.row: rowIndex
Layout.column: 0
sourceComponent: PlasmaComponents.Label {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
text: rowData.label
}
}
}
Repeater {
id: repeater
sourceComponent: RowLayout {
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
model: root.model
PlasmaComponents.Label {
id: text
delegate: Loader {
readonly property int rowIndex: index
readonly property var rowData: modelData
Layout.minimumWidth: item.Layout.minimumWidth
Layout.minimumHeight: item.Layout.minimumHeight
Layout.alignment: item.Layout.alignment
Layout.preferredWidth: item.Layout.preferredWidth
Layout.preferredHeight: item.Layout.preferredHeight
Layout.row: rowIndex
Layout.column: 1
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
sourceComponent: PlasmaComponents.Label {
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
text: rowData.text
}
text: rowData.text
}
}
}
......
......@@ -154,36 +154,59 @@ Item {
var model = [];
if (observationModel.windchill) {
model.push({ "text": i18n("Windchill: %1", observationModel.windchill) });
model.push({
"label": i18nc("@label", "Windchill:"),
"text": observationModel.windchill
});
};
if (observationModel.humidex) {
model.push({ "text": i18n("Humidex: %1", observationModel.humidex) });
model.push({
"label": i18nc("@label", "Humidex:"),
"text": observationModel.humidex
});
}
if (observationModel.dewpoint) {
model.push({ "text": i18nc("ground temperature", "Dewpoint: %1", observationModel.dewpoint) });
model.push({
"label": i18nc("@label ground temperature", "Dewpoint:"),
"text": observationModel.dewpoint
});
}
if (observationModel.pressure) {
model.push({ "text": i18n("Pressure: %1", observationModel.pressure) });
model.push({
"label": i18nc("@label", "Pressure:"),
"text": observationModel.pressure
});
}
if (observationModel.pressureTendency) {
model.push({ "text": i18nc("pressure tendency, rising/falling/steady",
"Pressure Tendency: %1", observationModel.pressureTendency) });
model.push({
"label": i18nc("@label pressure tendency, rising/falling/steady", "Pressure Tendency:"),
"text": observationModel.pressureTendency
});
}
if (observationModel.visibility) {
model.push({ "text": i18n("Visibility: %1", observationModel.visibility) });
model.push({
"label": i18nc("@label", "Visibility:"),
"text": observationModel.visibility
});
}
if (observationModel.humidity) {
model.push({ "text": i18n("Humidity: %1", observationModel.humidity) });
model.push({
"label": i18nc("@label", "Humidity:"),
"text": observationModel.humidity
});
}
if (observationModel.windGust) {
model.push({ "text": i18n("Wind Gust: %1",observationModel. windGust) });
model.push({
"label": i18nc("@label", "Wind Gust:"),
"text": observationModel.windGust
});
}
return model;
......
Supports Markdown
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