Hi list,I'm having problems with replacing content of QAbstractListModel, which is showed in a QML UI.
I checked my code many times, but I can't find any bugs there. So I created a simple demo, which shows the problem. Please check the attachment, it contains a PySide application, which shows a QML window. The window contains a list with 5 items and 2 buttons - "all" and "reduce". Button "all" fills the list with all 5 items, button "reduce" shows only first 2. You can see some debug messages in console.
Now try to use the 2 buttons and you can see that it behaves totally wrong. The good thing is that it behaves equally every time, which should make it easier to debug. For example try to hit "reduce" two times. The first time it works OK, but the second time you'll see only empty delegates and error messages in console. I think the most important information is that QML requests from QAbstractListModel item with index -1, which of course doesn't exist. Now try to move the list up or down so that the delegates are moved away from the window. And when the list returns, the delegates are suddenly showed correctly.
I hope I described the behavior clearly. Anyway please check my example and you can see it yourself. I hope the code is self explaining, if not, please let me know and I'll add some comments to it.
Best regards, Vladimir
llistmodel_test.7z
Description: Binary data
_______________________________________________ PySide mailing list PySide@lists.openbossa.org http://lists.openbossa.org/listinfo/pyside