Results 1 to 4 of 4

Thread: Problem with simple Model-View in Qt4.3

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with simple Model-View in Qt4.3

    Actually, the problem is somewhere else. Forget what I said before.
    The docs say:
    Resets the model to its original state in any attached views. When a model is reset it means that any previous data reported from the model is now invalid and has to be queried for again.
    When a model radically changes its data it can sometimes be easier to just call this function rather than emit dataChanged() to inform other components when the underlying data source, or its structure, has changed.
    You were clearing the data and also reset the model before recreating the back store. This happens in function TableModel: populate.

    The error was that when you called reset on the model, it tried to reinitialize with new data ( header views, etc ). But there was no new data, because it was created after you reset the model.

    The solution is to call reset just after setModelData(), in populate.
    This way the model will have an update source available.

    Regards

  2. The following user says thank you to marcel for this useful post:

    ccf_h (17th June 2007)

Similar Threads

  1. hierarchical model in a flat view
    By gniking in forum Qt Programming
    Replies: 4
    Last Post: 10th November 2009, 20:17
  2. Table Model / View Problem -- Data Not Displaying
    By jhendersen in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2007, 06:45
  3. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 08:50
  4. Model - View Programming doubt.
    By munna in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2006, 13:01
  5. Replies: 6
    Last Post: 20th April 2006, 10:23

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
  •  
Qt is a trademark of The Qt Company.