Repository: pyqtgraph/pyqtgraph

Issue:
Axes zoom area does not resize in 0.12.4
### Short description
When a plot is first generated with a given size, say `width ` and `height` in pixels, the entire axes areas on the left and bottom of the plot are zoomable. When the plot size is resized such that the plot is larger (e.g. the window is grabbed along an edge or corner and expanded), only the top `height` portion of the y-axes or the left `width` portion of the x-axis retain the ability to zoom the plot using the scroll wheel. The axes area outside (i.e. the lower portion of the y-axis or the right portion of the x-axis) are not zoomable. If hovering over the plot, not on an axes, there is no issue with zooming. Reverting to 0.12.3 fixes issue.

I was able to reproduce this in both custom plots and many of the pyqtgraph.example scripts.

### Tested environment(s)

 * PyQtGraph version: 0.12.4
 * Qt Python binding: PySide2 5.15.2.1 Qt 5.15.2
 * Python version: 3.7
 * NumPy version: 1.21.6
 * Operating system: Windows 10 Enterprise 21H2
 * Installation method: pip



Discussion:
Ha, I just zero'd in on this issue (not the fix) a few days ago and was meaning to make an issue.

The way I want to reproduce is I would run the histogram example, zoom in on the y-axis until more digits show up. 

Here is where things first start going wrong:

https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/graphicsItems/AxisItem.py#L1217-L1220

For some reason, the wheel event is assumed not to be inside the sceneBoundingRect.

Thanks for reporting @Seaspider1 
`git bisect` points to this commit as being the problematic one:       814de9c5fa472dd28167d2ba73ffab949d3a26ab

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/GraphicsWidget.py b/pyqtgraph/graphicsItems/GraphicsWidget.py
--- a/pyqtgraph/graphicsItems/GraphicsWidget.py
+++ b/pyqtgraph/graphicsItems/GraphicsWidget.py
@@ -3,36 +3,43 @@
 
 __all__ = ['GraphicsWidget']
 
+
 class GraphicsWidget(GraphicsItem, QtWidgets.QGraphicsWidget):
     
     _qtBaseClass = QtWidgets.QGraphicsWidget
-    def __init__(self, *args, **kargs):
+
+    def __init__(self, *args, **kwargs):
         """
         **Bases:** :class:`GraphicsItem <pyqtgraph.GraphicsItem>`, :class:`QtWidgets.QGraphicsWidget`
         
         Extends QGraphicsWidget with several helpful methods and workarounds for PyQt bugs. 
         Most of the extra functionality is inherited from :class:`GraphicsItem <pyqtgraph.GraphicsItem>`.
         """
-        QtWidgets.QGraphicsWidget.__init__(self, *args, **kargs)
+        QtWidgets.QGraphicsWidget.__init__(self, *args, **kwargs)
         GraphicsItem.__init__(self)
 
-        # cache bouding rect and geometry
+        # cache bounding rect and geometry
         self._boundingRectCache = self._previousGeometry = None
         self._painterPathCache = None
-        
-        ## done by GraphicsItem init
-        #GraphicsScene.registerObject(self)  ## workaround for pyqt bug in graphicsscene.items()
+        self.geometryChanged.connect(self._resetCachedProperties)
+
+        # done by GraphicsItem init
+        # GraphicsScene.registerObject(self)  # workaround for pyqt bug in GraphicsScene.items()
 
     # Removed due to https://bugreports.qt-project.org/browse/PYSIDE-86
-    #def itemChange(self, change, value):
-        ## BEWARE: Calling QGraphicsWidget.itemChange can lead to crashing!
-        ##ret = QtWidgets.QGraphicsWidget.itemChange(self, change, value)  ## segv occurs here
-        ## The default behavior is just to return the value argument, so we'll do that
-        ## without calling the original method.
-        #ret = value
-        #if change in [self.ItemParentHasChanged, self.ItemSceneHasChanged]:
-            #self._updateView()
-        #return ret
+    # def itemChange(self, change, value):
+    #     # BEWARE: Calling QGraphicsWidget.itemChange can lead to crashing!
+    #     # ret = QtWidgets.QGraphicsWidget.itemChange(self, change, value)  # segv occurs here
+    #     # The default behavior is just to return the value argument, so we'll do that
+    #     # without calling the original method.
+    #     ret = value
+    #     if change in [self.ItemParentHasChanged, self.ItemSceneHasChanged]:
+    #         self._updateView()
+    #     return ret
+
+    def _resetCachedProperties(self):
+        self._boundingRectCache = self._previousGeometry = None
+        self._painterPathCache = None
 
     def setFixedHeight(self, h):
         self.setMaximumHeight(h)
@@ -41,10 +48,10 @@ def setFixedHeight(self, h):
     def setFixedWidth(self, h):
         self.setMaximumWidth(h)
         self.setMinimumWidth(h)
-        
+
     def height(self):
         return self.geometry().height()
-    
+
     def width(self):
         return self.geometry().width()
 
@@ -52,19 +59,16 @@ def boundingRect(self):
         geometry = self.geometry()
         if geometry != self._previousGeometry:
             self._painterPathCache = None
-            
             br = self.mapRectFromParent(geometry).normalized()
             self._boundingRectCache = br
             self._previousGeometry = geometry
         else:
             br = self._boundingRectCache
-
         return br
 
-    def shape(self):  ## No idea why this is necessary, but rotated items do not receive clicks otherwise.
+    def shape(self):
         p = self._painterPathCache
         if p is None:
             self._painterPathCache = p = QtGui.QPainterPath()
             p.addRect(self.boundingRect())
-
         return p


Test patch: