×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    9

    QML ListView grows up

    Hi,
    I'm using QML ListView to display data which is provided by QAbstractListModel instance with C++, if I insert new items to the front of list, all displayed old list items would be pushed down, so user's operation will be interrupted. Is it possible that list view DO NOT scroll automatically when new items are inserted?
    Yang

  2. #2
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: QML ListView grows up

    Do you want to insert the element at first position in the list? If yes then you can call QML ListModel insert method from your C++ code, or can make a java script function that will insert the items into the list model and can call that function from qt/C++
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    9

    Re: QML ListView grows up

    I can insert elements, my problem is after inserting operation, all old list items displayed on the screen before would be pushed down and new inserted items are displayed on the screen, is there a way to prevent this pushing down action, just displaying those old items and keeping the new inserted items out of the screen ( top of list view)?

  4. #4
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: QML ListView grows up

    you may try http://doc.qt.nokia.com/4.7-snapshot...AtIndex-method positionViewAtIndex giving the index you want to see on top

  5. #5
    Registered User
    Join Date
    Feb 2011
    Posts
    9

    Re: QML ListView grows up

    Quote Originally Posted by njzk2 View Post
    you may try http://doc.qt.nokia.com/4.7-snapshot...AtIndex-method positionViewAtIndex giving the index you want to see on top
    Hi,
    I have tried positionViewAtIndex, but there are some problems:
    1, the model is changed in C++ side, but QML side does not know which item index should be set position view at.
    2, positionViewAtIndex method would cause list view scrolling quickly in a short time ( flickering ), that's not good user experience.
    3, after positionViewAtIndex method being called, those old list items almost can be displayed again, but they are not at exact positions they were before.

    Anyway, thanks for your reply.

    Yang

  6. #6
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: QML ListView grows up

    1 / you could use the onAdd signal in the listview
    2 / may be incrementCurrentIndex would be better, since it may show the item added, and then scroll down
    3 / I don't understand that point. do you mean that items are not in the same order ?

  7. #7
    Registered User
    Join Date
    Sep 2011
    Location
    Moscow, Russian Federation
    Posts
    19

    Re: QML ListView grows up

    Quote Originally Posted by njzk2 View Post
    I don't understand that point. do you mean that items are not in the same order ?
    I have the same problem. The issue is to keep current list position when inserting new items. For example QML ListView should not scroll down automatically when I prepend some elements to its head.

Similar Threads

  1. [Qt QML] Questions regarding QML Performance
    By SeanZhang in forum [Archived] Qt Quick
    Replies: 1
    Last Post: 2011-05-05, 13:07
  2. Replies: 0
    Last Post: 2010-12-07, 11:34
  3. PcSync2.SML file grows too big with Outlook calendar synchronization
    By Willy2 in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2007-07-31, 20:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×