Warning, /utilities/kweather/src/qml/FlatForecastPage.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 
0012 import org.kde.kirigami as Kirigami
0013 import org.kde.kweather
0014 
0015 SwipeView {
0016     id: forecastView
0017     property bool canGoLeft: currentIndex > 0
0018     property bool canGoRight: currentIndex < WeatherLocationListModel.count - 1
0019     
0020     anchors.fill: parent
0021     transform: Translate { y: yTranslate }
0022     
0023     function moveLeft() {
0024         currentIndex--;
0025     }
0026     function moveRight() {
0027         currentIndex++;
0028     }
0029     
0030     Repeater {
0031         id: forecastViewRepeater
0032         anchors.fill: parent
0033         
0034         // on mobile mode, for some reason, switching the type to dynamic and back to flat again gives an empty page unless we assign the model
0035         // after component creation
0036         Component.onCompleted: {
0037             model = Qt.binding(function() { return WeatherLocationListModel.locations; });
0038         }
0039         delegate: FlatLocationForecast {
0040             weatherLocation: modelData
0041         }
0042     }
0043 }