Wt: Wt::WAbstractItemView Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
Wt::WAbstractItemView Class Referenceabstract
Model/view system

An abstract base class for item Views. More...

`#include <Wt/WAbstractItemView.h>`

Inheritance diagram for Wt::WAbstractItemView:
[legend]

## Public Member Functions
virtual void | setModel (const std::shared_ptr< WAbstractItemModel > &model)
| Sets the model.
std::shared_ptr< WAbstractItemModel > | model () const
| Returns the model.
void | setRootIndex (const WModelIndex &rootIndex)
| Sets the root index.
const WModelIndex & | rootIndex () const
| Returns the root index.
void | setItemDelegate (const std::shared_ptr< WAbstractItemDelegate > &delegate)
| Sets the default item delegate.
std::shared_ptr< WAbstractItemDelegate > | itemDelegate () const
| Returns the default item delegate.
void | setItemDelegateForColumn (int column, const std::shared_ptr< WAbstractItemDelegate > &delegate)
| Sets the delegate for a column.
std::shared_ptr< WAbstractItemDelegate > | itemDelegateForColumn (int column) const
| Returns the delegate that was set for a column.
std::shared_ptr< WAbstractItemDelegate > | itemDelegate (const WModelIndex &index) const
| Returns the delegate for rendering an item.
std::shared_ptr< WAbstractItemDelegate > | itemDelegate (int column) const
| Returns the delegate for a column.
virtual WWidget * | itemWidget (const WModelIndex &index) const =0
| Returns the widget that renders an item.
void | setHeaderItemDelegate (const std::shared_ptr< WAbstractItemDelegate > &delegate)
| Sets the header item delegate.
std::shared_ptr< WAbstractItemDelegate > | headerItemDelegate () const
| Returns the header item delegate.
virtual void | setColumnAlignment (int column, AlignmentFlag alignment)
| Sets the content alignment for a column.
virtual AlignmentFlag | columnAlignment (int column) const
| Returns the content alignment for a column.
virtual void | setHeaderAlignment (int column, WFlags< AlignmentFlag > alignment)
| Sets the header alignment for a column.
AlignmentFlag | horizontalHeaderAlignment (int column) const
| Returns the horizontal header alignment for a column.
AlignmentFlag | verticalHeaderAlignment (int column) const
| Returns the vertical header alignment for a column.
void | setHeaderWordWrap (int column, bool enabled)
| Configures header text wrapping.
virtual void | setAlternatingRowColors (bool enable)
| Sets if alternating row colors are to be used.
virtual bool | alternatingRowColors () const
| Returns whether alternating row colors are used.
void | sortByColumn (int column, SortOrder order)
| Sorts the data according to a column.
int | sortColumn () const
| Returns the current sorting columm.
SortOrder | sortOrder () const
| Returns the current sorting order.
void | setSortingEnabled (bool enabled)
| Enables or disables sorting for all columns.
void | setSortingEnabled (int column, bool enabled)
| Enables or disables sorting for a single column.
bool | isSortingEnabled () const
| Returns whether sorting is enabled.
bool | isSortingEnabled (int column) const
| Returns whether sorting is enabled for a single column.
void | setColumnResizeEnabled (bool enabled)
| Enables interactive column resizing.
bool | isColumnResizeEnabled () const
| Returns whether column resizing is enabled.
void | setSelectionBehavior (SelectionBehavior behavior)
| Changes the selection behaviour.
SelectionBehavior | selectionBehavior () const
| Returns the selection behaviour.
void | setSelectionMode (SelectionMode mode)
| Sets the selection mode.
SelectionMode | selectionMode () const
| Returns the selection mode.
WItemSelectionModel * | selectionModel () const
| Returns the selection model.
void | setSelectedIndexes (const WModelIndexSet &indexes)
| Sets the selected items.
void | clearSelection ()
| Clears the selection.
void | select (const WModelIndex &index, SelectionFlag option=SelectionFlag::Select)
| Selects a single item.
bool | isSelected (const WModelIndex &index) const
| Returns wheter an item is selected.
WModelIndexSet | selectedIndexes () const
| Returns the set of selected items.
void | setDragEnabled (bool enable)
| Enables the selection to be dragged (drag & drop).
void | setDropsEnabled (bool enable)
| Enables drop operations (drag & drop).
void | setEnabledDropLocations (WFlags< DropLocation > droplocation)
| Enables drop operations (drag & drop).
WFlags< DropLocation > | enabledDropLocations () const
| Returns the enabled drop locations.
virtual void | setRowHeight (const WLength &rowHeight)
| Sets the row height.
const WLength & | rowHeight () const
| Returns the row height.
virtual void | setColumnWidth (int column, const WLength &width)=0
| Sets the column width.
WLength | columnWidth (int column) const
| Returns the column width.
virtual void | setColumnHidden (int column, bool hide)
| Changes the visibility of a column.
bool | isColumnHidden (int column) const
| Returns if a column is hidden.
void | hideColumn (int column)
| Hides a column.
void | showColumn (int column)
| Shows a column.
virtual void | setHeaderHeight (const WLength &height)
| Sets the header height.
const WLength & | headerHeight () const
| Returns the header height.
virtual int | pageCount () const =0
| Returns the number of pages.
virtual int | pageSize () const =0
| Returns the page size.
virtual int | currentPage () const =0
| Returns the current page.
virtual void | setCurrentPage (int page)=0
| Sets the current page.
virtual void | scrollTo (const WModelIndex &index, ScrollHint hint=ScrollHint::EnsureVisible)=0
| Scrolls the view to an item.
void | setEditTriggers (WFlags< EditTrigger > editTriggers)
| Configures what actions should trigger editing.
WFlags< EditTrigger > | editTriggers () const
| Returns the editing triggers.
void | setEditOptions (WFlags< EditOption > options)
| Configures editing options.
WFlags< EditOption > | editOptions () const
| Returns the editing options.
void | edit (const WModelIndex &index)
| Opens an editor for the given index.
void | closeEditor (const WModelIndex &index, bool saveData=true)
| Closes the editor for the given index.
void | closeEditors (bool saveData=true)
| Closes all open editors.
ValidationState | validateEditor (const WModelIndex &index)
| Validates the editor for the given index.
ValidationState | validateEditors ()
| Validates all editors.
bool | isEditing (const WModelIndex &index) const
| Returns whether an editor is open for a given index.
bool | isValid (const WModelIndex &index) const
| Returns whether an editor's state is valid.
Signal< WModelIndex, WMouseEvent > & | clicked ()
| Signal emitted when clicked.
Signal< WModelIndex, WMouseEvent > & | doubleClicked ()
| Signal emitted when double clicked.
Signal< WModelIndex, WMouseEvent > & | mouseWentDown ()
| Signal emitted when a mouse button is pressed down.
Signal< WModelIndex, WMouseEvent > & | mouseWentUp ()
| Signal emitted when the mouse button is released.
Signal< WModelIndex, WTouchEvent > & | touchStart ()
| Signal emitted when a finger is placed on the screen.
Signal< std::vector< WModelIndex >, WTouchEvent > & | touchStarted ()
| Signal emitted when one or more fingers are placed on the screen.
Signal< std::vector< WModelIndex >, WTouchEvent > & | touchMoved ()
| Signal emitted when one or more fingers are moved on the screen.
Signal< std::vector< WModelIndex >, WTouchEvent > & | touchEnded ()
| Signal emitted when one or more fingers are removed from the screen.
Signal & | selectionChanged ()
| Signal emitted when the selection is changed.
Signal & | pageChanged ()
| Signal emitted when page information was updated.
Signal< int, WLength > & | columnResized ()
| Returns the signal emitted when a column is resized by the user.
bool | sortEnabled ()
| Returns whether the view is sortable.
void | setHeaderClickSortEnabled (bool enabled)
| Alow to sort.
Signal< int, WMouseEvent > & | headerClicked ()
| Signal emitted when a header item is clicked.
Signal< int, WMouseEvent > & | headerDoubleClicked ()
| Signal emitted when a header item is double clicked.
Signal< int, WMouseEvent > & | headerMouseWentDown ()
| Signal emitted when a mouse button is pressed on a header item
Signal< int, WMouseEvent > & | headerMouseWentUp ()
| Signal emitted when a mouse button is released on a header item
virtual EventSignal< WScrollEvent > & | scrolled ()=0
| Signal emitted when scrolling.
virtual void | setRowHeaderCount (int count)
| Configures the number of columns that are used as row headers.
int | rowHeaderCount () const
| Returns the number of columns that are used as row headers.
EventSignal< WKeyEvent > & | keyWentDown ()
| Event signal emitted when a keyboard key is pushed down.
EventSignal< WKeyEvent > & | keyPressed ()
| Event signal emitted when a "character" was entered.
EventSignal< WKeyEvent > & | keyWentUp ()
| Event signal emitted when a keyboard key is released.
Public Member Functions inherited from Wt::WCompositeWidget
| WCompositeWidget ()
| Creates a WCompositeWidget.
| WCompositeWidget (std::unique_ptr< WWidget > implementation)
| Creates a WCompositeWidget with given implementation.
virtual std::vector< WWidget * > | children () const override
| Returns child widgets.
virtual std::unique_ptr< WWidget > | removeWidget (WWidget *widget) override
| Removes a child widget.
virtual void | setObjectName (const std::string &name) override
| Sets an object name.
virtual std::string | objectName () const override
| Returns the object name.
virtual const std::string | id () const override
| Returns the (unique) identifier for this object.
virtual void | setPositionScheme (PositionScheme scheme) override
| Sets the CSS position scheme.
virtual PositionScheme | positionScheme () const override
| Returns the CSS position scheme.
virtual void | setOffsets (const WLength &offset, WFlags< Side > sides=AllSides) override
| Sets CSS offsets for a non-statically positioned widget.
virtual WLength | offset (Side s) const override
| Returns a CSS offset.
virtual void | resize (const WLength &width, const WLength &height) override
| Resizes the widget.
virtual WLength | width () const override
| Returns the width.
virtual WLength | height () const override
| Returns the height.
virtual void | setMinimumSize (const WLength &width, const WLength &height) override
| Sets a minimum size.
virtual WLength | minimumWidth () const override
| Returns the minimum width.
virtual WLength | minimumHeight () const override
| Returns the minimum height.
virtual void | setMaximumSize (const WLength &width, const WLength &height) override
| Sets a maximum size.
virtual WLength | maximumWidth () const override
| Returns the maximum width.
virtual WLength | maximumHeight () const override
| Returns the maximum height.
virtual void | setLineHeight (const WLength &height) override
| Sets the CSS line height for contained text.
virtual WLength | lineHeight () const override
| Returns the CSS line height for contained text.
virtual void | setFloatSide (Side s) override
| Specifies a CSS float side.
virtual Side | floatSide () const override
| Returns the CSS float side.
virtual void | setClearSides (WFlags< Side > sides) override
| Sets the sides that should be cleared of floats.
virtual WFlags< Side > | clearSides () const override
| Returns the sides that should remain empty.
virtual void | setMargin (const WLength &margin, WFlags< Side > sides=AllSides) override
| Sets CSS margins around the widget.
virtual WLength | margin (Side side) const override
| Returns a CSS margin set.
virtual void | setHiddenKeepsGeometry (bool enabled) override
| Sets whether the widget keeps its geometry when hidden.
virtual bool | hiddenKeepsGeometry () const override
| Returns whether the widget keeps its geometry when hidden.
virtual void | setHidden (bool hidden, const WAnimation &animation=WAnimation()) override
| Hides or shows the widget.
virtual bool | isHidden () const override
| Returns whether the widget is set hidden.
virtual bool | isVisible () const override
| Returns whether the widget is visible.
virtual void | setDisabled (bool disabled) override
| Sets whether the widget is disabled.
virtual bool | isDisabled () const override
| Returns whether the widget is set disabled.
virtual bool | isEnabled () const override
| Returns whether the widget is enabled.
virtual void | setPopup (bool popup) override
| Lets the widget overlay over other sibling widgets.
virtual bool | isPopup () const override
| Returns whether the widget is overlayed.
virtual void | setInline (bool isInline) override
| Sets whether the widget is displayed inline or as a block.
virtual bool | isInline () const override
| Returns whether the widget is displayed inline or as block.
virtual void | setDecorationStyle (const WCssDecorationStyle &style) override
| Sets a CSS decoration style.
virtual WCssDecorationStyle & | decorationStyle () override
| Returns the decoration style of this widget.
virtual void | setStyleClass (const WString &styleClass) override
| Sets (one or more) CSS style classes.
virtual WString | styleClass () const override
| Returns the CSS style class.
virtual void | addStyleClass (const WString &styleClass, bool force=false) override
| Adds a CSS style class.
virtual void | removeStyleClass (const WString &styleClass, bool force=false) override
| Removes a CSS style class.
virtual bool | hasStyleClass (const WString &styleClass) const override
| Returns whether the widget has a style class.
virtual void | setVerticalAlignment (AlignmentFlag alignment, const WLength &length=WLength::Auto) override
| Sets the vertical alignment.
virtual AlignmentFlag | verticalAlignment () const override
| Returns the vertical alignment.
virtual WLength | verticalAlignmentLength () const override
| Returns the fixed vertical alignment that was set.
virtual void | setToolTip (const WString &text, TextFormat textFormat=TextFormat::Plain) override
| Sets a tooltip.
virtual WString | toolTip () const override
| Returns the tooltip.
virtual void | setDeferredToolTip (bool enable, TextFormat textFormat=TextFormat::Plain) override
| Enable deferred tooltip.
virtual void | refresh () override
| Refresh the widget.
virtual void | setAttributeValue (const std::string &name, const WString &value) override
| Sets an attribute value.
virtual WString | attributeValue (const std::string &name) const override
| Returns an attribute value.
virtual void | setJavaScriptMember (const std::string &name, const std::string &value) override
| Sets a JavaScript member.
virtual std::string | javaScriptMember (const std::string &name) const override
| Returns the value of a JavaScript member.
virtual void | callJavaScriptMember (const std::string &name, const std::string &args) override
| Calls a JavaScript member.
virtual void | load () override
| Loads content just before the widget is used.
virtual bool | loaded () const override
| Returns whether this widget has been loaded.
virtual void | setCanReceiveFocus (bool enabled) override
| Sets whether the widget can receive focus.
virtual bool | canReceiveFocus () const override
| Returns whether the widget can receive focus.
virtual void | setFocus (bool focus) override
| Sets focus.
virtual bool | setFirstFocus () override
| Set focus on the widget's first descendant.
virtual bool | hasFocus () const override
| Returns whether the widget currently has the focus.
virtual void | setTabIndex (int index) override
| Sets the tab index.
virtual int | tabIndex () const override
| Returns the tab index.
virtual void | setId (const std::string &id) override
| Sets the CSS Id.
virtual WWidget * | find (const std::string &name) override
| Finds a descendent widget by name.
virtual WWidget * | findById (const std::string &name) override
| Finds a descendent widget by id.
virtual void | setSelectable (bool selectable) override
| Sets as selectable.
virtual void | doJavaScript (const std::string &js) override
| Executes the given JavaScript statements when the widget is rendered or updated.
virtual void | propagateSetEnabled (bool enabled) override
| Propagates that a widget was enabled or disabled through children.
virtual bool | scrollVisibilityEnabled () const final override
| Returns whether scroll visibility detection is enabled for this widget.
virtual void | setScrollVisibilityEnabled (bool enabled) final override
| Sets whether scroll visibility detection is enabled for this widget.
virtual int | scrollVisibilityMargin () const final override
| Returns the margin around the viewport within which the widget is considered visible.
virtual void | setScrollVisibilityMargin (int margin) final override
| Sets the margin around the viewport within which the widget is considered visible.
virtual Signal< bool > & | scrollVisibilityChanged () final override
| Signal triggered when the scroll visibility of this widget changes.
virtual bool | isScrollVisible () const final override
| Returns whether this widget is currently considered scroll visible.
virtual void | setThemeStyleEnabled (bool enabled) final override
| Sets whether theme styling for a widget is enabled or disabled.
virtual bool | isThemeStyleEnabled () const final override
| Returns whether this widget is currently styled by the chosen theme.
template<typename Widget >
std::unique_ptr< Widget > | removeWidget (Widget *widget)
| Removes a child widget.
void | setFocus ()
| Sets focus.
Public Member Functions inherited from Wt::WWidget
virtual | ~WWidget ()
| Destructor.
WWidget * | parent () const
| Returns the parent widget.
template<typename Widget >
std::unique_ptr< Widget > | removeWidget (Widget *widget)
| Removes a child widget.
std::unique_ptr< WWidget > | removeFromParent ()
| Removes the widget from its parent.
void | setWidth (const WLength &width)
| Sets the width.
void | setHeight (const WLength &height)
| Sets the height.
virtual void | positionAt (const WWidget *widget, Orientation orientation=Orientation::Vertical)
| Positions a widget next to another widget.
virtual void | toggleStyleClass (const WString &styleClass, bool add, bool force=false)
| Toggles a CSS style class.
std::string | jsRef () const
| Returns a JavaScript expression to the corresponding DOM node.
void | setFocus ()
| Sets focus.
virtual void | acceptDrops (const std::string &mimeType, const WString &hoverStyleClass=WString())
| Sets a mime type to be accepted for dropping.
virtual void | stopAcceptDrops (const std::string &mimeType)
| Indicates that a mime type is no longer accepted for dropping.
virtual void | htmlText (std::ostream &out)
| Streams the (X)HTML representation.
bool | isRendered () const
| Returns whether the widget is rendered.
void | hide ()
| Hides the widget.
void | animateHide (const WAnimation &animation)
| Hides the widget using an animation.
void | show ()
| Shows the widget.
void | animateShow (const WAnimation &animation)
| Shows the widget using an animation.
void | enable ()
| Enables the widget.
void | disable ()
| Disable thes widget.
bool | layoutSizeAware () const
| Returns whether the widget is layout size aware.
Public Member Functions inherited from Wt::WObject
void | addChild (std::unique_ptr< WObject > child)
| Add a child WObject whose lifetime is determined by this WObject.
template<typename Child >
Child * | addChild (std::unique_ptr< Child > child)
| Add a child WObject, returning a raw pointer.
std::unique_ptr< WObject > | removeChild (WObject *child)
| Remove a child WObject, so its lifetime is no longer determined by this WObject.
template<typename Child >
std::unique_ptr< Child > | removeChild (Child *child)
| Remove a child WObject, so its lifetime is no longer determined by this WObject.
void | resetLearnedSlots ()
| Resets learned stateless slot implementations.
template<class T >
void | resetLearnedSlot (void(T::*method)())
| Resets a learned stateless slot implementation.
template<class T >
WStatelessSlot * | implementStateless (void(T::*method)())
| Declares a slot to be stateless and learn client-side behaviour on first invocation.
template<class T >
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)())
| Declares a slot to be stateless and learn client-side behaviour in advance.
void | isNotStateless ()
| Marks the current function as not stateless.
template<class T >
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode)
| Provides a JavaScript implementation for a method.
Public Member Functions inherited from Wt::Core::observable
| observable () noexcept
| Default constructor.
virtual | ~observable ()
| Destructor.
template<typename... Args, typename C >
auto | bindSafe (void(C::*method)(Args...)) noexcept
| Protects a method call against object destruction.
template<typename... Args, typename C >
auto | bindSafe (void(C::*method)(Args...) const) const noexcept
| Protects a const method call against object destruction.
template<typename Function >
auto | bindSafe (const Function &function) noexcept
| Protects a function against object destruction.

## Protected Member Functions
| WAbstractItemView ()
| Creates a new item view.
virtual void | dropEvent (const WDropEvent &event, const WModelIndex &target)
| Handles a drop event (drag & drop).
virtual void | dropEvent (const WDropEvent &event, const WModelIndex &index, Wt::Side side)
| Handles a drop event (drag & drop).
virtual std::unique_ptr< WWidget > | createExtraHeaderWidget (int column)
| Create an extra widget in the header.
WWidget * | extraHeaderWidget (int column)
| Returns the extra header widget.
virtual std::unique_ptr< WWidget > | createPageNavigationBar ()
| Returns a page navigation widget.
virtual void | handleClick (const WModelIndex &index, const WMouseEvent &event)
| Handles a click event.
virtual void | handleDoubleClick (const WModelIndex &index, const WMouseEvent &event)
| Handles a double click event.
virtual void | handleMouseDown (const WModelIndex &index, const WMouseEvent &event)
| Handles a mouse down event.
virtual void | handleMouseUp (const WModelIndex &index, const WMouseEvent &event)
| Handles a mouse up event.
virtual void | handleTouchSelect (const std::vector< WModelIndex > &indices, const WTouchEvent &event)
| Handles a touch select event.
virtual void | handleTouchStart (const std::vector< WModelIndex > &indices, const WTouchEvent &event)
| Handles a touch started event.
virtual void | handleTouchMove (const std::vector< WModelIndex > &indices, const WTouchEvent &event)
| Handles a touch moved event.
virtual void | handleTouchEnd (const std::vector< WModelIndex > &indices, const WTouchEvent &event)
| Handles a touch ended event.
virtual void | enableAjax () override
| Progresses to an Ajax-enabled widget.
virtual void | dropEvent (WDropEvent dropEvent)
| Handles a drop event.
Protected Member Functions inherited from Wt::WCompositeWidget
void | setImplementation (std::unique_ptr< WWidget > widget)
| Set the implementation widget.
template<typename Widget >
Widget * | setImplementation (std::unique_ptr< Widget > widget)
| Sets the implementation widget, returning a raw pointer.
template<typename W , typename... Args>
W * | setNewImplementation (Args &&... args)
| Creates the implementation widget and sets it, returning a raw pointer.
WWidget * | implementation ()
| Get the implementation widget.
virtual int | boxPadding (Orientation orientation) const override
| Returns the widget's built-in padding.
virtual int | boxBorder (Orientation orientation) const override
| Returns the widget's built-in border width.
virtual void | render (WFlags< RenderFlag > flags) override
| Renders the widget.
Protected Member Functions inherited from Wt::WWidget
void | setLayoutSizeAware (bool sizeAware)
| Sets the widget to be aware of its size set by a layout manager.
virtual void | layoutSizeChanged (int width, int height)
| Virtual method that indicates a size change.
| WWidget ()
| Creates a widget.
void | scheduleRender (WFlags< RepaintFlag > flags=None)
| Schedules rerendering of the widget.
virtual WStatelessSlot * | getStateless (Method method) override
| On-demand stateless slot implementation.
Protected Member Functions inherited from Wt::WObject

## Additional Inherited Members
Public Types inherited from Wt::WObject
typedef void(WObject::*) | Method()
| Typedef for a WObject method without arguments.
Static Public Member Functions inherited from Wt::WWidget
static WString | tr (const char *key)
| Short hand for WString::tr()
Static Public Member Functions inherited from Wt::WObject
Static Public Attributes inherited from Wt::WWidget
Protected Types inherited from Wt::WWidget
Static Protected Attributes inherited from Wt::WWidget

## Detailed Description

An abstract base class for item Views.

See WTableView or WTreeView for a description.

### i18n

The strings used in this class can be translated by overriding the default values for the following localization keys:

- Wt.WAbstractItemView.PageIOfN: {1} of {2}
- Wt.WAbstractItemView.PageBar.First: &#xc2ab; First
- Wt.WAbstractItemView.PageBar.Previous: &#xe280b9; Previous
- Wt.WAbstractItemView.PageBar.Next: Next &#xe280ba;
- Wt.WAbstractItemView.PageBar.Last: Last &#xc2bb;

## Member Function Documentation

## ◆ alternatingRowColors()

virtual bool Wt::WAbstractItemView::alternatingRowColors | ( |  | ) | const
| virtual

Returns whether alternating row colors are used.

When enabled, rows are displayed in alternating row colors, according to the current theme's definition.

See also
  setAlternatingRowColors()

## ◆ clearSelection()

void Wt::WAbstractItemView::clearSelection | ( |  | ) |

Clears the selection.

See also
  setSelectedIndexes()

## ◆ clicked()

Signal< WModelIndex, WMouseEvent > & Wt::WAbstractItemView::clicked | ( |  | ) |

Signal emitted when clicked.

When the event happened over an item, the first argument indicates the item that was clicked on.

See also
  doubleClicked()

## ◆ closeEditor()

void Wt::WAbstractItemView::closeEditor | ( | const WModelIndex & | index,
|  | bool | saveData = true )

Closes the editor for the given index.

If `saveData` is true, then the currently edited value is saved first to the model.

See also
  edit()

## ◆ closeEditors()

void Wt::WAbstractItemView::closeEditors | ( | bool | saveData = true | ) |

Closes all open editors.

If `saveData` is true, then the currently edited values are saved to the model before closing the editor.

See also
  closeEditor()

## ◆ columnAlignment()

virtual AlignmentFlag Wt::WAbstractItemView::columnAlignment | ( | int | column | ) | const
| virtual

Returns the content alignment for a column.

See also
  setColumnAlignment()

## ◆ columnResized()

Signal< int, WLength > & Wt::WAbstractItemView::columnResized | ( |  | ) |

Returns the signal emitted when a column is resized by the user.

The arguments of the signal are: the column index and the new width of the column.

## ◆ columnWidth()

WLength Wt::WAbstractItemView::columnWidth | ( | int | column | ) | const

Returns the column width.

See also
  setColumnWidth()

## ◆ createExtraHeaderWidget()

virtual std::unique_ptr< WWidget > Wt::WAbstractItemView::createExtraHeaderWidget | ( | int | column | ) |
| protectedvirtual

Create an extra widget in the header.

You may reimplement this method to provide an extra widget to be placed below the header label. The extra widget will be visible only if a multi-line header is configured using setHeaderHeight().

The widget is created only once, but this method may be called repeatedly for a column for which prior calls returned `0` (i.e. each time the header is rerendered).

The default implementation returns `0`.

See also
  setHeaderHeight(), extraHeaderWidget()

## ◆ createPageNavigationBar()

virtual std::unique_ptr< WWidget > Wt::WAbstractItemView::createPageNavigationBar | ( |  | ) |
| protectedvirtual

Returns a page navigation widget.

When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data, created by this method. The default implementation displays a simple navigation bar with (First, Prevous, Next, Last) buttons and a page counter.

You may want to reimplement this method to provide a custom page navigation bar. You can use the currentPage(), pageCount(), and setCurrentPage() methods to set or get the page information, and listen to the pageChanged() signal to react to changes.

## ◆ currentPage()

virtual int Wt::WAbstractItemView::currentPage | ( |  | ) | const
| pure virtual

Returns the current page.

When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This returns the current page (between 0 and pageCount() - 1).

See also
  createPageNavigationBar(), pageChanged()

Implemented in Wt::WTableView, and Wt::WTreeView.

## ◆ doubleClicked()

Signal< WModelIndex, WMouseEvent > & Wt::WAbstractItemView::doubleClicked | ( |  | ) |

Signal emitted when double clicked.

When the event happened over an item, the first argument indicates the item that was double clicked on.

See also
  clicked()

## ◆ dropEvent() [1/3]

virtual void Wt::WAbstractItemView::dropEvent | ( | const WDropEvent & | event,
|  | const WModelIndex & | index,
|  | Wt::Side | side )
| protectedvirtual

Handles a drop event (drag & drop).

The `event` object contains details about the drop operation, identifying the source (which provides the data) and the mime-type of the data. The drop was received relative to the `index` item and the `side` parameter will only be Wt::Top or Wt::Bottom.

A drop below the lowest item or on an empty view will result in a call to this method with an invalid index and side Wt::Bottom.

The drop event can be handled either by the view itself, or by the model. The default implementation checks if the mime-type is accepted by the model, and if so passes the drop event to the model as a DropAction::Move.

See also
  WAbstractItemModel::dropEvent()

## ◆ dropEvent() [2/3]

virtual void Wt::WAbstractItemView::dropEvent | ( | const WDropEvent & | event,
|  | const WModelIndex & | target )
| protectedvirtual

Handles a drop event (drag & drop).

The `event` object contains details about the drop operation, identifying the source (which provides the data) and the mime-type of the data. The drop was received on the `target` item.

The drop event can be handled either by the view itself, or by the model. The default implementation checks if the mime-type is accepted by the model, and if so passes the drop event to the model. If the source is the view's own selection model, then the drop event will be handled as a DropAction::Move, otherwise the drop event will be handled as a DropAction::Copy.

See also
  WAbstractItemModel::dropEvent()

## ◆ dropEvent() [3/3]

virtual void Wt::WWidget::dropEvent | ( | WDropEvent | dropEvent | ) |
| protectedvirtual

Handles a drop event.

Reimplement this method to handle a drop events for mime types you declared to accept using acceptDrops.

The default implementation simply completes the drag and drop operation as if nothing happened.

See also
  acceptDrops(), WInteractWidget::setDraggable()

Reimplemented from Wt::WWidget.

## ◆ edit()

void Wt::WAbstractItemView::edit | ( | const WModelIndex & | index | ) |

Opens an editor for the given index.

Unless multiple editors are enabled, any other open editor is closed first.

See also
  setEditTriggers(), setEditOptions(), closeEditor()

## ◆ editOptions()

WFlags< EditOption > Wt::WAbstractItemView::editOptions | ( |  | ) | const

Returns the editing options.

See also
  setEditOptions()

## ◆ editTriggers()

WFlags< EditTrigger > Wt::WAbstractItemView::editTriggers | ( |  | ) | const

Returns the editing triggers.

See also
  setEditTriggers()

## ◆ enableAjax()

virtual void Wt::WAbstractItemView::enableAjax | ( |  | ) |
| overrideprotectedvirtual

Progresses to an Ajax-enabled widget.

This method is called when the progressive bootstrap method is used, and support for AJAX has been detected. The default behavior will upgrade the widget's event handling to use AJAX instead of full page reloads, and propagate the call to its children.

You may want to reimplement this method if you want to make changes to widget when AJAX is enabled. You should always call the base implementation.

See also
  WApplication::enableAjax()

Reimplemented from Wt::WCompositeWidget.

Reimplemented in Wt::WTableView, and Wt::WTreeView.

## ◆ extraHeaderWidget()

WWidget * Wt::WAbstractItemView::extraHeaderWidget | ( | int | column | ) |
| protected

Returns the extra header widget.

Returns the widget previously created using createExtraHeaderWidget()

See also
  createExtraHeaderWidget()

## ◆ handleClick()

virtual void Wt::WAbstractItemView::handleClick | ( | const WModelIndex & | index,
|  | const WMouseEvent & | event )
| protectedvirtual

Handles a click event.

This processes the event for internal purposes (such as selection or editing) and emits the clicked() signal.

You may want to override this signal to override the built-in selection or editing behaviour.

## ◆ handleDoubleClick()

virtual void Wt::WAbstractItemView::handleDoubleClick | ( | const WModelIndex & | index,
|  | const WMouseEvent & | event )
| protectedvirtual

Handles a double click event.

This processes the event for internal purposes (such as editing) and emits the doubleClicked() signal.

You may want to override this signal to override the built-in editing behaviour.

## ◆ handleMouseDown()

virtual void Wt::WAbstractItemView::handleMouseDown | ( | const WModelIndex & | index,
|  | const WMouseEvent & | event )
| protectedvirtual

Handles a mouse down event.

This emits the mouseWentDown() signal.

## ◆ handleMouseUp()

virtual void Wt::WAbstractItemView::handleMouseUp | ( | const WModelIndex & | index,
|  | const WMouseEvent & | event )
| protectedvirtual

Handles a mouse up event.

This emits the mouseWentUp() signal.

## ◆ headerClicked()

Signal< int, WMouseEvent > & Wt::WAbstractItemView::headerClicked | ( |  | ) |

Signal emitted when a header item is clicked.

The argument that is passed is the column number.

See also
  clicked(), headerDblClicked()

## ◆ headerDoubleClicked()

Signal< int, WMouseEvent > & Wt::WAbstractItemView::headerDoubleClicked | ( |  | ) |

Signal emitted when a header item is double clicked.

The argument that is passed is the column number.

See also
  doubleClicked(), headerClicked()

## ◆ headerHeight()

const WLength & Wt::WAbstractItemView::headerHeight | ( |  | ) | const

Returns the header height.

See also
  setHeaderHeight()

## ◆ headerItemDelegate()

std::shared_ptr< WAbstractItemDelegate > Wt::WAbstractItemView::headerItemDelegate | ( |  | ) | const

Returns the header item delegate.

See also
  setHeaderItemDelegate()

## ◆ headerMouseWentDown()

Signal< int, WMouseEvent > & Wt::WAbstractItemView::headerMouseWentDown | ( |  | ) |

Signal emitted when a mouse button is pressed on a header item

The argument that is passed is the column number.

See also
  headerMouseWentDownUp()

## ◆ headerMouseWentUp()

Signal< int, WMouseEvent > & Wt::WAbstractItemView::headerMouseWentUp | ( |  | ) |

Signal emitted when a mouse button is released on a header item

The argument that is passed is the column number.

See also
  headerMouseWentDown()

## ◆ hideColumn()

void Wt::WAbstractItemView::hideColumn | ( | int | column | ) |

Hides a column.

See also
  showColumn(), setColumnHidden()

## ◆ horizontalHeaderAlignment()

AlignmentFlag Wt::WAbstractItemView::horizontalHeaderAlignment | ( | int | column | ) | const

Returns the horizontal header alignment for a column.

See also
  setHeaderAlignment()

## ◆ isColumnHidden()

bool Wt::WAbstractItemView::isColumnHidden | ( | int | column | ) | const

Returns if a column is hidden.

See also
  setColumnHidden()

## ◆ isColumnResizeEnabled()

bool Wt::WAbstractItemView::isColumnResizeEnabled | ( |  | ) | const

Returns whether column resizing is enabled.

See also
  setColumnResizeEnabled()

## ◆ isEditing()

bool Wt::WAbstractItemView::isEditing | ( | const WModelIndex & | index | ) | const

Returns whether an editor is open for a given index.

See also
  edit()

## ◆ isSelected()

bool Wt::WAbstractItemView::isSelected | ( | const WModelIndex & | index | ) | const

Returns wheter an item is selected.

When selection operates on rows (SelectionBehavior::Rows), this method returns true for each element in a selected row.

This is a convenience method for:

selectionModel()->isSelected(index)
Wt::WAbstractItemView::selectionModel
WItemSelectionModel * selectionModel() const
Returns the selection model.
Definition WAbstractItemView.h:392
Wt::WItemSelectionModel::isSelected
bool isSelected(const WModelIndex &index) const
Returns wheter an item is selected.

See also
  selectedIndexes(), select(), selectionModel()

## ◆ isSortingEnabled() [1/2]

bool Wt::WAbstractItemView::isSortingEnabled | ( |  | ) | const

Returns whether sorting is enabled.

See also
  setSortingEnabled()

## ◆ isSortingEnabled() [2/2]

bool Wt::WAbstractItemView::isSortingEnabled | ( | int | column | ) | const

Returns whether sorting is enabled for a single column.

See also
  setSortingEnabled()

## ◆ itemDelegate() [1/3]

std::shared_ptr< WAbstractItemDelegate > Wt::WAbstractItemView::itemDelegate | ( |  | ) | const

Returns the default item delegate.

See also
  setItemDelegate()

## ◆ itemDelegate() [2/3]

std::shared_ptr< WAbstractItemDelegate > Wt::WAbstractItemView::itemDelegate | ( | const WModelIndex & | index | ) | const

Returns the delegate for rendering an item.

See also
  setItemDelegateForColumn(), setItemDelegate()

## ◆ itemDelegate() [3/3]

std::shared_ptr< WAbstractItemDelegate > Wt::WAbstractItemView::itemDelegate | ( | int | column | ) | const

Returns the delegate for a column.

Returns either the delegate that was set for the column, or the default delegate.

## ◆ itemDelegateForColumn()

std::shared_ptr< WAbstractItemDelegate > Wt::WAbstractItemView::itemDelegateForColumn | ( | int | column | ) | const

Returns the delegate that was set for a column.

Returns `0` if no delegate was set for the column.

See also
  setItemDelegateForColumn()

## ◆ itemWidget()

virtual WWidget * Wt::WAbstractItemView::itemWidget | ( | const WModelIndex & | index | ) | const
| pure virtual

Returns the widget that renders an item.

This returns the widget that renders the given item. This may return 0 if the item is currently not rendered.

This widget has been created by an item delegate, and usually an item delegate is involved when updating it.

Implemented in Wt::WTableView, and Wt::WTreeView.

## ◆ keyPressed()

EventSignal< WKeyEvent > & Wt::WAbstractItemView::keyPressed | ( |  | ) |

Event signal emitted when a "character" was entered.

The keyPressed signal is emitted when a key is pressed, and a character is entered. Unlike keyWentDown(), it is emitted only for key presses that result in a character being entered, and thus not for modifier keys or keyboard navigation keys.

See also
  keyWentDown()

## ◆ keyWentDown()

EventSignal< WKeyEvent > & Wt::WAbstractItemView::keyWentDown | ( |  | ) |

Event signal emitted when a keyboard key is pushed down.

The keyWentDown signal is the first signal emitted when a key is pressed (before the keyPressed signal). Unlike keyPressed() however it is also emitted for modifier keys (such as "shift", "control", ...) or keyboard navigation keys that do not have a corresponding character.

See also
  keyPressed(), keyWentUp()

## ◆ keyWentUp()

EventSignal< WKeyEvent > & Wt::WAbstractItemView::keyWentUp | ( |  | ) |

Event signal emitted when a keyboard key is released.

This is the counter-part of the keyWentDown() event. Every key-down has its corresponding key-up.

See also
  keyWentDown()

## ◆ model()

std::shared_ptr< WAbstractItemModel > Wt::WAbstractItemView::model | ( |  | ) | const

Returns the model.

See also
  setModel()

## ◆ mouseWentDown()

Signal< WModelIndex, WMouseEvent > & Wt::WAbstractItemView::mouseWentDown | ( |  | ) |

Signal emitted when a mouse button is pressed down.

This signal is emitted only when 'over' an item (the model index is passed as first argument is never invalid).

See also
  mouseWentUp()

## ◆ mouseWentUp()

Signal< WModelIndex, WMouseEvent > & Wt::WAbstractItemView::mouseWentUp | ( |  | ) |

Signal emitted when the mouse button is released.

When the event happened over an item, the first argument indicates the item where the mouse went up.

See also
  mouseWentDown()

## ◆ pageChanged()

Signal & Wt::WAbstractItemView::pageChanged | ( |  | ) |

Signal emitted when page information was updated.

When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This signal is emitted when page-related information changed (e.g. the current page was changed, or the number of rows was changed).

See also
  createPageNavigationBar()

## ◆ pageCount()

virtual int Wt::WAbstractItemView::pageCount | ( |  | ) | const
| pure virtual

Returns the number of pages.

When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This returns the number of pages currently shown.

See also
  createPageNavigationBar(), pageChanged()

Implemented in Wt::WTableView, and Wt::WTreeView.

## ◆ pageSize()

virtual int Wt::WAbstractItemView::pageSize | ( |  | ) | const
| pure virtual

Returns the page size.

When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This returns the number of items per page.

See also
  createPageNavigationBar(), pageChanged()

Implemented in Wt::WTableView, and Wt::WTreeView.

## ◆ rootIndex()

const WModelIndex & Wt::WAbstractItemView::rootIndex | ( |  | ) | const

Returns the root index.

See also
  setRootIndex()

## ◆ rowHeaderCount()

int Wt::WAbstractItemView::rowHeaderCount | ( |  | ) | const

Returns the number of columns that are used as row headers.

See also
  setRowHeaderCount()

## ◆ scrolled()

virtual EventSignal< WScrollEvent > & Wt::WAbstractItemView::scrolled | ( |  | ) |
| pure virtual

Signal emitted when scrolling.

Note
  Works only if ajax is available.

Implemented in Wt::WTableView, and Wt::WTreeView.

## ◆ scrollTo()

virtual void Wt::WAbstractItemView::scrollTo | ( | const WModelIndex & | index,
|  | ScrollHint | hint = ScrollHint::EnsureVisible )
| pure virtual

Scrolls the view to an item.

Scrolls the view to ensure that the item which represents the provided `index` is visible. A `hint` may indicate how the item should appear in the viewport (if possible).

Note
  Currently only implemented to scroll to the correct row, not taking into account the column.

Implemented in Wt::WTableView, and Wt::WTreeView.

## ◆ select()

void Wt::WAbstractItemView::select | ( | const WModelIndex & | index,
|  | SelectionFlag | option = SelectionFlag::Select )

Selects a single item.

See also
  setSelectedIndexes(), selectionModel()

## ◆ selectedIndexes()

WModelIndexSet Wt::WAbstractItemView::selectedIndexes | ( |  | ) | const

Returns the set of selected items.

The model indexes are returned as a set, topologically ordered (in the order they appear in the view).

When selection operates on rows (SelectionBehavior::Rows), this method only returns the model index of first column's element of the selected rows.

This is a convenience method for:

selectionModel()->selectedIndexes()
Wt::WItemSelectionModel::selectedIndexes
WModelIndexSet selectedIndexes() const
Returns the set of selected items.
Definition WItemSelectionModel.h:58

See also
  setSelectedIndexes()

## ◆ selectionBehavior()

SelectionBehavior Wt::WAbstractItemView::selectionBehavior | ( |  | ) | const

Returns the selection behaviour.

See also
  setSelectionBehavior()

## ◆ selectionChanged()

Signal & Wt::WAbstractItemView::selectionChanged | ( |  | ) |

Signal emitted when the selection is changed.

See also
  select(), setSelectionMode(), setSelectionBehavior()

## ◆ selectionMode()

SelectionMode Wt::WAbstractItemView::selectionMode | ( |  | ) | const

Returns the selection mode.

See also
  setSelectionMode()

## ◆ selectionModel()

WItemSelectionModel * Wt::WAbstractItemView::selectionModel | ( |  | ) | const

Returns the selection model.

The selection model keeps track of the currently selected items.

## ◆ setAlternatingRowColors()

virtual void Wt::WAbstractItemView::setAlternatingRowColors | ( | bool | enable | ) |
| virtual

Sets if alternating row colors are to be used.

Configure whether rows get alternating background colors, defined by the current CSS theme.

The default value is `false`.

Reimplemented in Wt::WTableView, and Wt::WTreeView.

## ◆ setColumnAlignment()

virtual void Wt::WAbstractItemView::setColumnAlignment | ( | int | column,
|  | AlignmentFlag | alignment )
| virtual

Sets the content alignment for a column.

The default value is Wt::AlignmentFlag::Left.

See also
  setHeaderAlignment()

## ◆ setColumnHidden()

virtual void Wt::WAbstractItemView::setColumnHidden | ( | int | column,
|  | bool | hide )
| virtual

Changes the visibility of a column.

See also
  isColumnHidden()

Reimplemented in Wt::WTableView, and Wt::WTreeView.

## ◆ setColumnResizeEnabled()

void Wt::WAbstractItemView::setColumnResizeEnabled | ( | bool | enabled | ) |

Enables interactive column resizing.

Enable or disable column resize handles for interactive resizing of the columns.

Column resizing is enabled by default when JavaScript is available.

See also
  setColumnResizeEnabled()

## ◆ setColumnWidth()

virtual void Wt::WAbstractItemView::setColumnWidth | ( | int | column,
|  | const WLength & | width )
| pure virtual

Sets the column width.

The default column width is 150 pixels.

Note
  The width must be specified in LengthUnit::Pixel units.
  The actual space occupied by each column is the column width augmented by 7 pixels for internal padding and a border.

Implemented in Wt::WTableView, and Wt::WTreeView.

## ◆ setCurrentPage()

virtual void Wt::WAbstractItemView::setCurrentPage | ( | int | page | ) |
| pure virtual

Sets the current page.

When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This method can be used to change the current page.

See also
  createPageNavigationBar(), pageChanged()

Implemented in Wt::WTableView, and Wt::WTreeView.

## ◆ setDragEnabled()

void Wt::WAbstractItemView::setDragEnabled | ( | bool | enable | ) |

Enables the selection to be dragged (drag & drop).

To enable dragging of the selection, you first need to enable selection using setSelectionMode().

Whether an individual item may be dragged is controlled by the item's ItemFlag::DragEnabled flag. The selection can be dragged only if all items currently selected can be dragged.

See also
  setDropsEnabled()

## ◆ setDropsEnabled()

void Wt::WAbstractItemView::setDropsEnabled | ( | bool | enable | ) |

Enables drop operations (drag & drop).

When drop is enabled, the tree view will indicate that something may be dropped when the mime-type of the dragged object is compatible with one of the model's accepted drop mime-types (see WAbstractItemModel::acceptDropMimeTypes()) or this widget's accepted drop mime-types (see WWidget::acceptDrops()), and the target item has drop enabled (which is controlled by the item's ItemFlag::DropEnabled flag).

Drop events must be handled in dropEvent().

Deprecated
  Use setEnabledDropLocations() instead. This method now enables DropLocation::OnItem.

See also
  setDragEnabled(), dropEvent()

## ◆ setEditOptions()

void Wt::WAbstractItemView::setEditOptions | ( | WFlags< EditOption > | options | ) |

Configures editing options.

The default value is SingleEditor;

## ◆ setEditTriggers()

void Wt::WAbstractItemView::setEditTriggers | ( | WFlags< EditTrigger > | editTriggers | ) |

Configures what actions should trigger editing.

The default value is DoubleClicked.

See also
  edit()

## ◆ setEnabledDropLocations()

void Wt::WAbstractItemView::setEnabledDropLocations | ( | WFlags< DropLocation > | droplocation | ) |

Enables drop operations (drag & drop).

When drop is enabled, the tree view will indicate that something may be dropped when the mime-type of the dragged object is compatible with one of the model's accepted drop mime-types (see WAbstractItemModel::acceptDropMimeTypes()) or this widget's accepted drop mime-types (see WWidget::acceptDrops()).

When DropLocation::OnItem is enabled, the view will allow drops on items that have the ItemFlag::DropEnabled flag set. When DropLocation::BetweenRows is enabled, the view will indicate that something may be dropped between any two rows. When DropLocation::OnItem and DropLocation::BetweenRows are both enabled, the drop indication differs depending on whether ItemFlag::DropEnabled is set on the item.

Drop events must be handled in dropEvent().

## ◆ setHeaderAlignment()

virtual void Wt::WAbstractItemView::setHeaderAlignment | ( | int | column,
|  | WFlags< AlignmentFlag > | alignment )
| virtual

Sets the header alignment for a column.

The default alignemnt is horizontally left, and vertically centered. (Wt::AlignmentFlag::Left | Wt::AlignmentFlag::Middle).

Valid options for horizontal alignment are Wt::AlignmentFlag::Left, Wt::AlignmentFlag::Center or Wt::AlignmentFlag::Right.

Valid options for vertical alignment are Wt::AlignmentFlag::Middle or Wt::AlignmentFlag::Top. In the latter case, other contents may be added below the label in createExtraHeaderWidget().

See also
  setColumnAlignment()

## ◆ setHeaderClickSortEnabled()

void Wt::WAbstractItemView::setHeaderClickSortEnabled | ( | bool | enabled | ) |

Alow to sort.

When enabeld the view can be sorted by clicking on the header.

## ◆ setHeaderHeight()

virtual void Wt::WAbstractItemView::setHeaderHeight | ( | const WLength & | height | ) |
| virtual

Sets the header height.

The default value is 20 pixels.

Note
  The height must be specified in LengthUnit::Pixel units.

Reimplemented in Wt::WTableView, and Wt::WTreeView.

## ◆ setHeaderItemDelegate()

void Wt::WAbstractItemView::setHeaderItemDelegate | ( | const std::shared_ptr< WAbstractItemDelegate > & | delegate | ) |

Sets the header item delegate.

This item delegate is used for rendering items in the header.

The previous delegate is not deleted. This item delegate is for all columns for which no specific item delegate is set.

The default item delegate is a WItemDelegate.

## ◆ setHeaderWordWrap()

void Wt::WAbstractItemView::setHeaderWordWrap | ( | int | column,
|  | bool | enabled )

Configures header text wrapping.

This setting only affects a multiline header, and the default value is `true`. When set to `false`, the header itself will not wrap (as with a vertically centered header), and thus extra widgets will not shift down when there is a long header label.

## ◆ setItemDelegate()

void Wt::WAbstractItemView::setItemDelegate | ( | const std::shared_ptr< WAbstractItemDelegate > & | delegate | ) |

Sets the default item delegate.

The previous delegate is not deleted. This item delegate is for all columns for which no specific item delegate is set.

The default item delegate is a WItemDelegate.

See also
  setItemDelegateForColumn()

## ◆ setItemDelegateForColumn()

void Wt::WAbstractItemView::setItemDelegateForColumn | ( | int | column,
|  | const std::shared_ptr< WAbstractItemDelegate > & | delegate )

Sets the delegate for a column.

A delegate previously set (if any) is not deleted.

See also
  setItemDelegate()

## ◆ setModel()

virtual void Wt::WAbstractItemView::setModel | ( | const std::shared_ptr< WAbstractItemModel > & | model | ) |
| virtual

Sets the model.

The View will display data of the given `model` and changes in the model are reflected by the View.

The initial model is `0`.

See also
  setRootIndex()

Reimplemented in Wt::WTableView, and Wt::WTreeView.

## ◆ setRootIndex()

void Wt::WAbstractItemView::setRootIndex | ( | const WModelIndex & | rootIndex | ) |

Sets the root index.

The root index is the model index that is considered the root node. This node itself is not rendered, but its children are.

The default value is an invalid model index, corresponding to the model's root node.

See also
  setModel()

## ◆ setRowHeaderCount()

virtual void Wt::WAbstractItemView::setRowHeaderCount | ( | int | count | ) |
| virtual

Configures the number of columns that are used as row headers.

An item view does not use the vertical header data from the model in any way, but instead you can configure data in the first column(s) to be used as a row headers.

These columns will not scroll horizontally together with the rest of the model.

The default value is 0.

Note
  Currently, this property must be set before any other settings of the view and only a value of 0 or 1 is supported.

Reimplemented in Wt::WTableView, and Wt::WTreeView.

## ◆ setRowHeight()

virtual void Wt::WAbstractItemView::setRowHeight | ( | const WLength & | rowHeight | ) |
| virtual

Sets the row height.

The view renders all rows with a same height. This method configures this row height.

The default value is 20 pixels.

Note
  The height must be specified in LengthUnit::Pixel units.

See also
  setColumnWidth()

Reimplemented in Wt::WTableView, and Wt::WTreeView.

## ◆ setSelectedIndexes()

void Wt::WAbstractItemView::setSelectedIndexes | ( | const WModelIndexSet & | indexes | ) |

Sets the selected items.

Replaces the current selection with `indexes`.

When selection operates on rows (SelectionBehavior::Rows), it is sufficient to pass the first element in a row (column `0` ) to select the entire row.

See also
  select(), selectionModel()

## ◆ setSelectionBehavior()

void Wt::WAbstractItemView::setSelectionBehavior | ( | SelectionBehavior | behavior | ) |

Changes the selection behaviour.

The selection behavior indicates whether whole rows or individual items can be selected. It is a property of the selectionModel().

By default, selection operates on rows (SelectionBehavior::Rows), in which case model indexes will always be in the first column (column `0`).

Alternatively, you can allow selection for individual items (SelectionBehavior::Items)

See also
  WItemSelectionModel::setSelectionBehavior(), setSelectionMode()

## ◆ setSelectionMode()

void Wt::WAbstractItemView::setSelectionMode | ( | SelectionMode | mode | ) |

Sets the selection mode.

By default selection is disabled (SelectionMode::None).

See also
  setSelectionBehavior()

## ◆ setSortingEnabled() [1/2]

void Wt::WAbstractItemView::setSortingEnabled | ( | bool | enabled | ) |

Enables or disables sorting for all columns.

Enable or disable sorting by the user on all columns.

Sorting is enabled by default.

See also
  WAbstractItemModel::sort()

## ◆ setSortingEnabled() [2/2]

void Wt::WAbstractItemView::setSortingEnabled | ( | int | column,
|  | bool | enabled )

Enables or disables sorting for a single column.

Enable or disable sorting by the user for a specific column.

Sorting is enabled by default.

See also
  WAbstractItemModel::sort()

## ◆ showColumn()

void Wt::WAbstractItemView::showColumn | ( | int | column | ) |

Shows a column.

See also
  hideColumn(), setColumnHidden()

## ◆ sortByColumn()

void Wt::WAbstractItemView::sortByColumn | ( | int | column,
|  | SortOrder | order )

Sorts the data according to a column.

Sorts the data according to data in column `column` and sort order `order`.

The default sorting column is -1: the model is unsorted.

See also
  WAbstractItemModel::sort()

## ◆ sortColumn()

int Wt::WAbstractItemView::sortColumn | ( |  | ) | const

Returns the current sorting columm.

See also
  sortByColumn(), sortOrder()

## ◆ sortEnabled()

bool Wt::WAbstractItemView::sortEnabled | ( |  | ) |

Returns whether the view is sortable.

When enabeld the view can be sorted by clicking on the header.

## ◆ sortOrder()

SortOrder Wt::WAbstractItemView::sortOrder | ( |  | ) | const

Returns the current sorting order.

See also
  sortByColumn(), sortColumn()

## ◆ touchEnded()

Signal< std::vector< WModelIndex >, WTouchEvent > & Wt::WAbstractItemView::touchEnded | ( |  | ) |

Signal emitted when one or more fingers are removed from the screen.

When the event happened over an item, the first argument indicates the items where the touch ended. The indices in the model index vector match the indices in the changedTouches() of the WTouchEvent.

Note
  When JavaScript is disabled, the signal will never fire.

## ◆ touchMoved()

Signal< std::vector< WModelIndex >, WTouchEvent > & Wt::WAbstractItemView::touchMoved | ( |  | ) |

Signal emitted when one or more fingers are moved on the screen.

When the event happened over an item, the first argument indicates the items that were touched. The indices in the model index vector match the indices in the changedTouches() of the WTouchEvent.

## ◆ touchStart()

Signal< WModelIndex, WTouchEvent > & Wt::WAbstractItemView::touchStart | ( |  | ) |

Signal emitted when a finger is placed on the screen.

When the event happened over an item, the first argument indicates the item that was touched.

Deprecated
  Use touchStarted() instead.

## ◆ touchStarted()

Signal< std::vector< WModelIndex >, WTouchEvent > & Wt::WAbstractItemView::touchStarted | ( |  | ) |

Signal emitted when one or more fingers are placed on the screen.

When the event happened over an item, the first argument indicates the items that were touched. The indices in the model index vector match the indices in the changedTouches() of the WTouchEvent.

## ◆ validateEditor()

ValidationState Wt::WAbstractItemView::validateEditor | ( | const WModelIndex & | index | ) |

Validates the editor for the given index.

Validation is done by invoking WAbstractItemDelegate::validate().

## ◆ validateEditors()

ValidationState Wt::WAbstractItemView::validateEditors | ( |  | ) |

Validates all editors.

See also
  validateEditor().

## ◆ verticalHeaderAlignment()

AlignmentFlag Wt::WAbstractItemView::verticalHeaderAlignment | ( | int | column | ) | const

Returns the vertical header alignment for a column.

See also
  setHeaderAlignment()