Home · Modules · Classes · Namespaces · Functions

QxtSortFilterProxyModel Class Reference
[QxtGui module]

The QxtSortFilterProxyModel class is a multi column filter model. More...

    #include <QxtSortFilterProxyModel>

Inherits QSortFilterProxyModel.

Public Functions

Additional Inherited Members


Detailed Description

The QxtSortFilterProxyModel class is a multi column filter model.

The QxtSortFilterProxyModel makes it possible to filter over multiple columns.

    QxtSortFilterProxyModel * filterModel = new QxtSortFilterProxyModel(parent);
    filterModel->setSourceModel(sourceModel);
    filterModel->beginDeclareFilter();
    filterModel->setFilter(1,QVariant("SomeStringValue"),Qt::DisplayRole,Qt::MatchExactly);
    //remove some old filter
    filterModel->removeFilter(2);
    filterModel->setFilter(5,QVariant(1234),Qt::DisplayRole,Qt::MatchExactly);
    filterModel->endDeclateFilter();

Now the model will filter column 1 and 5, to be accepted by the filtermodel a row needs to pass all filters


Member Function Documentation

QxtSortFilterProxyModel::QxtSortFilterProxyModel ( QObject * parent = 0 )

Constructs a new QxtSortFilterProxyModel with parent.

void QxtSortFilterProxyModel::beginDeclareFilter ()

tells the model you want to declare a new filter

If you have a lot of data in your model it can be slow to declare more than one filter, because the model will always rebuild itself. If you call this member before setting the new filters the model will invalidate its contents not before you call

See also endDeclareFilter().

void QxtSortFilterProxyModel::endDeclareFilter ()

stops the filter declaration and invalidates the filter

See also beginDeclareFilter().

Qt::MatchFlags QxtSortFilterProxyModel::filterFlags ( const int column ) const

returns the filter flags for the given column

Note: if the column is not filtered it will return the default value

See also setFilterFlags().

int QxtSortFilterProxyModel::filterRole ( const int column ) const

Returns the filter role for the given column

Note: if the column is not filtered it will return -1

See also setFilterRole().

QVariant QxtSortFilterProxyModel::filterValue ( const int column ) const

Returns the filter value for the given column

Note: if the column is not filtered it will return a null variant

See also setFilterValue().

bool QxtSortFilterProxyModel::isFiltered ( const int column )

Returns true if the column is filtered

void QxtSortFilterProxyModel::removeFilter ( const int column )

Removes the filter from the given column

void QxtSortFilterProxyModel::setFilter ( const int column, const QVariant & value, const int role = Qt::DisplayRole, Qt::MatchFlags flags = Qt::MatchContains )

Sets the filter with value, role and flags to the given column

void QxtSortFilterProxyModel::setFilterFlags ( const int column, const Qt::MatchFlags flags = Qt::MatchContains )

Sets the filter flags for the given column

See also filterFlags().

void QxtSortFilterProxyModel::setFilterRole ( const int column, const int role = Qt::DisplayRole )

Sets the filter role for the given column

See also filterRole().

void QxtSortFilterProxyModel::setFilterValue ( const int column, const QVariant & value )

Sets the filter value for the given column

See also filterValue().


Copyright © 2007-2011 Qxt Foundation
Qxt 0.6.2