Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The ThemedView widget constructs, manages and displays themed views in Qtopia. More...
#include <ThemedView>
Inherits QWidget.
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.
Constant | Value | Description |
---|---|---|
ThemedView::Item | 0 | A generic item. |
ThemedView::Page | 1 | Top-level item for all themed views. |
ThemedView::Animation | 2 | An item for displaying pixmap collage animations. |
ThemedView::Level | 3 | An item for displaying a graphical level indicator. |
ThemedView::Status | 4 | An item for displaying an on/off indicator. |
ThemedView::Image | 5 | An item for displaying images |
ThemedView::Text | 6 | An item for displaying text |
ThemedView::Rect | 7 | An item for displaying rectangles. |
ThemedView::Line | 8 | An item for displaying lines. |
ThemedView::Plugin | 9 | An item for adding a plug-in as input. |
ThemedView::Exclusive | 10 | A container item that allows only 1 of its children to be active at once. |
ThemedView::Layout | 11 | A container item that positions and sizes its children. |
ThemedView::Group | 12 | A container that groups its children together |
ThemedView::Widget | 13 | An item that allows a widget to be displayed in a themed view. |
ThemedView::List | 14 | An item that displays a list based on QListView. |
ThemedView::Template | 15 | An item that interprets its child hierarchy declratively and can create instances of its hierarchy dynamically. |
ThemedView::TemplateInstance | 16 | An instance of a Template |
See also ThemeItem::rtti().
Constructs a ThemedView object passing the parent widget and widget flags f to the QWidget constructor.
Destroys the ThemedView object and all of its data.
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).
Returns the default directory for theme images. The default is $QPEDIR/themes/default.
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.
This function is deprecated.
This is an overloaded member function, provided for convenience.
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.
This function is deprecated.
This is an overloaded member function, provided for convenience.
Returns the ThemeItem located at the point pos in this ThemedView. pos is in local coordinates.
Emitted when the interactive item item is clicked. A click is a press and a release.
Emitted when the interactive item item is pressed.
Emitted when the interactive item item is released.
Lays out item an of its children.
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.
Emitted when the theme is successfully loaded.
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.
Returns the name attribute of the page element from the themed view XML.
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.
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.
If the rectangle rect is different to the current rect(), sets the new geometry to rect and calls layout() immediately.
This is an overloaded member function, provided for convenience.
Equivalent to calling ThemedView::setGeometryAndLayout(QRect(gx, gy, w, h))
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.
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().
Returns true if a themed view XML document has been loaded using ThemedView::loadSource() for this ThemedView, otherwise returns false.
Called whenever the theme, file, is loaded. This allows derived classes to configure themselves appropriately for the new theme.
The default implementation does nothing.
Returns the name of the theme this ThemedView belongs to as set by setThemeName().
See also setThemeName().
Emitted when the visibility of item changes. The visible parameter is true if item is visible or false otherwise.
Copyright © 2009 Trolltech | Trademarks | Qt Extended 4.4.3 |