Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

ThemeItem Class Reference
[QtBaseModule]

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

  • enum State { Default, Focus, Pressed, All }

Public Functions

Protected Functions

  • virtual void addCharacters ( const QString & characters )
  • int attribute ( const QString & key, ThemeItem::State state = ThemeItem::Default ) const
  • int attribute ( const QLatin1String & key, ThemeItem::State state = ThemeItem::Default ) const
  • virtual void clickedEvent ()
  • virtual void constructionComplete ()
  • QExpressionEvaluator * createExpression ( const QString & data )
  • virtual void expressionChanged ( QExpressionEvaluator * expression )
  • QVariant getExpressionResult ( QExpressionEvaluator * expression, const QVariant::Type & type )
  • bool isStringExpression ( const QString & str )
  • virtual void layout ()
  • virtual void paint ( QPainter * painter, const QRect & rect )
  • void setAttribute ( const QString & key, const int & value, ThemeItem::State state = ThemeItem::Default )
  • void setAttribute ( const QLatin1String & key, const int & value, ThemeItem::State state = ThemeItem::Default )
  • void setAttribute ( const QString & key, const QString & value, ThemeItem::State state = ThemeItem::Default )
  • void setAttribute ( const QLatin1String & key, const QString & value, ThemeItem::State state = ThemeItem::Default )
  • virtual void stateChanged ( const ThemeItem::State & state )
  • QString strAttribute ( const QString & key, ThemeItem::State state = ThemeItem::Default )
  • QString strAttribute ( const QLatin1String & key, ThemeItem::State state = ThemeItem::Default )
  • QString stripStringExpression ( const QString & str )
  • void update ()
  • void update ( int x, int y, int w, int h )

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.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 45
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 6
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le Qt Labs au hasard

Logo

La folie est de mettre en forme le même texte

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web