Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.15.2
-
None
Description
Hi all,
from QML I'm trying to get a list of QObject, invoking a Slot. It works only if a instance variable is used to store the list.
For example, the following code works well (it returns a well-formed list of TestModel to QML):
@Slot(result='QVariantList') def working_get_all(self): self._entries = [] for i in range(5): model = TestModel() model.name = 'Name ' + str(i) model.description = 'Description ' + str(i) self._entries.append(model) return self._entries
while the following code returns a list of null:
@Slot(result='QVariantList') def not_working_get_all(self): entries = [] for i in range(5): model = TestModel() model.name = 'Name ' + str(i) model.description = 'Description ' + str(i) entries.append(model) return entries
As attachment there is a complete example for bug reproduction.