From ef98583d2a5350602d0dac2736c772bfd84ebadb Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Mon, 10 Mar 2014 14:52:00 +0100 Subject: Improve NFC documentation 1.) Extend the NFC overview page 2.) Ensure that snippets are compiled at all times 3.) Mark Qt 5.3 APIs using \since Task-number: QTBUG-32401 Task-number: QTBUG-34978 Change-Id: I8928be3d7dd2c9de1314eb1ec6ed55c8d4301f4a Reviewed-by: Leena Miettinen Reviewed-by: Jerome Pasion Reviewed-by: Alex Blasche --- examples/nfc/ndefeditor/mainwindow.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'examples/nfc/ndefeditor/mainwindow.cpp') diff --git a/examples/nfc/ndefeditor/mainwindow.cpp b/examples/nfc/ndefeditor/mainwindow.cpp index df8f758c..fedb0866 100644 --- a/examples/nfc/ndefeditor/mainwindow.cpp +++ b/examples/nfc/ndefeditor/mainwindow.cpp @@ -120,8 +120,7 @@ void addRecord(Ui::MainWindow *ui, const QNdefRecord &record = QNdefRecord()) } MainWindow::MainWindow(QWidget *parent) -: QMainWindow(parent), ui(new Ui::MainWindow), m_manager(new QNearFieldManager(this)), - m_touchAction(NoAction) +: QMainWindow(parent), ui(new Ui::MainWindow), m_touchAction(NoAction) { ui->setupUi(this); @@ -135,10 +134,13 @@ MainWindow::MainWindow(QWidget *parent) QVBoxLayout *vbox = new QVBoxLayout; ui->scrollAreaWidgetContents->setLayout(vbox); + //! [QNearFieldManager init] + m_manager = new QNearFieldManager(this); connect(m_manager, SIGNAL(targetDetected(QNearFieldTarget*)), this, SLOT(targetDetected(QNearFieldTarget*))); connect(m_manager, SIGNAL(targetLost(QNearFieldTarget*)), this, SLOT(targetLost(QNearFieldTarget*))); + //! [QNearFieldManager init] } MainWindow::~MainWindow() @@ -205,7 +207,9 @@ void MainWindow::touchReceive() m_touchAction = ReadNdef; m_manager->setTargetAccessModes(QNearFieldManager::NdefReadTargetAccess); + //! [QNearFieldManager start detection] m_manager->startTargetDetection(); + //! [QNearFieldManager start detection] } void MainWindow::touchStore() @@ -218,6 +222,7 @@ void MainWindow::touchStore() m_manager->startTargetDetection(); } +//! [QNearFieldTarget detected] void MainWindow::targetDetected(QNearFieldTarget *target) { switch (m_touchAction) { @@ -240,11 +245,14 @@ void MainWindow::targetDetected(QNearFieldTarget *target) break; } } +//! [QNearFieldTarget detected] +//! [QNearFieldTarget lost] void MainWindow::targetLost(QNearFieldTarget *target) { target->deleteLater(); } +//! [QNearFieldTarget lost] void MainWindow::ndefMessageRead(const QNdefMessage &message) { @@ -267,7 +275,9 @@ void MainWindow::ndefMessageRead(const QNdefMessage &message) ui->status->setStyleSheet(QString()); m_manager->setTargetAccessModes(QNearFieldManager::NoTargetAccess); + //! [QNearFieldManager stop detection] m_manager->stopTargetDetection(); + //! [QNearFieldManager stop detection] m_request = QNearFieldTarget::RequestId(); ui->statusBar->clearMessage(); } -- cgit v1.2.3