QAdvanced Item View  0.4
The QAIV (Qt Advanced Item Views) library provides GUI and utility classes extending the capabilities of the Qt item views.
 All Classes Functions Variables Enumerations Enumerator Properties Groups Pages
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
QAbstractFilter Class Referenceabstract

The QAbstractFilter class provides a base class for filter definitions used with a QAdvancedTableView. More...

#include <qabstractfilter.h>

Inheritance diagram for QAbstractFilter:
QAutoFilter QRangeFilter QRegExpFilter QSelectionListFilter QSpecialFilter QTextFilter QValueFilter

Public Types

enum  { Type = -1 }
 

Public Member Functions

 QAbstractFilter ()
 
 QAbstractFilter (const QMap< QString, QVariant > &properties)
 
 ~QAbstractFilter ()
 
int column () const
 
virtual void addContextMenuActions (QMenu *menu, QWidget *receiver)
 
virtual QWidget * createEditor (QFilterViewItemDelegate *delegate, QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const =0
 
virtual QVariant data (int role=Qt::DisplayRole) const =0
 
QColor highlightColor () const
 
bool isEnabled () const
 
bool isValid () const
 
virtual bool matches (const QVariant &value, int type=-1) const =0
 
QVariant property (const QString &key, const QVariant &defaultValue=QVariant()) const
 
QMap< QString, QVariant > properties () const
 
int row () const
 
virtual void setEditorData (QWidget *editor, const QModelIndex &index)=0
 
void setHighlightColor (const QColor &color)
 
virtual void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index)=0
 
void setEnabled (bool on)
 
void setProperty (const QString &name, const QVariant &value)
 
int type () const
 
virtual void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index)=0
 

Static Public Attributes

static const int UserType = 65536
 

Protected Member Functions

 QAbstractFilter (int type, int row, int column)
 

Friends

class QAbstractFilterModel
 

Detailed Description

The QAbstractFilter class provides a base class for filter definitions used with a QAdvancedTableView.

A QAbstractFilter provides the interface and common functionality for filters used with the QAdvancedTableView or QFilterModel.

Properties

Properties of a QAbstractFilter can be saved and retrieved using setProperty() and property().

Constructor & Destructor Documentation

QAbstractFilter::QAbstractFilter ( )

Constructs an abstract (invalid) filter.

QAbstractFilter::QAbstractFilter ( const QMap< QString, QVariant > &  properties)

Constructs a QAbstractFilter with the given properties.

QAbstractFilter::~QAbstractFilter ( )

Destroys the abstract filter.

QAbstractFilter::QAbstractFilter ( int  type,
int  row,
int  column 
)
protected

Constructs a filter definition with the given type and column index.

Member Function Documentation

void QAbstractFilter::addContextMenuActions ( QMenu *  menu,
QWidget *  receiver 
)
virtual

Adds the context menu actions of this filter to given menu. The actions are connected to the specified receiver.

Remarks
The default implementation does nothing.

Reimplemented in QSpecialFilter, and QTextFilter.

int QAbstractFilter::column ( ) const

Returns the column for which the filter is defined.

virtual QWidget* QAbstractFilter::createEditor ( QFilterViewItemDelegate delegate,
QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
pure virtual

Returns the editor to be used for editing the filter data. The editor's parent widget is specified by parent, and the item options by option.

Implemented in QSpecialFilter, QRangeFilter, QValueFilter, QAutoFilter, QTextFilter, QSelectionListFilter, and QRegExpFilter.

virtual QVariant QAbstractFilter::data ( int  role = Qt::DisplayRole) const
pure virtual

Returns the filter's data for the given role, or an invalid QVariant if there is no data for the role.

Implemented in QSpecialFilter, QRangeFilter, QValueFilter, QAutoFilter, QTextFilter, QSelectionListFilter, and QRegExpFilter.

QColor QAbstractFilter::highlightColor ( ) const

Returns the color used to highlight rows matching this filter.

bool QAbstractFilter::isEnabled ( ) const

Returns true if the filter is enabled; Otherwise false. ()

bool QAbstractFilter::isValid ( ) const

Returns true if the filter definition is valid. Otherwise false.

virtual bool QAbstractFilter::matches ( const QVariant &  value,
int  type = -1 
) const
pure virtual

Returns true if the given value with the conditions defined by this filter. Otherwise false.

Implemented in QSpecialFilter, QRangeFilter, QSelectionListFilter, QValueFilter, QAutoFilter, QTextFilter, and QRegExpFilter.

QMap< QString, QVariant > QAbstractFilter::properties ( ) const

Returns the filter's properties.

QVariant QAbstractFilter::property ( const QString &  key,
const QVariant &  defaultValue = QVariant() 
) const

Returns the value of the property specified by the given key.

int QAbstractFilter::row ( ) const

Returns the number of the row (group) that contains this filter.

virtual void QAbstractFilter::setEditorData ( QWidget *  editor,
const QModelIndex &  index 
)
pure virtual

Sets the contents of the given editor to the data for the filter at the given index. Note that the index contains information about the model being used.

Implemented in QSpecialFilter, QSelectionListFilter, QRangeFilter, QValueFilter, QAutoFilter, QTextFilter, and QRegExpFilter.

void QAbstractFilter::setEnabled ( bool  on)

If on is true the filter is set to enabled, otherwise the filter is set to disabled.

See also
isEnabled()
void QAbstractFilter::setHighlightColor ( const QColor &  color)

Sets the color to hightlight rows matching this filter.

See also
highlightColor();
void QAbstractFilter::setProperty ( const QString &  name,
const QVariant &  value 
)

Sets the filter definition's property specified by key to the given value.

int QAbstractFilter::type ( ) const

Returns the filter defintion's type.

Member Data Documentation

const int QAbstractFilter::UserType = 65536
static

The lowest permitted type value for custom items (subclasses of QAbstractFilter or any of the standard filter). This value is used in conjunction with a reimplementation of QGraphicsItem::type() and declaring a Type enum value. Example:

class CustomFilter : public QAbstractFilter
{
....
enum { Type = UserType + 1};
...
};

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