|
SciDAVis
1.D4
|
Let the user pick single data points from a plot. More...
#include <DataPointPicker.h>
Public Member Functions | |
| DataPointPicker (Graph *g, ApplicationWindow *app) | |
| Constructor. | |
| 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 | |
| ApplicationWindow * | m_app |
| Graph * | m_graph |
| QEventLoop | m_picking_loop |
| QPointF | m_result |
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.
| DataPointPicker::DataPointPicker | ( | Graph * | g, |
| ApplicationWindow * | app | ||
| ) |
Constructor.
| DataPointPicker::~DataPointPicker | ( | ) |
Destructor (exits the event loop).
References m_picking_loop.
| 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().
|
protectedslot |
Handle selection of a point by the user.
References m_picking_loop, and m_result.
Referenced by pick().
|
private |
Referenced by pick().
|
private |
Referenced by pick(), pointSelected(), and ~DataPointPicker().
|
private |
Referenced by pick(), and pointSelected().
1.8.1