OpenCurves
0.9
|
An plot view viewing a Curves
model.
More...
#include <plotview.h>
Public Types | |
enum | ToolMode { MultiTool, PanTool, ZoomTool, ToolModeCount } |
Modes for various interaction tools. More... | |
typedef QFrame | Super |
Parent class alias. | |
Public Slots | |
void | zoomToFit () |
Change the current zoom level to fit the currently selected plots. More... | |
void | setSynchronised (bool sync) |
Set or clear the synchronisation flag for this view. More... | |
void | setToolMode (ToolMode mode) |
Set the tool mode for this view. More... | |
void | setMultiTool () |
Set the tool mode to MultiTool . | |
void | setPanTool () |
Set the tool mode to PanTool . | |
void | setZoomTool () |
Set the tool mode to ZoomTool . | |
void | setLegendPosition (int pos) |
Set the legend position. More... | |
void | copyToClipboard () |
Copies the current plot view content to the clipboard. More... | |
Signals | |
void | focusGained () |
Emitted when this PlotView gains focus. More... | |
void | focusLost () |
Emitted when this PlotView looses focus. More... | |
void | synchronisedChanged (bool sync) |
Emitted when the synchronised() flag changed. More... | |
void | toolModeChanged (ToolMode mode) |
Emitted when the current tool mode is changed. More... | |
void | legendChanged (QwtLegend *legend, int position) |
The legend or its position has been changed, possibly to null. More... | |
Public Member Functions | |
PlotView (Curves *curves, QWidget *parent=nullptr) | |
Create a view into curves . | |
~PlotView () | |
Destructor. | |
void | showNone () |
Clear viewing of all items. No notification triggered. | |
void | loadSettings (QSettings &settings) |
Load settings for this view. More... | |
void | saveSettings (QSettings &settings) |
Save settings for this view. More... | |
QwtPlot * | plot () |
Access the primary plotting widget. More... | |
const QwtPlot * | plot () const |
Access the primary plotting widget. More... | |
ToolMode | toolMode () const |
Get the current tool mode. More... | |
int | legendPosition () const |
Request the current legend position. More... | |
bool | synchronised () const |
Get the synchronisation state. More... | |
PlotZoomer * | zoomer () const |
Access the zooming tool. More... | |
PlotPanner * | panner () const |
Access the panning tool. More... | |
void | setHighlight (bool active) |
Set to display in the highlight or not. More... | |
bool | isHighlighted () const |
Request the current highlight state (as per setHighlight() ). More... | |
void | updateActive (const QStringList &sourceNames, const QStringList &curveNames) |
Updates which plots and files this view is showing. More... | |
const QStringList & | activeSourceNames () const |
Retrieves the list of active sources this view is displaying, or expecting to display. More... | |
const QStringList & | visibleCurveNames () const |
Retrieves the list of visible curves this view is displaying, or expecting to display. More... | |
Static Public Attributes | |
static const int | SharedLegend |
Special index for shared legend. | |
Protected Slots | |
void | addCurve (PlotInstance *curve) |
Handles a new curve definition by creating an appropriate display interface. More... | |
void | removeCurve (const PlotInstance *curve) |
Handles curve removal or deletion, removing the corresponding display adaptor. More... | |
void | curveDataChanged (const PlotInstance *curve) |
Handles changes to curve data. More... | |
void | curvesCleared () |
Handles removal of all curves. More... | |
void | legendSelectionChanged (int index) |
Handles changes to the legend position combo box. More... | |
void | toolActionToggled (bool checked) |
Ensures the current tool action stays checked. More... | |
Friends | |
class | FocusPlot |
An plot view viewing a Curves
model.
The view maintains its own visibility status including list of visible files, curves zoom level and position.
enum PlotView::ToolMode |
|
inline |
Retrieves the list of active sources this view is displaying, or expecting to display.
This is set in updateActive()
.
|
protectedslot |
Handles a new curve definition by creating an appropriate display interface.
The new curve is initially visible only if its source and name are present in activeSourceNames()
and visibleCurveNames()
respectively.
Handler for Curves::curveAdded()
curve | The new curve. |
|
slot |
Copies the current plot view content to the clipboard.
The current curves and legend (if not shared) are rendered to a bitmap and added to the system clipboard. The size of the bitmap matches the plot()
size.
This call does nothing if there is no system clipboard, determined by whether QApplication::clipboard()
is null or not.
|
protectedslot |
Handles changes to curve data.
This updates the display adaptor for curve
and may replot if the curve is visible. The method assumes all data may be invalidated as there is no specification for what has changed.
curve | The curve which has been modified or invalidated. |
|
protectedslot |
Handles removal of all curves.
The activeSourceNames()
and visibleCurveNames()
remain unchanged.
Handler for Curves::curvesCleared()
|
signal |
|
signal |
bool PlotView::isHighlighted | ( | ) | const |
Request the current highlight state (as per setHighlight()
).
|
signal |
The legend or its position has been changed, possibly to null.
legend | The new legend object, or null if position is SharedLegend . |
position | The new legend position; one of QwtLegend::LegendPosition or SharedLegend . |
int PlotView::legendPosition | ( | ) | const |
Request the current legend position.
The result corresponds to QwtPlot::LegendPosition
with an additional possible value of SharedLegend
.
The SharedLeged
is not handled by this view as the semantics imply higher level handling at a single, shared level.
QwtPlot::LegendPosition
or SharedLegend
.
|
protectedslot |
Handles changes to the legend position combo box.
May emit legendChanged()
index | The new legend position index. |
void PlotView::loadSettings | ( | QSettings & | settings | ) |
|
inline |
Access the panning tool.
|
inline |
Access the primary plotting widget.
The widget is a child of this object.
QwtPlot
used to display the curves.
|
inline |
Access the primary plotting widget.
The widget is a child of this object.
QwtPlot
used to display the curves.
|
protectedslot |
Handles curve removal or deletion, removing the corresponding display adaptor.
The visibleCurveNames()
remains unchanged.
Handler for Curves::curveRemoved()
curve | The curve being removed (and likely to be deleted). |
void PlotView::saveSettings | ( | QSettings & | settings | ) |
Save settings for this view.
Stores the following items:
Key | Data Item |
---|---|
sources | list of activeSourceNames() |
visible | list of visibleCurveNames() |
sync | synchronised() state |
legend | The legendPosition() |
tool | The toolMode() |
Zoom settings | See PlotZoomer::saveSettings() |
settings | The settings object to use. |
void PlotView::setHighlight | ( | bool | active | ) |
Set to display in the highlight or not.
This affects the display border.
active | True to activate the highlight. |
|
slot |
Set the legend position.
The pos
must be in range or the call is ignored.
On changing the legend position, the legendChanged()
signal is raised.
pos | The new legend position. Must be one of QwtLegend::LegendPosition values, or SharedLegend . |
|
slot |
Set or clear the synchronisation flag for this view.
Raises the synchronisedChanged()
signal.
sync | True to enable view synchronisation. |
synchronised()
|
slot |
Set the tool mode for this view.
Raises the toolModeChanged()
signal.
mode | The mode to set. |
ToolMode
Referenced by setMultiTool(), setPanTool(), and setZoomTool().
|
inline |
Get the synchronisation state.
A synchronised plot view is expected to keep its panning and zoom levels in sync with one or more other PlotView
objects. This flag simply indicates the desired internal state and synchronisation is managed at a higher level.
|
signal |
Emitted when the synchronised()
flag changed.
sync | The new flag value. |
|
protectedslot |
Ensures the current tool action stays checked.
Handler for all tool mode actions.
PlotViewToolbar
. checked | The new checked state for the QAction sending the signal. |
|
inline |
Get the current tool mode.
|
signal |
Emitted when the current tool mode is changed.
mode | The new ToolMode . |
void PlotView::updateActive | ( | const QStringList & | sourceNames, |
const QStringList & | curveNames | ||
) |
Updates which plots and files this view is showing.
To display, a curve must have a source name matching one of the sourceNames
and a curve name matching one of the curveNames
.
The allActiveSources
may be used as the collated list of sources being displayed by any active view. This ensures all curves are colour shifted the same way when provided to all views.
sourceNames | The list of sources to display. |
curveNames | The list of curves to display from the sources. |
|
inline |
Retrieves the list of visible curves this view is displaying, or expecting to display.
This is set in updateActive()
.
|
inline |
Access the zooming tool.
|
slot |
Change the current zoom level to fit the currently selected plots.
This resets the zoom-stack and enabled auto-scaling on both axes.
Raises the PlotZoomer::zoomed()
signal from zoomer()
.