Wt
3.2.1
|
A class that represents a selection for a WAbstractItemView. More...
#include <Wt/WItemSelectionModel>
Public Member Functions | |
WAbstractItemModel * | model () const |
Returns the WAbstractItemModel. | |
WModelIndexSet | selectedIndexes () const |
Returns the set of selected items. | |
bool | isSelected (const WModelIndex &index) const |
Returns wheter an item is selected. | |
void | setSelectionBehavior (SelectionBehavior behavior) |
Sets the selection behaviour. | |
SelectionBehavior | selectionBehavior () const |
Returns the selection behaviour. | |
![]() | |
WObject (WObject *parent=0) | |
Create a WObject with a given parent object. | |
virtual | ~WObject () |
Destructor. | |
virtual const std::string | id () const |
Returns the (unique) identifier for this object. | |
void | setObjectName (const std::string &name) |
Sets an object name. | |
virtual std::string | objectName () const |
Returns the object name. | |
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. | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. | |
void | addChild (WObject *child) |
Adds a child object. | |
virtual void | removeChild (WObject *child) |
Removes a child object. | |
const std::vector< WObject * > & | children () const |
Returns the children. | |
WObject * | parent () const |
Returns the parent object. |
Additional Inherited Members | |
![]() | |
typedef void(WObject::* | Method )() |
Typedef for a WObject method without arguments. | |
![]() | |
virtual WStatelessSlot * | getStateless (Method method) |
On-demand stateless slot implementation. | |
![]() | |
static WObject * | sender () |
Returns the sender of the current slot call. |
A class that represents a selection for a WAbstractItemView.
This model is currently only used by WTreeView, and plays only a role in drag & drop of an item selection.
When an item selection is dragged from a view widget, the generated drop events will have as source object (see WDropEvent::source()) this selection model.
Although this class does not (yet) allow you to modify the selection, note that manipulations to the model may modify the selection (row insertions and removals may shift the selection, and row deletions may shrink the selection).
bool Wt::WItemSelectionModel::isSelected | ( | const WModelIndex & | index | ) | const |
Returns wheter an item is selected.
When selection operates on rows (SelectRows), this method returns true for each element in a selected row.
WModelIndexSet Wt::WItemSelectionModel::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 (SelectRows), this method only returns the model index of first column's element of the selected rows.
SelectionBehavior Wt::WItemSelectionModel::selectionBehavior | ( | ) | const |
Returns the selection behaviour.
void Wt::WItemSelectionModel::setSelectionBehavior | ( | SelectionBehavior | behavior | ) |
Sets the selection behaviour.
By default, the selection contains rows (SelectRows), in which case model indexes will always be have column 0, but represent the whole row.
Alternatively, you can allow selection for individual items (SelectItems).