QContactDetail Proxy Page
Macros
Macro Documentation
Q_DECLARE_CUSTOM_CONTACT_DETAIL
Macro for simplifying declaring custom (leaf) detail classes.
The first argument is the detail type of the class.
If you are creating a convenience class for a type of QContactDetail, you should use this macro when declaring your class to ensure that it interoperates with other contact functionality.
Here is an example of a custom extension class using this macro. Note that the class provides some predefined constants and some convenience methods that return values associated with schema fields.
#include <QContactDetail> class ContactVehicle : public QContactDetail { public: Q_DECLARE_CUSTOM_CONTACT_DETAIL(ContactVehicle) enum VehicleField { FieldRegistration = 0, FieldMake, FieldModel, FieldColor }; QString registration() const { return value(FieldRegistration).toString(); } void setRegistration(const QString& _registration) { setValue(FieldRegistration, _registration); QString make() const { return value(FieldMake).toString(); } void setMake(const QString& _make) { setValue(FieldMake, _make); } QString model() const { return value(FieldModel).toString(); } void setModel(const QString& _model) { setValue(FieldModel, _model); } QString color() const { return value(FieldColor).toString(); } void setColor(const QString &_color) { setValue(FieldColor, _color); } };