• File: weather.qml
  • Full Path: /home/insbudnet/domains/insbud.net/public_html/download/software/qml/olkusz_mila/qml/pl/screens/user/weather.qml
  • File size: 20.59 KB
  • MIME-type: text/plain
  • Charset: utf-8
 
Open Back
// This example demonstrates placing items in a view using
// an ObjectModel

import QtQuick 2.3
import QtQml.Models 2.1
import QtQuick.Layouts 1.1
import "../../commons/"

Core {
    id: root
    color: "lightgray"
    width: 320
    height: 480

    property string vqml_counter_weather_location_0_name: "Olkusz"

    property int vqml_setting_weather_location_0_latitude: 5028
    property int vqml_setting_weather_location_0_longitude: 1956

    property int vqml_counter_weather_location_0_current_condition_temp_c: 220
    property int vqml_counter_weather_location_0_current_condition_temp_f: 720
    property int vqml_counter_weather_location_0_current_condition_wind_speed_miles: 7
    property int vqml_counter_weather_location_0_current_condition_wind_speed_kmph: 11
    property int vqml_counter_weather_location_0_current_condition_wind_dir_degree: 140
    property int vqml_counter_weather_location_0_current_condition_weather_code: 113
    property int vqml_counter_weather_location_0_current_condition_precip_mm: 1
    property int vqml_counter_weather_location_0_current_condition_humidity: 40
    property int vqml_counter_weather_location_0_current_condition_visibility: 10
    property int vqml_counter_weather_location_0_current_condition_pressure: 1011
    property int vqml_counter_weather_location_0_current_condition_cloudcover: 0
    property int vqml_counter_weather_location_0_current_condition_observation_date_time_year: 14
    property int vqml_counter_weather_location_0_current_condition_observation_date_time_month: 4
    property int vqml_counter_weather_location_0_current_condition_observation_date_time_day: 29
    property int vqml_counter_weather_location_0_current_condition_observation_date_time_hour: 17
    property int vqml_counter_weather_location_0_current_condition_observation_date_time_min: 46

    property int vqml_counter_weather_location_0_forecast_day_0_date_year: 14
    property int vqml_counter_weather_location_0_forecast_day_0_date_month: 4
    property int vqml_counter_weather_location_0_forecast_day_0_date_day: 29
    property int vqml_counter_weather_location_0_forecast_day_0_max_temp_c: 190
    property int vqml_counter_weather_location_0_forecast_day_0_max_temp_f: 670
    property int vqml_counter_weather_location_0_forecast_day_0_min_temp_c: 80
    property int vqml_counter_weather_location_0_forecast_day_0_min_temp_f: 470
    property int vqml_counter_weather_location_0_forecast_day_0_wind_speed_miles: 7
    property int vqml_counter_weather_location_0_forecast_day_0_wind_speed_kmph: 11
    property int vqml_counter_weather_location_0_forecast_day_0_wind_dir_degree: 140
    property int vqml_counter_weather_location_0_forecast_day_0_weather_code: 356
    property int vqml_counter_weather_location_0_forecast_day_0_precip_mm: 1

    property int vqml_counter_weather_location_0_forecast_day_1_date_year: 14
    property int vqml_counter_weather_location_0_forecast_day_1_date_month: 4
    property int vqml_counter_weather_location_0_forecast_day_1_date_day: 29
    property int vqml_counter_weather_location_0_forecast_day_1_max_temp_c: 190
    property int vqml_counter_weather_location_0_forecast_day_1_max_temp_f: 670
    property int vqml_counter_weather_location_0_forecast_day_1_min_temp_c: 80
    property int vqml_counter_weather_location_0_forecast_day_1_min_temp_f: 470
    property int vqml_counter_weather_location_0_forecast_day_1_wind_speed_miles: 7
    property int vqml_counter_weather_location_0_forecast_day_1_wind_speed_kmph: 11
    property int vqml_counter_weather_location_0_forecast_day_1_wind_dir_degree: 140
    property int vqml_counter_weather_location_0_forecast_day_1_weather_code: 356
    property int vqml_counter_weather_location_0_forecast_day_1_precip_mm: 1

    property int vqml_counter_weather_location_0_forecast_day_2_date_year: 14
    property int vqml_counter_weather_location_0_forecast_day_2_date_month: 4
    property int vqml_counter_weather_location_0_forecast_day_2_date_day: 29
    property int vqml_counter_weather_location_0_forecast_day_2_max_temp_c: 190
    property int vqml_counter_weather_location_0_forecast_day_2_max_temp_f: 670
    property int vqml_counter_weather_location_0_forecast_day_2_min_temp_c: 80
    property int vqml_counter_weather_location_0_forecast_day_2_min_temp_f: 470
    property int vqml_counter_weather_location_0_forecast_day_2_wind_speed_miles: 7
    property int vqml_counter_weather_location_0_forecast_day_2_wind_speed_kmph: 11
    property int vqml_counter_weather_location_0_forecast_day_2_wind_dir_degree: 140
    property int vqml_counter_weather_location_0_forecast_day_2_weather_code: 356
    property int vqml_counter_weather_location_0_forecast_day_2_precip_mm: 1

    property int vqml_counter_weather_location_0_forecast_day_3_date_year: 14
    property int vqml_counter_weather_location_0_forecast_day_3_date_month: 4
    property int vqml_counter_weather_location_0_forecast_day_3_date_day: 29
    property int vqml_counter_weather_location_0_forecast_day_3_max_temp_c: 190
    property int vqml_counter_weather_location_0_forecast_day_3_max_temp_f: 670
    property int vqml_counter_weather_location_0_forecast_day_3_min_temp_c: 80
    property int vqml_counter_weather_location_0_forecast_day_3_min_temp_f: 470
    property int vqml_counter_weather_location_0_forecast_day_3_wind_speed_miles: 7
    property int vqml_counter_weather_location_0_forecast_day_3_wind_speed_kmph: 11
    property int vqml_counter_weather_location_0_forecast_day_3_wind_dir_degree: 140
    property int vqml_counter_weather_location_0_forecast_day_3_weather_code: 356
    property int vqml_counter_weather_location_0_forecast_day_3_precip_mm: 1

    property int vqml_counter_weather_location_0_forecast_day_4_date_year: 14
    property int vqml_counter_weather_location_0_forecast_day_4_date_month: 4
    property int vqml_counter_weather_location_0_forecast_day_4_date_day: 29
    property int vqml_counter_weather_location_0_forecast_day_4_max_temp_c: 190
    property int vqml_counter_weather_location_0_forecast_day_4_max_temp_f: 670
    property int vqml_counter_weather_location_0_forecast_day_4_min_temp_c: 80
    property int vqml_counter_weather_location_0_forecast_day_4_min_temp_f: 470
    property int vqml_counter_weather_location_0_forecast_day_4_wind_speed_miles: 7
    property int vqml_counter_weather_location_0_forecast_day_4_wind_speed_kmph: 11
    property int vqml_counter_weather_location_0_forecast_day_4_wind_dir_degree: 140
    property int vqml_counter_weather_location_0_forecast_day_4_weather_code: 356
    property int vqml_counter_weather_location_0_forecast_day_4_precip_mm: 1

    property bool printDestruction: false

    function update() {
        weather_01_location_0_current_condition.update();
        weather_01_location_0_forecast_day_0.update();
        weather_01_location_0_forecast_day_1.update();
        weather_01_location_0_forecast_day_2.update();
        weather_01_location_0_forecast_day_3.update();
        weather_01_location_0_forecast_day_4.update();
    }

    Timer {
        id: timer
        interval: 500; repeat: true
        running: true
        triggeredOnStart: true

        onTriggered: update()
    }

    ObjectModel {
        id: pagesModel

        Rectangle {
            id: rec_weather_location_0
            width: view.width
            height: view.height

            gradient: Gradient {
                GradientStop {
                    position: 0
                    color: "#8ee9fb"
                }

                GradientStop {
                    position: 1
                    color: "#0099ff"
                }
            }


            Flickable {
                id: flick_weather_location_0_details
                x: 2
                y: 2
                width: parent.width - x * 2
                height: parent.height - y * 2
                contentHeight: itm_weather_location_0_content.height
                clip: true


                Item {
                    id: itm_weather_location_0_content
                    width: parent.width
                    height: layout_weather_loacation_0.implicitHeight

                    ColumnLayout{
                        id: layout_weather_loacation_0
                        x: 13
                        y: 5
                        width: parent.width - 2 * x
                        spacing: 4

                        Rectangle {
                            id: rec_weather_location_0_header

                            Layout.fillWidth: true
                            Layout.preferredHeight: 70

                            color: "lightgray"
                            border.color: "gray"
                            radius: 5

                            Text {
                                id: txt_weather_location_0_name
                                color: "#ffffff"
                                styleColor: "#7a7a7a"
                                style: Text.Outline
                                font.pixelSize: 38
                                anchors.centerIn: parent
                                text: vqml_counter_weather_location_0_name
                            }

                            Text {
                                id: txt_weather_location_0_coordinates
                                color: "#ffffff"
                                font.pixelSize: 12
                                anchors.right: parent.right
                                anchors.rightMargin: 8
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 8

                                text: "(" + vqml_setting_weather_location_0_latitude / 100 + ", " + vqml_setting_weather_location_0_longitude / 100 + ")"
                            }
                        }


                        C_weather_01_current_conditions {
                            id: weather_01_location_0_current_condition

                            prop_temp_c: vqml_counter_weather_location_0_current_condition_temp_c
                            prop_temp_f: vqml_counter_weather_location_0_current_condition_temp_f
                            prop_wind_speed_miles: vqml_counter_weather_location_0_current_condition_wind_speed_miles
                            prop_wind_speed_kmph: vqml_counter_weather_location_0_current_condition_wind_speed_kmph
                            prop_wind_dir_degree: vqml_counter_weather_location_0_current_condition_wind_dir_degree
                            prop_weather_code: vqml_counter_weather_location_0_current_condition_weather_code
                            prop_precip_mm: vqml_counter_weather_location_0_current_condition_precip_mm
                            prop_humidity: vqml_counter_weather_location_0_current_condition_humidity
                            prop_visibility: vqml_counter_weather_location_0_current_condition_visibility
                            prop_pressure: vqml_counter_weather_location_0_current_condition_pressure
                            prop_cloudcover: vqml_counter_weather_location_0_current_condition_cloudcover

                            prop_observation_date_time_year: vqml_counter_weather_location_0_current_condition_observation_date_time_year
                            prop_observation_date_time_month: vqml_counter_weather_location_0_current_condition_observation_date_time_month
                            prop_observation_date_time_day: vqml_counter_weather_location_0_current_condition_observation_date_time_day
                            prop_observation_date_time_hour: vqml_counter_weather_location_0_current_condition_observation_date_time_hour
                            prop_observation_date_time_min: vqml_counter_weather_location_0_current_condition_observation_date_time_min
                        }


                        C_weather_01_forecast {
                            id: weather_01_location_0_forecast_day_0

                            prop__date_year: vqml_counter_weather_location_0_forecast_day_0_date_year
                            prop__date_month: vqml_counter_weather_location_0_forecast_day_0_date_month
                            prop__date_day: vqml_counter_weather_location_0_forecast_day_0_date_day
                            prop__max_temp_c: vqml_counter_weather_location_0_forecast_day_0_max_temp_c
                            prop__max_temp_f: vqml_counter_weather_location_0_forecast_day_0_max_temp_f
                            prop__min_temp_c: vqml_counter_weather_location_0_forecast_day_0_min_temp_c
                            prop__min_temp_f: vqml_counter_weather_location_0_forecast_day_0_min_temp_f
                            prop__wind_speed_miles: vqml_counter_weather_location_0_forecast_day_0_wind_speed_miles
                            prop__wind_speed_kmph: vqml_counter_weather_location_0_forecast_day_0_wind_speed_kmph
                            prop__wind_dir_degree: vqml_counter_weather_location_0_forecast_day_0_wind_dir_degree
                            prop__weather_code: vqml_counter_weather_location_0_forecast_day_0_weather_code
                            prop__precip_mm: vqml_counter_weather_location_0_forecast_day_0_precip_mm
                        }

                        C_weather_01_forecast {
                            id: weather_01_location_0_forecast_day_1

                            prop__date_year: vqml_counter_weather_location_0_forecast_day_1_date_year
                            prop__date_month: vqml_counter_weather_location_0_forecast_day_1_date_month
                            prop__date_day: vqml_counter_weather_location_0_forecast_day_1_date_day
                            prop__max_temp_c: vqml_counter_weather_location_0_forecast_day_1_max_temp_c
                            prop__max_temp_f: vqml_counter_weather_location_0_forecast_day_1_max_temp_f
                            prop__min_temp_c: vqml_counter_weather_location_0_forecast_day_1_min_temp_c
                            prop__min_temp_f: vqml_counter_weather_location_0_forecast_day_1_min_temp_f
                            prop__wind_speed_miles: vqml_counter_weather_location_0_forecast_day_1_wind_speed_miles
                            prop__wind_speed_kmph: vqml_counter_weather_location_0_forecast_day_1_wind_speed_kmph
                            prop__wind_dir_degree: vqml_counter_weather_location_0_forecast_day_1_wind_dir_degree
                            prop__weather_code: vqml_counter_weather_location_0_forecast_day_1_weather_code
                            prop__precip_mm: vqml_counter_weather_location_0_forecast_day_1_precip_mm
                        }

                        C_weather_01_forecast {
                            id: weather_01_location_0_forecast_day_2

                            prop__date_year: vqml_counter_weather_location_0_forecast_day_2_date_year
                            prop__date_month: vqml_counter_weather_location_0_forecast_day_2_date_month
                            prop__date_day: vqml_counter_weather_location_0_forecast_day_2_date_day
                            prop__max_temp_c: vqml_counter_weather_location_0_forecast_day_2_max_temp_c
                            prop__max_temp_f: vqml_counter_weather_location_0_forecast_day_2_max_temp_f
                            prop__min_temp_c: vqml_counter_weather_location_0_forecast_day_2_min_temp_c
                            prop__min_temp_f: vqml_counter_weather_location_0_forecast_day_2_min_temp_f
                            prop__wind_speed_miles: vqml_counter_weather_location_0_forecast_day_2_wind_speed_miles
                            prop__wind_speed_kmph: vqml_counter_weather_location_0_forecast_day_2_wind_speed_kmph
                            prop__wind_dir_degree: vqml_counter_weather_location_0_forecast_day_2_wind_dir_degree
                            prop__weather_code: vqml_counter_weather_location_0_forecast_day_2_weather_code
                            prop__precip_mm: vqml_counter_weather_location_0_forecast_day_2_precip_mm
                        }

                        C_weather_01_forecast {
                            id: weather_01_location_0_forecast_day_3

                            prop__date_year: vqml_counter_weather_location_0_forecast_day_3_date_year
                            prop__date_month: vqml_counter_weather_location_0_forecast_day_3_date_month
                            prop__date_day: vqml_counter_weather_location_0_forecast_day_3_date_day
                            prop__max_temp_c: vqml_counter_weather_location_0_forecast_day_3_max_temp_c
                            prop__max_temp_f: vqml_counter_weather_location_0_forecast_day_3_max_temp_f
                            prop__min_temp_c: vqml_counter_weather_location_0_forecast_day_3_min_temp_c
                            prop__min_temp_f: vqml_counter_weather_location_0_forecast_day_3_min_temp_f
                            prop__wind_speed_miles: vqml_counter_weather_location_0_forecast_day_3_wind_speed_miles
                            prop__wind_speed_kmph: vqml_counter_weather_location_0_forecast_day_3_wind_speed_kmph
                            prop__wind_dir_degree: vqml_counter_weather_location_0_forecast_day_3_wind_dir_degree
                            prop__weather_code: vqml_counter_weather_location_0_forecast_day_3_weather_code
                            prop__precip_mm: vqml_counter_weather_location_0_forecast_day_3_precip_mm
                        }

                        C_weather_01_forecast {
                            id: weather_01_location_0_forecast_day_4

                            prop__date_year: vqml_counter_weather_location_0_forecast_day_4_date_year
                            prop__date_month: vqml_counter_weather_location_0_forecast_day_4_date_month
                            prop__date_day: vqml_counter_weather_location_0_forecast_day_4_date_day
                            prop__max_temp_c: vqml_counter_weather_location_0_forecast_day_4_max_temp_c
                            prop__max_temp_f: vqml_counter_weather_location_0_forecast_day_4_max_temp_f
                            prop__min_temp_c: vqml_counter_weather_location_0_forecast_day_4_min_temp_c
                            prop__min_temp_f: vqml_counter_weather_location_0_forecast_day_4_min_temp_f
                            prop__wind_speed_miles: vqml_counter_weather_location_0_forecast_day_4_wind_speed_miles
                            prop__wind_speed_kmph: vqml_counter_weather_location_0_forecast_day_4_wind_speed_kmph
                            prop__wind_dir_degree: vqml_counter_weather_location_0_forecast_day_4_wind_dir_degree
                            prop__weather_code: vqml_counter_weather_location_0_forecast_day_4_weather_code
                            prop__precip_mm: vqml_counter_weather_location_0_forecast_day_4_precip_mm
                        }
                    }
                }
            }

            Component.onDestruction: if (printDestruction) print("destroyed 1")
        }

        Rectangle {
            width: view.width; height: view.height
            color: "white"

            Text {
                text: "Licence, copyright, warnings etc (page 1)"
                font.bold: true
                anchors.centerIn: parent
                font.pixelSize: 10
                clip: true
            }

            Component.onDestruction: if (printDestruction) print("destroyed 2")
        }

        Rectangle {
            width: view.width; height: view.height
            color: "white"

            Text {
                text: "Licence, copyright, warnings etc (page 2)"
                font.bold: true
                anchors.centerIn: parent
                font.pixelSize: 10
                clip: true
            }

            Component.onDestruction: if (printDestruction) print("destroyed 3")
        }
    }

    ListView {
        id: view
        anchors { fill: parent; bottomMargin: 30 }
        model: pagesModel
        preferredHighlightBegin: 0; preferredHighlightEnd: 0
        highlightRangeMode: ListView.StrictlyEnforceRange
        orientation: ListView.Horizontal
        snapMode: ListView.SnapOneItem; flickDeceleration: 2000
        cacheBuffer: 200
    }

    Rectangle {
        width: root.width; height: 30
        anchors { top: view.bottom; bottom: parent.bottom }
        color: "gray"

        Row {
            anchors.centerIn: parent
            spacing: 20

            Repeater {
                model: pagesModel.count

                Rectangle {
                    width: 5; height: 5
                    radius: 3
                    color: view.currentIndex == index ? "blue" : "white"

                    MouseArea {
                        width: 20; height: 20
                        anchors.centerIn: parent
                        onClicked: view.currentIndex = index
                    }
                }
            }
        }
    }
}