Hi Thomas,
thanks a lot for your reply. I'll answer to your points below:
Dne 15.12.2010 14:21, Thomas Perl napsal(a):
Hi Vladimir,
2010/12/15 user<[email protected]>:
I followed the guide here:
http://developer.qt.nokia.com/wiki/Selectable_list_of_Python_objects_in_QML to
create a QAbstractListModel. This model is then forwarded to QML. So my first
idea was to replace the model, but this resulted in a Python crash.
If it crashes, chances are that the version of PySide you are using is
too old. Try to get the latest version from Git or the 1.0.0 beta1
release. The example works with that. If it still crashes with 1.0.0
beta1, please report it as a bug on http://bugs.openbossa.org/ in the
PySide product.
I use 1.0.0 beta1, the example works fine. But I tried to replace
content of QML ListView by replacing QAbstractListModel with a new
instance. This is probably a completely wrong idea of doing it and the
reason why it crashed.
What exactly do you want to achieve? It might be better if your QML UI
calls the Python code, and not the other way around (so that your code
does not need to "know" about the internal structure of the UI - it
results in cleaner code, but this might or might not be a target for
your specific case).
The UI should allow filtering of audio files by tags. There are columns
"genre", "artist" and "album". If I click in "genre" column on "Pop" I
want to show only artist and albums containing tracks having genre
"Pop". My idea of doing it is following:
1) Catch the click and call a function (through a Slot) in Python. (done)
2) Get the clicked item (column number and value). (done)
3) Get the items for next columns (artist, album) from sqlite database.
(done)
4) Replace the content of the artist and album columns. (that's what I
can't do)
I did some more investigations and probably what I need is to define a
removeRows and addItem functions for my QAbstractListModel. Then I need
to inform the QML that the content has been changed (if it's not done
automatically).
Is this the right way of doing the task I described? Or should I do it
completely differently? How?
Thanks a lot for any advice.
Vladimir
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside