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. #7
    Join Date
    Aug 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    1

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

    Ok I'll try to explain better:

    I have a char array that's the underlying data structure.
    I've subclassed QAbstractTableModel to act as the model.
    I've added a Table view like this:



    I have a timer that increments the underlying data, in its [0,0] position.
    Right now, when I select a cell, or interact in some way with the table, then the cell's value is updated, because the table view somehow calls the model's data() method.
    What I want to achieve is on each timer event, twice per second, the view updates the cell's values on the screen.
    So please tell me what object should be the sender, and what signal of it, and what object should be the receiver, and what slot of it.
    Or if I can achieve this with just a method call, instead of signals.

    Edit:
    I tried emitting layoutChanged() from the model, which works ok.
    But I'm setting a timer with 0 msec timout and all I get is the signal emitted no more than 30 times per second, I need something faster.

    Can't I just inform the view to update exactly the cell I know has changed?
    I tried with the signal QAbstractItemModel::dataChanged, but I can't emit it from a QAbstractTableModel subclass, although it should inherit QAbstractItemModel's members, so what, aren't signals inherited?
    Last edited by Petruza; 20th June 2010 at 20:30.

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.