Commit 6dc3a933 authored by Nicolas Fella's avatar Nicolas Fella Committed by Han Young
Browse files

Fix locations page

parent 0b1ce216
......@@ -111,7 +111,7 @@ Kirigami.ScrollablePage {
spacing: Kirigami.Units.smallSpacing
Kirigami.Icon {
Layout.alignment: Qt.AlignHCenter
source: location.hourListModel.currentForecast == null ? "weather-none-available" : location.hourListModel.currentForecast.weatherIcon
source: location.todayForecast.weatherIcon
Layout.maximumHeight: Kirigami.Units.iconSizes.sizeForLabels * 2
Layout.preferredWidth: height
Layout.preferredHeight: Kirigami.Units.iconSizes.sizeForLabels * 2
......@@ -119,7 +119,7 @@ Kirigami.ScrollablePage {
Label {
Layout.alignment: Qt.AlignHCenter
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.3
text: location.hourListModel.currentForecast == null ? "0" : location.hourListModel.currentForecast.temperatureRounded
text: location.todayForecast.maxTemp
}
}
......
......@@ -227,3 +227,11 @@ void WeatherLocation::updateCurrentDateTime()
Q_EMIT currentTimeChanged();
Q_EMIT currentDateChanged();
}
KWeatherCore::DailyWeatherForecast WeatherLocation::todayForecast() const
{
if (!m_dayForecasts.isEmpty()) {
return m_dayForecasts.first().value<KWeatherCore::DailyWeatherForecast>();
}
return {};
}
......@@ -36,6 +36,7 @@ class WeatherLocation : public QObject
Q_PROPERTY(QVariantList dayForecasts READ dayForecasts NOTIFY dayForecastsChanged)
Q_PROPERTY(QVariantList hourForecasts READ hourForecasts NOTIFY hourForecastsChanged)
Q_PROPERTY(int selectedDay READ selectedDay WRITE setSelectedDay NOTIFY selectedDayChanged)
Q_PROPERTY(KWeatherCore::DailyWeatherForecast todayForecast READ todayForecast NOTIFY dayForecastsChanged)
Q_PROPERTY(QString backgroundComponent READ backgroundComponent NOTIFY currentForecastChange)
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY currentForecastChange)
......@@ -149,6 +150,7 @@ public:
Q_EMIT selectedDayChanged();
}
}
KWeatherCore::DailyWeatherForecast todayForecast() const;
// for restore order of locations
void saveOrder(int index);
......
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