diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/nfc/annotatedurl/annotatedurl.cpp | 40 | ||||
-rw-r--r-- | examples/nfc/annotatedurl/annotatedurl.h | 4 | ||||
-rw-r--r-- | examples/nfc/annotatedurl/main.cpp | 17 | ||||
-rw-r--r-- | examples/nfc/annotatedurl/mainwindow.cpp | 4 | ||||
-rw-r--r-- | examples/nfc/annotatedurl/mainwindow.h | 6 |
5 files changed, 33 insertions, 38 deletions
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 f4fe2ab9..e62b9d08 100644 --- a/examples/nfc/annotatedurl/annotatedurl.h +++ b/examples/nfc/annotatedurl/annotatedurl.h @@ -51,7 +51,7 @@ #ifndef ANNOTATEDURL_H #define ANNOTATEDURL_H -#include <QNdefMessage> +#include <QtNfc/QNdefMessage> #include <QtCore/QObject> @@ -60,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 { |