This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
QNdefRecord is an implicitly shared class. This means you can efficiently convert between
QNdefRecord and specialized record classes. The
isRecordType() template function can be used to test if a conversion is possible. The following example shows how to test if a
QNdefRecord is an NFC RTD Text record and extract the text information from it.
if record.isRecordType<QNdefNfcTextRecord>(): textRecord = QNdefNfcTextRecord(record) print(textRecord.text())
Creating Specialized NDEF Record Classes#
Specialized NDEF record classes can be easily created with the
Q_DECLARE_ISRECORDTYPE_FOR_NDEF_RECORD() macros. The following example shows the class declaration of the hypothetical example.com:f record type that encapsulates a single int property foo.
class ExampleComF(QNdefRecord): # public Q_DECLARE_NDEF_RECORD(ExampleComF, QNdefRecord.ExternalRtd, "example.com:f", QByteArray(sizeof(int), char(0))) foo = int() def setFoo(v): Q_DECLARE_ISRECORDTYPE_FOR_NDEF_RECORD(ExampleComF, QNdefRecord.ExternalRtd, "example.com:f")
The developer only needs to provide implementations for the
setFoo() functions that parse and set the contents of the NDEF record’s payload.
- class PySide6.QtNfc.QNdefRecord#
PySide6.QtNfc.QNdefRecord(other, typeNameFormat, type)
Constructs a new empty NDEF record.
Constructs a new NDEF record that is a copy of
This enum describes the type name format of an NDEF record.
An empty NDEF record, the record does not contain a payload
The NDEF record type is defined by an NFC RTD Specification
The NDEF record type follows the construct described in RFC 2046
The NDEF record type follows the construct described in RFC 3986
The NDEF record type follows the construct for external type names described the NFC RTD Specification
The type of the record is unknown and should be treated similar to content with MIME type ‘application/octet-stream’ without further context
Clear the NDEF record.
Returns the id of the NDEF record.
- Return type:
true if the NDEF record contains an empty payload; otherwise returns
This is equivalent to calling
- Return type:
true if this NDEF record does not equal
other; otherwise return
- Return type:
other and this NDEF record are the same. Otherwise returns
Returns the payload of the NDEF record.
Sets the id of the NDEF record to
Sets the payload of the NDEF record to
Sets the type of the NDEF record to
Sets the type name format of the NDEF record to
Returns the type of the NDEF record.
Returns the type name format of the NDEF record.