C++ (Qt) QScrollBar* vScroll1 = ui->listWidget->verticalScrollBar(); QScrollBar* hScroll1 = ui->listWidget->horizontalScrollBar(); QScrollBar* vScroll2 = ui->listWidget_2->verticalScrollBar(); QScrollBar* hScroll2 = ui->listWidget_2->horizontalScrollBar(); QObject::connect(vScroll1, SIGNAL(valueChanged(int)), vScroll2, SLOT(setValue(int))); QObject::connect(hScroll1, SIGNAL(valueChanged(int)), hScroll2, SLOT(setValue(int)));
QScrollBar* vScroll1 = ui->listWidget->verticalScrollBar();QScrollBar* hScroll1 = ui->listWidget->horizontalScrollBar();QScrollBar* vScroll2 = ui->listWidget_2->verticalScrollBar();QScrollBar* hScroll2 = ui->listWidget_2->horizontalScrollBar();QObject::connect(vScroll1, SIGNAL(valueChanged(int)), vScroll2, SLOT(setValue(int)));QObject::connect(hScroll1, SIGNAL(valueChanged(int)), hScroll2, SLOT(setValue(int)));QObject::connect(vScroll2, SIGNAL(valueChanged(int)), vScroll1, SLOT(setValue(int)));QObject::connect(hScroll2, SIGNAL(valueChanged(int)), hScroll1, SLOT(setValue(int)));
C++ (Qt)ui->listWidget_2->setVerticalScrollBar(ui->listWidget->verticalScrollBar());