0

Let's say i have two QGraphicsViews:

QGraphicsView *view1;
QGraphicsView *view2;

where view1 is big view that has vertical scroll bar(this view is guaranteed to contain an image that is bigger than viewport) and is to contain some drawing, put by user, and view2 is ruler-like view that represents y value of the according part of view1. What i want is to simultaneously scroll view2, once view1 is scrolled. I also don't want view1 to have any scroll bars. Is that possible? If so - how? Any help is appreciated.

George
  • 578
  • 4
  • 21
  • 3
    I would create a container widget which captures all scroll events and then implement scrolling for both QGraphicsViews. For scrollbar, you can retrieve a pointer to it from GraphicsView and use QWidget::hide() function. – Anže Jun 27 '19 at 06:59
  • If the first one only contains the image and the scond one only a ruler, you should consider to use one `QGraphicsView` – Dimitry Ernot Jun 27 '19 at 07:09
  • @RomhaKorev well, not exactly. Second one only contains a ruler, and first one contains the image, but user also draws on the first one. I should have mentioned it in the question. Should i still use only one QGraphicsView? – George Jun 27 '19 at 07:17
  • 2
    From what I understood, you should use only one `QGraphicsView`. If you provide a minimal and complete example, I will be able to give an answer. But, first, check if [this question](https://stackoverflow.com/questions/56588152/how-to-make-a-ruler-on-the-border-of-a-qgraphicsview/56606196#56606196) fits your needs. – Dimitry Ernot Jun 27 '19 at 07:21
  • @RomhaKorev it seems to fit my needs, thank you. – George Jun 27 '19 at 07:28

0 Answers0