Quark  0.1
BasicFilterTableModel< T, IS, OS > Class Template Reference

An abstract subclass of QSortFilterProxyModel for sorting and filtering of AbstractTableModels. More...

#include <BasicFilterTableModel.h++>

Inheritance diagram for BasicFilterTableModel< T, IS, OS >:

Public Member Functions

virtual ~BasicFilterTableModel ()
 Destructor. More...
 
T * getItemForIndex (const QModelIndex &index) const
 Returns the filtered item at the given index in this model. More...
 
int itemCount () const
 Returns the number of (filtered) items in this model. More...
 
bool isEmpty () const
 Tests if this model is empty. More...
 
T * getItemAt (int row) const
 Returns the filtered item at the given row in this model. More...
 
void setEditable (bool editable)
 Sets the editability of this model. More...
 
bool isEditable () const
 Tests whether this model is editable. More...
 
AbstractTableModel< T, IS, OS > * sourceModel () const
 Returns this filter model's source model. More...
 

Protected Member Functions

 BasicFilterTableModel (AbstractTableModel< T, IS, OS > *sourceModel, QObject *parent=NULL)
 Constructs a new BasicFilterTableModel with the given source model. More...
 
virtual bool filterAcceptsItem (const T &item) const
 Called to test whether a given item in the model is accepted by this filter. More...
 
virtual bool filterAcceptsField (int field) const
 Called to test whether a given field in the model is accepted by this filter. More...
 
virtual bool fieldLessThan (int field, const QVariant &value1, const QVariant &value2) const
 Compares the values of a given field of two items in the model, for the purpose of sorting. More...
 

Detailed Description

template<class T, class IS = QDataStream, class OS = QDataStream>
class quark::gui::BasicFilterTableModel< T, IS, OS >

An abstract subclass of QSortFilterProxyModel for sorting and filtering of AbstractTableModels.

Subclasses must provide a suitable public constructor and implement filterAcceptsItem(), filterAcceptsField() and/or fieldLessThan().

Template Parameters
TThe type template parameter of the AbstractTableModel.
ISThe input stream template parameter of the AbstractTableModel.
OSThe output stream template parameter of the AbstractTableModel.
Author
Mark Lindner

Constructor & Destructor Documentation

◆ ~BasicFilterTableModel()

virtual ~BasicFilterTableModel ( )
virtual

Destructor.

◆ BasicFilterTableModel()

BasicFilterTableModel ( AbstractTableModel< T, IS, OS > *  sourceModel,
QObject *  parent = NULL 
)
protected

Constructs a new BasicFilterTableModel with the given source model.

Member Function Documentation

◆ fieldLessThan()

virtual bool fieldLessThan ( int  field,
const QVariant &  value1,
const QVariant &  value2 
) const
protectedvirtual

Compares the values of a given field of two items in the model, for the purpose of sorting.

The default implementation compares the string representations of the two values.

Parameters
fieldThe field number.
value1The field's value in the first item.
value2The field's value in the second item.
Returns
true if value1 < value2, false otherwise.

◆ filterAcceptsField()

virtual bool filterAcceptsField ( int  field) const
protectedvirtual

Called to test whether a given field in the model is accepted by this filter.

The default implementation is a no-op that returns true.

Parameters
fieldThe field number to filter.
Returns
true if the filter accepts the ifield, false otherwise.

◆ filterAcceptsItem()

virtual bool filterAcceptsItem ( const T &  item) const
protectedvirtual

Called to test whether a given item in the model is accepted by this filter.

The default implementation is a no-op that returns true.

Parameters
itemThe item to filter.
Returns
true if the filter accepts the item, false otherwise.

◆ getItemAt()

T* getItemAt ( int  row) const

Returns the filtered item at the given row in this model.

◆ getItemForIndex()

T* getItemForIndex ( const QModelIndex &  index) const

Returns the filtered item at the given index in this model.

◆ isEditable()

bool isEditable ( ) const

Tests whether this model is editable.

◆ isEmpty()

bool isEmpty ( ) const

Tests if this model is empty.

◆ itemCount()

int itemCount ( ) const

Returns the number of (filtered) items in this model.

◆ setEditable()

void setEditable ( bool  editable)

Sets the editability of this model.

◆ sourceModel()

AbstractTableModel<T, IS, OS>* sourceModel ( ) const
inline

Returns this filter model's source model.


The documentation for this class was generated from the following file: