SciDAVis  1.D4
Public Member Functions | Protected Slots | Private Attributes
DataPointPicker Class Reference

Let the user pick single data points from a plot. More...

#include <DataPointPicker.h>

List of all members.

Public Member Functions

 DataPointPicker (Graph *g, ApplicationWindow *app)
QPointF pick ()
 Let the user pick a single data point and return its coordinates.
 ~DataPointPicker ()
 Destructor (exits the event loop).

Protected Slots

void pointSelected (QwtPlotCurve *curve, int pointIndex)
 Handle selection of a point by the user.

Private Attributes

QEventLoop m_picking_loop
QPointF m_result

Detailed Description

Let the user pick single data points from a plot.

While DataPickerTool does the actual selection work, DataPointPicker provides the framework necessary for script-driven usage. In particular, the event-oriented interface of DataPickerTool doesn't fit very well into the typical imparative structure of simple scripts. DataPointPicker bridges this gap by starting a new event loop (see QEventLoop) which allows the user to pick a data point while the script is still running within the main event loop. The inner event loop exits when the user has selected a data point, pick() returns its coordinates and control flows back to the caller.

Constructor & Destructor Documentation

DataPointPicker::DataPointPicker ( Graph g,
ApplicationWindow app 


DataPointPicker::~DataPointPicker ( )

Destructor (exits the event loop).

References m_picking_loop.

Member Function Documentation

QPointF DataPointPicker::pick ( )

Let the user pick a single data point and return its coordinates.

Starts a new event loop, which runs until either the user has selected a point or the DataPointPicker is destructed.

References DataPickerTool::Display, Graph::isPiePlot(), m_app, m_graph, m_picking_loop, m_result, pointSelected(), Graph::setActiveTool(), and Graph::validCurvesDataSize().

void DataPointPicker::pointSelected ( QwtPlotCurve *  curve,
int  pointIndex 

Handle selection of a point by the user.

References m_picking_loop, and m_result.

Referenced by pick().

Member Data Documentation

ApplicationWindow* DataPointPicker::m_app

Referenced by pick().

Graph* DataPointPicker::m_graph

Referenced by pick().

QEventLoop DataPointPicker::m_picking_loop
QPointF DataPointPicker::m_result

Referenced by pick(), and pointSelected().

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