C++ (Qt)QSqlQueryModel *qmodel = new QSqlQueryModel;qmodel->setQuery(...);...while (qmodel->canFetchMore()) qmodel->fetchMore(); ...
connect(treeView->verticalScrollBar(),SIGNAL(sliderMoved(int)),this,SLOT(sliderMoved(int)));
treeView->verticalScrollBar()->setSliderPosition(currentBarPosition);