diff options
Diffstat (limited to 'examples')
26 files changed, 98 insertions, 138 deletions
diff --git a/examples/bluetooth/btchat/btchat.pro b/examples/bluetooth/btchat/btchat.pro index 6ecae4c7..9c37dfcf 100644 --- a/examples/bluetooth/btchat/btchat.pro +++ b/examples/bluetooth/btchat/btchat.pro @@ -2,6 +2,7 @@ TEMPLATE = app TARGET = btchat QT = core bluetooth widgets +requires(qtConfig(listwidget)) android: QT += androidextras SOURCES = \ diff --git a/examples/bluetooth/btfiletransfer/btfiletransfer.pro b/examples/bluetooth/btfiletransfer/btfiletransfer.pro index e5d47302..92b81bef 100644 --- a/examples/bluetooth/btfiletransfer/btfiletransfer.pro +++ b/examples/bluetooth/btfiletransfer/btfiletransfer.pro @@ -2,6 +2,7 @@ TEMPLATE = app TARGET = btfiletransfer QT = core bluetooth widgets +requires(qtConfig(filedialog)) SOURCES = \ main.cpp \ diff --git a/examples/bluetooth/btfiletransfer/progress.h b/examples/bluetooth/btfiletransfer/progress.h index 6dc9d6be..64a19ca0 100644 --- a/examples/bluetooth/btfiletransfer/progress.h +++ b/examples/bluetooth/btfiletransfer/progress.h @@ -52,7 +52,6 @@ #define PROGRESS_H #include <QDialog> -#include <qbluetoothglobal.h> #include <QTime> QT_FORWARD_DECLARE_CLASS(QBluetoothTransferReply) diff --git a/examples/bluetooth/btscanner/btscanner.pro b/examples/bluetooth/btscanner/btscanner.pro index f1254629..904ea5a8 100644 --- a/examples/bluetooth/btscanner/btscanner.pro +++ b/examples/bluetooth/btscanner/btscanner.pro @@ -1,6 +1,7 @@ TARGET = btscanner QT = core bluetooth widgets +requires(qtConfig(listwidget)) TEMPLATE = app SOURCES = \ diff --git a/examples/bluetooth/btscanner/device.h b/examples/bluetooth/btscanner/device.h index a8202898..7111e1ec 100644 --- a/examples/bluetooth/btscanner/device.h +++ b/examples/bluetooth/btscanner/device.h @@ -53,7 +53,6 @@ #include "ui_device.h" -#include <qbluetoothglobal.h> #include <qbluetoothlocaldevice.h> #include <QDialog> diff --git a/examples/bluetooth/btscanner/service.h b/examples/bluetooth/btscanner/service.h index 83b4bf42..94748dad 100644 --- a/examples/bluetooth/btscanner/service.h +++ b/examples/bluetooth/btscanner/service.h @@ -53,7 +53,6 @@ #include "ui_service.h" -#include <qbluetoothglobal.h> #include <QDialog> QT_FORWARD_DECLARE_CLASS(QBluetoothAddress) diff --git a/examples/bluetooth/heartrate-game/devicehandler.cpp b/examples/bluetooth/heartrate-game/devicehandler.cpp index ec83586b..3d263a4c 100644 --- a/examples/bluetooth/heartrate-game/devicehandler.cpp +++ b/examples/bluetooth/heartrate-game/devicehandler.cpp @@ -52,6 +52,7 @@ #include "devicehandler.h" #include "deviceinfo.h" #include <QtEndian> +#include <QRandomGenerator> DeviceHandler::DeviceHandler(QObject *parent) : BluetoothBaseClass(parent), @@ -258,11 +259,11 @@ void DeviceHandler::updateDemoHR() { int randomValue = 0; if (m_currentValue < 30) { // Initial value - randomValue = 55 + qrand()%30; + randomValue = 55 + QRandomGenerator::global()->bounded(30); } else if (!m_measuring) { // Value when relax - randomValue = qBound(55, m_currentValue - 2 + qrand()%5, 75); + randomValue = qBound(55, m_currentValue - 2 + QRandomGenerator::global()->bounded(5), 75); } else { // Measuring - randomValue = m_currentValue + qrand()%10 - 2; + randomValue = m_currentValue + QRandomGenerator::global()->bounded(10) - 2; } addMeasurement(randomValue); diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp index 77314256..2ae30c16 100644 --- a/examples/bluetooth/lowenergyscanner/device.cpp +++ b/examples/bluetooth/lowenergyscanner/device.cpp @@ -50,6 +50,7 @@ ****************************************************************************/ #include "device.h" + #include <qbluetoothaddress.h> #include <qbluetoothdevicediscoveryagent.h> #include <qbluetoothlocaldevice.h> diff --git a/examples/bluetooth/lowenergyscanner/device.h b/examples/bluetooth/lowenergyscanner/device.h index 6dbfa948..a30cf9b6 100644 --- a/examples/bluetooth/lowenergyscanner/device.h +++ b/examples/bluetooth/lowenergyscanner/device.h @@ -51,7 +51,6 @@ #ifndef DEVICE_H #define DEVICE_H -#include <qbluetoothglobal.h> #include <qbluetoothlocaldevice.h> #include <QObject> #include <QVariant> diff --git a/examples/nfc/annotatedurl/annotatedurl.cpp b/examples/nfc/annotatedurl/annotatedurl.cpp index 7f63f44b..5c4a0527 100644 --- a/examples/nfc/annotatedurl/annotatedurl.cpp +++ b/examples/nfc/annotatedurl/annotatedurl.cpp @@ -47,24 +47,22 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - #include "annotatedurl.h" -#include <qnearfieldmanager.h> -#include <qnearfieldtarget.h> -#include <qndefmessage.h> -#include <qndefrecord.h> -#include <qndefnfctextrecord.h> -#include <qndefnfcurirecord.h> - -#include <QtCore/QUrl> +#include <QtNfc/qnearfieldmanager.h> +#include <QtNfc/qnearfieldtarget.h> +#include <QtNfc/qndefmessage.h> +#include <QtNfc/qndefrecord.h> +#include <QtNfc/qndefnfctextrecord.h> +#include <QtNfc/qndefnfcurirecord.h> + +#include <QtWidgets/QGridLayout> +#include <QtWidgets/QLabel> +#include <QtGui/QMouseEvent> +#include <QtGui/QDesktopServices> +#include <QtCore/QDebug> #include <QtCore/QLocale> - -#include <QGridLayout> -#include <QLabel> -#include <QMouseEvent> -#include <QDesktopServices> -#include <QDebug> +#include <QtCore/QUrl> AnnotatedUrl::AnnotatedUrl(QObject *parent) : QObject(parent) @@ -91,10 +89,10 @@ AnnotatedUrl::AnnotatedUrl(QObject *parent) qWarning() << "Platform does not support NDEF message handler registration"; manager->startTargetDetection(); - connect(manager, SIGNAL(targetDetected(QNearFieldTarget*)), - this, SLOT(targetDetected(QNearFieldTarget*))); - connect(manager, SIGNAL(targetLost(QNearFieldTarget*)), - this, SLOT(targetLost(QNearFieldTarget*))); + connect(manager, &QNearFieldManager::targetDetected, + this, &AnnotatedUrl::targetDetected); + connect(manager, &QNearFieldManager::targetLost, + this, &AnnotatedUrl::targetLost); } AnnotatedUrl::~AnnotatedUrl() @@ -107,8 +105,8 @@ void AnnotatedUrl::targetDetected(QNearFieldTarget *target) if (!target) return; - connect(target, SIGNAL(ndefMessageRead(QNdefMessage)), - this, SLOT(handlePolledNdefMessage(QNdefMessage))); + connect(target, &QNearFieldTarget::ndefMessageRead, + this, &AnnotatedUrl::handlePolledNdefMessage); target->readNdefMessages(); } diff --git a/examples/nfc/annotatedurl/annotatedurl.h b/examples/nfc/annotatedurl/annotatedurl.h index 0fb1ae56..e62b9d08 100644 --- a/examples/nfc/annotatedurl/annotatedurl.h +++ b/examples/nfc/annotatedurl/annotatedurl.h @@ -51,8 +51,7 @@ #ifndef ANNOTATEDURL_H #define ANNOTATEDURL_H -#include <qnfcglobal.h> -#include <QNdefMessage> +#include <QtNfc/QNdefMessage> #include <QtCore/QObject> @@ -61,8 +60,6 @@ QT_FORWARD_DECLARE_CLASS(QPixmap) QT_FORWARD_DECLARE_CLASS(QNearFieldManager) QT_FORWARD_DECLARE_CLASS(QNearFieldTarget) -QT_USE_NAMESPACE - class AnnotatedUrl : public QObject { Q_OBJECT diff --git a/examples/nfc/annotatedurl/main.cpp b/examples/nfc/annotatedurl/main.cpp index 109fb3b7..9ce6c1b9 100644 --- a/examples/nfc/annotatedurl/main.cpp +++ b/examples/nfc/annotatedurl/main.cpp @@ -51,26 +51,21 @@ #include "annotatedurl.h" #include "mainwindow.h" -#include <qnearfieldmanager.h> -#include <qndefnfctextrecord.h> -#include <qndefnfcurirecord.h> - -#include <QtCore/QLocale> - -#include <QApplication> +#include <QtNfc/qnearfieldmanager.h> +#include <QtNfc/qndefnfctextrecord.h> +#include <QtNfc/qndefnfcurirecord.h> +#include <QtWidgets/QApplication> int main(int argc, char *argv[]) { - //QLocale::setDefault(QLocale(QLocale::Japanese)); - QApplication a(argc, argv); MainWindow mainWindow; AnnotatedUrl annotatedUrl; - QObject::connect(&annotatedUrl, SIGNAL(annotatedUrl(QUrl,QString,QPixmap)), - &mainWindow, SLOT(displayAnnotatedUrl(QUrl,QString,QPixmap))); + QObject::connect(&annotatedUrl, &AnnotatedUrl::annotatedUrl, + &mainWindow, &MainWindow::displayAnnotatedUrl); mainWindow.show(); diff --git a/examples/nfc/annotatedurl/mainwindow.cpp b/examples/nfc/annotatedurl/mainwindow.cpp index 2220d747..707c03eb 100644 --- a/examples/nfc/annotatedurl/mainwindow.cpp +++ b/examples/nfc/annotatedurl/mainwindow.cpp @@ -51,9 +51,9 @@ #include "mainwindow.h" #include "ui_mainwindow.h" -#include <QtCore/QUrl> -#include <QtGui/QMouseEvent> #include <QtGui/QDesktopServices> +#include <QtGui/QMouseEvent> +#include <QtCore/QUrl> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) diff --git a/examples/nfc/annotatedurl/mainwindow.h b/examples/nfc/annotatedurl/mainwindow.h index e56ba521..9cfb6e7f 100644 --- a/examples/nfc/annotatedurl/mainwindow.h +++ b/examples/nfc/annotatedurl/mainwindow.h @@ -51,9 +51,13 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include <QMainWindow> +#include <QtWidgets/QMainWindow> +QT_FORWARD_DECLARE_CLASS(QMouseEvent) QT_FORWARD_DECLARE_CLASS(QUrl) +QT_FORWARD_DECLARE_CLASS(QPixmap) +QT_FORWARD_DECLARE_CLASS(QString) +QT_FORWARD_DECLARE_CLASS(QWidget) QT_BEGIN_NAMESPACE namespace Ui { diff --git a/examples/nfc/corkboard/Mode.qml b/examples/nfc/corkboard/Mode.qml index b06b22a5..0d427cf5 100644 --- a/examples/nfc/corkboard/Mode.qml +++ b/examples/nfc/corkboard/Mode.qml @@ -66,7 +66,8 @@ Item { Text { anchors { horizontalCenter: parent.horizontalCenter; top: parent.top; topMargin: 10} text: name; - font.pixelSize: 30; font.bold: true; color: "white" + font { pixelSize: 30; bold: true } + color: "white" style: Text.Outline; styleColor: "black" } @@ -75,8 +76,8 @@ Item { Item { id: stickyPage - x: Math.random() * (listView.width-listView.width*0.30) + listView.width*0.10 - y: Math.random() * (listView.height-listView.height*0.30) + listView.height*0.10 + x: ListView.width * (0.7 * Math.random() + 0.1) + y: ListView.height * (0.7 * Math.random() + 0.1) rotation: -listView.horizontalVelocity / 200; Behavior on rotation { diff --git a/examples/nfc/corkboard/corkboards.qml b/examples/nfc/corkboard/corkboards.qml index a1d9bee1..92cb6616 100644 --- a/examples/nfc/corkboard/corkboards.qml +++ b/examples/nfc/corkboard/corkboards.qml @@ -110,15 +110,14 @@ Rectangle { ListElement { name: "Work" notes: [ - //ListElement { noteText: "To write a tag, click the red flag of a note and then touch a tag" }, - ListElement { noteText: "https://www.qt.io" } + ListElement { noteText: "https://www.qt.io" }, + ListElement { noteText: "To write a tag, click the red flag of a note and then touch a tag" } ] } } ListView { id: listView - anchors.fill: parent orientation: ListView.Horizontal snapMode: ListView.SnapOneItem diff --git a/examples/nfc/ndefeditor/mainwindow.cpp b/examples/nfc/ndefeditor/mainwindow.cpp index 02a969ae..41077c2d 100644 --- a/examples/nfc/ndefeditor/mainwindow.cpp +++ b/examples/nfc/ndefeditor/mainwindow.cpp @@ -55,21 +55,18 @@ #include "urirecordeditor.h" #include "mimeimagerecordeditor.h" -#include <QtCore/QTime> -#include <QMenu> -#include <QVBoxLayout> -#include <QFrame> -#include <QLabel> -#include <QFileDialog> - -#include <qnearfieldmanager.h> -#include <qnearfieldtarget.h> -#include <qndefrecord.h> -#include <qndefnfctextrecord.h> -#include <qndefnfcurirecord.h> -#include <qndefmessage.h> - -#include <QtCore/QDebug> +#include <QtNfc/qndefnfcurirecord.h> +#include <QtNfc/qndefnfctextrecord.h> +#include <QtNfc/qndefrecord.h> +#include <QtNfc/qndefmessage.h> +#include <QtNfc/qnearfieldmanager.h> +#include <QtNfc/qnearfieldtarget.h> + +#include <QtWidgets/QMenu> +#include <QtWidgets/QVBoxLayout> +#include <QtWidgets/QFrame> +#include <QtWidgets/QLabel> +#include <QtWidgets/QFileDialog> class EmptyRecordLabel : public QLabel { @@ -239,19 +236,16 @@ void MainWindow::targetDetected(QNearFieldTarget *target) case NoAction: break; case ReadNdef: - connect(target, SIGNAL(ndefMessageRead(QNdefMessage)), - this, SLOT(ndefMessageRead(QNdefMessage))); - connect(target, SIGNAL(error(QNearFieldTarget::Error,QNearFieldTarget::RequestId)), - this, SLOT(targetError(QNearFieldTarget::Error,QNearFieldTarget::RequestId))); + connect(target, &QNearFieldTarget::ndefMessageRead, this, &MainWindow::ndefMessageRead); + connect(target, &QNearFieldTarget::error, this, &MainWindow::targetError); m_request = target->readNdefMessages(); if (!m_request.isValid()) // cannot read messages targetError(QNearFieldTarget::NdefReadError, m_request); break; case WriteNdef: - connect(target, SIGNAL(ndefMessagesWritten()), this, SLOT(ndefMessageWritten())); - connect(target, SIGNAL(error(QNearFieldTarget::Error,QNearFieldTarget::RequestId)), - this, SLOT(targetError(QNearFieldTarget::Error,QNearFieldTarget::RequestId))); + connect(target, &QNearFieldTarget::ndefMessagesWritten, this, &MainWindow::ndefMessageWritten); + connect(target, &QNearFieldTarget::error, this, &MainWindow::targetError); m_request = target->writeNdefMessages(QList<QNdefMessage>() << ndefMessage()); if (!m_request.isValid()) // cannot write messages diff --git a/examples/nfc/ndefeditor/mainwindow.h b/examples/nfc/ndefeditor/mainwindow.h index e16a44a4..9018cbfb 100644 --- a/examples/nfc/ndefeditor/mainwindow.h +++ b/examples/nfc/ndefeditor/mainwindow.h @@ -51,18 +51,12 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include <QMainWindow> +#include <QtNfc/qnearfieldtarget.h> -#include <qnfcglobal.h> +#include <QtWidgets/QMainWindow> -#include <qnearfieldtarget.h> - -QT_BEGIN_NAMESPACE -class QNearFieldManager; -class QNdefMessage; -QT_END_NAMESPACE - -QT_USE_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QNearFieldManager) +QT_FORWARD_DECLARE_CLASS(QNdefMessage) QT_BEGIN_NAMESPACE namespace Ui { diff --git a/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp b/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp index ef8cf1fd..8044e8a6 100644 --- a/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp +++ b/examples/nfc/ndefeditor/mimeimagerecordeditor.cpp @@ -51,9 +51,9 @@ #include "mimeimagerecordeditor.h" #include "ui_mimeimagerecordeditor.h" -#include <QBuffer> -#include <QFileDialog> -#include <QImageReader> +#include <QtGui/QImageReader> +#include <QtWidgets/QFileDialog> +#include <QtCore/QBuffer> static QString imageFormatToMimeType(const QByteArray &format) { diff --git a/examples/nfc/ndefeditor/mimeimagerecordeditor.h b/examples/nfc/ndefeditor/mimeimagerecordeditor.h index 9ea7d3b4..1e810f64 100644 --- a/examples/nfc/ndefeditor/mimeimagerecordeditor.h +++ b/examples/nfc/ndefeditor/mimeimagerecordeditor.h @@ -52,11 +52,9 @@ #ifndef MIMEIMAGERECORDEDITOR_H #define MIMEIMAGERECORDEDITOR_H -#include <qnfcglobal.h> +#include <QtNfc/qndefrecord.h> -#include <QWidget> - -#include <qndefrecord.h> +#include <QtWidgets/QWidget> QT_USE_NAMESPACE diff --git a/examples/nfc/ndefeditor/ndefeditor.pro b/examples/nfc/ndefeditor/ndefeditor.pro index 43ab47fa..4b81c17c 100644 --- a/examples/nfc/ndefeditor/ndefeditor.pro +++ b/examples/nfc/ndefeditor/ndefeditor.pro @@ -1,4 +1,5 @@ QT += nfc widgets +requires(qtConfig(filedialog)) TARGET = ndefeditor TEMPLATE = app diff --git a/examples/nfc/ndefeditor/textrecordeditor.cpp b/examples/nfc/ndefeditor/textrecordeditor.cpp index 390674ad..381ff88f 100644 --- a/examples/nfc/ndefeditor/textrecordeditor.cpp +++ b/examples/nfc/ndefeditor/textrecordeditor.cpp @@ -51,8 +51,6 @@ #include "textrecordeditor.h" #include "ui_textrecordeditor.h" -#include <QtCore/QDebug> - TextRecordEditor::TextRecordEditor(QWidget *parent) : QWidget(parent), ui(new Ui::TextRecordEditor) diff --git a/examples/nfc/ndefeditor/textrecordeditor.h b/examples/nfc/ndefeditor/textrecordeditor.h index 65e33fb7..d7bf4d2e 100644 --- a/examples/nfc/ndefeditor/textrecordeditor.h +++ b/examples/nfc/ndefeditor/textrecordeditor.h @@ -51,9 +51,9 @@ #ifndef TEXTRECORDEDITOR_H #define TEXTRECORDEDITOR_H -#include <QWidget> +#include <QtNfc/qndefnfctextrecord.h> -#include <qndefnfctextrecord.h> +#include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE namespace Ui { diff --git a/examples/nfc/ndefeditor/urirecordeditor.h b/examples/nfc/ndefeditor/urirecordeditor.h index ef75065a..7eee55eb 100644 --- a/examples/nfc/ndefeditor/urirecordeditor.h +++ b/examples/nfc/ndefeditor/urirecordeditor.h @@ -48,13 +48,12 @@ ** ****************************************************************************/ - #ifndef URIRECORDEDITOR_H #define URIRECORDEDITOR_H -#include <QWidget> +#include <QtNfc/qndefnfcurirecord.h> -#include <qndefnfcurirecord.h> +#include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE namespace Ui { diff --git a/examples/nfc/poster/poster.qml b/examples/nfc/poster/poster.qml index 3127d44e..3e2a1eda 100644 --- a/examples/nfc/poster/poster.qml +++ b/examples/nfc/poster/poster.qml @@ -128,11 +128,9 @@ Rectangle { Text { id: touchText - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter + anchors { horizontalCenter: parent.horizontalCenter; horizontalCenterOffset: parent.verticalCenter } text: "Touch an NFC tag with at least one Text and one URI record." - font.bold: true - font.pointSize: 18 + font { italic: true; pointSize: 18 } wrapMode: Text.WordWrap width: root.width*0.75 horizontalAlignment: Text.AlignHCenter @@ -150,27 +148,22 @@ Rectangle { Text { id: posterText - anchors.horizontalCenter: parent.right - anchors.horizontalCenterOffset: - parent.width / 4 y: -height - font.bold: true - font.pointSize: 18 + anchors { horizontalCenter: parent.right; horizontalCenterOffset: - parent.width / 4 } + font { italic: true; pointSize: 18 } } Text { id: posterUrl - anchors.horizontalCenter: parent.right - anchors.horizontalCenterOffset: - parent.width / 4 y: parent.height - font.italic: true - font.pointSize: 14 + anchors { horizontalCenter: parent.right; horizontalCenterOffset: - parent.width / 4 } + font { italic: true; pointSize: 14 } } MouseArea { id: openMouseArea anchors.fill: parent enabled: root.state == "show" - onClicked: Qt.openUrlExternally(posterUrl.text) Rectangle { @@ -179,14 +172,10 @@ Rectangle { height: 50 color: "lightsteelblue" opacity: 0.3 - anchors.top: parent.top - anchors.right: close.left - anchors.rightMargin: 10 - + anchors { top: parent.top; right: close.left; rightMargin: 10 } MouseArea { id: touchMouseArea anchors.fill: parent - onClicked: { if (root.state == "") { root.state = "show"; @@ -204,34 +193,26 @@ Rectangle { color: "black" radius: 0 opacity: 0.3 - anchors.top: parent.top - anchors.topMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 - + anchors { top: parent.top; topMargin: 0; right: parent.right; rightMargin: 0 } MouseArea { id: closeMouseArea anchors.fill: parent - onClicked: Qt.quit(); } } } - states: [ - State { - name: "show" - PropertyChanges { target: posterText; y: root.height / 3 } - PropertyChanges { target: posterUrl; y: 2 * root.height / 3 } - PropertyChanges { target: posterImage; x: root.width / 20 } - PropertyChanges { target: touchText; opacity: 0 } - } - ] + states: State { + name: "show" + PropertyChanges { target: posterText; y: root.height / 3 } + PropertyChanges { target: posterUrl; y: 2 * root.height / 3 } + PropertyChanges { target: posterImage; x: root.width / 20 } + PropertyChanges { target: touchText; opacity: 0 } + } - transitions: [ - Transition { - PropertyAnimation { easing.type: Easing.OutQuad; properties: "x,y" } - PropertyAnimation { property: "opacity"; duration: 125 } - } - ] + + transitions: Transition { + PropertyAnimation { easing.type: Easing.OutQuad; properties: "x,y" } + PropertyAnimation { property: "opacity"; duration: 125 } + } } diff --git a/examples/nfc/poster/qmlposter.cpp b/examples/nfc/poster/qmlposter.cpp index 5bf5f352..a4f98de3 100644 --- a/examples/nfc/poster/qmlposter.cpp +++ b/examples/nfc/poster/qmlposter.cpp @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) view.setResizeMode(QQuickView::SizeRootObjectToView); // Qt.quit() called in embedded .qml by default only emits // quit() signal, so do this (optionally use Qt.exit()). - QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit())); + QObject::connect(view.engine(), &QQmlEngine::quit, qApp, &QGuiApplication::quit); view.setGeometry(QRect(100, 100, 640, 360)); view.show(); return application.exec(); |