The QDeclarativeNdefRecord class implements the NdefRecord element in QML. More...
#include <QDeclarativeNdefRecord>
Inherits: QObject.
QDeclarativeNdefRecord ( QObject * parent = 0 ) | |
QDeclarativeNdefRecord ( const QNdefRecord & record, QObject * parent = 0 ) | |
QNdefRecord | record () const |
QString | recordType () const |
void | setRecord ( const QNdefRecord & record ) |
void | setRecordType ( const QString & type ) |
void | recordTypeChanged () |
Q_DECLARE_NDEFRECORD ( className, typeNameFormat, type ) |
The QDeclarativeNdefRecord class implements the NdefRecord element in QML.
The QDeclarativeNdefRecord class is the base class for all NdefRecord elements 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 QDeclarativeNdefFooRecord : public QDeclarativeNdefRecord { Q_OBJECT Q_PROPERTY(int foo READ foo WRITE setFoo NOTIFY fooChanged) public: explicit QDeclarativeNdefFooRecord(QObject *parent = 0); Q_INVOKABLE QDeclarativeNdefFooRecord(const QNdefRecord &record, QObject *parent = 0); ~QDeclarativeNdefFooRecord(); int foo() const; void setFoo(int value); signals: void fooChanged(); };
Within the implementation file the Q_DECLARE_NDEFRECORD() macro is expanded:
Q_DECLARE_NDEFRECORD(QDeclarativeNdefFooRecord, QNdefRecord::ExternalRtd, "com.example:f")
Finially the application or plugin code calls qmlRegisterType():
qmlRegisterType<QDeclarativeNdefFooRecord>(uri, 1, 0, "NdefFooRecord");
See also NdefRecord.
This property hold the record type of the NDEF record that this class represents.
Access functions:
QString | recordType () const |
void | setRecordType ( const QString & type ) |
Notifier signal:
void | recordTypeChanged () |
Constructs a new empty QDeclarativeNdefRecord with parent.
Constructs a new QDeclarativeNdefRecord representing record. The parent of the newly constructed object will be set to parent.
Returns a copy of the record.
See also setRecord().
This signal is emitted when the record type changes.
Sets the record to record.
See also record().
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.