The QQmlNdefRecord class implements the NdefRecord type in QML. 更多...
头: | #include <QQmlNdefRecord> |
qmake: | QT += nfc |
Since: | Qt 5.2 |
实例化: | NdefRecord |
继承: | QObject |
该类在 Qt 5.2 引入。
enum | TypeNameFormat { Empty, NfcRtd, Mime, Uri, ExternalRtd, Unknown } |
QQmlNdefRecord (const QNdefRecord & record , QObject * parent = nullptr) | |
QQmlNdefRecord (QObject * parent = nullptr) | |
virtual | ~QQmlNdefRecord () |
QNdefRecord | record () const |
void | setRecord (const QNdefRecord & record ) |
void | setType (const QString & newtype ) |
void | setTypeNameFormat (QQmlNdefRecord::TypeNameFormat newTypeNameFormat ) |
QString | type () const |
QQmlNdefRecord::TypeNameFormat | typeNameFormat () const |
void | recordChanged () |
void | typeChanged () |
void | typeNameFormatChanged () |
Q_DECLARE_NDEFRECORD ( className , typeNameFormat , type ) |
The QQmlNdefRecord class is the base class for all NdefRecord types in QML. To support a new NDEF record type in QML subclass this class and expose new properties, member functions and signals appropriate for the new record type. The following must be done to create a new NDEF record type in QML:
For example the declaration of such a class may look like the following.
class QQmlNdefFooRecord : public QQmlNdefRecord { Q_OBJECT Q_PROPERTY(int foo READ foo WRITE setFoo NOTIFY fooChanged) public: explicit QQmlNdefFooRecord(QObject *parent = 0); Q_INVOKABLE QQmlNdefFooRecord(const QNdefRecord &record, QObject *parent = 0); ~QQmlNdefFooRecord(); int foo() const; void setFoo(int value); signals: void fooChanged(); };
Within the implementation file the Q_DECLARE_NDEFRECORD () macro is expanded:
Q_DECLARE_NDEFRECORD(QQmlNdefFooRecord, QNdefRecord::ExternalRtd, "com.example:f")
Finially the application or plugin code calls qmlRegisterType():
qmlRegisterType<QQmlNdefFooRecord>(uri, 1, 0, "NdefFooRecord");
另请参阅 NdefRecord .
This enum describes the type name format of an NDEF record. The values of this enum are according to QNdefRecord::TypeNameFormat
常量 | 值 | 描述 |
---|---|---|
QQmlNdefRecord::Empty
|
QNdefRecord::Empty
|
An empty NDEF record, the record does not contain a payload. |
QQmlNdefRecord::NfcRtd
|
QNdefRecord::NfcRtd
|
The NDEF record type is defined by an NFC RTD Specification. |
QQmlNdefRecord::Mime
|
QNdefRecord::Mime
|
The NDEF record type follows the construct described in RFC 2046. |
QQmlNdefRecord::Uri
|
QNdefRecord::Uri
|
The NDEF record type follows the construct described in RFC 3986. |
QQmlNdefRecord::ExternalRtd
|
QNdefRecord::ExternalRtd
|
The NDEF record type follows the construct for external type names described the NFC RTD Specification. |
QQmlNdefRecord::Unknown
|
QNdefRecord::Unknown
|
The NDEF record type is unknown. |
This property hold the NDEF record that this class represents.
访问函数:
QNdefRecord | record () const |
void | setRecord (const QNdefRecord & record ) |
通知程序信号:
void | recordChanged () |
This property hold the type of the NDEF record.
访问函数:
QString | type () const |
void | setType (const QString & newtype ) |
通知程序信号:
void | typeChanged () |
This property hold the TNF of the NDEF record.
访问函数:
QQmlNdefRecord::TypeNameFormat | typeNameFormat () const |
void | setTypeNameFormat (QQmlNdefRecord::TypeNameFormat newTypeNameFormat ) |
通知程序信号:
void | typeNameFormatChanged () |
Constructs a new QQmlNdefRecord representing record . The parent of the newly constructed object will be set to parent .
Constructs a new empty QQmlNdefRecord with parent .
[signal]
void
QQmlNdefRecord::
typeChanged
()
This signal is emitted when the record type changes.
注意: 通知程序信号对于特性 type .
[虚拟]
QQmlNdefRecord::
~QQmlNdefRecord
()
销毁 QQmlNdefRecord 实例。
Returns a copy of the record.
注意: Getter function for property record.
另请参阅 setRecord ().
Sets the record to record . If the record is set the recordChanged () 信号会被发射。
注意: setter 函数对于特性 record .
另请参阅 record ().
Sets the record type to newtype if it is not currently equal to type (); otherwise does nothing. If the record type is set the typeChanged () 信号会被发射。
注意: setter 函数对于特性 type .
另请参阅 QNdefRecord::setType () 和 QNdefRecord::type ().
Sets the type name format of the NDEF record to newTypeNameFormat .
注意: setter 函数对于特性 typeNameFormat .
另请参阅 typeNameFormat ().
Returns the type of the record.
注意: getter 函数对于特性 type。
另请参阅 QNdefRecord::setType () 和 QNdefRecord::type ().
Returns the type name format of the NDEF record.
注意: Getter function for property typeNameFormat.
另请参阅 setTypeNameFormat ().
This macro ensures that className is declared as the class implementing the NDEF record identified by typeNameFormat and type .
This macro should be expanded in the implementation file for className .