This example requires Qt5 >= 5.9 setup for building.
17int main(
int argc,
char *argv[])
21 QQuickStyle::setStyle(
"Windows");
22 QQuickStyle::setFallbackStyle(
"Universal");
void setApplicationName(const QString &application)
void setOrganizationDomain(const QString &orgDomain)
void setOrganizationName(const QString &orgName)
void setContextProperty(const QString &name, QObject *value)
void setResizeMode(QQuickView::ResizeMode)
QQmlContext * rootContext() const const
void setSource(const QUrl &url)
QUrl fromLocalFile(const QString &localFile)
void resize(const QSize &newSize)
void setIcon(const QIcon &icon)
UI definition using QML.
2import QtQuick.Controls 2.2
3import QtQuick.Layouts 1.3
4import QtQuick.Dialogs 1.2
5import QtQuick.Controls.Universal 2.2
11 Layout.fillWidth: true
12 Layout.fillHeight: true
14 property var loadFile: true
15 property var enableSnapSend: false
17 Universal.theme: Universal.System
19 background: Rectangle {
22 color: Universal.background
25 function urlToPath(urlString) {
27 if (urlString.startsWith("file:///")) {
28 var k = urlString.charAt(9) === ':' ? 8 : 7
29 s = urlString.substring(k)
33 return decodeURIComponent(s);
40 title: loadFile ? "Select an image or driver to load" : "Save image"
41 selectExisting: loadFile
43 nameFilters: ["Firmware Update Files (*.guf)", "All files (*)"]
47 var path = urlToPath(fileUrl.toString());
48 backEnd.BtnOpenGuf(path)
52 property alias statusText: status.text
57 flow: GridLayout.TopToBottom
62 text: qsTr("QmlFirmwareUpdater Example. First select a .guf file which should be used
63to update the device. Then click \"Scan\" to list all connected devices. After selecting the
64desired camera/update combination, \"Start Update\". Wait for the update to finish and
65keep the camera connected during the whole process.")
67 horizontalAlignment: Text.AlignHCenter
69 Layout.fillWidth: true
74 objectName: "btnOpenGuf"
76 text: qsTr("Open guf file")
88 implicitWidth: btnOpenGuf.width
98 objectName: "btnStartUpdate"
100 text: qsTr("Start Update")
103 backEnd.BtnStartUpdate(gufEntriesCombo.currentIndex, cameraCombo.currentText)
110 Layout.fillWidth: true
111 model: backEnd.GufEntriesCombo
112 onCurrentIndexChanged: backEnd.UpdateGufEntryInfo(gufEntriesCombo.currentIndex)
118 Layout.fillWidth: true
120 model: backEnd.CameraCombo
128 Layout.fillWidth: true
135 objectName: "gufContent"