Exemplo n.º 1
0
 def lessThan(self, left, right):
     # TODO: Remove fixed column handling
     if left.column() == 1 and right.column():
         left_gds = str(qunpack(left.data(Qt.DisplayRole)))
         right_gds = str(qunpack(right.data(Qt.DisplayRole)))
         left_gds = left_gds.lstrip("GDS")
         right_gds = right_gds.lstrip("GDS")
         try:
             return int(left_gds) < int(right_gds)
         except ValueError:
             pass
     return QSortFilterProxyModel.lessThan(self, left, right)
Exemplo n.º 2
0
 def lessThan(self, left, right):
     # TODO: Remove fixed column handling
     if left.column() == 1 and right.column():
         left_gds = str(qunpack(left.data(Qt.DisplayRole)))
         right_gds = str(qunpack(right.data(Qt.DisplayRole)))
         left_gds = left_gds.lstrip("GDS")
         right_gds = right_gds.lstrip("GDS")
         try:
             return int(left_gds) < int(right_gds)
         except ValueError:
             pass
     return QSortFilterProxyModel.lessThan(self, left, right)
Exemplo n.º 3
0
    def lessThan(self, left, right):
        if self.__sortingFunc is None:
            return QSortFilterProxyModel.lessThan(self, left, right)
        model = self.sourceModel()
        left_data = model.data(left)
        right_data = model.data(right)

        flat_model = self.sourceModel()
        left_description = flat_model.data(left, role=QtWidgetRegistry.WIDGET_DESC_ROLE)
        right_description = flat_model.data(right, role=QtWidgetRegistry.WIDGET_DESC_ROLE)

        left_matches_title = self.filterRegExp().indexIn(left_description.name) > -1
        right_matches_title = self.filterRegExp().indexIn(right_description.name) > -1

        if left_matches_title != right_matches_title:
            return left_matches_title
        return self.__sortingFunc(left_data, right_data)
Exemplo n.º 4
0
    def lessThan(self, left, right):
        if self.__sortingFunc is None:
            return QSortFilterProxyModel.lessThan(self, left, right)
        model = self.sourceModel()
        left_data = model.data(left)
        right_data = model.data(right)

        flat_model = self.sourceModel()
        left_description = flat_model.data(
            left, role=QtWidgetRegistry.WIDGET_DESC_ROLE)
        right_description = flat_model.data(
            right, role=QtWidgetRegistry.WIDGET_DESC_ROLE)

        left_matches_title = self.filterRegExp().indexIn(
            left_description.name) > -1
        right_matches_title = self.filterRegExp().indexIn(
            right_description.name) > -1

        if left_matches_title != right_matches_title:
            return left_matches_title
        return self.__sortingFunc(left_data, right_data)