I have a tree view for which some fields need to use a custom delegate for editing. The delegate presents a QListView
for value selection. It seems like the QAbstractItemView.edit()
method should be used to initiate the edit from the test but I can't figure out how to get access to the created editor (a QListView
) so I can select the proper element for the test.
This is part of a test I had working with a QComboBox
delegate before switching to the QListVew
, but it seems too manual.
for index, enumerator in enumerate(group.children):
editor = delegate.createEditor(
parent=viewport,
option=None,
index=target_index,
)
editor.setCurrentIndex(index)
delegate.setModelData(editor, model, target_index)
assert enumerator.uuid == item.enumeration_uuid
Aucun commentaire:
Enregistrer un commentaire