Modifying a ListView content from PySide



  • Hello,

    I have a problem with solving following application behavior:

    I'm working on a music player with library filters similar to iTunes or Songbird. This means I have 3 vertical lists with Genre, Artist and Album. I begin with all columns completely filled. Now when I click on genre "Rock" in first column I want the columns "Artist" and "Album" to be filled only with artists and albums from rock genre. I know how to catch the click and filter the right items from database. But I have no idea how do I change the content of the 2 ListViews.

    My backend is written in PySide. I tried to simply replace the models (QtCore.QAbstractListModel) with new ones, containing only the filtered items. But this resulted in a Python crash. What is the correct way of updating a ListView from Python? I need to keep the UI and Python data model in sync.

    I hope I explained my problem clearly.



  • Have you connected all you content to the category "genre".

    It also depend on the version of python and Qt.



  • I already solved the problem by implementing removeRows and addItem functions of the associated QAbstractListModel following "this tutorial":http://blog.rburchell.com/2010/02/pyside-tutorial-model-view-programming_22.html.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.