Skip to content

Class QAccelPlot::SelectionTool

ClassList > QAccelPlot > SelectionTool

Selects a data-space region by dragging, without changing the plot viewport. More...

  • #include <SelectionTool.hpp>

Inherits the following classes: QObject

Inheritance diagram

flowchart TB
  classQAccelPlot_1_1SelectionTool["QAccelPlot::SelectionTool"]

  external_base_classQAccelPlot_1_1SelectionTool_1["QObject"]
  external_base_classQAccelPlot_1_1SelectionTool_1 --> classQAccelPlot_1_1SelectionTool

Public Types

Type Name
enum Mode
Region selected by a gesture.

Public Properties

Type Name
property Border * border
Outline inside the rectangle's edges. Default: Colors.dark.selectionBorder , width 1.
property Qt::MouseButton button
Mouse button that starts a gesture. Default: Qt.LeftButton.
property bool enabled
Enables gestures; disabling cancels a gesture in progress and keeps the selection. Default: true.
property QColor fillColor
Fill color of the rectangle. Default: Colors.dark.selectionFill .
property bool hasSelection
True while a region is selected.
property qreal minimumSize
Smallest gesture in logical pixels that selects; a smaller one only clears the selection. Default: 6.
property Mode mode
Region a gesture selects: a box, an X range, or a Y range. Default: Box.
property InspectionRowModel * model
Read-only constant: one row of region statistics per selected series.
property Qt::KeyboardModifiers modifiers
Exact Qt::KeyboardModifiers required at press time. Default: Qt.ShiftModifier.
property PlotView * plot
Plot receiving the selection gestures.
property bool selecting
True while a gesture is in progress.
property QRectF selectionRect
Gesture or selected region in the plot's coordinates, in logical pixels; empty without either.
property bool visible
Draws the gesture and the selected region with fillColor andborder . Default: true.
property Axis * xAxis
Axis the X limits refer to; unset uses the plot's primary X axis.
property qreal xMax
Upper X limit of the selection; Infinity when unbounded, NaN without a selection.
property qreal xMin
Lower X limit of the selection; -Infinity when unbounded, NaN without a selection.
property Axis * yAxis
Axis the Y limits refer to; unset uses the plot's primary Y axis.
property qreal yMax
Upper Y limit of the selection; Infinity when unbounded, NaN without a selection.
property qreal yMin
Lower Y limit of the selection; -Infinity when unbounded, NaN without a selection.

Public Signals

Type Name
signal void buttonChanged
Emitted when the button property changes.
signal void completed
Emitted when a gesture selected a region. Rows of series that are still preparing follow later.
signal void enabledChanged
Emitted when the enabled property changes.
signal void fillColorChanged
Emitted when the fillColor property changes.
signal void minimumSizeChanged
Emitted when the minimumSize property changes.
signal void modeChanged
Emitted when the mode property changes.
signal void modifiersChanged
Emitted when the modifiers property changes.
signal void plotChanged
Emitted when the plot property changes.
signal void selectingChanged
Emitted when a gesture starts or ends.
signal void selectionChanged
Emitted when the selected region is set, changed, or cleared.
signal void selectionRectChanged
Emitted when the selectionRect property changes.
signal void visibleChanged
Emitted when the visible property changes.
signal void xAxisChanged
Emitted when the axis the X limits refer to changes.
signal void yAxisChanged
Emitted when the axis the Y limits refer to changes.

Public Functions

Type Name
SelectionTool (QObject * parent=nullptr)
Constructs a tool without a plot.
Border * border () const
Returns the rectangle's outline settings. The object is owned by the tool.
Qt::MouseButton button () const
Returns the mouse button that starts a gesture.
Q_INVOKABLE void clear ()
Cancels a gesture in progress and clears the selection.
bool enabled () const
Returns whether gestures are enabled.
QColor fillColor () const
Returns the rectangle's fill color.
bool hasSelection () const
Returns true while a region is selected.
Q_INVOKABLE InspectionPage indices (PlotSeries * series, int offset=0, int limit=4096)
Returns one page of series' source indices inside the selection, against its current data.
bool isVisible () const
Returns whether the tool draws the gesture and the selected region.
qreal minimumSize () const
Returns the smallest selecting gesture in logical pixels.
Mode mode () const
Returns the region a gesture selects.
InspectionRowModel * model () const
Returns the model of per-series region statistics.
Qt::KeyboardModifiers modifiers () const
Returns the required keyboard modifiers.
PlotView * plot () const
Returns the attached plot.
Q_INVOKABLE bool select (qreal xMin, qreal xMax, qreal yMin, qreal yMax)
Selects the region with the given limits; returns false when a limit is NaN.
bool selecting () const
Returns true while a gesture is in progress.
QRectF selectionRect () const
Returns the gesture or selected region in the plot's coordinates, in logical pixels.
void setButton (Qt::MouseButton button)
Sets the mouse button that starts a gesture.
void setEnabled (bool enabled)
Enables or disables gestures.
void setFillColor (const QColor & color)
Sets the rectangle's fill color.
void setMinimumSize (qreal size)
Sets the smallest selecting gesture, clamping negative values to zero and ignoring nonfinite values.
void setMode (Mode mode)
Sets the region a gesture selects and cancels a gesture in progress.
void setModifiers (Qt::KeyboardModifiers modifiers)
Sets the exact keyboard modifiers required at press time.
void setPlot (PlotView * plot)
Attaches to plot and clears the selection.
void setVisible (bool visible)
Shows or hides the tool's drawing without affecting gestures or the selection.
void setXAxis (Axis * axis)
Sets the X axis and clears the selection; null uses the plot's primary X axis.
void setYAxis (Axis * axis)
Sets the Y axis and clears the selection; null uses the plot's primary Y axis.
Axis * xAxis () const
Returns the axis the X limits refer to.
qreal xMax () const
Returns the upper X limit of the selection.
qreal xMin () const
Returns the lower X limit of the selection.
Axis * yAxis () const
Returns the axis the Y limits refer to.
qreal yMax () const
Returns the upper Y limit of the selection.
qreal yMin () const
Returns the lower Y limit of the selection.

Detailed Description

The tool draws the gesture and the selected region in the plot's overlay, below the overlay's other children. To draw them yourself, set visible to false and bind an overlay item to selectionRect. The region is kept in data coordinates, so it follows panning and zooming and survives data updates: the model rows are recomputed whenever a series changes. An infinite limit leaves that side of the region unbounded, as a range selection does for its other dimension.

See also: SeriesInspection, InspectionRowModel

Public Types Documentation

enum Mode

Region selected by a gesture.

enum QAccelPlot::SelectionTool::Mode {
    Box,
    XRange,
    YRange
};


Public Properties Documentation

property border

Outline inside the rectangle's edges. Default: Colors.dark.selectionBorder , width 1.

Border* QAccelPlot::SelectionTool::border;


property button

Mouse button that starts a gesture. Default: Qt.LeftButton.

Qt::MouseButton QAccelPlot::SelectionTool::button;


property enabled

Enables gestures; disabling cancels a gesture in progress and keeps the selection. Default: true.

bool QAccelPlot::SelectionTool::enabled;


property fillColor

Fill color of the rectangle. Default: Colors.dark.selectionFill .

QColor QAccelPlot::SelectionTool::fillColor;


property hasSelection

True while a region is selected.

bool QAccelPlot::SelectionTool::hasSelection;


property minimumSize

Smallest gesture in logical pixels that selects; a smaller one only clears the selection. Default: 6.

qreal QAccelPlot::SelectionTool::minimumSize;


property mode

Region a gesture selects: a box, an X range, or a Y range. Default: Box.

Mode QAccelPlot::SelectionTool::mode;


property model

Read-only constant: one row of region statistics per selected series.

InspectionRowModel* QAccelPlot::SelectionTool::model;


property modifiers

Exact Qt::KeyboardModifiers required at press time. Default: Qt.ShiftModifier.

Qt::KeyboardModifiers QAccelPlot::SelectionTool::modifiers;


property plot

Plot receiving the selection gestures.

PlotView* QAccelPlot::SelectionTool::plot;


property selecting

True while a gesture is in progress.

bool QAccelPlot::SelectionTool::selecting;


property selectionRect

Gesture or selected region in the plot's coordinates, in logical pixels; empty without either.

QRectF QAccelPlot::SelectionTool::selectionRect;

This is the rectangle the tool draws. It follows panning and zooming, and an unbounded side lies on the plot-area edge. It extends past plotRect when the region is partly out of view; the tool clips its drawing to the plot area. The plot's overlay shares these coordinates, so an item there can bind to it directly.


property visible

Draws the gesture and the selected region with fillColor andborder . Default: true.

bool QAccelPlot::SelectionTool::visible;

Gestures and the selection work either way. Set it to false to draw selectionRect with your own item.


property xAxis

Axis the X limits refer to; unset uses the plot's primary X axis.

Axis* QAccelPlot::SelectionTool::xAxis;


property xMax

Upper X limit of the selection; Infinity when unbounded, NaN without a selection.

qreal QAccelPlot::SelectionTool::xMax;


property xMin

Lower X limit of the selection; -Infinity when unbounded, NaN without a selection.

qreal QAccelPlot::SelectionTool::xMin;


property yAxis

Axis the Y limits refer to; unset uses the plot's primary Y axis.

Axis* QAccelPlot::SelectionTool::yAxis;


property yMax

Upper Y limit of the selection; Infinity when unbounded, NaN without a selection.

qreal QAccelPlot::SelectionTool::yMax;


property yMin

Lower Y limit of the selection; -Infinity when unbounded, NaN without a selection.

qreal QAccelPlot::SelectionTool::yMin;


Public Signals Documentation

signal buttonChanged

Emitted when the button property changes.

void QAccelPlot::SelectionTool::buttonChanged;


signal completed

Emitted when a gesture selected a region. Rows of series that are still preparing follow later.

void QAccelPlot::SelectionTool::completed;


signal enabledChanged

Emitted when the enabled property changes.

void QAccelPlot::SelectionTool::enabledChanged;


signal fillColorChanged

Emitted when the fillColor property changes.

void QAccelPlot::SelectionTool::fillColorChanged;


signal minimumSizeChanged

Emitted when the minimumSize property changes.

void QAccelPlot::SelectionTool::minimumSizeChanged;


signal modeChanged

Emitted when the mode property changes.

void QAccelPlot::SelectionTool::modeChanged;


signal modifiersChanged

Emitted when the modifiers property changes.

void QAccelPlot::SelectionTool::modifiersChanged;


signal plotChanged

Emitted when the plot property changes.

void QAccelPlot::SelectionTool::plotChanged;


signal selectingChanged

Emitted when a gesture starts or ends.

void QAccelPlot::SelectionTool::selectingChanged;


signal selectionChanged

Emitted when the selected region is set, changed, or cleared.

void QAccelPlot::SelectionTool::selectionChanged;


signal selectionRectChanged

Emitted when the selectionRect property changes.

void QAccelPlot::SelectionTool::selectionRectChanged;


signal visibleChanged

Emitted when the visible property changes.

void QAccelPlot::SelectionTool::visibleChanged;


signal xAxisChanged

Emitted when the axis the X limits refer to changes.

void QAccelPlot::SelectionTool::xAxisChanged;


signal yAxisChanged

Emitted when the axis the Y limits refer to changes.

void QAccelPlot::SelectionTool::yAxisChanged;


Public Functions Documentation

function SelectionTool

Constructs a tool without a plot.

explicit QAccelPlot::SelectionTool::SelectionTool (
    QObject * parent=nullptr
) 


function border

Returns the rectangle's outline settings. The object is owned by the tool.

Border * QAccelPlot::SelectionTool::border () const


function button

Returns the mouse button that starts a gesture.

Qt::MouseButton QAccelPlot::SelectionTool::button () const


function clear

Cancels a gesture in progress and clears the selection.

Q_INVOKABLE void QAccelPlot::SelectionTool::clear () 


function enabled

Returns whether gestures are enabled.

bool QAccelPlot::SelectionTool::enabled () const


function fillColor

Returns the rectangle's fill color.

QColor QAccelPlot::SelectionTool::fillColor () const


function hasSelection

Returns true while a region is selected.

bool QAccelPlot::SelectionTool::hasSelection () const


function indices

Returns one page of series' source indices inside the selection, against its current data.

Q_INVOKABLE InspectionPage QAccelPlot::SelectionTool::indices (
    PlotSeries * series,
    int offset=0,
    int limit=4096
) 

Pages like SeriesInspection::indices(): limit must be positive and is capped at 4096.


function isVisible

Returns whether the tool draws the gesture and the selected region.

bool QAccelPlot::SelectionTool::isVisible () const


function minimumSize

Returns the smallest selecting gesture in logical pixels.

qreal QAccelPlot::SelectionTool::minimumSize () const


function mode

Returns the region a gesture selects.

Mode QAccelPlot::SelectionTool::mode () const


function model

Returns the model of per-series region statistics.

InspectionRowModel * QAccelPlot::SelectionTool::model () const


function modifiers

Returns the required keyboard modifiers.

Qt::KeyboardModifiers QAccelPlot::SelectionTool::modifiers () const


function plot

Returns the attached plot.

PlotView * QAccelPlot::SelectionTool::plot () const


function select

Selects the region with the given limits; returns false when a limit is NaN.

Q_INVOKABLE bool QAccelPlot::SelectionTool::select (
    qreal xMin,
    qreal xMax,
    qreal yMin,
    qreal yMax
) 


function selecting

Returns true while a gesture is in progress.

bool QAccelPlot::SelectionTool::selecting () const


function selectionRect

Returns the gesture or selected region in the plot's coordinates, in logical pixels.

QRectF QAccelPlot::SelectionTool::selectionRect () const


function setButton

Sets the mouse button that starts a gesture.

void QAccelPlot::SelectionTool::setButton (
    Qt::MouseButton button
) 


function setEnabled

Enables or disables gestures.

void QAccelPlot::SelectionTool::setEnabled (
    bool enabled
) 


function setFillColor

Sets the rectangle's fill color.

void QAccelPlot::SelectionTool::setFillColor (
    const QColor & color
) 


function setMinimumSize

Sets the smallest selecting gesture, clamping negative values to zero and ignoring nonfinite values.

void QAccelPlot::SelectionTool::setMinimumSize (
    qreal size
) 


function setMode

Sets the region a gesture selects and cancels a gesture in progress.

void QAccelPlot::SelectionTool::setMode (
    Mode mode
) 


function setModifiers

Sets the exact keyboard modifiers required at press time.

void QAccelPlot::SelectionTool::setModifiers (
    Qt::KeyboardModifiers modifiers
) 


function setPlot

Attaches to plot and clears the selection.

void QAccelPlot::SelectionTool::setPlot (
    PlotView * plot
) 


function setVisible

Shows or hides the tool's drawing without affecting gestures or the selection.

void QAccelPlot::SelectionTool::setVisible (
    bool visible
) 


function setXAxis

Sets the X axis and clears the selection; null uses the plot's primary X axis.

void QAccelPlot::SelectionTool::setXAxis (
    Axis * axis
) 


function setYAxis

Sets the Y axis and clears the selection; null uses the plot's primary Y axis.

void QAccelPlot::SelectionTool::setYAxis (
    Axis * axis
) 


function xAxis

Returns the axis the X limits refer to.

Axis * QAccelPlot::SelectionTool::xAxis () const


function xMax

Returns the upper X limit of the selection.

qreal QAccelPlot::SelectionTool::xMax () const


function xMin

Returns the lower X limit of the selection.

qreal QAccelPlot::SelectionTool::xMin () const


function yAxis

Returns the axis the Y limits refer to.

Axis * QAccelPlot::SelectionTool::yAxis () const


function yMax

Returns the upper Y limit of the selection.

qreal QAccelPlot::SelectionTool::yMax () const


function yMin

Returns the lower Y limit of the selection.

qreal QAccelPlot::SelectionTool::yMin () const



The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/inspection/SelectionTool.hpp