Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
nfc.cpp
Go to the documentation of this file.
1
// Copyright (C) 2017 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
#
include
<
QtNfc
/
qndefrecord
.
h
>
5
#
include
<
QtNfc
/
qndefnfctextrecord
.
h
>
6
7
#
include
<
QtCore
/
QDebug
>
8
9
QT_USE_NAMESPACE
10
11
void
snippet_recordConversion
()
12
{
13
QNdefRecord record;
14
15
//! [Record conversion]
16
if
(record.isRecordType<QNdefNfcTextRecord>()) {
17
QNdefNfcTextRecord textRecord(record);
18
19
qDebug() << textRecord.text();
20
}
21
//! [Record conversion]
22
}
23
24
//! [Specialized class definition]
25
class
ExampleComF
:
public
QNdefRecord
26
{
27
public
:
28
Q_DECLARE_NDEF_RECORD
(
ExampleComF
,
QNdefRecord
::
ExternalRtd
,
"example.com:f"
,
29
QByteArray
(
sizeof
(
int
),
char
(0)))
30
31
int
foo()
const
;
32
void
setFoo
(
int
v);
33
};
34
35
Q_DECLARE_ISRECORDTYPE_FOR_NDEF_RECORD(ExampleComF, QNdefRecord::ExternalRtd,
"example.com:f"
)
36
//! [Specialized class definition]
ExampleComF
[Specialized class definition]
Definition
nfc.cpp:26
ExampleComF::setFoo
void setFoo(int v)
ExampleComF::Q_DECLARE_NDEF_RECORD
Q_DECLARE_NDEF_RECORD(ExampleComF, QNdefRecord::ExternalRtd, "example.com:f", QByteArray(sizeof(int), char(0))) int foo() const
snippet_recordConversion
QT_USE_NAMESPACE void snippet_recordConversion()
Definition
nfc.cpp:11
qtconnectivity
src
nfc
doc
snippets
nfc.cpp
Generated on
for Qt by
1.18.0