Important: Please read the Qt Code of Conduct -

Set a listView model to empty string crashes the program

  • Hi,
    I am using the same model in two listViews. And i am using a Flickable to first show a listView to add players to a pythonModel and to show the user a player list. After the players has been added to the playlist they can click a done button. Then the next ListView shows up in the flickable using the same pythonModel but with another delegate to show the game.

    This is not a problem though the lists are really small so they will not take much memory. But if i would have a lot of stuff in the pythonModel I don't want it to use both listViews at the same time, it is not needed as thaey are shown one at the time.

    What I have done is that when the players has been added to the playlist and they click on my done button i set the listView model to an empty string.
    It is working when I change an example made in Qt Creator, the list will just become empty. But if i do it in Eclipse using PySide it just exit the program (the qml program, not Eclipse) without an error message.
    if(listView.count>1){ listView.model = "" }

    Am i not supposed to set the model to an empty string or is it a bug in pyside? as I sad it worked in a Qt Creator example that was not using any pyside stuff.

  • this is probably happening because the onClicked method is on a delegate rendered from the listView's model?

  • You tryed to use listView->clean(); ?

Log in to reply