Results 1 to 3 of 3

Thread: QListView not updating

  1. #1

    Unhappy QListView not updating

    Hi, i've created a model, with 2 methods data and rowCount.
    When i add data to my model, I call reset(); and then i see (by qDebug) that the overiden methods data() and rowCount() were sucessfully called.

    Yet my QListView does not update.
    Yes I did view->setModel(model) at the start.

    Any help?

    Qt Code:
    1. QVariant Session::data(const QModelIndex & index, int role) const
    2. {
    3. return QString("lk");
    4. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Terabyte; 6th January 2009 at 06:53.

  2. #2
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: QListView not updating

    Hi,

    maybe you need to emit the dataChanged() signal from your setData function?

  3. #3

    Unhappy Re: QListView not updating

    the solution:

    if ((index.isValid()) && (role == Qt:isplayRole)) return ... else return QVariant


    literally.

    What a gotcha.
    Last edited by Terabyte; 6th January 2009 at 09:05.

Similar Threads

  1. QListView: How to move the cursor to a specific row
    By muellerp in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2008, 07:29
  2. QListView word wrap
    By serega in forum Qt Programming
    Replies: 17
    Last Post: 30th August 2007, 03:13
  3. QDialog / QListView problem
    By harakiri in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2007, 18:31
  4. Subclass QListView to show two colums in one
    By Mookie in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2007, 02:12
  5. Keeping focus at bottom of QListView
    By jakamph in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2006, 14:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.