scrollbars strange behavior
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.
Re: scrollbars strange behavior
Are you using a recent version of Qt?
Re: scrollbars strange behavior
Code:
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.
Re: scrollbars strange behavior
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?
Re: scrollbars strange behavior
Quote:
Originally Posted by
wysota
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.
Re: scrollbars strange behavior
Quote:
Originally Posted by
siniy
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).
Re: scrollbars strange behavior
Thanks, you are absolutely right.