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  · 

ThemedView Class Reference
[QtBaseModule]

The ThemedView widget constructs, manages and displays themed views in Qtopia. More...

    #include <ThemedView>

Inherits QWidget.

Public Types

  • enum Type { Item, Page, Animation, Level, ..., TemplateInstance }

Public Functions

  • ThemedView ( QWidget * parent = 0, Qt::WFlags f = 0 )
  • virtual ~ThemedView ()
  • const QString base () const
  • const QString defaultPics () const
  • ThemeItem * findItem ( const QString & name, ThemedView::Type type = ThemedView::Item, ThemeItem::State state = ThemeItem::All ) const
  • ThemeItem * findItem ( const QString & name, int type, int state = ThemeItem::All ) const   (deprecated)
  • QList<ThemeItem *> findItems ( const QString & name, ThemedView::Type type = ThemedView::Item, ThemeItem::State state = ThemeItem::All ) const
  • QList<ThemeItem *> findItems ( const QString & name, int type, int state = ThemeItem::All ) const   (deprecated)
  • ThemeItem * itemAt ( const QPoint & pos ) const
  • bool loadSource ( const QString & fileName = QString() )
  • virtual QWidget * newWidget ( ThemeWidgetItem * item, const QString & name )
  • const QString pageName () const
  • void paint ( QPainter * painter, const QRect & clip, ThemeItem * item = 0 )
  • void setGeometryAndLayout ( const QRect & rect )
  • void setGeometryAndLayout ( int gx, int gy, int w, int h )
  • void setSourceFile ( const QString & fileName )
  • void setThemeName ( const QString & themeName )
  • bool sourceLoaded () const
  • QString themeName () const
  • 206 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 14 public functions inherited from QPaintDevice

Signals

Protected Functions

  • 38 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice

Additional Inherited Members

  • 57 properties inherited from QWidget
  • 1 property inherited from QObject
  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject
  • 1 public type inherited from QObject
  • 4 static public members inherited from QWidget
  • 4 static public members inherited from QObject
  • 1 protected slot inherited from QWidget
  • 2 protected variables inherited from QObject
  • 1 protected type inherited from QPaintDevice

Detailed Description

The ThemedView widget constructs, manages and displays themed views in Qtopia.

A Qt Extended theme is made up of multiple themed views, each described by an XML document called the themed view XML. You construct a new ThemedView by passing a themed view XML file to the ThemedView::loadSource() function. The ThemedView widget parses the XML, creates the theme item tree and renders it to the widget.

The theme item tree is the run-time representation of a themed view. Each node in the tree derives from ThemeItem and implements some specific functionality eg. ThemeTextItem displays text, ThemeRectItem draws rectangles, ThemeLayoutItem positions and sizes other items etc. The ThemedView widget manages the theme item tree, instructing items to layout and paint themselves at the appropriate times.

As the ThemedView is basically a customizeable user interface component, a core part of a themed view is its ability to display data to the user. There are 2 different methods of getting data into a themed view for display to the user. 1. Using the ThemedView::findItem() function, you can get access to theme items in the tree and set data on them directly. Eg.

    ThemedView *view;
    ..
    ThemeTextItem* myTextItem = static_cast<ThemeTextItem*>(view->findItem("myTextItem", ThemedView::Text);
    if (myTextItem != 0)
        myTextItem->setText("Hello, World!");

The above example finds the item with name "myTextItem" and a ThemeItem::rtti() value of ThemedView::Text and sets its contents to be "Hello, World!".

2. ThemeLevelItem, ThemeStatusItem, ThemeTextItem and ThemeImageItem can source their data through a QExpressionEvaluator. This method allows items to source data from the system without any tight-coupling. See the item-specific documentation for details.

The ThemedView is also responsible for handling user interactivity with theme items. You can monitor user interactivity programatically by connecting to the ThemedView::itemPressed(), ThemedView::itemClicked() and ThemedView::itemReleased() signals. Alternatively, theme items can send IPC messages to services or a specific channel when clicked. This allows themed views to effect the system without tight coupling. See the documentation of ThemeItem for details.


Member Type Documentation

enum ThemedView::Type

ConstantValueDescription
ThemedView::Item0A generic item.
ThemedView::Page1Top-level item for all themed views.
ThemedView::Animation2An item for displaying pixmap collage animations.
ThemedView::Level3An item for displaying a graphical level indicator.
ThemedView::Status4An item for displaying an on/off indicator.
ThemedView::Image5An item for displaying images
ThemedView::Text6An item for displaying text
ThemedView::Rect7An item for displaying rectangles.
ThemedView::Line8An item for displaying lines.
ThemedView::Plugin9An item for adding a plug-in as input.
ThemedView::Exclusive10A container item that allows only 1 of its children to be active at once.
ThemedView::Layout11A container item that positions and sizes its children.
ThemedView::Group12A container that groups its children together
ThemedView::Widget13An item that allows a widget to be displayed in a themed view.
ThemedView::List14An item that displays a list based on QListView.
ThemedView::Template15An item that interprets its child hierarchy declratively and can create instances of its hierarchy dynamically.
ThemedView::TemplateInstance16An instance of a Template

See also ThemeItem::rtti().


Member Function Documentation

ThemedView::ThemedView ( QWidget * parent = 0, Qt::WFlags f = 0 )

Constructs a ThemedView object passing the parent widget and widget flags f to the QWidget constructor.

ThemedView::~ThemedView ()   [virtual]

Destroys the ThemedView object and all of its data.

const QString ThemedView::base () const

Returns the base directory for this ThemedView. This function simply accesses the root theme item and returns ThemePageItem::base(). As such, you cannot call this function before the root item has been constructed (ie. before a themed view XML has been successfully loaded).

const QString ThemedView::defaultPics () const

Returns the default directory for theme images. The default is $QPEDIR/themes/default.

ThemeItem * ThemedView::findItem ( const QString & name, ThemedView::Type type = ThemedView::Item, ThemeItem::State state = ThemeItem::All ) const

Finds the item in the theme item tree that has the name name, the type type and the state state. If the value of type is ThemedView::Item, items with any type are searched for. The default value of state is ThemeItem::All which matches the state of all items. Returns a pointer to the item if found, otherwise returns 0.

ThemeItem * ThemedView::findItem ( const QString & name, int type, int state = ThemeItem::All ) const

This function is deprecated.

This is an overloaded member function, provided for convenience.

QList<ThemeItem *> ThemedView::findItems ( const QString & name, ThemedView::Type type = ThemedView::Item, ThemeItem::State state = ThemeItem::All ) const

Finds all of the items in the theme item tree that have the name name, the type type and the state state. If the value of type is ThemedView::Item, items with any type are searched for. By default, state if set to ThemeItem::All, and so items with any state are search for. Returns any items found.

QList<ThemeItem *> ThemedView::findItems ( const QString & name, int type, int state = ThemeItem::All ) const

This function is deprecated.

This is an overloaded member function, provided for convenience.

ThemeItem * ThemedView::itemAt ( const QPoint & pos ) const

Returns the ThemeItem located at the point pos in this ThemedView. pos is in local coordinates.

void ThemedView::itemClicked ( ThemeItem * item )   [signal]

Emitted when the interactive item item is clicked. A click is a press and a release.

void ThemedView::itemPressed ( ThemeItem * item )   [signal]

Emitted when the interactive item item is pressed.

void ThemedView::itemReleased ( ThemeItem * item )   [signal]

Emitted when the interactive item item is released.

void ThemedView::layout ( ThemeItem * item = 0 )   [protected]

Lays out item an of its children.

bool ThemedView::loadSource ( const QString & fileName = QString() )

Loads the themed view XML specified by fileName. If fileName is empty (the default) but ThemedView::setSourceFile() has been called, the fileName value from that call will be used. Returns true if a source was successfully loaded, otherwise returns false.

void ThemedView::loaded ()   [signal]

Emitted when the theme is successfully loaded.

QWidget * ThemedView::newWidget ( ThemeWidgetItem * item, const QString & name )   [virtual]

Called by the ThemeWidgetItem item when it wishes to construct the widget corresponding to the specified name. name is the name attribute from the themed view XML. This function must be overriden by subclasses for themed views that have a ThemeWidgetItem in them. The default implementation always returns 0.

See also ThemeWidgetItem.

const QString ThemedView::pageName () const

Returns the name attribute of the page element from the themed view XML.

void ThemedView::paint ( QPainter * painter, const QRect & clip, ThemeItem * item = 0 )

Paints item using the painter painter within the given clip rect. You normally don't want to call this function directly, but it is useful for painting template items to a user-specified painter.

void ThemedView::registerExpression ( ThemeItem * item, QExpressionEvaluator * expression )   [protected]

Registers the expression expression for the given theme item. The ThemedView will unregister the expression when expression is deleted, and call the expressionChanged() call-back on item whenever the QExpressionEvaluator::termsChanged() signal is emitted.

void ThemedView::setGeometryAndLayout ( const QRect & rect )

If the rectangle rect is different to the current rect(), sets the new geometry to rect and calls layout() immediately.

void ThemedView::setGeometryAndLayout ( int gx, int gy, int w, int h )

This is an overloaded member function, provided for convenience.

Equivalent to calling ThemedView::setGeometryAndLayout(QRect(gx, gy, w, h))

void ThemedView::setSourceFile ( const QString & fileName )

Set the themed view XML file to be fileName. If ThemedView::loadSource() is called with an empty argument (the default) the themed view XML file fileName will be loaded.

void ThemedView::setThemeName ( const QString & themeName )

Sets the name of the theme this ThemedView belongs to be themeName. The name of the theme will be used as the key for text translations. themeName() simply returns this value.

See also themeName().

bool ThemedView::sourceLoaded () const

Returns true if a themed view XML document has been loaded using ThemedView::loadSource() for this ThemedView, otherwise returns false.

void ThemedView::themeLoaded ( const QString & file )   [virtual protected]

Called whenever the theme, file, is loaded. This allows derived classes to configure themselves appropriately for the new theme.

The default implementation does nothing.

QString ThemedView::themeName () const

Returns the name of the theme this ThemedView belongs to as set by setThemeName().

See also setThemeName().

void ThemedView::visibilityChanged ( ThemeItem * item, bool visible )   [signal]

Emitted when the visibility of item changes. The visible parameter is true if item is visible or false otherwise.

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. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 8
Page suivante

Le Qt Developer Network au hasard

Logo

Installation de PySide : binaires et compilation

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. 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