Microwave filters GUI 2.0.3

- Main Page
- Related Pages
- Packages
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
dbplot.CanvasEventFilter Class Reference

Event filter for the canvas. More...

## Public Member Functions
def | __init__
| Class constructor.
def | eventFilter
| The event filter.

## Detailed Description

Event filter for the canvas.

This filter is necessary to pick up events that are not handled by the QwtPlotPicker class, like mouse dragging.

It would be enough (and better practice) to reimplement mousePressEvent() and keyPressEvent() of the QwtPlotCanvas class, but we if we create a derived class from QwtPlotCanvas it is not possible to set an instance of this class to the canvas of a QwtPlot object since there is not setPlotCanvas() method in QwtPlot class.

To handle left mouse clicks it is enough to create a mouseClicked() slot and connect to 'selected' signal of QwtPlotPicker class: self.connect(pickerLeft, SIGNAL('selected(QwtDoublePoint)'), self.mouseClicked ) but since we have to implement this filter anyway in order to handle mouse dragging, we will handle also all the other events here.

Reimplementation of mousePressEvent() from QwtPlot does not work, because we need the mouse coordinates obtained from event.pos() to be relative to the QwtPlotCanvas widget, not to the QwtPlot, in order to get the graph coordinates using QwtPlot.invTransform().

Implementing this filter is essentially what the QwtPlotPicker class does, but unfortunately it does not support mouse dragging, only mouse selection.

Definition at line 2221 of file dbplot.py.

## Constructor & Destructor Documentation

def dbplot.CanvasEventFilter.__init__ | ( |  | self,
|  |  | dbplot,
|  |  | hPlot
| ) |  |

Class constructor.

Parameters

  dbplot | = DbPlot class instance, necessary to check the value of some dbPlot flags.
  hPlot | = The parent widget. Must be a Qwt.QwtPlot class instance, since non-processed events will be sent to Qwt.QwtPlot.eventFilter(self, object, event).

Definition at line 2229 of file dbplot.py.

References dbplot.MyPicker.dbplot, and dbplot.CanvasEventFilter.dbplot.

## Member Function Documentation

def dbplot.CanvasEventFilter.eventFilter | ( |  | self,
|  |  | object,
|  |  | event
| ) |  |

The event filter.

When the event has been processed, for mouse movements the return value is not True, in order to allow the event to be processed also by other widgets like QwtPlotPicker.

Definition at line 2242 of file dbplot.py.

The documentation for this class was generated from the following file:

- dbplot.py