def splitPath(self, path): self._local_completion_prefix = path self.updateModel() if self._filter_model.rowCount() == 0: self._using_orig_model = False self._filter_model.setSourceModel(QtCore.QStringListModel([path])) return [path] return []
def __init__(self, parent=None, node_dict=None): super(TabSearchWidget, self).__init__(parent) self.setAttribute(QtCore.Qt.WA_MacShowFocusRect, 0) self.setStyleSheet(STYLE_TABSEARCH) self.setMinimumSize(200, 22) self.setTextMargins(2, 0, 2, 0) self.hide() self._node_dict = node_dict or {} node_names = sorted(self._node_dict.keys()) self._model = QtCore.QStringListModel(node_names, self) self._completer = TabSearchCompleter() self._completer.setModel(self._model) self.setCompleter(self._completer) popup = self._completer.popup() popup.setStyleSheet(STYLE_TABSEARCH_LIST) popup.clicked.connect(self._on_search_submitted) self.returnPressed.connect(self._on_search_submitted)