Warning, /utilities/kweather/src/qml/WeatherDayDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Han Young <hanyoung@protonmail.com>
0003  * SPDX-FileCopyrightText: 2020 Devin Lin <espidev@gmail.com>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Controls
0010 import QtQuick.Layouts
0011 import QtQuick.Shapes
0012 import org.kde.kirigami as Kirigami
0013 import org.kde.kweather
0014 
0015 Item {
0016     implicitWidth: Kirigami.Units.gridUnit * 6
0017     implicitHeight: dayElement.implicitHeight + Kirigami.Units.largeSpacing * 2
0018     // implicitHeight: Kirigami.Units.gridUnit * 8
0019 
0020     property var weather
0021     property color textColor
0022     property color secondaryTextColor
0023     property alias mouseArea: mouse 
0024     
0025     MouseArea {
0026         id: mouse
0027         anchors.fill: parent
0028         onClicked: dailyListView.currentIndex = index
0029     }
0030     
0031     // actual day display
0032     ColumnLayout {
0033         id: dayElement
0034         anchors.top: parent.top
0035         anchors.left: parent.left
0036         anchors.right: parent.right
0037         anchors.leftMargin: Kirigami.Units.largeSpacing
0038         anchors.topMargin: Kirigami.Units.largeSpacing
0039         anchors.rightMargin: Kirigami.Units.largeSpacing
0040         spacing: Kirigami.Units.smallSpacing
0041 
0042         Label {
0043             Layout.fillWidth: true
0044             Layout.topMargin: Kirigami.Units.smallSpacing
0045             font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1
0046             text: weather.date.toLocaleString(Qt.locale(), "ddd d").replace(".", "")
0047             color: textColor
0048             elide: Text.ElideRight
0049         }
0050         Kirigami.Icon {
0051             Layout.topMargin: Kirigami.Units.smallSpacing
0052             source: weather.weatherIcon
0053             implicitHeight: Kirigami.Units.iconSizes.medium
0054             implicitWidth: Kirigami.Units.iconSizes.medium
0055         }
0056         Row {
0057             Layout.topMargin: Kirigami.Units.smallSpacing
0058             spacing: Kirigami.Theme.defaultFont.pointSize * 0.6
0059             Label {
0060                 id: highTemp
0061                 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.3
0062                 text: Formatter.formatTemperatureRounded(weather.maxTemp, settingsModel.temperatureUnits)
0063                 color: textColor
0064             }
0065             Label {
0066                 anchors.baseline: highTemp.baseline
0067                 color: secondaryTextColor
0068                 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1
0069                 text: Formatter.formatTemperatureRounded(weather.minTemp, settingsModel.temperatureUnits)
0070             }
0071         }
0072         Label {
0073             Layout.fillWidth: true
0074             Layout.topMargin: Kirigami.Units.smallSpacing
0075             text: weather.weatherDescription
0076             color: textColor
0077             wrapMode: Text.Wrap
0078         }
0079     }
0080 }