update
[apps/onscreenapp.git] / app / main.qml
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16  
17 import QtQuick 2.6
18 import QtQuick.Window 2.2
19 import QtQuick.Layouts 1.1
20 import QtQuick.Controls 2.0
21 import AGL.Demo.Controls 1.0
22
23 Window {
24     id: root
25     flags: Qt.FramelessWindowHint
26     visible: true
27     x: 0
28     y:  218
29     width: 1080
30     height: 1488
31     color: '#00000000'
32
33     function qmlLoader(url) {
34         console.log(qsTr('onscreenapp >>> qmlLoader load ' + url));
35         osLoader.source = url;
36     }
37
38     function qmlOnScreenParameter(text) {
39         console.log(qsTr('onscreenapp >>> qmlOnScreenParameter.' + text));
40         if (osLoader.status == Loader.Ready) {
41             // call qmlOnScreenParameter in qml to post parameter which from application
42             if (osLoader.item && osLoader.item.qmlOnScreenParameter) {
43                 osLoader.item.qmlOnScreenParameter(text);
44             }
45         }
46         else {
47             console.log("osLoader.status is not ready")
48         }
49     }
50
51     Loader {
52         objectName: "loaderObject"
53         id: osLoader
54         anchors.centerIn: parent
55         width: childrenRect.width
56         height: childrenRect.height
57     }
58 }