Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ListView duplicating last item on update in Windows

ListView duplicating last item on update in Windows

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 2.9k Views
  • 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.
  • X Offline
    X Offline
    xsacha
    wrote on last edited by
    #1

    Hey
    I have a ListView with a custom C++ model. It's actually the same model documented here: http://doc.qt.nokia.com/4.7/gettingstartedqml.html

    It's a simple folder/file model. The ListView is listing the files of a certain type (.txt) within a chosen folder.

    The problem comes when a new file is added to the folder. I move the list with my mouse and a new item is added to the list. The new item (at the end of the list), now has the same name as the item before it whereas it should instead have the new filename. On Symbian this does not occur.

    Workaround: If I reset the model using model = logDir.files whenever the directory changes, the correct name appears. Though, I shouldn't have to do this?

    Code:
    @
    Component {
    id: filedelegate
    Item {
    height: 50
    x: 20
    width: parent.width - 40
    Text {
    id: nameText
    text: name.replace(/.txt/g, '')
    // ...
    }
    }
    }

    ListView {
    id: loglist
    width: parent.width; height: parent.height - 80;
    x: 20
    y: 20
    spacing: 10
    delegate: filedelegate
    model: logDir.files
    highlight: Rectangle {
    //...
    }
    }@

    • Sacha
    1 Reply Last reply
    0
    • 2 Offline
      2 Offline
      2beers
      wrote on last edited by
      #2

      I had a similar situation, and I thought that the only solution was to update(reset) the model. I never tried on Symbian but if you say it's working there and not on desktop's OS you should fill a bug.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        blam
        wrote on last edited by
        #3

        It sounds like a bug. Can you report it with a small example at bugreports.qt.nokia.com?

        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