Issue
Lets say that there are two subclasses of QGraphicsView
and QGraphicsScene
.
I want to run a function when QGraphicsScene
is scrolled.
Like in QPushButton
, there is a function named clicked
and it can call a function when we click the button. Similarly, is there any function similar to that which can call a function when QGraphicsScene
is scrolled?
Solution
Like all Qt scroll areas, QGraphicsView has two scrollbars, and those are used by all scroll areas for that purposes, even if they are hidden. So, what you're looking for, is to connect to the valueChanged
signal:
self.graphicsView.horizontalScollBar().valueChanged.connect(self.myFunction)
self.graphicsView.verticalScollBar().valueChanged.connect(self.myFunction)
Answered By - musicamante
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.