Version: 6.3.1
Data Structures | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Private Member Functions | Private Attributes

QtxPreferenceItem Class Reference

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

#include <QtxPreferenceMgr.h>

Inheritance diagram for QtxPreferenceItem:
Inheritance graph

Data Structures

class  Updater
 Preference item updater. More...

Public Member Functions

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

Static Public Member Functions

static int RTTI ()
 Specify unique item class identifier.

Protected Types

typedef QList
< QtxPreferenceItem * > 
ItemList

Protected Member Functions

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

Static Private Member Functions

static int generateId ()
 Generate unique preference item identifier.

Private Attributes

int myId
QtxPreferenceItemmyParent
ItemList myChildren
bool myEval
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

int QtxPreferenceItem::id ( ) const
Returns:
item ID

References myId.

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

References RTTI().

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

References parentItem().

QtxPreferenceItem * QtxPreferenceItem::parentItem ( ) const
Returns:
parent item

References myParent.

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

References myChildren.

int QtxPreferenceItem::depth ( ) const
Returns:
item depth

References depth(), and parentItem().

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

References myChildren.

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

References myChildren.

void QtxPreferenceItem::appendItem ( QtxPreferenceItem item)

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

Parameters:
itemitem to be added
See also:
removeItem()

References insertItem().

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

References itemRemoved(), myChildren, and myParent.

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

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

References myIcon.

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

References myTitle.

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.

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

References myIcon, and sendItemChanges().

void QtxPreferenceItem::setTitle ( const QString &  title) [virtual]
Parameters:
titlenew item title
See also:
title()

Reimplemented in QtxPageNamedPrefItem, QtxPagePrefLabelItem, and QtxPagePrefCheckItem.

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

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::updateContents ( ) [virtual]
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().

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

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

bool QtxPreferenceItem::isEvaluateValues ( ) const

References myEval.

void QtxPreferenceItem::setEvaluateValues ( const bool  on)

References myEval.

void QtxPreferenceItem::store ( ) [pure virtual]
void QtxPreferenceItem::retrieve ( ) [pure virtual]
QString QtxPreferenceItem::resourceValue ( ) const
Returns:
associated resource file setting value
See also:
setResourceValue()

References getString().

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

References setString().

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

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

Reimplemented in QtxPreferenceMgr.

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

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

Reimplemented in QtxPreferenceMgr.

References parentItem(), and preferenceMgr().

void QtxPreferenceItem::activate ( ) [virtual]

Reimplemented in QtxPagePrefItem.

void QtxPreferenceItem::ensureVisible ( )

References ensureVisible(), and parentItem().

int QtxPreferenceItem::RTTI ( ) [static]
Returns:
item class ID
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().

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

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

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

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

void QtxPreferenceItem::setInteger ( const int  val) [protected]
Parameters:
valnew value
See also:
getInteger()

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::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::setFont ( const QFont &  val) [protected]
Parameters:
valnew value
See also:
getFont()

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

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

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

void QtxPreferenceItem::itemAdded ( QtxPreferenceItem ) [protected, virtual]

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 QtxPagePrefMgr, and QtxPagePrefItem.

void QtxPreferenceItem::itemRemoved ( QtxPreferenceItem ) [protected, virtual]

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 QtxPagePrefMgr, and QtxPagePrefItem.

void QtxPreferenceItem::itemChanged ( QtxPreferenceItem ) [protected, virtual]

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 QtxPagePrefMgr, and QtxPagePrefItem.

void QtxPreferenceItem::ensureVisible ( QtxPreferenceItem ) [protected, virtual]
void QtxPreferenceItem::sendItemChanges ( ) [protected]

References itemChanged(), and parentItem().

void QtxPreferenceItem::triggerUpdate ( ) [protected, virtual]
QVariant QtxPreferenceItem::optionValue ( const QString &  name) const [protected, virtual]

This function can be reimplemented in the subclasses. Base implementation does nothing.

Parameters:
nameoption name
Returns:
property value or null QVariant if option is not set
See also:
setOptionValue()

Reimplemented in QtxPagePrefMgr, QtxPagePrefListItem, QtxPagePrefTabsItem, QtxPagePrefFrameItem, QtxPagePrefGroupItem, QtxPagePrefLabelItem, QtxPagePrefSpaceItem, QtxPagePrefEditItem, QtxPagePrefSliderItem, QtxPagePrefSelectItem, QtxPagePrefSpinItem, QtxPagePrefFontItem, QtxPagePrefPathItem, QtxPagePrefPathListItem, QtxPagePrefDateTimeItem, QtxUserDefinedItem, and SUIT_PreferenceMgr.

References isEvaluateValues(), and title().

void QtxPreferenceItem::setOptionValue ( const QString &  name,
const QVariant &  val 
) [protected, virtual]
int QtxPreferenceItem::generateId ( ) [static, private]
Returns:
unique item ID

Field Documentation

int QtxPreferenceItem.myId [private]
bool QtxPreferenceItem.myEval [private]
QIcon QtxPreferenceItem.myIcon [private]
QString QtxPreferenceItem.myTitle [private]
QString QtxPreferenceItem.mySection [private]

Reimplemented in QtxPagePrefShortcutTreeItem.

QString QtxPreferenceItem.myParameter [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS