Documents > BPS V2 C++ API
BpsSortFilterProxyModel Class Reference

Derived from QSortFilterProxyModel with enhancements for BPS. More...

#include <bpssortfilterproxymodel.h>

List of all members.

Public Member Functions

 BpsSortFilterProxyModel (QObject *aParent=0)
int columnSortRole (int aColumn) const
 Get the special role for a distinct column.
QModelIndex firstIndex (const QModelIndex &aParent=QModelIndex())
 Get index of first item.
QModelIndexList mapListFromSource (const QModelIndexList &aSourceIndexList) const
 Convenience function to convert a list of source into proxy model indexes.
QModelIndexList mapListToSource (const QModelIndexList &aProxyIndexList) const
 Convenience function to convert a list of proxy into source model indexes.
void setColumnSortRole (int aColumn, int aRole)
 Sets a special sort role for a distinct column.
void setColumnSortRoles (BpsTable *aTable)
 Sets special sort roles for all columns from a table specification.

Protected Member Functions

virtual bool lessThan (const QModelIndex &aLeft, const QModelIndex &aRight) const
 Compares the sortRole() if set in the left item, and Qt::DisplayRole otherwise.

Detailed Description

Derived from QSortFilterProxyModel with enhancements for BPS.

  • The overall sort role is initialized to Qt::EditRole.
  • Dynamic sort/filter is enabled by default.
  • Text compare is set to case insensitive and locale aware by default.

Constructor & Destructor Documentation

BpsSortFilterProxyModel::BpsSortFilterProxyModel ( QObject *  aParent = 0)
Parameters:
[in]aParentThe parent object.

Member Function Documentation

int BpsSortFilterProxyModel::columnSortRole ( int  aColumn) const

Get the special role for a distinct column.

Parameters:
[in]aColumnThe column to get the special role for.
Returns:
The special role, or -1 if no special role set.
QModelIndex BpsSortFilterProxyModel::firstIndex ( const QModelIndex &  aParent = QModelIndex())

Get index of first item.

Parameters:
[in]aParentThe parent index.
Returns:
The index if any first row, or QModelIndex() if no such record.
virtual bool BpsSortFilterProxyModel::lessThan ( const QModelIndex &  aLeft,
const QModelIndex &  aRight 
) const [protected, virtual]

Compares the sortRole() if set in the left item, and Qt::DisplayRole otherwise.

Supports a generic compare that understands several data types, including int, QString, and QDateTime. If the compared column is equal, all other columns starting from 0 up are compared in sequence until a compare returns an unequal result.

Parameters:
[in]aLeftIndex of the first item.
[in]aRightIndex of the second item.
Returns:
True it the left item is less that the right.
QModelIndexList BpsSortFilterProxyModel::mapListFromSource ( const QModelIndexList &  aSourceIndexList) const

Convenience function to convert a list of source into proxy model indexes.

Parameters:
[in]aSourceIndexListThe given list of source model indexes.
Returns:
The proxy model index list for the given source model index list.
QModelIndexList BpsSortFilterProxyModel::mapListToSource ( const QModelIndexList &  aProxyIndexList) const

Convenience function to convert a list of proxy into source model indexes.

Parameters:
[in]aProxyIndexListThe list of given proxy model indexes.
Returns:
The source model index list for the given proxy model index list.
void BpsSortFilterProxyModel::setColumnSortRole ( int  aColumn,
int  aRole 
)

Sets a special sort role for a distinct column.

The column sort role has precedence over the overall sort role. Set the role to -1 to remove the special column sort role and make the column use the overall role again.

Parameters:
[in]aColumnThe column to set a special sort role for.
[in]aRoleThe special sort role for the column.
void BpsSortFilterProxyModel::setColumnSortRoles ( BpsTable aTable)

Sets special sort roles for all columns from a table specification.

Parameters:
[in]aTableThe table where the sort roles are taken from.

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