Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QDeclarativeNdefRecord Class Reference

The QDeclarativeNdefRecord class implements the NdefRecord element in QML. More...

 #include <QDeclarativeNdefRecord>

Inherits: QObject.

Properties

  • 1 property inherited from QObject

Public Functions

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 )
  • 29 public functions inherited from QObject

Signals

void recordTypeChanged ()

Macros

Q_DECLARE_NDEFRECORD ( className, typeNameFormat, type )

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

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:

  • The subclass must have a Q_OBJECT macro in its declaration.
  • The subclass must have an invokable constructor that takes a QNdefRecord and a QObject pointer.
  • The subclass must be declared as an NDEF record by expanding the Q_DECLARE_NDEFRECORD() macro in the implementation file of the subclass.
  • The subclass must be registered with 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.

Property Documentation

recordType : QString

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 ()

Member Function Documentation

QDeclarativeNdefRecord::QDeclarativeNdefRecord ( QObject * parent = 0 )

Constructs a new empty QDeclarativeNdefRecord with parent.

QDeclarativeNdefRecord::QDeclarativeNdefRecord ( const QNdefRecord & record, QObject * parent = 0 )

Constructs a new QDeclarativeNdefRecord representing record. The parent of the newly constructed object will be set to parent.

QNdefRecord QDeclarativeNdefRecord::record () const

Returns a copy of the record.

See also setRecord().

void QDeclarativeNdefRecord::recordTypeChanged () [signal]

This signal is emitted when the record type changes.

void QDeclarativeNdefRecord::setRecord ( const QNdefRecord & record )

Sets the record to record.

See also record().

Macro Documentation

Q_DECLARE_NDEFRECORD ( className, typeNameFormat, type )

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.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web