PDA

View Full Version : scrollbars strange behavior



siniy
26th December 2006, 10:12
Hi all!
I have a problem with scrollbars using QTableView.
If I change any row both scrolls moves to the left-top corner. What can I do to prevent this? It would be nice if the scrolls will stay at the same position they was when I starting to edit row.

jpn
26th December 2006, 13:47
Are you using a recent version of Qt?

siniy
26th December 2006, 14:04
sinelnikov@designer02:~/coding/bezzubov$ dpkg -l|grep libqt4
ii libqt4-core 4.2.1-2
ii libqt4-dev 4.2.1-2
ii libqt4-gui 4.2.1-2

Debian Etch at work. Ok, I'll try to compile my app with qt-4.2.2 for Windows.

wysota
26th December 2006, 20:19
My guess is that your model is incorrect. It is probably being reset after a change occurs which causes the view to be reset as well which would produce the behaviour you describe. How did you implement setData() and insertRows() in your model?

siniy
26th December 2006, 23:55
My guess is that your model is incorrect. It is probably being reset after a change occurs which causes the view to be reset as well which would produce the behaviour you describe. How did you implement setData() and insertRows() in your model?
I don't think so beacouse I'm just using standart QSqlRelationTabelModel. I can publish the sources tomorrow if it will be helpful.

wysota
27th December 2006, 00:53
I don't think so beacouse I'm just using standart QSqlRelationTabelModel.

Whenever this model submits its data to the storage, it is also being refreshed (which does a reset of the model), so if you use any other edit strategy than QSqlTableModel::OnManualSubmit, then you experience the behaviour I described in my previous post. Try changing the edit strategy and you'll see the view starts to behave properly. I suggest you use manual submit and submit the data just before you exit the application (or when all views using the model are closed).

siniy
29th December 2006, 10:27
Thanks, you are absolutely right.