jzaremba / guiqwt

Automatically exported from code.google.com/p/guiqwt
Other
0 stars 1 forks source link

Baseplot captures mouseDoubleClickEvent for whole plot area instead of just the axis area #43

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Since Baseplot now implements mouseDoubleClickEvent, a reimplementation at a 
higher level is ignored (it never sees the event) so you can't implement custom 
actions (for instance, double-clicking the plot auto-zooms).

What steps will reproduce the problem?
1. Use the plot.py example from tests
2. Subclass CurveDialog to a local copy (say CurveDialogLocal) and implement a 
mouseDoubleClickEvent() there.
3. Verify that double-clicking on the plot area does not trigger the event in 
CurveDialogLocal.

This occurs because the mouseDoubleClickEvent in BasePlot doesn't ignore 
double-clicks that are on the canvas area (it just accepts them and does 
nothing).  Modifying BasePlot's mouseDoubleClickEvent to detect when the 
d-click is on the canvas and calling event.ignore() will pass the event up and 
allow higher level widgets to respond.  Suggested fix:

    def mouseDoubleClickEvent(self, event):
        """Reimplement QWidget method"""
        if self.canvas().geometry().contains(event.pos()): #NEW
            event.ignore()                                 #NEW
            return                                         #NEW
        for axis_id in self.AXIS_IDS:
            widget = self.axisWidget(axis_id)
            if widget.geometry().contains(event.pos()):
                self.edit_axis_parameters(axis_id)

What version of the product are you using? On what operating system?
Using guiqwt 2.2.1-1 (installed via PythonXY) on Windows7 (and Scientific Linux 
6.2 - where I have the older version installed that works since mouseDCEvent 
isn't implemented there).

Please provide any additional information below.

Original issue reported on code.google.com by ericj...@gmail.com on 6 Feb 2013 at 5:04