I'm not sure if I understood what you're trying to do...
You have graphics item in the scene that controls graphics view scroll bars?
What I wrote previously still applies, you just get values from different place.
Assuming that the item you use to control has min and max bound and you can know them then it would be something like that:
double percent = controlItemCurrentX / controlItemMaxX; // one of the values has to be double/float otherwise it won't work
viewScrollBar->setValue( viewScrollBar->maximum() * percent );
double percent = controlItemCurrentX / controlItemMaxX; // one of the values has to be double/float otherwise it won't work
viewScrollBar->setValue( viewScrollBar->maximum() * percent );
To copy to clipboard, switch view to plain text mode
the idea is to get control item percentage position alongside its axis, then you know where along the scene axis viewport should be.
To make it more accurate you may need to factor in viewport size into the calculation.
Bookmarks