#include <Wt/WItemDelegate>
Public Member Functions | |
virtual WWidget * | update (WWidget *widget, const WModelIndex &index, WFlags< ViewItemRenderFlag > flags) |
Create or update a widget that renders an item. | |
virtual void | updateModelIndex (WWidget *widget, const WModelIndex &index) |
Update the model index of a widget. | |
void | setTextFormat (const WString &format) |
Set the text format string. | |
const WString & | textFormat () const |
Returns the text format string. |
This class provides the standard implementation for rendering an item in a WTreeView.
WWidget * Wt::WItemDelegate::update | ( | WWidget * | widget, | |
const WModelIndex & | index, | |||
WFlags< ViewItemRenderFlag > | flags | |||
) | [virtual] |
Create or update a widget that renders an item.
The item is specified by its model index, which also indicates the model. If an existing widget already renders the item, but needs to be updated, it is passed as the widget parameter. You may decide to create a new widget, in which case you are responsible to delete the previous widget if it is not reused.
When widget is null
, a new widget needs to be created.
The flags parameter indicates options for rendering the item.
Implements Wt::WAbstractItemDelegate.
void Wt::WItemDelegate::updateModelIndex | ( | WWidget * | widget, | |
const WModelIndex & | index | |||
) | [virtual] |
Update the model index of a widget.
This method is invoked by the view when due to row/column insertions or removals, an index was modified for a widget.
You should reimplement this method if you are storing the model index (e.g. for editing purposes) in the widget, which you should update to the new index.
The default implementation does nothing.
Reimplemented from Wt::WAbstractItemDelegate.
void Wt::WItemDelegate::setTextFormat | ( | const WString & | format | ) |
Set the text format string.
The DisplayRole data is converted to a string using asString() by passing the given format.
The default value is "".
const WString& Wt::WItemDelegate::textFormat | ( | ) | const [inline] |