Skip to main content
`Ctrl`+`K`

# `NexusSortFilterProxyModel` class

class NexusSortFilterProxyModel(parent=None)

  Bases: `QSortFilterProxyModel`

  Try to sort items according to Nexus structure. Else sort by name.

  hasChildren(parent)

    Returns true if parent has any children; otherwise returns false.

    Parameters:

      parent (qt.QModelIndex) – Index of the item to check

    Return type:

      bool

  rowCount(parent)

    Returns the number of rows under the given parent.

    Parameters:

      parent (qt.QModelIndex) – Index of the item to check

    Return type:

      int

  lessThan(sourceLeft, sourceRight)

    Returns True if the value of the item referred to by the given index sourceLeft is less than the value of the item referred to by the given index sourceRight, otherwise returns false.

    Parameters:

      - sourceLeft (qt.QModelIndex)

      - sourceRight (qt.QModelIndex)

    Return type:

      bool

  getWordsAndNumbers(name)

    Returns a list of words and integers composing the name.

    An input “aaa10bbb50.30” will return [“aaa”, 10, “bbb”, 50, “.”, 30].

    Parameters:

      name (str) – A name

    Return type:

      List

  nameLessThan(left, right)

    Returns True if the left string is less than the right string.

    Number composing the names are compared as integers, as result “name2” is smaller than “name10”.

    Parameters:

      - left (str) – A string

      - right (str) – A string

    Return type:

      bool

  childDatasetLessThan(left, right, childName)

    Reach the same children name of two items and compare their values.

    Returns True if the left one is smaller than the right one.

    Parameters:

      - left (Hdf5Item) – An item

      - right (Hdf5Item) – An item

      - childName (str) – Name of the children to search. Returns None if the children is not found.

    Return type:

      bool

  data(self, index: QModelIndex, role: int = Qt.DisplayRole) → Any