PDA

View Full Version : QTableView top row not updating



murrekatt
3rd March 2010, 08:45
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

aamer4yu
3rd March 2010, 09:06
How do you change/ update data in the model ?
May be you are missing QAbstractItemModel::dataChanged :rolleyes:

murrekatt
3rd March 2010, 09:36
How do you change/ update data in the model ?
May be you are missing QAbstractItemModel::dataChanged :rolleyes:

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

JD2000
3rd March 2010, 14:16
It looks like nothing is being emitted when row = 0.

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

murrekatt
3rd March 2010, 14:50
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.