December 14, 2010

jech jech
Lab Rat
77 posts

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.

2 replies

December 24, 2010

qtrahul qtrahul
Lab Rat
188 posts

Have you connected all you content to the category “genre”.

It also depend on the version of python and Qt.

December 24, 2010

jech jech
Lab Rat
77 posts

I already solved the problem by implementing removeRows and addItem functions of the associated QAbstractListModel following this tutorial [blog.rburchell.com].

 
  ‹‹ WebView focus on the WebPage      Q_ENUMS problem ››

You must log in to post a reply. Not a member yet? Register here!