OpenCurves
0.9
|
Custom zoom handler for Plot
objects.
More...
#include <plotzoomer.h>
Public Types | |
enum | ZoomMode { ZoomBoth, ZoomX, ZoomY, ZoomModeCount } |
Zooming mode. More... | |
typedef QwtPlotZoomer | Super |
Parent class. | |
Public Slots | |
void | setZoomMode (ZoomMode mode) |
Set the active ZoomMode . More... | |
void | setZoomModeBoth () |
Set the zoom mode to ZoomBoth . | |
void | setZoomModeX () |
Set the zoom mode to ZoomX . | |
void | setZoomModeY () |
Set the zoom mode to ZoomY . | |
void | zoomSync (const QRectF &rect) |
Event for zoom synchronisation. More... | |
Signals | |
void | zoomModeChanged (int mode) |
Notifies changes in zoomMode() . | |
void | zoomModeBoth (bool isset) |
Signal for changes to/from ZoomBoth . More... | |
void | zoomModeX (bool isset) |
Signal for changes to/from ZoomX . More... | |
void | zoomModeY (bool isset) |
Signal for changes to/from ZoomY . More... | |
Public Member Functions | |
PlotZoomer (QwtPlotCanvas *plot, bool doReplot=true) | |
Constructor, operating on the given plot . More... | |
~PlotZoomer () | |
Destructor. | |
ZoomMode | zoomMode () const |
Access the current ZoomMode . More... | |
QAction * | zoomBothAction () const |
Fetch the action used to select the ZoomBoth mode. More... | |
QAction * | zoomXAction () const |
Fetch the action used to select the ZoomX mode. More... | |
QAction * | zoomYAction () const |
Fetch the action used to select the ZoomY mode. More... | |
void | loadSettings (QSettings &settings) |
Load zoom settings stored by saveSettings() . More... | |
void | saveSettings (QSettings &settings) |
Save zoom settings to settings . More... | |
void | fitIfAutoScaling () |
Set current zoom to fit if auto scaling is enabled. | |
void | zoomToFit (bool replot=true) |
Zoom to fit even if auto-scaling is off. More... | |
void | zoom (const QRectF &rect) override |
Override to prevent catastrophic event propagation on synchronised zoom response. More... | |
void | zoom (int up) override |
Override to set auto scaling when reaching zoom level zero. More... | |
Static Public Attributes | |
static const unsigned int | AxisY = 0 |
YAxis reference within QwtPlot . | |
static const unsigned int | AxisX = 2 |
XAxis reference within QwtPlot . | |
Protected Slots | |
void | zoomActionToggled (bool checked) |
Bound to zoom actions simply to ensure one is kept active. | |
Protected Member Functions | |
void | widgetMousePressEvent (QMouseEvent *event) override |
End panning or reset the zoom level on right mouse button. More... | |
void | widgetMouseReleaseEvent (QMouseEvent *event) override |
Ignore middle click - handled by panner - resolve right click zoom restore or context menu. More... | |
void | widgetWheelEvent (QWheelEvent *event) override |
Cycle zoom levels on wheel. More... | |
bool | end (bool ok=true) override |
Overload to handle ZoomMode . | |
Custom zoom handler for Plot
objects.
Extends zoom functionality to handle mouse wheel cycling through zoom levels, middle mouse panning and right mouse reset.
enum PlotZoomer::ZoomMode |
|
explicit |
Constructor, operating on the given plot
.
plot | The plot to operate on. |
doReplot | Call QwtPlot::replot() for the attached plot before initializing the zoomer with its scales. This might be necessary, when the plot is in a state with pending scale changes. |
void PlotZoomer::loadSettings | ( | QSettings & | settings | ) |
Load zoom settings stored by saveSettings()
.
Note: zoomToFit()
is called if the stack size is 1 or empty. This enforces auto scaling when there is no active stack.
settings | The object to load from. |
saveSettings()
void PlotZoomer::saveSettings | ( | QSettings & | settings | ) |
Save zoom settings to settings
.
Settings are stored in a group labelled "zoom". The following settings are stored:
Key | Description |
---|---|
mode | The zoomMode() |
index | The current zoomRectIndex() in the zoomStack() |
stack | The zoomStack() as a array of rectangles (see below) |
Each zoom rectangle is written as:
Key | Description |
---|---|
x | The X position |
y | The Y position |
w | The rectangle width |
h | The rectangle height |
settings | The object to save to. |
|
slot |
Set the active ZoomMode
.
Raises the zoomModeChanged()
signal if the mode differs from the current mode.
mode | The mode to set. |
Referenced by setZoomModeBoth(), setZoomModeX(), and setZoomModeY().
|
overrideprotected |
End panning or reset the zoom level on right mouse button.
event | The mouse event. |
|
overrideprotected |
Ignore middle click - handled by panner - resolve right click zoom restore or context menu.
event | The mouse event. |
|
overrideprotected |
Cycle zoom levels on wheel.
event | The mouse event. |
|
override |
Override to prevent catastrophic event propagation on synchronised zoom response.
rect | The zoom rectangle. |
|
override |
Override to set auto scaling when reaching zoom level zero.
up | The number of zoom steps to make. |
|
inline |
|
inline |
Access the current ZoomMode
.
ZoomMode
.
|
signal |
Signal for changes to/from ZoomBoth
.
isset | True if ZoomBoth is the new zoom mode. |
|
signal |
Signal for changes to/from ZoomX
.
isset | True if ZoomX is the new zoom mode. |
|
signal |
Signal for changes to/from ZoomY
.
isset | True if ZoomY is the new zoom mode. |
|
slot |
Event for zoom synchronisation.
The whole zoom stack is synchronised if the sender is a QwtPlotZoomer
.
void PlotZoomer::zoomToFit | ( | bool | replot = true | ) |
Zoom to fit even if auto-scaling is off.
replot | Force replot after the zoom? |
|
inline |
|
inline |