summaryrefslogtreecommitdiff
path: root/app/qml-example/main.qml
blob: 1ceb19d051ba2de26ffb3fe64c08d968facd54e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
 * SPDX license identifier: MPL-2.0
 *
 * Copyright (C) 2015, GENIVI Alliance
 *
 * This file is part of GENIVI AudioManager PoC.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License (MPL), v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * For further information see http://www.genivi.org/.
 *
 * List of changes:
 * 29.01.2014, Holger Behrens, written based on template created by QtCreator
 */

import QtQuick 2.3
import QtQuick.Controls 1.2

Rectangle {
    id: window
    visible: true
    width: 600
    height: 480

    signal qmlSignal(string msg)

    Column {
        id: column1
        height: 200
        anchors.right: parent.right
        anchors.rightMargin: 0
        anchors.left: parent.left
        anchors.leftMargin: 0
        anchors.top: parent.top
        anchors.topMargin: 0

        Button {
            id: buttonOne
            text: qsTr("No")
            anchors.top: parent.top
            anchors.topMargin: 8
            anchors.right: parent.right
            anchors.rightMargin: 20
            onClicked: {
                console.log("buttonOne clicked");
                window.qmlSignal("Hello from QML (buttonOne)")
            }
        }
        Text {
            x: 0
            y: 0
            width: 120
            text: qsTr("Hello GENIVI World")
            anchors.left: parent.left
            anchors.leftMargin: 10
            anchors.top: parent.top
            anchors.topMargin: 8
            horizontalAlignment: Text.AlignLeft
        }
        TextInput {
            id: textInputOne
            height: 20
            text: qsTr("Text Input")
            horizontalAlignment: Text.AlignLeft
            anchors.verticalCenter: parent.verticalCenter
            anchors.left: parent.left
            anchors.leftMargin: 24
            anchors.right: parent.right
            anchors.rightMargin: 260
            font.pixelSize: 12
        }
        TextField {
            id: textFieldOne
            x: 0
            y: 0
            width: 120
            transformOrigin: Item.Center
            anchors.top: textInputOne.bottom
            anchors.topMargin: 8
            anchors.left: parent.left
            anchors.leftMargin: 24
            placeholderText: qsTr("Text Field")
        }
    }

    MouseArea {
        id: mouseArea
        y: 0
        height: 280
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 0
        anchors.right: parent.right
        anchors.left: parent.left
        anchors.rightMargin: 0
        anchors.leftMargin: 0
        onClicked: {
            console.log("mouseArea clicked - at", mouse.x, mouse.y)
        }
        onPressedChanged: {
            console.log("Mouse area is pressed?", pressed)
        }
    }
}