I have two view whose perspectives are xy and xz. These views have their own scrollbars and x side of these views are equal. When i move scroll bar of x sides , i want x scrollbars to move simultaneously.
Class of views is QGraphicsView
and scrollbars of these views are their own scrollbar.
How can i make it? Any help will be appreciated.
Thanks
A QWidget does not have scrollbars, you need to add a zone which will have scrollbars. Just add a QScrollArea to your window, and put all the widgets in it (buttons, etc...). Don't forget to layout your scroll area to the whole main window.
You should create widget, fill it with proper layout and then use QScrollArea::setWidget(QWidget *) to make it scrollable.
A horizontal scroll bar enables the user to scroll the content of a window to the left or right. A vertical scroll bar enables the user to scroll the content up or down.
If I understand you correctly, you could simply do the following (if you use QScrollBar as your scrollbar)
connect(firstScrollbar, SIGNAL(valueChanged(int)), secondScrollbar, SLOT(setValue(int)));
connect(secondScrollbar, SIGNAL(valueChanged(int)), firstScrollbar, SLOT(setValue(int)));
Hope this answers your question and works for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With