Results 1 to 13 of 13

Thread: How to inform a Model/TableView that some data changed?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Apr 2010
    Posts
    98
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    19
    Thanked 8 Times in 6 Posts

    Default Re: How to inform a Model/TableView that some data changed?

    Check the QAbstractItemModel docs.

    #1 You can just emit layoutAboutToBeChanged() and layoutChanged().The view will then update itself thoroughly.
    #2 If you are inserting/removing/moving items.Check the protected function.
    example:
    Qt Code:
    1. void MyModel::removeOneRow(int index)
    2. {
    3. beginRemoveRows(xx);
    4. ...//Do the remove action here.
    5. endRemoveRows(xx);
    6. }
    To copy to clipboard, switch view to plain text mode 
    After calling this function,the view will also update itself.
    #3 If you want to update a range of item.Check the dataChanged(xxx) signal.
    It's not the goodbye that hurts,but the flashback that follow.

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

    jcyangzh (6th October 2012)

Similar Threads

  1. TableView/Model Display Question
    By SixDegrees in forum Qt Programming
    Replies: 9
    Last Post: 27th August 2010, 09:06
  2. Replies: 1
    Last Post: 1st February 2010, 18:42
  3. tableview model view problem
    By skuda in forum Qt Programming
    Replies: 5
    Last Post: 3rd December 2007, 14:02
  4. getting data from tableView
    By mkarakaplan in forum Newbie
    Replies: 1
    Last Post: 7th November 2007, 09:51
  5. Informing a model its data has changed
    By saknopper in forum Newbie
    Replies: 3
    Last Post: 17th January 2007, 19:58

Tags for this Thread

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.