Exemplo n.º 1
0
 def setFilterProxyModel(self, proxy: QSortFilterProxyModel) -> None:
     """
     Set an instance of QSortFilterProxyModel that will be used for filtering
     the model. The `proxy` must be a filtering proxy only; it MUST not sort
     the row of the model.
     The FilterListView takes ownership of the proxy.
     """
     self.__pmodel.rowsAboutToBeRemoved.disconnect(
         self.__filter_rowsAboutToBeRemoved)
     self.__pmodel.rowsInserted.disconnect(self.__filter_rowsInserted)
     self.__pmodel = proxy
     proxy.setParent(self)
     self.__pmodel.rowsAboutToBeRemoved.connect(
         self.__filter_rowsAboutToBeRemoved)
     self.__pmodel.rowsInserted.connect(self.__filter_rowsInserted)
     self.__pmodel.setSourceModel(self.model())
     self.__filter_reset()