A SharedProperty is a basic implementation of QtilitiesProperty. More...
#include <QtilitiesProperty.h>
Public Member Functions | |
virtual IExportable::ExportResultFlags | exportBinary (QDataStream &stream) const |
Allows exporting to a QDataStream. | |
virtual IExportable::ExportResultFlags | exportXml (QDomDocument *doc, QDomElement *object_node) const |
Allows exporting to an XML document. A reference to the QDomElement to which the object's information must be added is provided, along with a reference to the QDomDocument. | |
virtual IExportable::ExportResultFlags | importBinary (QDataStream &stream, QList< QPointer< QObject > > &import_list) |
Allows importing and reconstruction of the object state from information provided in a QDataStream. | |
virtual IExportable::ExportResultFlags | importXml (QDomDocument *doc, QDomElement *object_node, QList< QPointer< QObject > > &import_list) |
QObject * | objectBase () |
const QObject * | objectBase () const |
virtual bool | setValue (QVariant new_value) |
Sets the value of the property. | |
ExportModeFlags | supportedFormats () const |
Provides information about the export format(s) supported by your implementation of IExportable. | |
virtual QVariant | value () const |
Returns the value of the property. | |
Public Member Functions inherited from Qtilities::Core::QtilitiesProperty | |
bool | isReadOnly () const |
Indicates if the property is read only. | |
bool | isRemovable () const |
Indicates if the property is removable. | |
bool | isReserved () const |
Indicates if the property is reserved. | |
bool | isValid () |
Function to check if an observer property is valid. | |
void | makeNotRemovable () |
Makes the property non removable. Properties can only be made not removable once, after that they always stay not removable. | |
void | makeReadOnly () |
Makes the property read only. Properties can only be made read only once, after that they always stay read only. | |
void | makeReserved () |
Makes the property reserved. Properties can only be made reserved once, after that they always stay reserved. | |
QString | propertyNameString () const |
Gets the name of this property as a QString. | |
void | setPropertyName (const char *new_name) |
Sets the name of this property. | |
void | setPropertyName (const QString &new_name) |
Sets the name of this property. | |
bool | supportsChangeNotifications () const |
Indicates if this property supports change notifications. | |
Public Member Functions inherited from Qtilities::Core::Interfaces::IExportable | |
quint32 | applicationExportVersion () const |
Returns the application export version currently used by all your application's classes. | |
virtual void | clearExportTask () |
Clears the export task. | |
IExportable * | duplicate (QString *error_msg=0, int properties_to_copy=0, ExportResultFlags *result_flags=0) const |
Function which will create a duplicate (copy) of this object. | |
virtual ITask * | exportTask () const |
Gets the task which must be used to log import/export information to. | |
Qtilities::ExportVersion | exportVersion () const |
Returns the export version currently used by all Qtilities classes. | |
virtual InstanceFactoryInfo | instanceFactoryInfo () const |
The instance factory information which must be used when the exported object is reconstructed during an import. | |
bool | isExportable () const |
Gets if this object must be part of it's parents' exports. | |
virtual void | setApplicationExportVersion (quint32 version) |
Sets the application export version currently used by all your application's classes. | |
virtual void | setExportTask (ITask *task) |
Sets the task which must be used to log import/export information to. | |
virtual void | setExportVersion (Qtilities::ExportVersion version) |
Returns the export version currently used by all Qtilities classes. | |
virtual void | setIsExportable (bool new_is_exportable) |
Sets if this object must be part of it's parents' exports. | |
Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase | |
QString | objectOriginID () const |
Allows interfaces to provide some sort of source identification. | |
void | setObjectOriginID (const QString &object_origin_id) |
Allows setting of the object source ID of this interface implementation. |
Additional Inherited Members | |
Static Public Member Functions inherited from Qtilities::Core::QtilitiesProperty | |
static QVariant | constructVariant (const QString &type_string, const QString &value_string) |
Converts a QString type_string and QString value_string to a matching QVariant. | |
static QVariant | constructVariant (QVariant::Type type, const QString &value_string) |
Converts a QVariant::Type and QString value_string to a matching QVariant. | |
static bool | isExportableVariant (QVariant variant) |
Checks if a QVariant is exportable. Thus, if it can be converted to QString. | |
static bool | propertyIsExportable (const char *property_name) |
Function to check if any Qtilities property is exportable. | |
static bool | propertyIsRemovable (const char *property_name) |
Function to check if any Qtilities property is removable. | |
static bool | propertyIsReserved (const char *property_name) |
Function to check if any Qtilities property is reserved. | |
static bool | propertySupportsChangeNotifications (const char *property_name) |
Function to check if any Qtilities property supports change notifications. | |
Static Public Member Functions inherited from Qtilities::Core::Interfaces::IExportable | |
template<typename T > | |
static T * | duplicateInstance (IExportable *obj, QString *error_msg=0, int properties_to_copy=0, ExportResultFlags *result_flags=0) |
Provides an easy to use template based implementation of IExportable::duplicate(). | |
static QString | exportModeToString (ExportMode export_mode) |
Function which returns a string associated with a specific ExportMode. | |
static ExportMode | stringToExportMode (const QString &export_mode_string) |
Function which returns the ExportMode associated with a string. | |
static Result | validateQtilitiesExportVersion (Qtilities::ExportVersion export_version, ITask *task=0) |
Checks the exportVersion() against the supported Qtilities export versions for the current Qtilities version. | |
static Result | validateQtilitiesImportVersion (Qtilities::ExportVersion import_version, ITask *task=0) |
Checks the exportVersion() against the supported Qtilities import versions for the current Qtilities version. |
A SharedProperty is a basic implementation of QtilitiesProperty.
A SharedProperty is a basic implementation of QtilitiesProperty which stored a single QVariant value set with setValue() and can be obtained using value().
Getting and setting shared properties are done by the Qtilities::Core::Observer class which provides easy to use functions to set and get properties and their values. For shared properties it is easy to get and set the value of the property because we do not need to know the context since the value is the same for all contexts.
The following example shows how to construct and work with Qtilities::Core::SharedProperty.
For information about how SharedProperty are used in the context of Qtilities::Core::Observer, please see Dynamic properties used and managed by Observers.
Note that you can inspect all SharedProperty properties on an object through the Qtilities::CoreGui::ObjectDynamicPropertyBrowser widget. See the example below:
|
virtual |
Allows exporting to a QDataStream.
See Serializing Qtilities Data Types Overview for more information about the expected output format.
stream | A reference to the QDataStream to which the object's information must be appended is provided. |
Reimplemented from Qtilities::Core::QtilitiesProperty.
|
virtual |
Allows exporting to an XML document. A reference to the QDomElement to which the object's information must be added is provided, along with a reference to the QDomDocument.
See Serializing Qtilities Data Types Overview for more information about the expected output format.
Reimplemented from Qtilities::Core::QtilitiesProperty.
|
virtual |
Allows importing and reconstruction of the object state from information provided in a QDataStream.
See Serializing Qtilities Data Types Overview for more information about the expected output format.
stream | The QDataStream which contains the object's information. |
import_list | All objects constructed during the import operation must be added to the import list. When the operation fails, all objects in this list will be deleted. |
Reimplemented from Qtilities::Core::QtilitiesProperty.
|
virtual |
This function will add a set of attributes directly to the object_node passed to it.
Reimplemented from Qtilities::Core::QtilitiesProperty.
|
inlinevirtual |
Reimplemented from Qtilities::Core::QtilitiesProperty.
|
inlinevirtual |
Reimplemented from Qtilities::Core::QtilitiesProperty.
|
virtual |
Sets the value of the property.
new_value | The new QVariant value which must be assigned to the property. |
|
virtual |
Provides information about the export format(s) supported by your implementation of IExportable.
Reimplemented from Qtilities::Core::QtilitiesProperty.
Qtilities : Reference Documentation | Back to top |
Copyright © 2009-2013, Jaco Naudé
|