# eric4.UI.BrowserSortFilterProxyModel

Module implementing the browser sort filter proxy model.

### Global Attributes

None

### Classes

BrowserSortFilterProxyModel | Class implementing the browser sort filter proxy model.

### Functions

None

## BrowserSortFilterProxyModel

Class implementing the browser sort filter proxy model.

### Derived from

QSortFilterProxyModel

### Class Attributes

None

### Methods

BrowserSortFilterProxyModel | Constructor
filterAcceptsRow | Protected method to filter rows.
hasChildren | Public method to check for the presence of child items.
item | Public method to get a reference to an item.
lessThan | Protected method used to sort the displayed items.
preferencesChanged | Public slot called to handle a change of the preferences settings.
sort | Public method to sort the items.

#### BrowserSortFilterProxyModel (Constructor)

BrowserSortFilterProxyModel(parent = None)

Constructor

parent
  reference to the parent object (QObject)

#### BrowserSortFilterProxyModel.filterAcceptsRow

filterAcceptsRow(source_row, source_parent)

Protected method to filter rows.

It implements a filter to suppress the display of non public classes, methods and attributes.

source_row
  row number (in the source model) of item (integer)
source_parent
  index of parent item (in the source model) of item (QModelIndex)

Returns:
  flag indicating, if the item should be shown (boolean)

#### BrowserSortFilterProxyModel.hasChildren

hasChildren(parent = QModelIndex())

Public method to check for the presence of child items.

We always return True for normal items in order to do lazy population of the tree.

parent
  index of parent item (QModelIndex)

Returns:
  flag indicating the presence of child items (boolean)

#### BrowserSortFilterProxyModel.item

item(index)

Public method to get a reference to an item.

index
  index of the data to retrieve (QModelIndex)

Returns:
  requested item reference (BrowserItem)

#### BrowserSortFilterProxyModel.lessThan

lessThan(left, right)

Protected method used to sort the displayed items.

It implements a special sorting function that takes into account, if folders should be shown first, and that __init__ is always the first method of a class.

left
  index of left item (QModelIndex)
right
  index of right item (QModelIndex)

Returns:
  true, if left is less than right (boolean)

#### BrowserSortFilterProxyModel.preferencesChanged

preferencesChanged()

Public slot called to handle a change of the preferences settings.

#### BrowserSortFilterProxyModel.sort

sort(column, order)

Public method to sort the items.

column
  column number to sort on (integer)
order
  sort order for the sort (Qt.SortOrder)

Up