Results 1 to 5 of 5

Thread: QTableView top row not updating

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Question QTableView top row not updating

    Hi everyone!

    I'm new to Qt and this is my first post here in this forum, so be nice ;)

    So, to my problem. I'm playing around a bit with a QTableView and a model that randomly updates data. Everything works fine and I have a grid full with random numbers visible. The numbers are changing as my model randomly generates new values for the cells and that works fine, except for the first (top) row, which is not updated at all. I can click in a cell on that row and then see the value being updated to something else, I guess this forced some kind of repaint of that cell when I clicked into it or something.

    As I'm fairly new to Qt I'm not sure where to start looking for answers. I tried google and this forum for answers, but no luck so far. Hence, this post.

    Platform is Windows and Qt version is 4.5.3. Let me know if I can tell more about something.

    Looking forward to hearing what the problem might be!

    Thanks!

    Tommy

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView top row not updating

    How do you change/ update data in the model ?
    May be you are missing QAbstractItemModel::dataChanged

  3. #3
    Join Date
    Mar 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableView top row not updating

    Quote Originally Posted by aamer4yu View Post
    How do you change/ update data in the model ?
    May be you are missing QAbstractItemModel::dataChanged
    Thanks for the reply!

    The model is very simple, I call emit for every cell individually as I randomize the new value.

    emit dataChanged(index, index);

    Also, the updating works for everything except the top row. Might this still be a problem somehow?

    Tommy

  4. #4
    Join Date
    Oct 2009
    Posts
    151
    Thanks
    6
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView top row not updating

    It looks like nothing is being emitted when row = 0.

    How are the two indexes being calculated?
    Posting the code would be helpful!

  5. #5
    Join Date
    Mar 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableView top row not updating

    Quote Originally Posted by JD2000 View Post
    It looks like nothing is being emitted when row = 0.

    How are the two indexes being calculated?
    Posting the code would be helpful!
    I tried installing Qt 4.6.2 and there it works fine, so I assume this was a bug in 4.5.3 that I was using previously. So now it works fine.

    Thanks for your help.

Similar Threads

  1. Updating creator
    By piotr.dobrogost in forum Installation and Deployment
    Replies: 0
    Last Post: 31st May 2009, 22:53
  2. updating QTableView with new qsl columns
    By sylvainb in forum Qt Programming
    Replies: 2
    Last Post: 28th January 2009, 20:51
  3. Updating a data in QTableView question
    By MarkoSan in forum Qt Programming
    Replies: 5
    Last Post: 6th June 2008, 11:45
  4. scrollArea not updating
    By user in forum Qt Programming
    Replies: 9
    Last Post: 3rd October 2007, 08:17
  5. Replies: 5
    Last Post: 16th May 2007, 11:03

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.