blob: 65403e1b7424ccfff597b065ab4444b15f83fd03 (
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
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtLocation
//! [PlaneMapQuick1]
// Plane.qml
MapQuickItem {
id: plane
property string pilotName;
property int bearing: 0;
anchorPoint.x: image.width/2
anchorPoint.y: image.height/2
sourceItem: Grid {
//...
//! [PlaneMapQuick1]
columns: 1
Grid {
horizontalItemAlignment: Grid.AlignHCenter
Image {
id: image
rotation: bearing
source: "airplane.png"
}
Rectangle {
id: bubble
color: "lightblue"
border.width: 1
width: text.width * 1.3
height: text.height * 1.3
radius: 5
Text {
id: text
anchors.centerIn: parent
text: pilotName
}
}
}
Rectangle {
id: message
color: "lightblue"
border.width: 1
width: banner.width * 1.3
height: banner.height * 1.3
radius: 5
opacity: 0
Text {
id: banner
anchors.centerIn: parent
}
SequentialAnimation {
id: playMessage
running: false
NumberAnimation { target: message;
property: "opacity";
to: 1.0;
duration: 200
easing.type: Easing.InOutQuad
}
PauseAnimation { duration: 1000 }
NumberAnimation { target: message;
property: "opacity";
to: 0.0;
duration: 200}
}
}
}
function showMessage(message) {
banner.text = message
playMessage.start()
//! [PlaneMapQuick2]
}
}
//! [PlaneMapQuick2]
|