Debian Codegraph @

tests/manual/planets-qml/InfoSheet.qml

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import QtQuick 2.0
5
6 Rectangle {
7 id: infoSheet
8
9 width: 200
10 height: 450
11 anchors.verticalCenter: parent.verticalCenter
12
13 property alias planet: planetText.planet
14 property alias radius: infoText.radius
15 property alias temperature: infoText.temperature
16 property alias orbitalPeriod: infoText.orbitalPeriod
17 property alias distance: infoText.distance
18 property alias exampleDetails: infoText.exampleDetails
19
20 Behavior on opacity { PropertyAnimation {} }
21
22 color: "black"
23
24 Text {
25 id: planetText
26 anchors.top: parent.top
27 anchors.topMargin: 20
28 anchors.horizontalCenter: parent.horizontalCenter
29
30 property string planet: ""
31
32 font.family: "Helvetica"
33 font.pixelSize: 32
34 font.weight: Font.Light
35 color: "white"
36
37 text: "<p>" + planet + "</p>"
38 }
39
40 Text {
41 id: infoText
42 anchors.top: planetText.bottom
43 anchors.horizontalCenter: parent.horizontalCenter
44
45 property string radius: ""
46 property string temperature: ""
47 property string orbitalPeriod: ""
48 property string distance: ""
49 property string exampleDetails: ""
50
51 font.family: "Helvetica"
52 font.pixelSize: 18
53 font.weight: Font.Light
54 lineHeight: 1.625 * 18
55 lineHeightMode: Text.FixedHeight
56 color: "white"
57
58 text: {
59 if (planet == "Solar System") {
60 "<p>" + exampleDetails + "</p>"
61 } else if (planet == "Sun") {
62 "<p>Equatorial Diameter:</p><p>" + radius + "</p></br>"
63 + "<p>Surface Temperature:</p><p>" + temperature + "</p>"
64 } else {
65 "<p>Equatorial Diameter:</p><p>" + radius + "</p></br>"
66 + "<p>Surface Temperature:</p><p>" + temperature + "</p></br>"
67 + "<p>Solar Orbit Period:</p><p>" + orbitalPeriod + "</p></br>"
68 + "<p>Distance from Sun:</p><p>" + distance + "</p>"
69 }
70 }
71
72 onLinkActivated: Qt.openUrlExternally(link)
73 }
74 }
75