use filter combobox for type editor

This commit is contained in:
iLLiCiTiT 2021-05-11 09:30:29 +02:00
parent d76fae0096
commit 342fd59eb2

View file

@ -1,5 +1,6 @@
from Qt import QtWidgets, QtCore
from .widgets import FilterComboBox
from .multiselection_combobox import MultiSelectionComboBox
@ -50,7 +51,7 @@ class TypeDelegate(QtWidgets.QStyledItemDelegate):
super(TypeDelegate, self).__init__(*args, **kwargs)
def createEditor(self, parent, option, index):
editor = QtWidgets.QComboBox(parent)
editor = FilterComboBox(parent)
if not self._project_doc_cache.project_doc:
return editor
@ -59,6 +60,12 @@ class TypeDelegate(QtWidgets.QStyledItemDelegate):
return editor
def setEditorData(self, editor, index):
value = index.data(QtCore.Qt.EditRole)
index = editor.findText(value)
if index >= 0:
editor.setCurrentIndex(index)
class ToolsDelegate(QtWidgets.QStyledItemDelegate):
def __init__(self, tools_cache, *args, **kwargs):