diff --git a/examples/bluetooth/btchat/main.cpp b/examples/bluetooth/btchat/main.cpp
index 5c7bbf7550ca3da5298c34e02969db1beb2a3fb1..e728efd272f54719a0e7424a2e42149cf2810a49 100644
--- a/examples/bluetooth/btchat/main.cpp
+++ b/examples/bluetooth/btchat/main.cpp
@@ -56,6 +56,7 @@
 int main(int argc, char *argv[])
 {
     //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QApplication app(argc, argv);
 
     Chat d;
diff --git a/examples/bluetooth/btfiletransfer/main.cpp b/examples/bluetooth/btfiletransfer/main.cpp
index 2c2b6df5f6536961f4fcefdc63bd797387e0aa6e..1871e2073917708992b100f9016488646446b969 100644
--- a/examples/bluetooth/btfiletransfer/main.cpp
+++ b/examples/bluetooth/btfiletransfer/main.cpp
@@ -54,6 +54,7 @@
 
 int main(int argc, char *argv[])
 {
+    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QApplication app(argc, argv);
 
     RemoteSelector d;
diff --git a/examples/bluetooth/btfiletransfer/pindisplay.h b/examples/bluetooth/btfiletransfer/pindisplay.h
index b7ad8866a3a46009ea99029375c785b6e4bdbfbb..7acc517e8ee4110b901c7f7ffea95581e022a63f 100644
--- a/examples/bluetooth/btfiletransfer/pindisplay.h
+++ b/examples/bluetooth/btfiletransfer/pindisplay.h
@@ -64,7 +64,7 @@ class pinDisplay : public QDialog
     Q_OBJECT
 
 public:
-    explicit pinDisplay(QString title, QString pin, QWidget *parent = 0);
+    explicit pinDisplay(QString title, QString pin, QWidget *parent = nullptr);
     ~pinDisplay();
 
     void setOkCancel();
diff --git a/examples/bluetooth/btfiletransfer/progress.h b/examples/bluetooth/btfiletransfer/progress.h
index ec73e14b8ad17f97b4e9db7ab56e2225056baa0b..afd72153b870fd30e1b1776ccc92335ecfee9053 100644
--- a/examples/bluetooth/btfiletransfer/progress.h
+++ b/examples/bluetooth/btfiletransfer/progress.h
@@ -69,7 +69,7 @@ class Progress : public QDialog
     Q_OBJECT
 
 public:
-    explicit Progress(QWidget *parent = 0);
+    explicit Progress(QWidget *parent = nullptr);
     ~Progress();
 
     void setStatus(QString title, QString filename);
diff --git a/examples/bluetooth/btfiletransfer/remoteselector.h b/examples/bluetooth/btfiletransfer/remoteselector.h
index b0850c413ee899b24199f948f02096381d2eed40..670eb2525786964cab08d04a6e5b866d14981420 100644
--- a/examples/bluetooth/btfiletransfer/remoteselector.h
+++ b/examples/bluetooth/btfiletransfer/remoteselector.h
@@ -78,7 +78,7 @@ class RemoteSelector : public QDialog
     Q_OBJECT
 
 public:
-    explicit RemoteSelector(QWidget *parent = 0);
+    explicit RemoteSelector(QWidget *parent = nullptr);
     ~RemoteSelector();
 
     void startDiscovery(const QBluetoothUuid &uuid);
diff --git a/examples/bluetooth/btscanner/device.h b/examples/bluetooth/btscanner/device.h
index 7111e1ec3fc081704cac7dd7fceca01ccc855930..35dc7965383a960113b5f91e158038f16c871acd 100644
--- a/examples/bluetooth/btscanner/device.h
+++ b/examples/bluetooth/btscanner/device.h
@@ -67,7 +67,7 @@ class DeviceDiscoveryDialog : public QDialog
     Q_OBJECT
 
 public:
-    DeviceDiscoveryDialog(QWidget *parent = 0);
+    DeviceDiscoveryDialog(QWidget *parent = nullptr);
     ~DeviceDiscoveryDialog();
 
 public slots:
diff --git a/examples/bluetooth/btscanner/main.cpp b/examples/bluetooth/btscanner/main.cpp
index ca7628020875c537bee6b8babb1db47a9bee53fc..a84dcda978c5b7a0d600f561540d0782fc05d725 100644
--- a/examples/bluetooth/btscanner/main.cpp
+++ b/examples/bluetooth/btscanner/main.cpp
@@ -54,6 +54,7 @@
 
 int main(int argc, char *argv[])
 {
+    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QApplication app(argc, argv);
 
     DeviceDiscoveryDialog d;
diff --git a/examples/bluetooth/btscanner/service.h b/examples/bluetooth/btscanner/service.h
index 94748dad010ff47d48c56db0e45fdaef7dce3f86..93d1e12bbb8997ee39dde381982a8dd0165dbcf8 100644
--- a/examples/bluetooth/btscanner/service.h
+++ b/examples/bluetooth/btscanner/service.h
@@ -66,7 +66,7 @@ class ServiceDiscoveryDialog : public QDialog
     Q_OBJECT
 
 public:
-    ServiceDiscoveryDialog(const QString &name, const QBluetoothAddress &address, QWidget *parent = 0);
+    ServiceDiscoveryDialog(const QString &name, const QBluetoothAddress &address, QWidget *parent = nullptr);
     ~ServiceDiscoveryDialog();
 
 public slots:
diff --git a/examples/bluetooth/chat/qmlchat.cpp b/examples/bluetooth/chat/qmlchat.cpp
index e7ce3f3a9759b2faa91e2ef9e2d0094fedfbc7bd..6c8d2fa729cdc742281cc3a2267936b499891950 100644
--- a/examples/bluetooth/chat/qmlchat.cpp
+++ b/examples/bluetooth/chat/qmlchat.cpp
@@ -62,6 +62,7 @@
 int main(int argc, char *argv[])
 {
     //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QGuiApplication application(argc, argv);
 
     QList<QBluetoothHostInfo> infos = QBluetoothLocalDevice::allDevices();
diff --git a/examples/bluetooth/heartrate-game/main.cpp b/examples/bluetooth/heartrate-game/main.cpp
index 099f82a77f19c13e703fd806c74d193332f217f9..05557c05d466596b21e9576d20ad1a4bb9862fc9 100644
--- a/examples/bluetooth/heartrate-game/main.cpp
+++ b/examples/bluetooth/heartrate-game/main.cpp
@@ -60,6 +60,7 @@
 int main(int argc, char *argv[])
 {
     QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QGuiApplication app(argc, argv);
 
     ConnectionHandler connectionHandler;
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 82179db14a2812aa8bb4fd437ced43fbf3af9509..d860457e719d24e911f92cdd9be4e98d347261d1 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -152,12 +152,12 @@ void Device::scanServices(const QString &address)
     // We need the current device for service discovery.
 
     for (auto d: qAsConst(devices)) {
-        auto device = qobject_cast<DeviceInfo *>(d);
-        if (!device)
-            continue;
-
-        if (device->getAddress() == address )
-            currentDevice.setDevice(device->getDevice());
+        if (auto device = qobject_cast<DeviceInfo *>(d)) {
+            if (device->getAddress() == address ) {
+                currentDevice.setDevice(device->getDevice());
+                break;
+            }
+        }
     }
 
     if (!currentDevice.getDevice().isValid()) {
diff --git a/examples/bluetooth/lowenergyscanner/main.cpp b/examples/bluetooth/lowenergyscanner/main.cpp
index 351ab13a2c9ae6f48d7c8edc295c94e96ad8cadb..f223b028b7d547fc31bb5ce02006bdabb9967a76 100644
--- a/examples/bluetooth/lowenergyscanner/main.cpp
+++ b/examples/bluetooth/lowenergyscanner/main.cpp
@@ -59,6 +59,7 @@
 int main(int argc, char *argv[])
 {
     //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QGuiApplication app(argc, argv);
 
     Device d;
diff --git a/examples/bluetooth/picturetransfer/filetransfer.h b/examples/bluetooth/picturetransfer/filetransfer.h
index 5e2e08f9856f5639cee551d5a578cc24e53ba84b..4dee32fe1b8bcce5b9cd28832bf68d18b9c0b51b 100644
--- a/examples/bluetooth/picturetransfer/filetransfer.h
+++ b/examples/bluetooth/picturetransfer/filetransfer.h
@@ -59,7 +59,7 @@ class FileTransfer : public QObject
     Q_OBJECT
     Q_PROPERTY(float progress READ getProgress NOTIFY progressChanged)
 public:
-    explicit FileTransfer(QObject *parent = 0);
+    explicit FileTransfer(QObject *parent = nullptr);
     float getProgress() { return m_progress;}
 
 signals:
diff --git a/examples/bluetooth/picturetransfer/main.cpp b/examples/bluetooth/picturetransfer/main.cpp
index b4a1e6706d78f3b5ba7652228c3d965a97dea33c..4622e87e0c30fc0e0c7a4e29a6790bd7b7637ccc 100644
--- a/examples/bluetooth/picturetransfer/main.cpp
+++ b/examples/bluetooth/picturetransfer/main.cpp
@@ -58,6 +58,7 @@
 
 int main(int argc, char *argv[])
 {
+    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QGuiApplication application(argc, argv);
 //! [Transfer-2]
     QQuickView view;
diff --git a/examples/bluetooth/pingpong/main.cpp b/examples/bluetooth/pingpong/main.cpp
index fc1029de3fe2b10ca18616ca25d1d6fce8503e92..7c34b1355444247dbfd0a5249a1b9d9657cb4b6b 100644
--- a/examples/bluetooth/pingpong/main.cpp
+++ b/examples/bluetooth/pingpong/main.cpp
@@ -58,6 +58,7 @@
 int main(int argc, char *argv[])
 {
     //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QGuiApplication app(argc, argv);
     PingPong pingPong;
     QQmlApplicationEngine engine;
diff --git a/examples/bluetooth/scanner/qmlscanner.cpp b/examples/bluetooth/scanner/qmlscanner.cpp
index 4ead23646ff611edf94669c2c2edb2c44ffeafe6..2dbc0c271cd8f51ab483b0741e42bb0c34c56cd7 100644
--- a/examples/bluetooth/scanner/qmlscanner.cpp
+++ b/examples/bluetooth/scanner/qmlscanner.cpp
@@ -56,6 +56,7 @@
 int main(int argc, char *argv[])
 {
     //QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
+    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
     QGuiApplication application(argc, argv);
     const QString mainQmlApp(QStringLiteral("qrc:/scanner.qml"));
     QQuickView view;