RangeSelectorTool Class Reference

`#include <RangeSelectorTool.h>`

Inheritance diagram for RangeSelectorTool:

## Public Slots

virtual void | pointSelected (const QPoint &point)
void | setCurveRange ()
void | setEnabled (bool on=true)

## Signals

void | changed ()
| Emitted whenever the selected curve and/or range have changed. More...
void | statusText (const QString &)

## Public Member Functions

void | clearSelection ()
void | copySelection ()
void | cutSelection ()
int | dataSize () const
virtual bool | eventFilter (QObject *obj, QEvent *event)
bool | isVisible ()
bool | keyEventFilter (QKeyEvent *ke)
double | maxXValue () const
double | maxYValue () const
double | minXValue () const
double | minYValue () const
void | pasteSelection ()
| RangeSelectorTool (Graph *graph, const QObject *status_target=NULL, const char *status_slot="")
virtual int | rtti () const
QwtPlotCurve * | selectedCurve () const
void | setSelectedCurve (QwtPlotCurve *curve)
| Caller is responsible for replot. More...
void | setVisible (bool on)
virtual | ~RangeSelectorTool ()
Public Member Functions inherited from PlotToolInterface
| PlotToolInterface (Graph *graph, const QObject *status_target=NULL, const char *status_slot="")
virtual | ~PlotToolInterface ()

## Protected Member Functions

virtual void | append (const QPoint &point)
void | emitStatusText ()
void | setActivePoint (int index)
| Caller is responsible for replot. More...
void | switchActiveMarker ()

## Private Types

enum | RangeEditOperation { Copy, Cut, Delete }

## Private Slots

void | clearMultipleSelection ()
void | copyMultipleSelection ()
void | cutMultipleSelection ()

## Private Member Functions

void | clearSelectedCurve ()
| Clears data range from the selected curve. More...
void | copySelectedCurve ()
| Copies data range from the selected curve to clipboard. More...
bool | mightNeedMultipleSelection ()
void | showSelectionDialog (RangeEditOperation op=Copy)

## Private Attributes

QwtPlotMarker | d_active_marker
int | d_active_point
bool | d_enabled
QwtPlotMarker | d_inactive_marker
int | d_inactive_point
QwtPlotCurve * | d_selected_curve
QPointer< QDialog > | d_selection_dialog
QList< QCheckBox * > | d_selection_lst
| Keeps track of the multiple curves selection. More...
bool | d_visible

## Additional Inherited Members

Public Types inherited from PlotToolInterface
enum | RttiValues { Rtti_PlotTool = 0, Rtti_RangeSelector, Rtti_DataPicker, Rtti_TranslateCurveTool, Rtti_MultiPeakFitTool, Rtti_LineProfileTool, Rtti_AddWidgetTool, Rtti_DrawDataPoints, Rtti_ImageProfilesTool, Rtti_SubtractLineTool, Rtti_PlotUserTool = 1000 }
Protected Attributes inherited from PlotToolInterface
Graph * | d_graph
const char * | d_status_slot
const QObject * | d_status_target

## Detailed Description

Plot tool for selecting ranges on curves.

As detailed in the documentation of PlotToolInterface, this one is different from most other plot tools in that other tools depend on it. Thus, either RangeSelectorTool should cease to inherit from PlotToolInterface and be renamed to RangeSelector, drawing a clear destinction to the other tools, or the notion of multiple tools being active in parallel and possibly depending on each other should be generalized somehow.

In any case, gathering the code specific to range selection in a seperate class makes Graph/CanvasPicker more manageable; maybe something similar can be done for zooming.

## Member Enumeration Documentation

## RangeEditOperation

enum RangeSelectorTool::RangeEditOperation

private

Enumerator
Copy |
Cut |
Delete |

## Constructor & Destructor Documentation

## RangeSelectorTool()

RangeSelectorTool::RangeSelectorTool | ( | Graph * | graph,
|  | const QObject * | status_target = `NULL`,
|  | const char * | status_slot = `""`
| ) |  |

References Graph::curve(), Graph::curveCount(), d_active_marker, d_active_point, d_enabled, PlotToolInterface::d_graph, d_inactive_marker, d_inactive_point, d_selected_curve, d_selection_dialog, d_visible, and statusText().

## ~RangeSelectorTool()

RangeSelectorTool::~RangeSelectorTool | ( |  | ) |

virtual

References d_active_marker, PlotToolInterface::d_graph, d_inactive_marker, and d_selection_dialog.

## Member Function Documentation

## append()

virtual void RangeSelectorTool::append | ( | const QPoint & | point | ) |

inline protected virtual

References emitStatusText(), pointSelected(), setActivePoint(), and switchActiveMarker().

## changed

void RangeSelectorTool::changed | ( |  | ) |

signal

Emitted whenever the selected curve and/or range have changed.

Referenced by clearMultipleSelection(), clearSelectedCurve(), isVisible(), pasteSelection(), pointSelected(), setActivePoint(), and setSelectedCurve().

## clearMultipleSelection

void RangeSelectorTool::clearMultipleSelection | ( |  | ) |

private slot

References changed(), Table::colIndex(), Graph::curve(), d_active_marker, d_active_point, PlotToolInterface::d_graph, d_inactive_marker, d_inactive_point, d_selected_curve, d_selection_dialog, d_selection_lst, emitStatusText(), Graph::Function, Table::isReadOnlyColumn(), Table::notifyChanges(), Table::setText(), Table::table(), and PlotCurve::type().

Referenced by cutMultipleSelection(), isVisible(), and showSelectionDialog().

## clearSelectedCurve()

void RangeSelectorTool::clearSelectedCurve | ( |  | ) |

private

Clears data range from the selected curve.

References changed(), Table::colIndex(), d_active_marker, d_active_point, PlotToolInterface::d_graph, d_inactive_marker, d_inactive_point, d_selected_curve, emitStatusText(), Graph::Function, Table::isReadOnlyColumn(), Table::notifyChanges(), Table::setText(), and Table::table().

Referenced by clearSelection(), and cutSelection().

## clearSelection()

void RangeSelectorTool::clearSelection | ( |  | ) |

References clearSelectedCurve(), d_selected_curve, Delete, mightNeedMultipleSelection(), and showSelectionDialog().

Referenced by selectedCurve().

## copyMultipleSelection

void RangeSelectorTool::copyMultipleSelection | ( |  | ) |

private slot

References Graph::curve(), d_active_point, PlotToolInterface::d_graph, d_inactive_point, d_selected_curve, d_selection_dialog, d_selection_lst, Graph::ErrorBars, Graph::multiLayer(), and PlotCurve::type().

Referenced by cutMultipleSelection(), isVisible(), and showSelectionDialog().

## copySelectedCurve()

void RangeSelectorTool::copySelectedCurve | ( |  | ) |

private

Copies data range from the selected curve to clipboard.

References MdiSubWindow::applicationWindow(), d_active_point, ApplicationWindow::d_decimal_digits, PlotToolInterface::d_graph, d_inactive_point, d_selected_curve, and Graph::multiLayer().

Referenced by copySelection(), and cutSelection().

## copySelection()

void RangeSelectorTool::copySelection | ( |  | ) |

References copySelectedCurve(), d_selected_curve, mightNeedMultipleSelection(), and showSelectionDialog().

Referenced by selectedCurve().

## cutMultipleSelection

void RangeSelectorTool::cutMultipleSelection | ( |  | ) |

private slot

References clearMultipleSelection(), and copyMultipleSelection().

Referenced by isVisible(), and showSelectionDialog().

## cutSelection()

void RangeSelectorTool::cutSelection | ( |  | ) |

References clearSelectedCurve(), copySelectedCurve(), Cut, d_selected_curve, mightNeedMultipleSelection(), and showSelectionDialog().

Referenced by selectedCurve().

## dataSize()

int RangeSelectorTool::dataSize | ( |  | ) | const

inline

References d_active_point, d_inactive_point, eventFilter(), and keyEventFilter().

## emitStatusText()

void RangeSelectorTool::emitStatusText | ( |  | ) |

protected

References MdiSubWindow::applicationWindow(), Table::colIndex(), Table::columnType(), d_active_marker, d_active_point, ApplicationWindow::d_decimal_digits, PlotToolInterface::d_graph, d_inactive_marker, d_inactive_point, d_selected_curve, Graph::ErrorBars, Graph::Function, Graph::Histogram, Graph::multiLayer(), Table::Numeric, statusText(), DataCurve::table(), DataCurve::tableRow(), Table::text(), DataCurve::xColumnName(), PlotCurve::xOffset(), DataCurve::xTable(), and PlotCurve::yOffset().

Referenced by append(), clearMultipleSelection(), clearSelectedCurve(), pasteSelection(), pointSelected(), setActivePoint(), setSelectedCurve(), and switchActiveMarker().

## eventFilter()

bool RangeSelectorTool::eventFilter | ( | QObject * | obj,
|  | QEvent * | event
| ) |  |

virtual

References keyEventFilter().

Referenced by dataSize().

## isVisible()

bool RangeSelectorTool::isVisible | ( |  | ) |

inline

References changed(), clearMultipleSelection(), copyMultipleSelection(), cutMultipleSelection(), d_visible, pointSelected(), setCurveRange(), setEnabled(), and statusText().

## keyEventFilter()

bool RangeSelectorTool::keyEventFilter | ( | QKeyEvent * | ke | ) |

References Graph::curve(), Graph::curveCount(), Graph::curveIndex(), d_active_point, PlotToolInterface::d_graph, d_selected_curve, setActivePoint(), setSelectedCurve(), and switchActiveMarker().

Referenced by dataSize(), and eventFilter().

## maxXValue()

double RangeSelectorTool::maxXValue | ( |  | ) | const

inline

References d_active_marker, and d_inactive_marker.

## maxYValue()

double RangeSelectorTool::maxYValue | ( |  | ) | const

inline

References d_active_marker, and d_inactive_marker.

## mightNeedMultipleSelection()

bool RangeSelectorTool::mightNeedMultipleSelection | ( |  | ) |

private

References Graph::curve(), Graph::curveCount(), PlotToolInterface::d_graph, d_selected_curve, Graph::Function, and PlotCurve::type().

Referenced by clearSelection(), copySelection(), and cutSelection().

## minXValue()

double RangeSelectorTool::minXValue | ( |  | ) | const

inline

References d_active_marker, and d_inactive_marker.

## minYValue()

double RangeSelectorTool::minYValue | ( |  | ) | const

inline

References d_active_marker, and d_inactive_marker.

## pasteSelection()

void RangeSelectorTool::pasteSelection | ( |  | ) |

References changed(), Table::colIndex(), Table::columnNumericFormat(), d_active_marker, d_active_point, PlotToolInterface::d_graph, d_inactive_marker, d_inactive_point, d_selected_curve, emitStatusText(), Graph::Function, Table::isReadOnlyColumn(), Graph::multiLayer(), Table::notifyChanges(), Table::setText(), and Table::table().

Referenced by selectedCurve().

## pointSelected

void RangeSelectorTool::pointSelected | ( | const QPoint & | point | ) |

virtual slot

References changed(), Graph::closestCurve(), d_active_marker, d_active_point, PlotToolInterface::d_graph, d_inactive_marker, d_inactive_point, d_selected_curve, emitStatusText(), and setActivePoint().

Referenced by append(), and isVisible().

## rtti()

virtual int RangeSelectorTool::rtti | ( |  | ) | const

inline virtual

Reimplemented from PlotToolInterface.

References PlotToolInterface::Rtti_RangeSelector, and setVisible().

## selectedCurve()

QwtPlotCurve* RangeSelectorTool::selectedCurve | ( |  | ) | const

inline

References clearSelection(), copySelection(), cutSelection(), d_selected_curve, pasteSelection(), and setSelectedCurve().

## setActivePoint()

void RangeSelectorTool::setActivePoint | ( | int | index | ) |

protected

Caller is responsible for replot.

References changed(), d_active_marker, d_active_point, d_enabled, d_selected_curve, and emitStatusText().

Referenced by append(), keyEventFilter(), and pointSelected().

## setCurveRange

void RangeSelectorTool::setCurveRange | ( |  | ) |

slot

References d_active_point, PlotToolInterface::d_graph, d_inactive_point, d_selected_curve, Graph::Function, Graph::notifyChanges(), and Graph::updatePlot().

Referenced by isVisible().

## setEnabled

void RangeSelectorTool::setEnabled | ( | bool | on = `true` | ) |

slot

References d_enabled, and PlotToolInterface::d_graph.

Referenced by isVisible().

## setSelectedCurve()

void RangeSelectorTool::setSelectedCurve | ( | QwtPlotCurve * | curve | ) |

Caller is responsible for replot.

References changed(), d_active_marker, d_active_point, d_enabled, d_inactive_marker, d_inactive_point, d_selected_curve, and emitStatusText().

Referenced by keyEventFilter(), and selectedCurve().

## setVisible()

void RangeSelectorTool::setVisible | ( | bool | on | ) |

References d_active_marker, d_enabled, PlotToolInterface::d_graph, d_inactive_marker, and d_visible.

Referenced by rtti().

## showSelectionDialog()

void RangeSelectorTool::showSelectionDialog | ( | RangeEditOperation | op = `Copy` | ) |

private

References clearMultipleSelection(), Copy, copyMultipleSelection(), Graph::curve(), Graph::curveCount(), Cut, cutMultipleSelection(), PlotToolInterface::d_graph, d_selected_curve, d_selection_dialog, d_selection_lst, Delete, Graph::Function, and PlotCurve::type().

Referenced by clearSelection(), copySelection(), and cutSelection().

## statusText

void RangeSelectorTool::statusText | ( | const QString & |  | ) |

signal

Emitted whenever a new message should be presented to the user.

You don't have to connect to this signal if you alreay specified a reciever during initialization.

Referenced by emitStatusText(), isVisible(), and RangeSelectorTool().

## switchActiveMarker()

void RangeSelectorTool::switchActiveMarker | ( |  | ) |

protected

References d_active_marker, d_active_point, PlotToolInterface::d_graph, d_inactive_marker, d_inactive_point, and emitStatusText().

Referenced by append(), and keyEventFilter().

## Member Data Documentation

## d_active_marker

QwtPlotMarker RangeSelectorTool::d_active_marker

private

Referenced by clearMultipleSelection(), clearSelectedCurve(), emitStatusText(), maxXValue(), maxYValue(), minXValue(), minYValue(), pasteSelection(), pointSelected(), RangeSelectorTool(), setActivePoint(), setSelectedCurve(), setVisible(), switchActiveMarker(), and ~RangeSelectorTool().

## d_active_point

int RangeSelectorTool::d_active_point

private

Referenced by clearMultipleSelection(), clearSelectedCurve(), copyMultipleSelection(), copySelectedCurve(), dataSize(), emitStatusText(), keyEventFilter(), pasteSelection(), pointSelected(), RangeSelectorTool(), setActivePoint(), setCurveRange(), setSelectedCurve(), and switchActiveMarker().

## d_enabled

bool RangeSelectorTool::d_enabled

private

Referenced by RangeSelectorTool(), setActivePoint(), setEnabled(), setSelectedCurve(), and setVisible().

## d_inactive_marker

QwtPlotMarker RangeSelectorTool::d_inactive_marker

private

Referenced by clearMultipleSelection(), clearSelectedCurve(), emitStatusText(), maxXValue(), maxYValue(), minXValue(), minYValue(), pasteSelection(), pointSelected(), RangeSelectorTool(), setSelectedCurve(), setVisible(), switchActiveMarker(), and ~RangeSelectorTool().

## d_inactive_point

int RangeSelectorTool::d_inactive_point

private

Referenced by clearMultipleSelection(), clearSelectedCurve(), copyMultipleSelection(), copySelectedCurve(), dataSize(), emitStatusText(), pasteSelection(), pointSelected(), RangeSelectorTool(), setCurveRange(), setSelectedCurve(), and switchActiveMarker().

## d_selected_curve

QwtPlotCurve* RangeSelectorTool::d_selected_curve

private

Referenced by clearMultipleSelection(), clearSelectedCurve(), clearSelection(), copyMultipleSelection(), copySelectedCurve(), copySelection(), cutSelection(), emitStatusText(), keyEventFilter(), mightNeedMultipleSelection(), pasteSelection(), pointSelected(), RangeSelectorTool(), selectedCurve(), setActivePoint(), setCurveRange(), setSelectedCurve(), and showSelectionDialog().

## d_selection_dialog

QPointer<QDialog> RangeSelectorTool::d_selection_dialog

private

Referenced by clearMultipleSelection(), copyMultipleSelection(), RangeSelectorTool(), showSelectionDialog(), and ~RangeSelectorTool().

## d_selection_lst

QList<QCheckBox *> RangeSelectorTool::d_selection_lst

private

Keeps track of the multiple curves selection.

Referenced by clearMultipleSelection(), copyMultipleSelection(), and showSelectionDialog().

## d_visible

bool RangeSelectorTool::d_visible

private

Referenced by isVisible(), RangeSelectorTool(), and setVisible().

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

- qtiplot/src/plot2D/RangeSelectorTool.h
- qtiplot/src/plot2D/RangeSelectorTool.cpp