Detailed Description
The ThemeListModelEntry class implements a single theme list entry in a ThemeListModel.
The ThemeListModelEntry has a uid() and a type(), which are used by templateInstance() to associate a single template instance to this entry. The ThemeListModelEntry stores this template instance internally and can be retrieved using templateInstance().
This class must be subclassed and the pure virtual type() function reimplemented to return the appropriate value.
See also ThemeListModel, ThemeTemplateItem, and ThemeTemplateInstanceItem.
Member Function Documentation
ThemeListModelEntry::ThemeListModelEntry ( ThemeListModel * model )
Constructs a ThemeListModelEntry an associates it with the given model.
ThemeListModelEntry::~ThemeListModelEntry () [virtual]
Destroys the ThemeListModelEntry.
ThemeListModel * ThemeListModelEntry::model () const
Returns the parent ThemeListModel instance associated with this entry.
void ThemeListModelEntry::setValue ( const QString & key, const QVariant & value )
Sets the given value in the valuespace based on the given key. The actual key set will be templateInstance()->fullVSPath() + key.
See also value().
Creates and returns a ThemeTemplateInstanceItem object for this entry. This function searches all template items defined under the list item in the themed view XML file looking for an item that has a name attribute matching the return value of type(). When it finds one it calls ThemeTemplateItem::createInstance() passing the value of uid(), and stores the return value in this entry. If a template instance item already exists but its name attribute does not match the value currently returned by type(), then it is deleted and a new template instance is created. If no template can be found for this entry 0 is returned, otherwise a pointer to the associated ThemeTemplateInstanceItem is returned.
See also ThemeTemplateInstanceItem.
QString ThemeListModelEntry::type () const [pure virtual]
Returns the type of this entry. Subclasses must overrride this pure virtual function and return a value that corresponds to the name attribute of a template item defined under the associated list item in the themed view XML. templateInstance() calls this function to lookup and associate this entry to a ThemeTemplateItem. If the value that this function returns changes, either the subclass or the parent ThemeListModel implementation should instruct the view to repaint this entry, probably by calling ThemeListModel::triggerUpdate(). The internal QItemDelegate implementation will call templateInstance() to create and associate a ThemeTemplateInstanceItem object with this entry, based on the new return value.
QString ThemeListModelEntry::uid ()
Returns a globally unique identifier for this entry. The return value of this function is used by templateInstance() in order to associate this entry with a theme template instance.
QVariant ThemeListModelEntry::value ( const QString & key )
Retrives a value from the valuespace based on the given key. The actual valuespace key used to get the value will be templateInstance()->fullVSPath() + key.
See also setValue().