summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/bluetooth/btchat/main.cpp1
-rw-r--r--examples/bluetooth/btchat/remoteselector.cpp10
-rw-r--r--examples/bluetooth/btfiletransfer/main.cpp1
-rw-r--r--examples/bluetooth/btfiletransfer/pindisplay.h2
-rw-r--r--examples/bluetooth/btfiletransfer/progress.h6
-rw-r--r--examples/bluetooth/btfiletransfer/remoteselector.cpp25
-rw-r--r--examples/bluetooth/btfiletransfer/remoteselector.h4
-rw-r--r--examples/bluetooth/btscanner/device.cpp8
-rw-r--r--examples/bluetooth/btscanner/device.h2
-rw-r--r--examples/bluetooth/btscanner/main.cpp1
-rw-r--r--examples/bluetooth/btscanner/service.h2
-rw-r--r--examples/bluetooth/chat/qmlchat.cpp1
-rw-r--r--examples/bluetooth/heartrate-game/main.cpp1
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp12
-rw-r--r--examples/bluetooth/lowenergyscanner/main.cpp1
-rw-r--r--examples/bluetooth/picturetransfer/filetransfer.h2
-rw-r--r--examples/bluetooth/picturetransfer/main.cpp1
-rw-r--r--examples/bluetooth/pingpong/main.cpp1
-rw-r--r--examples/bluetooth/scanner/qmlscanner.cpp1
-rw-r--r--examples/nfc/corkboard/android/AndroidManifest.xml2
20 files changed, 43 insertions, 41 deletions
diff --git a/examples/bluetooth/btchat/main.cpp b/examples/bluetooth/btchat/main.cpp
index 5c7bbf75..e728efd2 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/btchat/remoteselector.cpp b/examples/bluetooth/btchat/remoteselector.cpp
index 2bd1efcc..ec5d207c 100644
--- a/examples/bluetooth/btchat/remoteselector.cpp
+++ b/examples/bluetooth/btchat/remoteselector.cpp
@@ -114,17 +114,15 @@ void RemoteSelector::serviceDiscovered(const QBluetoothServiceInfo &serviceInfo)
<< serviceInfo.protocolServiceMultiplexer();
qDebug() << "\tRFCOMM server channel:" << serviceInfo.serverChannel();
#endif
- QMapIterator<QListWidgetItem *, QBluetoothServiceInfo> i(m_discoveredServices);
- while (i.hasNext()){
- i.next();
- if (serviceInfo.device().address() == i.value().device().address()){
+ const QBluetoothAddress address = serviceInfo.device().address();
+ for (const QBluetoothServiceInfo &info : qAsConst(m_discoveredServices)) {
+ if (info.device().address() == address)
return;
- }
}
QString remoteName;
if (serviceInfo.device().name().isEmpty())
- remoteName = serviceInfo.device().address().toString();
+ remoteName = address.toString();
else
remoteName = serviceInfo.device().name();
diff --git a/examples/bluetooth/btfiletransfer/main.cpp b/examples/bluetooth/btfiletransfer/main.cpp
index 2c2b6df5..1871e207 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 b7ad8866..7acc517e 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 64a19ca0..afd72153 100644
--- a/examples/bluetooth/btfiletransfer/progress.h
+++ b/examples/bluetooth/btfiletransfer/progress.h
@@ -52,7 +52,7 @@
#define PROGRESS_H
#include <QDialog>
-#include <QTime>
+#include <QElapsedTimer>
QT_FORWARD_DECLARE_CLASS(QBluetoothTransferReply)
@@ -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);
@@ -81,7 +81,7 @@ public Q_SLOTS:
private:
Ui::Progress *ui;
- QTime start;
+ QElapsedTimer start;
};
#endif // PROGRESS_H
diff --git a/examples/bluetooth/btfiletransfer/remoteselector.cpp b/examples/bluetooth/btfiletransfer/remoteselector.cpp
index 766bd028..b3c60cb3 100644
--- a/examples/bluetooth/btfiletransfer/remoteselector.cpp
+++ b/examples/bluetooth/btfiletransfer/remoteselector.cpp
@@ -171,18 +171,17 @@ void RemoteSelector::serviceDiscovered(const QBluetoothServiceInfo &serviceInfo)
// new QListWidgetItem(QString::fromLatin1("%1\t%2\t%3").arg(serviceInfo.device().address().toString(),
// serviceInfo.device().name(), serviceInfo.serviceName()));
- QMutableMapIterator<int, QBluetoothServiceInfo> i(m_discoveredServices);
- while (i.hasNext()){
- i.next();
- if (serviceInfo.device().address() == i.value().device().address()){
- i.setValue(serviceInfo);
+ const QBluetoothAddress address = serviceInfo.device().address();
+ for (QBluetoothServiceInfo &info : m_discoveredServices) {
+ if (info.device().address() == address){
+ info = serviceInfo;
return;
}
}
int row = ui->remoteDevices->rowCount();
ui->remoteDevices->insertRow(row);
- QTableWidgetItem *item = new QTableWidgetItem(serviceInfo.device().address().toString());
+ QTableWidgetItem *item = new QTableWidgetItem(address.toString());
ui->remoteDevices->setItem(row, 0, item);
item = new QTableWidgetItem(serviceInfo.device().name());
ui->remoteDevices->setItem(row, 1, item);
@@ -190,9 +189,7 @@ void RemoteSelector::serviceDiscovered(const QBluetoothServiceInfo &serviceInfo)
ui->remoteDevices->setItem(row, 2, item);
- QBluetoothLocalDevice::Pairing p;
-
- p = m_localDevice->pairingStatus(serviceInfo.device().address());
+ QBluetoothLocalDevice::Pairing p = m_localDevice->pairingStatus(address);
ui->remoteDevices->blockSignals(true);
@@ -275,13 +272,11 @@ void RemoteSelector::on_stopButton_clicked()
m_discoveryAgent->stop();
}
-QString RemoteSelector::addressToName(const QBluetoothAddress &address)
+QString RemoteSelector::addressToName(const QBluetoothAddress &address) const
{
- QMapIterator<int, QBluetoothServiceInfo> i(m_discoveredServices);
- while (i.hasNext()){
- i.next();
- if (i.value().device().address() == address)
- return i.value().device().name();
+ for (const QBluetoothServiceInfo &info : m_discoveredServices) {
+ if (info.device().address() == address)
+ return info.device().name();
}
return address.toString();
}
diff --git a/examples/bluetooth/btfiletransfer/remoteselector.h b/examples/bluetooth/btfiletransfer/remoteselector.h
index b0850c41..8266c8c4 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);
@@ -95,7 +95,7 @@ private:
QPointer<pinDisplay> m_pindisplay;
bool m_pairingError;
- QString addressToName(const QBluetoothAddress &address);
+ QString addressToName(const QBluetoothAddress &address) const;
public Q_SLOTS:
void startDiscovery();
diff --git a/examples/bluetooth/btscanner/device.cpp b/examples/bluetooth/btscanner/device.cpp
index e97c0637..b6a07db4 100644
--- a/examples/bluetooth/btscanner/device.cpp
+++ b/examples/bluetooth/btscanner/device.cpp
@@ -109,9 +109,9 @@ void DeviceDiscoveryDialog::addDevice(const QBluetoothDeviceInfo &info)
QListWidgetItem *item = new QListWidgetItem(label);
QBluetoothLocalDevice::Pairing pairingStatus = localDevice->pairingStatus(info.address());
if (pairingStatus == QBluetoothLocalDevice::Paired || pairingStatus == QBluetoothLocalDevice::AuthorizedPaired )
- item->setTextColor(QColor(Qt::green));
+ item->setForeground(QColor(Qt::green));
else
- item->setTextColor(QColor(Qt::black));
+ item->setForeground(QColor(Qt::black));
ui->list->addItem(item);
}
@@ -218,12 +218,12 @@ void DeviceDiscoveryDialog::pairingDone(const QBluetoothAddress &address, QBluet
if (pairing == QBluetoothLocalDevice::Paired || pairing == QBluetoothLocalDevice::AuthorizedPaired ) {
for (int var = 0; var < items.count(); ++var) {
QListWidgetItem *item = items.at(var);
- item->setTextColor(QColor(Qt::green));
+ item->setForeground(QColor(Qt::green));
}
} else {
for (int var = 0; var < items.count(); ++var) {
QListWidgetItem *item = items.at(var);
- item->setTextColor(QColor(Qt::red));
+ item->setForeground(QColor(Qt::red));
}
}
}
diff --git a/examples/bluetooth/btscanner/device.h b/examples/bluetooth/btscanner/device.h
index 7111e1ec..35dc7965 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 ca762802..a84dcda9 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 94748dad..93d1e12b 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 e7ce3f3a..6c8d2fa7 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 099f82a7..05557c05 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 82179db1..d860457e 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 351ab13a..f223b028 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 5e2e08f9..4dee32fe 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 b4a1e670..4622e87e 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 fc1029de..7c34b135 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 4ead2364..2dbc0c27 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;
diff --git a/examples/nfc/corkboard/android/AndroidManifest.xml b/examples/nfc/corkboard/android/AndroidManifest.xml
index 68566b1b..ac0c5a67 100644
--- a/examples/nfc/corkboard/android/AndroidManifest.xml
+++ b/examples/nfc/corkboard/android/AndroidManifest.xml
@@ -72,7 +72,7 @@
</application>
- <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
+ <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.