Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxPreferenceItem Class Referenceabstract

Base class for implementing of all the preference items. More...

#include <QtxPreferenceMgr.h>

Inheritance diagram for QtxPreferenceItem:
Inheritance graph

Classes

class  Updater
 Preference item updater. More...
 

Public Member Functions

 QtxPreferenceItem (QtxPreferenceItem *=0)
 Constructor. More...
 
 QtxPreferenceItem (const QString &, QtxPreferenceItem *)
 Constructor. More...
 
 QtxPreferenceItem (const QString &, const QString &, const QString &, QtxPreferenceItem *)
 Constructor. More...
 
virtual ~QtxPreferenceItem ()
 Destructor. More...
 
int id () const
 Get unique item identifier. More...
 
virtual int rtti () const
 Get unique item type identifier. More...
 
QtxPreferenceItemrootItem () const
 Get root preference item. More...
 
QtxPreferenceItemparentItem () const
 Get parent preference item. More...
 
QList< QtxPreferenceItem * > childItems (const bool=false) const
 Get all child preference items. More...
 
int depth () const
 Get preference item depth. More...
 
int count () const
 Get child preference items number. More...
 
virtual bool isEmpty () const
 Check if the item has children. More...
 
void appendItem (QtxPreferenceItem *)
 Append child preference item. More...
 
void removeItem (QtxPreferenceItem *)
 Remove child preference item. More...
 
void insertItem (QtxPreferenceItem *, QtxPreferenceItem *=0)
 Insert child preference item before specified item. If the before item is 0 then new item is appended. More...
 
QIcon icon () const
 Get preference item icon. More...
 
QString title () const
 Get preference item title. More...
 
void resource (QString &, QString &) const
 Get resource file settings associated to the preference item. More...
 
virtual void setIcon (const QIcon &)
 Set prefence item icon. More...
 
virtual void setTitle (const QString &)
 Set preference item title . More...
 
virtual void setResource (const QString &, const QString &)
 Assign resource file settings to the preference item. More...
 
virtual void updateContents ()
 Update preference item. More...
 
QVariant option (const QString &) const
 Get preference item option value. More...
 
void setOption (const QString &, const QVariant &)
 Set preference item option value. More...
 
bool isEvaluateValues () const
 Get variables auto-conversion option value. More...
 
void setEvaluateValues (const bool)
 Switch variables auto-conversion option on/off. More...
 
bool isRestartRequired () const
 Get restart needed option value. More...
 
void setRestartRequired (const bool)
 Switch restart needed option on/off. More...
 
virtual void store ()=0
 Save preference item (for example, to the resource file). More...
 
virtual void retrieve ()=0
 Restore preference item (for example, from the resource file). More...
 
QString resourceValue () const
 Get the value of the associated resource file setting. More...
 
void setResourceValue (const QString &)
 Get the value of the associated resource file setting. More...
 
QtxPreferenceItemfindItem (const int, const bool=false) const
 Find the item by the specified identifier. More...
 
QtxPreferenceItemfindItem (const QString &, const bool=false) const
 Find the item by the specified title. More...
 
QtxPreferenceItemfindItem (const QString &, const int, const bool=false) const
 Find the item by the specified title and identifier. More...
 
virtual QtxResourceMgrresourceMgr () const
 Get the resources manager. More...
 
virtual QtxPreferenceMgrpreferenceMgr () const
 Get the parent preferences manager. More...
 
virtual void activate ()
 
void ensureVisible ()
 

Static Public Member Functions

static int RTTI ()
 Specify unique item class identifier. More...
 

Protected Types

typedef QList
< QtxPreferenceItem * > 
ItemList
 

Protected Member Functions

int getInteger (const int=0) const
 Get integer resources value corresponding to the item. More...
 
double getDouble (const double=0.0) const
 Get double resources value corresponding to the item. More...
 
bool getBoolean (const bool=false) const
 Get boolean resources value corresponding to the item. More...
 
QColor getColor (const QColor &=QColor()) const
 Get color resources value corresponding to the item. More...
 
QFont getFont (const QFont &=QFont()) const
 Get font resources value corresponding to the item. More...
 
QString getString (const QString &=QString()) const
 Get string resources value corresponding to the item. More...
 
void setInteger (const int)
 Set integer resources value corresponding to the item. More...
 
void setDouble (const double)
 Set double resources value corresponding to the item. More...
 
void setBoolean (const bool)
 Set boolean resources value corresponding to the item. More...
 
void setColor (const QColor &)
 Set color resources value corresponding to the item. More...
 
void setFont (const QFont &)
 Set font resources value corresponding to the item. More...
 
void setString (const QString &)
 Set string resources value corresponding to the item. More...
 
virtual void itemAdded (QtxPreferenceItem *)
 Callback function which is called when the child preference item is added. More...
 
virtual void itemRemoved (QtxPreferenceItem *)
 Callback function which is called when the child preference item is removed. More...
 
virtual void itemChanged (QtxPreferenceItem *)
 Callback function which is called when the child preference item is modified. More...
 
virtual void ensureVisible (QtxPreferenceItem *)
 
void sendItemChanges ()
 Initiate item changing call back operation. More...
 
virtual void triggerUpdate ()
 Initiate item updating. More...
 
virtual QVariant optionValue (const QString &) const
 Get preference item option value. More...
 
virtual void setOptionValue (const QString &, const QVariant &)
 Set preference item option value. More...
 

Static Private Member Functions

static int generateId ()
 Generate unique preference item identifier. More...
 

Private Attributes

int myId
 
QtxPreferenceItemmyParent
 
ItemList myChildren
 
bool myEval
 
bool myRestartNeeded
 
QIcon myIcon
 
QString myTitle
 
QString mySection
 
QString myParameter
 

Detailed Description

To implement any specific preference item, cubclass from the QtxPreferenceItem and redefine store() and retrieve() methods.

Member Typedef Documentation

Constructor & Destructor Documentation

QtxPreferenceItem::QtxPreferenceItem ( QtxPreferenceItem parent = 0)
Parameters
parentparent preference item

References generateId(), insertItem(), and myId.

QtxPreferenceItem::QtxPreferenceItem ( const QString &  title,
QtxPreferenceItem parent 
)
Parameters
titleitem title
parentparent preference item

References generateId(), insertItem(), and myId.

QtxPreferenceItem::QtxPreferenceItem ( const QString &  title,
const QString &  sect,
const QString &  param,
QtxPreferenceItem parent 
)
Parameters
titleitem title
sectresource file section to be associated with the item
paramresource file parameter to be associated with the item
parentparent preference item

References generateId(), insertItem(), and myId.

QtxPreferenceItem::~QtxPreferenceItem ( )
virtual

Member Function Documentation

void QtxPreferenceItem::activate ( )
virtual

Reimplemented in QtxPagePrefItem.

void QtxPreferenceItem::appendItem ( QtxPreferenceItem item)

Removes (if necessary) the item from the previous parent.

Parameters
itemitem to be added
See Also
removeItem()

References insertItem().

QList< QtxPreferenceItem * > QtxPreferenceItem::childItems ( const bool  rec = false) const
Parameters
recrecursion boolean flag
Returns
list of child items

References myChildren.

int QtxPreferenceItem::count ( ) const
Returns
number of child items
See Also
isEmpty()

References myChildren.

int QtxPreferenceItem::depth ( ) const
Returns
item depth

References depth(), and parentItem().

void QtxPreferenceItem::ensureVisible ( )

References ensureVisible(), and parentItem().

void QtxPreferenceItem::ensureVisible ( QtxPreferenceItem )
protectedvirtual
QtxPreferenceItem * QtxPreferenceItem::findItem ( const int  id,
const bool  rec = false 
) const
Parameters
idchild item ID
recif true recursive search is done
Returns
child item or 0 if it is not found

References findItem(), id(), and myChildren.

QtxPreferenceItem * QtxPreferenceItem::findItem ( const QString &  title,
const bool  rec = false 
) const
Parameters
titlechild item title
recif true recursive search is done
Returns
child item or 0 if it is not found

References findItem(), myChildren, and title().

QtxPreferenceItem * QtxPreferenceItem::findItem ( const QString &  title,
const int  id,
const bool  rec = false 
) const
Parameters
titlechild item title
idchild item ID
recif true recursive search is done
Returns
child item or 0 if it is not found

References findItem(), id(), myChildren, and title().

int QtxPreferenceItem::generateId ( )
staticprivate
Returns
unique item ID
bool QtxPreferenceItem::getBoolean ( const bool  val = false) const
protected
Parameters
valdefault value (returned if there is no such resource)
Returns
boolean value of the associated resource
See Also
setBoolean()

References QtxResourceMgr::booleanValue(), myParameter, mySection, and resourceMgr().

QColor QtxPreferenceItem::getColor ( const QColor &  val = QColor()) const
protected
Parameters
valdefault value (returned if there is no such resource)
Returns
color value of the associated resource
See Also
setColor()

References QtxResourceMgr::colorValue(), myParameter, mySection, and resourceMgr().

double QtxPreferenceItem::getDouble ( const double  val = 0.0) const
protected
Parameters
valdefault value (returned if there is no such resource)
Returns
double value of the associated resource
See Also
setDouble()

References QtxResourceMgr::doubleValue(), myParameter, mySection, and resourceMgr().

QFont QtxPreferenceItem::getFont ( const QFont &  val = QFont()) const
protected
Parameters
valdefault value (returned if there is no such resource)
Returns
font value of the associated resource
See Also
setFont()

References QtxResourceMgr::fontValue(), myParameter, mySection, and resourceMgr().

int QtxPreferenceItem::getInteger ( const int  val = 0) const
protected
Parameters
valdefault value (returned if there is no such resource)
Returns
integer value of the associated resource
See Also
setInteger()

References QtxResourceMgr::integerValue(), myParameter, mySection, and resourceMgr().

QString QtxPreferenceItem::getString ( const QString &  val = QString()) const
protected
Parameters
valdefault value (returned if there is no such resource)
Returns
string value of the associated resource
See Also
setString()

References isEvaluateValues(), myParameter, mySection, resourceMgr(), and QtxResourceMgr::value().

QIcon QtxPreferenceItem::icon ( ) const
Returns
item icon
See Also
setIcon()

References myIcon.

int QtxPreferenceItem::id ( ) const
Returns
item ID

References myId.

void QtxPreferenceItem::insertItem ( QtxPreferenceItem item,
QtxPreferenceItem before = 0 
)

Removes (if necessary) the item from the previous parent.

Parameters
itemitem to be added
beforeitem before which is inserted new
See Also
removeItem()

References itemAdded(), myChildren, myParent, parentItem(), and removeItem().

bool QtxPreferenceItem::isEmpty ( ) const
virtual
Returns
true if item does not have children
See Also
count()

References myChildren.

bool QtxPreferenceItem::isEvaluateValues ( ) const
Returns
option value

References myEval.

bool QtxPreferenceItem::isRestartRequired ( ) const
Returns
option value

References myRestartNeeded.

void QtxPreferenceItem::itemAdded ( QtxPreferenceItem )
protectedvirtual

This function can be reimplemented in the subclasses to customize child item addition operation. Base implementation does nothing.

Parameters
itemchild item being added
See Also
itemRemoved(), itemChanged()

Reimplemented in QtxPagePrefItem, and QtxPagePrefMgr.

void QtxPreferenceItem::itemChanged ( QtxPreferenceItem )
protectedvirtual

This function can be reimplemented in the subclasses to customize child item modifying operation. Base implementation does nothing.

Parameters
itemchild item being modified
See Also
itemAdded(), itemRemoved()

Reimplemented in QtxPagePrefItem, and QtxPagePrefMgr.

void QtxPreferenceItem::itemRemoved ( QtxPreferenceItem )
protectedvirtual

This function can be reimplemented in the subclasses to customize child item removal operation. Base implementation does nothing.

Parameters
itemchild item being removed
See Also
itemAdded(), itemChanged()

Reimplemented in QtxPagePrefItem, and QtxPagePrefMgr.

QVariant QtxPreferenceItem::option ( const QString &  name) const
Parameters
nameoption name
Returns
property value or null QVariant if option is not set
See Also
setOption()

References optionValue().

QVariant QtxPreferenceItem::optionValue ( const QString &  name) const
protectedvirtual
QtxPreferenceItem * QtxPreferenceItem::parentItem ( ) const
Returns
parent item

References myParent.

QtxPreferenceMgr * QtxPreferenceItem::preferenceMgr ( ) const
virtual
Returns
preferences manager or 0 if it is not defined

Reimplemented in QtxPreferenceMgr.

References parentItem(), and preferenceMgr().

void QtxPreferenceItem::removeItem ( QtxPreferenceItem item)
Parameters
itemitem to be removed
See Also
insertItem()

References itemRemoved(), myChildren, and myParent.

void QtxPreferenceItem::resource ( QString &  sec,
QString &  param 
) const
Parameters
secused to return resource file section name
paramused to return resource file parameter name
See Also
setResource()

References myParameter, and mySection.

QtxResourceMgr * QtxPreferenceItem::resourceMgr ( ) const
virtual
Returns
resource manager pointer or 0 if it is not defined

Reimplemented in QtxPreferenceMgr.

References preferenceMgr(), and QtxPreferenceMgr::resourceMgr().

QString QtxPreferenceItem::resourceValue ( ) const
Returns
associated resource file setting value
See Also
setResourceValue()

References getString().

QtxPreferenceItem * QtxPreferenceItem::rootItem ( ) const
Returns
root item

References parentItem().

int QtxPreferenceItem::rtti ( ) const
virtual
Returns
item type ID

References RTTI().

int QtxPreferenceItem::RTTI ( )
static
Returns
item class ID
void QtxPreferenceItem::sendItemChanges ( )
protected

References itemChanged(), and parentItem().

void QtxPreferenceItem::setBoolean ( const bool  val)
protected
Parameters
valnew value
See Also
getBoolean()

References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().

void QtxPreferenceItem::setColor ( const QColor &  val)
protected
Parameters
valnew value
See Also
getColor()

References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().

void QtxPreferenceItem::setDouble ( const double  val)
protected
Parameters
valnew value
See Also
getDouble()

References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().

void QtxPreferenceItem::setEvaluateValues ( const bool  on)
Parameters
onoption value

References myEval.

void QtxPreferenceItem::setFont ( const QFont &  val)
protected
Parameters
valnew value
See Also
getFont()

References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().

void QtxPreferenceItem::setIcon ( const QIcon &  ico)
virtual
Parameters
iconew item icon
See Also
icon()

References myIcon, and sendItemChanges().

void QtxPreferenceItem::setInteger ( const int  val)
protected
Parameters
valnew value
See Also
getInteger()

References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().

void QtxPreferenceItem::setOption ( const QString &  name,
const QVariant &  val 
)
Parameters
nameoption name
valnew property value
See Also
option()

References optionValue(), sendItemChanges(), and setOptionValue().

void QtxPreferenceItem::setOptionValue ( const QString &  name,
const QVariant &  val 
)
protectedvirtual
void QtxPreferenceItem::setResource ( const QString &  sec,
const QString &  param 
)
virtual
Parameters
secresource file section name
paramresource file parameter name
See Also
resource()

Reimplemented in QtxPagePrefGroupItem.

References myParameter, and mySection.

void QtxPreferenceItem::setResourceValue ( const QString &  val)
Parameters
valnew associated resource file setting value
See Also
resourceValue()

References setString().

void QtxPreferenceItem::setRestartRequired ( const bool  on)
Parameters
onoption value

References myRestartNeeded.

void QtxPreferenceItem::setString ( const QString &  val)
protected
Parameters
valnew value
See Also
getString()

References myParameter, mySection, resourceMgr(), and QtxResourceMgr::setValue().

void QtxPreferenceItem::setTitle ( const QString &  title)
virtual
Parameters
titlenew item title
See Also
title()

Reimplemented in QtxPagePrefCheckItem, QtxPagePrefLabelItem, and QtxPageNamedPrefItem.

References myTitle, sendItemChanges(), and title().

QString QtxPreferenceItem::title ( ) const
Returns
item title
See Also
setTitle()

References myTitle.

void QtxPreferenceItem::triggerUpdate ( )
protectedvirtual

Member Data Documentation

ItemList QtxPreferenceItem::myChildren
private
bool QtxPreferenceItem::myEval
private
QIcon QtxPreferenceItem::myIcon
private
int QtxPreferenceItem::myId
private
QString QtxPreferenceItem::myParameter
private
QtxPreferenceItem* QtxPreferenceItem::myParent
private
bool QtxPreferenceItem::myRestartNeeded
private
QString QtxPreferenceItem::mySection
private
QString QtxPreferenceItem::myTitle
private

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