Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Set a listView model to empty string crashes the program

Set a listView model to empty string crashes the program

Scheduled Pinned Locked Moved Language Bindings
3 Posts 3 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BadOmen
    wrote on last edited by
    #1

    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.
    @onClicked:{
    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.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hhartz
      wrote on last edited by
      #2

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

      --

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GentooXativa
        wrote on last edited by
        #3

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

        Jose Vicente Giner Sanchez - Senior Mobile Developer

        www.gigigo.com

        C/ Dr. Zamenhof 36bis, 1ºA 28027 Madrid
        T: +34 917431436

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved