summaryrefslogtreecommitdiffstats
path: root/examples/nfc/ndefeditor
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-03-10 14:52:00 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-11 15:50:42 +0100
commitef98583d2a5350602d0dac2736c772bfd84ebadb (patch)
treed89480f6b49b34027c1ab5cfa7947d80fef804c9 /examples/nfc/ndefeditor
parent2d2dbd3199a10985c713e97d32688e001e4cb226 (diff)
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 <riitta-leena.miettinen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'examples/nfc/ndefeditor')
-rw-r--r--examples/nfc/ndefeditor/mainwindow.cpp14
1 files changed, 12 insertions, 2 deletions
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();
}