Putting our marquee control on our display.
2 import QtQuick.Controls 1.2
3 import QtQuick.Layouts 1.1
9 Component.onCompleted: {
10 display.closed.connect(onDisplayClosed);
11 display.opened.connect(onDisplayOpened);
12 display.openError.connect(updateDisplayStatusError);
13 display.powerStatus.connect(updatePowerStatus);
14 display.deviceId.connect(updateDeviceId);
15 display.firmwareVersion.connect(updateFirmwareVersion);
18 //We need to disconnect our signals to avoid receiving stray events
19 Component.onDestruction: {
20 display.closed.disconnect(onDisplayClosed);
21 display.opened.disconnect(onDisplayOpened);
22 display.openError.disconnect(updateDisplayStatusError);
23 display.powerStatus.disconnect(updatePowerStatus);
24 display.deviceId.disconnect(updateDeviceId);
25 display.firmwareVersion.disconnect(updateFirmwareVersion);
28 function updatePowerStatus(powerOn)
32 labelDisplayPowerStatus.text=qsTr("Power: ON");
36 labelDisplayPowerStatus.text=qsTr("Power: OFF");
40 function updateDeviceId(deviceId)
42 labelDisplayDeviceId.text = deviceId;
43 display.requestFirmwareVersion();
46 function updateFirmwareVersion(version)
48 labelDisplayFirmwareVersion.text = "Firmware v" + version;
49 display.requestPowerStatus();
52 function onDisplayOpened()
54 updateDisplayStatus();
56 display.requestDeviceId();
59 function onDisplayClosed()
61 updateDisplayStatus();
62 labelDisplayDeviceId.text="";
63 labelDisplayFirmwareVersion.text="";
64 labelDisplayPowerStatus.text="";
68 function updateDisplayStatusError()
70 updateDisplayStatus();
71 labelDisplayStatus.text=qsTr("Connection error");
74 function updateDisplayStatus()
78 labelDisplayStatus.text=qsTr("Connected");
82 labelDisplayStatus.text=qsTr("Disconnected");
85 labelDisplayVendor.text=display.vendor;
86 labelDisplayProduct.text=display.product;
87 labelDisplaySerialNumber.text=display.serialNumber;
93 id: labelDisplayStatus
94 text: qsTr("Disconnected")
98 id: labelDisplayVendor
103 id: labelDisplayProduct
108 id: labelDisplaySerialNumber
109 visible: false //We don't want to display that. GP1212A01A does not even provide a proper string.
114 id: labelDisplayDeviceId
119 id: labelDisplayFirmwareVersion
124 id: labelDisplayPowerStatus