"
Why not just connect valueChanged() signals of vertical (or horizontal, where appropriate) scrollbars of both widgets to their setValue() counterparts?
"
-- Tnx, recently connected next way:
@connect(ui->treeView->verticalScrollBar(),SIGNAL(valueChanged(int)),this,SLOT(scroll_gv_v(int)));
connect(ui->graphicsView->verticalScrollBar(),SIGNAL(valueChanged(int)),this,SLOT(scroll_tv_v(int)));
//...
void MainWindow::scroll_gv_v(int dy)
{
qDebug()<<"*** in scroll_gv_v, dy = "<<dy<<endl;
ui->graphicsView->verticalScrollBar()->setValue(dy);
ui->graphicsView->verticalScrollBar()->setSliderPosition(dy);
ui->graphicsView->verticalScrollBar()->update();
ui->graphicsView->verticalScrollBar()->repaint();
ui->graphicsView->update();
ui->graphicsView->repaint();
qDebug()<<"*** in scroll_gv_v, tree view scroll bar value = "<<ui->treeView->verticalScrollBar()->value()<<endl;
qDebug()<<"*** in scroll_gv_v, graphics view scroll bar value = "<<ui->graphicsView->verticalScrollBar()->value()<<endl;
}
void MainWindow::scroll_tv_v(int dy)
{
qDebug()<<"*** in scroll_tv_v, dy = "<<dy<<endl;
ui->treeView->verticalScrollBar()->setValue(dy);
ui->treeView->verticalScrollBar()->setSliderPosition(dy);
ui->treeView->verticalScrollBar()->update();
ui->treeView->verticalScrollBar()->repaint();
ui->treeView->update();
ui->treeView->repaint();
qDebug()<<"*** in scroll_tv_v, tree view scroll bar value = "<<ui->treeView->verticalScrollBar()->value()<<endl;
qDebug()<<"*** in scroll_tv_v, graphics view scroll bar value = "<<ui->graphicsView->verticalScrollBar()->value()<<endl;
}@
then qDebug() shows, that the verticalScrollBar() value of the counterparts stays the same after the signals called and finished and counterpart scrollbars of the connected widgets do not move at all then. Why the value of the counterpart verticalScrollBar() wasn't changed then in such implementation ?
when I changed
@
void MainWindow::scroll_gv(int dx,int dy)
{
ui->graphicsView->scroll(dx,dy);
}
void MainWindow::scroll_tv(int dx,int dy)
{
ui->treeView->scroll(dx,dy);
}@
to:
[CODE]
void MainWindow::scroll_gv(int dx,int dy)
{
ui->graphicsView->viewport()->scroll(dx,dy);
}
void MainWindow::scroll_tv(int dx,int dy)
{
ui->treeView->viewport()->scroll(dx,dy);
}[/CODE]
then the internal widgets move more close fashion to the desired results, but still scroll bars frozen while moving and internals of the widgets are degraded during scrolling, see video recorded:
"https://www.box.com/s/irv4qqgmxmewvydc8ual":[url]https://www.box.com/s/irv4qqgmxmewvydc8ual[/url]
The question is how to correct that, what widgets properties to set to what value ? How to code the scrolling ?
Thanks.