Home · All Classes · Grouped Classes · Annotated · Functions

ThemeItem Class Reference

The ThemeItem class is the base class of all items in a ThemedView. More...

    #include <ThemeItem>

Inherited by ThemeExclusiveItem, ThemeGraphicItem, ThemeGroupItem, ThemeLayoutItem, ThemePageItem, ThemePluginItem, and ThemeTemplateItem.

Public Types

Public Functions

Protected Functions


Detailed Description

The ThemeItem class is the base class of all items in a ThemedView.

A ThemedView manages the theme item tree, which is run-time representation of a loaded themed view XML document.

ThemeItem encapsulates functionality common to all theme item tree nodes. It manages common attributes such as rect, whether the item is active, transient, visible, layout attributes, user interactivity and so on.

Normally you do not want to call this item's functions directly, but rather specify the relevant attributes and data for this item in the themed view XML.

See also ThemedView and common theme attributes.


Member Type Documentation

enum ThemeItem::State

State describes the different states of a theme element.

ConstantValueDescription
ThemeItem::Default1The default state of an element.
ThemeItem::Focus2The element has the focus.
ThemeItem::Pressed6The element is pressed.
ThemeItem::All7All the states of an element.


Member Function Documentation

ThemeItem::ThemeItem ( ThemeItem * parent, ThemedView * view, const ThemeAttributes & atts )

Constructs a ThemeItem with parent parent, view view and attributes atts.

ThemeItem::~ThemeItem ()   [virtual]

Destroys the ThemeItem. All child nodes are deleted.

bool ThemeItem::active () const

Returns true if this item is currently active, otherwise returns false.

See also setActive().

void ThemeItem::addCharacters ( const QString & characters )   [virtual protected]

Adds the characters characters to this item. Normally overridden by subclasses.

int ThemeItem::attribute ( const QString & key, ThemeItem::State state = ThemeItem::Default ) const   [protected]

Returns an integer value for state state based on the given storage key.

See also setAttribute().

int ThemeItem::attribute ( const QLatin1String & key, ThemeItem::State state = ThemeItem::Default ) const   [protected]

This is an overloaded member function, provided for convenience.

Returns an integer value for state state based on the given storage key.

This function was introduced in Qtopia 4.3.1.

QList<ThemeItem *> ThemeItem::children () const

Returns the children of this item.

void ThemeItem::clickedEvent ()   [virtual protected]

Called by ThemedView when this item has been clicked. A click is a mouse press followed by a mouse release.

void ThemeItem::constructionComplete ()   [virtual protected]

Called by ThemedView when the item has finished being constructed from the themed view XML. This call-back allows an item to perform any required calculations on its data with the knowledge that the data it has is complete. Subclasses should always call the base class version of this function so that proper construction occurs at all levels.

QExpressionEvaluator * ThemeItem::createExpression ( const QString & data )   [protected]

Creates a new QExpressionEvaluator instance based on data. Any valuespace keys are expanded based on this item's fullVSPath(). Performs error checking to ensure the expression given by data is valid. If no error occurs, registers the expression with ThemedView by calling ThemedView::registerExpression() and returns a pointer to the new expression, otherwise returns 0.

void ThemeItem::expressionChanged ( QExpressionEvaluator * expression )   [virtual protected]

Called by ThemedView for a QExpressionEvaluator instance when it emits the Expression::termsChanged() signal. expression is an expression registered through a call to ThemedView::registerExpression(). The Expression expression will be an expression that belongs to this item. Subclasses should make sure they call the base class version of this function should they not know about expression.

QString ThemeItem::fullVSPath ()

Returns the full vspath for this item. The full vspath is this item's vspath appended to the parent item's full vspath. A trailing slash is always included.

QRect ThemeItem::geometry () const

Returns the geometry of this item, relative to its parent.

See also setGeometry().

QRectF ThemeItem::geometryHint () const

Returns the rect for this item as literally specified in the themed view XML.

QVariant ThemeItem::getExpressionResult ( QExpressionEvaluator * expression, const QVariant::Type & type )   [protected]

Retreives a QVariant from expression that can be converted to the specified type type. It performs error checking to ensure expression is a valid expression and expression->result() returns a type that can be converted to type. If an error occurs, returns a QVariant that cannot be converted to type type. Returns a QVariant that can be converted to type type otherwise.

bool ThemeItem::hasFocus () const

Returns true if the item currently has focus, otherwise returns false.

bool ThemeItem::isInteractive () const

Returns true if this item has the themed view XML attribute interactive="yes", otherwise returns false.

bool ThemeItem::isStringExpression ( const QString & str )   [protected]

Returns true if str is an expression from the themed view XML, false otherwise.

bool ThemeItem::isVisible () const

Returns true if the item is currently visible, otherwise returns false.

QString ThemeItem::itemName () const

Returns the name attribute for this item. This is the value given for the name attribute in the themed view XML.

void ThemeItem::layout ()   [virtual protected]

Lays out the item. The item calcuates its actual position and size based on the abstract geometry information specified for the rect attribute in the themed view XML.

void ThemeItem::paint ( QPainter * painter, const QRect & rect )   [virtual protected]

Paints the rect portion of the item using the painter painter. Normally overridden by sub-classes.

ThemeItem * ThemeItem::parentItem () const

Returns the parent item of this item. Should always return an item, except for the ThemePageItem which will return 0.

bool ThemeItem::pressed () const

Returns true if the item is currently pressed, otherwise returns false.

QRect ThemeItem::rect () const

Returns the geometry of this item relative to the parent ThemedView. rect().x() and rect.y() are the ThemedView widget coordinates where this item is currently positioned.

int ThemeItem::rtti () const   [virtual]

Run-time type information. Returns ThemedView::Item.

void ThemeItem::setActive ( bool active )   [virtual]

Sets this item to be active if active is true, otherwise sets the item to be inactive.

See also active().

void ThemeItem::setAttribute ( const QString & key, const int & value, ThemeItem::State state = ThemeItem::Default )   [protected]

Stores the integer value for the state state based on the given storage key.

See also attribute().

void ThemeItem::setAttribute ( const QLatin1String & key, const int & value, ThemeItem::State state = ThemeItem::Default )   [protected]

This is an overloaded member function, provided for convenience.

Stores the integer value for the state state based on the given storage key.

This function was introduced in Qtopia 4.3.1.

void ThemeItem::setAttribute ( const QString & key, const QString & value, ThemeItem::State state = ThemeItem::Default )   [protected]

This is an overloaded member function, provided for convenience.

Stores the string value for state state based on the given storage key.

void ThemeItem::setAttribute ( const QLatin1String & key, const QString & value, ThemeItem::State state = ThemeItem::Default )   [protected]

This is an overloaded member function, provided for convenience.

Stores the string value for state state based on the given storage key.

This function was introduced in Qtopia 4.3.1.

void ThemeItem::setGeometry ( const QRect & rect )   [virtual]

Sets this item's run-time geometry to rect. This controls the position and size of the item in the ThemedView.

See also geometry().

void ThemeItem::setVisible ( bool visible )

Sets this item to be visible if visible is true, otherwise hides the item.

See also isVisible().

ThemeItem::State ThemeItem::state () const

Returns the current state of this ThemeItem.

See also ThemeItem::State.

void ThemeItem::stateChanged ( const ThemeItem::State & state )   [virtual protected]

Called when an item's state is changed to state. The default implementation does nothing.

QString ThemeItem::strAttribute ( const QString & key, ThemeItem::State state = ThemeItem::Default )   [protected]

Returns the string value for state state based on the given storage key.

QString ThemeItem::strAttribute ( const QLatin1String & key, ThemeItem::State state = ThemeItem::Default )   [protected]

This is an overloaded member function, provided for convenience.

Returns the string value for state state based on the given storage key.

This function was introduced in Qtopia 4.3.1.

QString ThemeItem::stripStringExpression ( const QString & str )   [protected]

Strips the expression indicators from the expression str. isStringExpression(str) must return true, or this function will abort.

bool ThemeItem::transient () const

Returns true if this item has the themed view XML attribute transient="yes", otherwise returns false.

void ThemeItem::update ()   [protected]

Updates this item. Causes this item to be repainted immediately.

void ThemeItem::update ( int x, int y, int w, int h )   [protected]

This is an overloaded member function, provided for convenience.

Causes the area given by x, y, w, h of this item to be repainted immediately.

ThemedView * ThemeItem::view () const

Returns the ThemedView this item belongs to.

QString ThemeItem::vsPath ()

Returns the vspath attribute for this item. This can be the attribute as it was specified for this item in the themed view XML, or in the case of ThemeTemplateInstanceItem, it will be a dynamically assigned uid.

See also ThemeTemplateInstanceItem.


Copyright © 2008 Nokia Trademarks
Qtopia 4.3.3