QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
UserProperties Class Reference

The UserProperties class This class store user properties. User properties are properties set by user who are don't know by QElectroTech. An user property is defined by a name and a value of arbitrarie type (QString, char*, int, double, bool, QUuid, QColor) More...

#include <userproperties.h>

Inheritance diagram for UserProperties:
Inheritance graph
Collaboration diagram for UserProperties:
Collaboration graph

Public Member Functions

 UserProperties (const QString tag_name="userProperties")
 UserProperties::UserProperties.
 
virtual void toSettings (QSettings &, const QString=QString()) const override
 toSettings Save properties to setting file.
 
virtual void fromSettings (const QSettings &, const QString=QString()) override
 fromSettings load properties to setting file.
 
virtual QDomElement toXml (QDomDocument &xml_document) const override
 UserProperties::toXml.
 
virtual bool fromXml (const QDomElement &xml_element) override
 UserProperties::fromXml.
 
void deleteUserProperties ()
 UserProperties::deleteUserProperties Delete all userproperties.
 
int userPropertiesCount () const
 UserProperties::userPropertiesCount.
 
void setUserProperty (const QString &key, const QVariant &value)
 UserProperties::setUserProperty Adds a new property if key does not exist in the properties member, otherwise overwrite the value.
 
bool existUserProperty (const QString &key) const
 UserProperties::existUserProperty Checks if a user property with key key is available or not.
 
QVariant userPropertyValue (const QString &key)
 UserProperties::userPropertyValue Returns the value of a user property with key key If key is not found, an invalid QVariant is returned. Use QVariant::type() to get the type of the value.
 
void setTagName (const QString &tag_name)
 UserProperties::setTagName Set the tag name use to store in xml.
 
QString tagName () const
 
- Public Member Functions inherited from PropertiesInterface
 PropertiesInterface ()
 PropertiesInterface::PropertiesInterface.
 
virtual ~PropertiesInterface ()
 PropertiesInterface::~PropertiesInterface.
 

Private Attributes

QHash< QString, QVariant > m_properties
 
QString m_tag_name
 

Detailed Description

The UserProperties class This class store user properties. User properties are properties set by user who are don't know by QElectroTech. An user property is defined by a name and a value of arbitrarie type (QString, char*, int, double, bool, QUuid, QColor)

Constructor & Destructor Documentation

◆ UserProperties()

UserProperties::UserProperties ( const QString  tag_name = "userProperties")

UserProperties::UserProperties.

Parameters
tag_name

Member Function Documentation

◆ deleteUserProperties()

void UserProperties::deleteUserProperties ( )

UserProperties::deleteUserProperties Delete all userproperties.

◆ existUserProperty()

bool UserProperties::existUserProperty ( const QString &  key) const

UserProperties::existUserProperty Checks if a user property with key key is available or not.

Parameters
key
Returns
true if property exist
Here is the caller graph for this function:

◆ fromSettings()

virtual void UserProperties::fromSettings ( const QSettings &  settings,
const QString  = QString() 
)
inlineoverridevirtual

fromSettings load properties to setting file.

Parameters
settings: is use for prefix a word before the name of each parameter
QString

Implements PropertiesInterface.

◆ fromXml()

bool UserProperties::fromXml ( const QDomElement &  xml_element)
overridevirtual

UserProperties::fromXml.

Parameters
xml_element
Returns
load user properties from xml Take care before using this function that the tagName of this class is the same as the tag of xml_element given in parameter.

Implements PropertiesInterface.

Here is the call graph for this function:

◆ setTagName()

void UserProperties::setTagName ( const QString &  tag_name)

UserProperties::setTagName Set the tag name use to store in xml.

Parameters
tag_name

◆ setUserProperty()

void UserProperties::setUserProperty ( const QString &  key,
const QVariant &  value 
)

UserProperties::setUserProperty Adds a new property if key does not exist in the properties member, otherwise overwrite the value.

Parameters
key
value

◆ tagName()

QString UserProperties::tagName ( ) const

◆ toSettings()

virtual void UserProperties::toSettings ( QSettings &  settings,
const QString  = QString() 
) const
inlineoverridevirtual

toSettings Save properties to setting file.

Parameters
settings: is use for prefix a word before the name of each parameter
QString

Implements PropertiesInterface.

◆ toXml()

QDomElement UserProperties::toXml ( QDomDocument &  xml_document) const
overridevirtual

UserProperties::toXml.

Parameters
xml_document
Returns
A QDomElement who contain one child for each user properties the tag name of the returned domElement is "userProperties" by default If you want to change the tag name, see setTagName and tagName function.

Implements PropertiesInterface.

Here is the call graph for this function:

◆ userPropertiesCount()

int UserProperties::userPropertiesCount ( ) const

UserProperties::userPropertiesCount.

Returns
Returns the number of user properties

◆ userPropertyValue()

QVariant UserProperties::userPropertyValue ( const QString &  key)

UserProperties::userPropertyValue Returns the value of a user property with key key If key is not found, an invalid QVariant is returned. Use QVariant::type() to get the type of the value.

Parameters
key
Returns
Here is the call graph for this function:

Member Data Documentation

◆ m_properties

QHash<QString, QVariant> UserProperties::m_properties
private

◆ m_tag_name

QString UserProperties::m_tag_name
private

The documentation for this class was generated from the following files: