From: <ds...@us...> - 2009-05-28 16:11:21
|
Revision: 7155 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7155&view=rev Author: dsdale Date: 2009-05-28 16:11:16 +0000 (Thu, 28 May 2009) Log Message: ----------- handle scroll wheel events in Qt4 backend Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-05-28 15:59:12 UTC (rev 7154) +++ trunk/matplotlib/CHANGELOG 2009-05-28 16:11:16 UTC (rev 7155) @@ -1,3 +1,6 @@ +2009-05-28 Applied fbianco's patch to handle scroll wheel events in + the qt4 backend - DSD + 2009-05-26 Add support for "axis spines" to have arbitrary location. -ADS 2009-05-20 Add an empty matplotlibrc to the tests/ directory so that running Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2009-05-28 15:59:12 UTC (rev 7154) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2009-05-28 16:11:16 UTC (rev 7155) @@ -136,6 +136,16 @@ FigureCanvasBase.button_release_event( self, x, y, button ) if DEBUG: print 'button released' + def wheelEvent( self, event ): + x = event.x() + # flipy so y=0 is bottom of canvas + y = self.figure.bbox.height - event.y() + # from QWheelEvent::delta doc + steps = event.delta()/120 + if (event.orientation() == Qt.Qt.Vertical): + FigureCanvasBase.scroll_event( self, x, y, steps) + if DEBUG: print 'scroll event : delta = %i, steps = %i ' % (event.delta(),steps) + def keyPressEvent( self, event ): key = self._get_key( event ) FigureCanvasBase.key_press_event( self, key ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |