libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::BasePlotWidget Class Reference

#include <baseplotwidget.h>

Inheritance diagram for pappso::BasePlotWidget:
pappso::BaseColorMapPlotWidget pappso::BaseTracePlotWidget pappso::DriftSpecMassSpecColorMapPlotWidget pappso::TicXicChromDriftSpecColorMapPlotWidget pappso::TicXicChromMassSpecColorMapPlotWidget pappso::DriftSpecTracePlotWidget pappso::MassSpecTracePlotWidget pappso::TicXicChromTracePlotWidget

Signals

void setFocusSignal ()
void lastCursorHoveredPointSignal (const QPointF &pointf)
void plotRangesChangedSignal (QMouseEvent *event, const pappso::BasePlotContext &context)
void plotRangesChangedWheelEventSignal (QWheelEvent *event, const pappso::BasePlotContext &context)
void xAxisMeasurementSignal (const pappso::BasePlotContext &context, bool with_delta)
void keyPressEventSignal (QKeyEvent *event, const pappso::BasePlotContext &context)
void keyReleaseEventSignal (QKeyEvent *event, const pappso::BasePlotContext &context)
void mousePressEventSignal (QMouseEvent *event, const pappso::BasePlotContext &context)
void mouseReleaseEventSignal (QMouseEvent *event, const pappso::BasePlotContext &context)
void mouseMoveDraggingCursorSignal (QMouseEvent *event, const pappso::BasePlotContext &context)
void mouseWheelEventSignal (QWheelEvent *event, const pappso::BasePlotContext &context)
void plottableSelectionChangedSignal (QCPAbstractPlottable *plottable_p, bool selected)
void integrationRequestedSignal (const BasePlotContext &context)
void plottableDestructionRequestedSignal (BasePlotWidget *base_plot_widget_p, QCPAbstractPlottable *plottable_p, const pappso::BasePlotContext &context)
void beforeReplotSignal ()
void afterLayoutSignal ()
void afterReplotSignal ()

Public Member Functions

 BasePlotWidget (QWidget *parent)
 BasePlotWidget (QWidget *parent, const QString &x_axis_label, const QString &y_axis_label)
virtual ~BasePlotWidget ()
 Destruct this BasePlotWidget instance.
virtual bool setupWidget ()
virtual void setPen (const QPen &pen)
virtual const QPen & getPen () const
virtual void setPlottingColor (QCPAbstractPlottable *plottable_p, const QColor &new_color)
virtual void setPlottingColor (int index, const QColor &new_color)
virtual QColor getPlottingColor (QCPAbstractPlottable *plottable_p) const
virtual QColor getPlottingColor (int index=0) const
virtual void setAxisLabelX (const QString &label)
virtual void setAxisLabelY (const QString &label)
virtual void resetAxesRangeHistory ()
virtual void updateAxesRangeHistory ()
 Create new axis range history items and append them to the history.
virtual void restorePreviousAxesRangeHistory ()
 Go up one history element in the axis history.
virtual void restoreAxesRangeHistory (std::size_t index)
 Get the axis histories at index index and update the plot ranges.
virtual void keyPressEvent (QKeyEvent *event)
 KEYBOARD-related EVENTS.
virtual void keyReleaseEvent (QKeyEvent *event)
 Handle specific key codes and trigger respective actions.
virtual void spaceKeyReleaseEvent (QKeyEvent *event)
virtual void directionKeyPressEvent (QKeyEvent *event)
virtual void directionKeyReleaseEvent (QKeyEvent *event)
virtual void mousePseudoButtonKeyPressEvent (QKeyEvent *event)
virtual void mousePseudoButtonKeyReleaseEvent (QKeyEvent *event)
virtual void mousePressHandler (QMouseEvent *event)
 KEYBOARD-related EVENTS.
virtual void mouseReleaseHandler (QMouseEvent *event)
virtual void mouseReleaseHandlerLeftButton (QMouseEvent *event)
virtual void mouseReleaseHandlerRightButton (QMouseEvent *event)
virtual void mouseWheelHandler (QWheelEvent *event)
virtual void mouseMoveHandler (QMouseEvent *event)
 KEYBOARD-related EVENTS.
virtual void mouseMoveHandlerNotDraggingCursor (QMouseEvent *event)
virtual void mouseMoveHandlerDraggingCursor (QMouseEvent *event)
virtual void mouseMoveHandlerLeftButtonDraggingCursor (QMouseEvent *event)
virtual void mouseMoveHandlerRightButtonDraggingCursor (QMouseEvent *event)
virtual void axisDoubleClickHandler (QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
bool isClickOntoXAxis (const QPointF &mousePoint)
bool isClickOntoYAxis (const QPointF &mousePoint)
int dragDirection ()
 MOUSE-related EVENTS.
virtual void moveMouseCursorGraphCoordToGlobal (QPointF plot_coordinates)
virtual void moveMouseCursorPixelCoordToGlobal (QPointF local_coordinates)
virtual void horizontalMoveMouseCursorCountPixels (int pixel_count)
virtual QPointF horizontalGetGraphCoordNewPointCountPixels (int pixel_count)
virtual void verticalMoveMouseCursorCountPixels (int pixel_count)
virtual QPointF verticalGetGraphCoordNewPointCountPixels (int pixel_count)
virtual QCPRange getRangeX (bool &found_range, int index) const
 MOUSE MOVEMENTS mouse/keyboard-triggered.
virtual QCPRange getRangeY (bool &found_range, int index) const
QCPRange getRange (Enums::Axis axis, RangeType range_type, bool &found_range) const
virtual QCPRange getInnermostRangeX (bool &found_range) const
virtual QCPRange getOutermostRangeX (bool &found_range) const
virtual QCPRange getInnermostRangeY (bool &found_range) const
virtual QCPRange getOutermostRangeY (bool &found_range) const
void yMinMaxOnXAxisCurrentRange (double &min, double &max, QCPAbstractPlottable *plottable_p=nullptr)
void yMinMaxOnXAxisCurrentRange (double &min, double &max, int index)
virtual void axisRescale ()
 RANGE-related functions.
virtual void axisReframe ()
virtual void axisZoom ()
virtual void axisPan ()
virtual void replotWithAxesRanges (QCPRange xAxisRange, QCPRange yAxisRange, Enums::Axis axis)
virtual void replotWithAxisRangeX (double lower, double upper)
virtual void replotWithAxisRangeY (double lower, double upper)
virtual void hideAllPlotItems ()
 PLOTTING / REPLOTTING functions.
virtual void showTracers ()
 Show the traces (vertical and horizontal).
virtual void hideTracers ()
 Hide the traces (vertical and horizontal).
virtual void drawXScopeSpanFeatures ()
virtual void drawYScopeSpanFeatures ()
virtual void calculateDragDeltas ()
virtual bool isVerticalDisplacementAboveThreshold ()
virtual void drawSelectionRectangleAndPrepareZoom (bool as_line_segment=false, bool for_integration=false)
virtual void updateIntegrationScopeDrawing (bool as_line_segment=false, bool for_integration=false)
virtual void resetSelectionRectangle ()
virtual void hideSelectionRectangle (bool reset_values=false)
virtual bool isSelectionRectangleVisible ()
virtual SelectionDrawingLines whatIsVisibleOfTheSelectionRectangle ()
virtual void setFocus ()
 PLOT ITEMS : TRACER TEXT ITEMS...
virtual void redrawPlotBackground (QWidget *focusedPlotWidget)
 Redraw the background of the focusedPlotWidget plot widget.
virtual void updateContextXandYAxisRanges ()
virtual const BasePlotContextgetContext () const

Protected Member Functions

virtual void createAllAncillaryItems ()
virtual void updateIntegrationScope (bool for_integration=false)
virtual void updateIntegrationScopeRect (bool for_integration=false)
virtual void updateIntegrationScopeHorizontalRhomb (bool for_integration=false)
virtual void updateIntegrationScopeVerticalRhomb (bool for_integration=false)
virtual void updateIntegrationScopeRhomb (bool for_integration=false)
virtual QString allLayerNamesToString () const
virtual QString layerableLayerName (QCPLayerable *layerable_p) const
virtual int layerableLayerIndex (QCPLayerable *layerable_p) const

Protected Attributes

QString m_name = "NOT_SET"
 Name of the plot widget.
QString m_desc = "NOT_SET"
 Description of the plot widget.
QString m_fileName
 The name of the data file from which the mass data were read.
QString m_axisLabelX
QString m_axisLabelY
BasePlotContext m_context
int m_leftMousePseudoButtonKey = Qt::Key_Less
int m_rightMousePseudoButtonKey = Qt::Key_Greater
QCPItemLine * mp_selectionRectangeLine1 = nullptr
 Rectangle defining the borders of zoomed-in/out data.
QCPItemLine * mp_selectionRectangeLine2 = nullptr
QCPItemLine * mp_selectionRectangeLine3 = nullptr
QCPItemLine * mp_selectionRectangeLine4 = nullptr
QCPItemText * mp_xDeltaTextItem = nullptr
 Text describing the x-axis delta value during a drag operation.
QCPItemText * mp_yDeltaTextItem = nullptr
bool m_shouldTracersBeVisible = true
 Tells if the tracers should be visible.
QCPItemLine * mp_hPosTracerItem = nullptr
 Horizontal position tracer.
QCPItemLine * mp_vPosTracerItem = nullptr
 Vertical position tracer.
QCPItemLine * mp_vStartTracerItem = nullptr
 Vertical selection start tracer (typically in green).
QCPItemLine * mp_vEndTracerItem = nullptr
 Vertical selection end tracer (typically in red).
std::size_t m_lastAxisRangeHistoryIndex = 0
 Index of the last axis range history item.
std::vector< QCPRange * > m_xAxisRangeHistory
 List of x axis ranges occurring during the panning zooming actions.
std::vector< QCPRange * > m_yAxisRangeHistory
 List of y axis ranges occurring during the panning zooming actions.
int m_mouseMoveHandlerSkipAmount = 10
 How many mouse move events must be skipped *‍/.
int m_mouseMoveHandlerSkipCount = 0
 Counter to handle the "fat data" mouse move event handling.
QColor m_unfocusedColor = QColor("lightgray")
 Color used for the background of unfocused plot.
QBrush m_unfocusedBrush = QBrush(m_unfocusedColor)
 Color used for the background of unfocused plot.
QColor m_focusedColor = QColor(Qt::transparent)
 Color used for the background of focused plot.
QBrush m_focusedBrush = QBrush(m_focusedColor)
 Color used for the background of focused plot.
QPen m_pen
 Pen used to draw the graph and textual elements in the plot widget.

Detailed Description

Definition at line 83 of file baseplotwidget.h.

Constructor & Destructor Documentation

◆ BasePlotWidget() [1/2]

pappso::BasePlotWidget::BasePlotWidget ( QWidget * parent)
explicit

Definition at line 49 of file baseplotwidget.cpp.

49 : QCustomPlot(parent)
50{
51 if(parent == nullptr)
52 qFatal("Programming error.");
53
54 // Default settings for the pen used to graph the data.
55 m_pen.setStyle(Qt::SolidLine);
56 m_pen.setBrush(Qt::black);
57 m_pen.setWidth(1);
58
59 // qDebug() << "Created new BasePlotWidget with" << layerCount()
60 //<< "layers before setting up widget.";
61 // qDebug().noquote() << "All layer names:\n" << allLayerNamesToString();
62
63 // As of today 20210313, the QCustomPlot is created with the following 6
64 // layers:
65 //
66 // All layers' name:
67 //
68 // Layer index 0 name: background
69 // Layer index 1 name: grid
70 // Layer index 2 name: main
71 // Layer index 3 name: axes
72 // Layer index 4 name: legend
73 // Layer index 5 name: overlay
74
75 if(!setupWidget())
76 qFatal("Programming error.");
77
78 // Do not call createAllAncillaryItems() in this base class because all the
79 // items will have been created *before* the addition of plots and then the
80 // rendering order will hide them to the viewer, since the rendering order is
81 // according to the order in which the items have been created.
82 //
83 // The fact that the ancillary items are created before trace plots is not a
84 // problem because the trace plots are sparse and do not effectively hide the
85 // data.
86 //
87 // But, in the color map plot widgets, we cannot afford to create the
88 // ancillary items *before* the plot itself because then, the rendering of the
89 // plot (created after) would screen off the ancillary items (created before).
90 //
91 // So, the createAllAncillaryItems() function needs to be called in the
92 // derived classes at the most appropriate moment in the setting up of the
93 // widget.
94 //
95 // All this is only a workaround of a bug in QCustomPlot. See
96 // https://www.qcustomplot.com/index.php/support/forum/2283.
97 //
98 // I initially wanted to have a plots layer on top of the default background
99 // layer and a items layer on top of it. But that setting prevented the
100 // selection of graphs.
101
102 // qDebug() << "Created new BasePlotWidget with" << layerCount()
103 //<< "layers after setting up widget.";
104 // qDebug().noquote() << "All layer names:\n" << allLayerNamesToString();
105
106 show();
107}
QPen m_pen
Pen used to draw the graph and textual elements in the plot widget.

References m_pen, and setupWidget().

Referenced by pappso::BaseColorMapPlotWidget::BaseColorMapPlotWidget(), pappso::BaseColorMapPlotWidget::BaseColorMapPlotWidget(), pappso::BaseTracePlotWidget::BaseTracePlotWidget(), pappso::BaseTracePlotWidget::BaseTracePlotWidget(), and plottableDestructionRequestedSignal().

◆ BasePlotWidget() [2/2]

pappso::BasePlotWidget::BasePlotWidget ( QWidget * parent,
const QString & x_axis_label,
const QString & y_axis_label )
explicit

Definition at line 109 of file baseplotwidget.cpp.

112 : QCustomPlot(parent), m_axisLabelX(x_axis_label), m_axisLabelY(y_axis_label)
113{
114 // qDebug();
115
116 if(parent == nullptr)
117 qFatal("Programming error.");
118
119 // Default settings for the pen used to graph the data.
120 m_pen.setStyle(Qt::SolidLine);
121 m_pen.setBrush(Qt::black);
122 m_pen.setWidth(1);
123
124 xAxis->setLabel(x_axis_label);
125 yAxis->setLabel(y_axis_label);
126
127 // qDebug() << "Created new BasePlotWidget with" << layerCount()
128 //<< "layers before setting up widget.";
129 // qDebug().noquote() << "All layer names:\n" << allLayerNamesToString();
130
131 // As of today 20210313, the QCustomPlot is created with the following 6
132 // layers:
133 //
134 // All layers' name:
135 //
136 // Layer index 0 name: background
137 // Layer index 1 name: grid
138 // Layer index 2 name: main
139 // Layer index 3 name: axes
140 // Layer index 4 name: legend
141 // Layer index 5 name: overlay
142
143 if(!setupWidget())
144 qFatal("Programming error.");
145
146 // qDebug() << "Created new BasePlotWidget with" << layerCount()
147 //<< "layers after setting up widget.";
148 // qDebug().noquote() << "All layer names:\n" << allLayerNamesToString();
149
150 show();
151}

References m_axisLabelX, m_axisLabelY, m_pen, and setupWidget().

◆ ~BasePlotWidget()

pappso::BasePlotWidget::~BasePlotWidget ( )
virtual

Destruct this BasePlotWidget instance.

The destruction involves clearing the history, deleting all the axis range history items for x and y axes.

Definition at line 160 of file baseplotwidget.cpp.

161{
162 // qDebug() << "In the destructor of plot widget:" << this;
163
164 m_xAxisRangeHistory.clear();
165 m_yAxisRangeHistory.clear();
166
167 // Note that the QCustomPlot xxxItem objects are allocated with (this) which
168 // means their destruction is automatically handled upon *this' destruction.
169}
std::vector< QCPRange * > m_yAxisRangeHistory
List of y axis ranges occurring during the panning zooming actions.
std::vector< QCPRange * > m_xAxisRangeHistory
List of x axis ranges occurring during the panning zooming actions.

References m_xAxisRangeHistory, and m_yAxisRangeHistory.

Member Function Documentation

◆ afterLayoutSignal

void pappso::BasePlotWidget::afterLayoutSignal ( )
signal

Referenced by setupWidget().

◆ afterReplotSignal

void pappso::BasePlotWidget::afterReplotSignal ( )
signal

Referenced by setupWidget().

◆ allLayerNamesToString()

QString pappso::BasePlotWidget::allLayerNamesToString ( ) const
protectedvirtual

Definition at line 172 of file baseplotwidget.cpp.

173{
174
175 QString text;
176
177 for(int iter = 0; iter < layerCount(); ++iter)
178 {
179 text +=
180 QString("Layer index %1: %2\n").arg(iter).arg(layer(iter)->name());
181 }
182
183 return text;
184}

◆ axisDoubleClickHandler()

void pappso::BasePlotWidget::axisDoubleClickHandler ( QCPAxis * axis,
QCPAxis::SelectablePart part,
QMouseEvent * event )
virtual

Reimplemented in pappso::BaseTracePlotWidget.

Definition at line 1698 of file baseplotwidget.cpp.

1702{
1703 // qDebug();
1704
1705 m_context.m_keyboardModifiers = QGuiApplication::queryKeyboardModifiers();
1706
1707 if(m_context.m_keyboardModifiers & Qt::ControlModifier)
1708 {
1709 // qDebug();
1710
1711 // If the Ctrl modifiers is active, then both axes are to be reset. Also
1712 // the histories are reset also.
1713
1714 rescaleAxes();
1716 }
1717 else
1718 {
1719 // qDebug();
1720
1721 // Only the axis passed as parameter is to be rescaled.
1722 // Reset the range of that axis to the max view possible.
1723
1724 axis->rescale();
1725
1727
1728 event->accept();
1729 }
1730
1731 // The double-click event does not cancel the mouse press event. That is, if
1732 // left-double-clicking, at the end of the operation the button still
1733 // "pressed". We need to remove manually the button from the pressed buttons
1734 // context member.
1735
1736 m_context.m_pressedMouseButtons ^= event->button();
1737
1739
1741
1742 replot();
1743}
virtual void updateAxesRangeHistory()
Create new axis range history items and append them to the history.
void plotRangesChangedSignal(QMouseEvent *event, const pappso::BasePlotContext &context)
virtual void resetAxesRangeHistory()
virtual void updateContextXandYAxisRanges()
BasePlotContext m_context

References m_context, plotRangesChangedSignal(), resetAxesRangeHistory(), updateAxesRangeHistory(), and updateContextXandYAxisRanges().

Referenced by setupWidget().

◆ axisPan()

void pappso::BasePlotWidget::axisPan ( )
virtual

Reimplemented in pappso::BaseTracePlotWidget.

Definition at line 2164 of file baseplotwidget.cpp.

2165{
2166 // Sanity check
2167 if(!m_context.m_wasClickOnXAxis && !m_context.m_wasClickOnYAxis)
2168 qFatal(
2169 "This function can only be called if the mouse click was on one of the "
2170 "axes");
2171
2172 if(m_context.m_wasClickOnXAxis)
2173 {
2174 xAxis->setRange(m_context.m_xRange.lower - m_context.m_xDelta,
2175 m_context.m_xRange.upper - m_context.m_xDelta);
2176 }
2177
2178 if(m_context.m_wasClickOnYAxis)
2179 {
2180 yAxis->setRange(m_context.m_yRange.lower - m_context.m_yDelta,
2181 m_context.m_yRange.upper - m_context.m_yDelta);
2182 }
2183
2185
2186 // qDebug() << "The updated context:" << m_context.toString();
2187
2188 // We cannot store the new ranges in the history, because the pan operation
2189 // involved a huge quantity of micro-movements elicited upon each mouse move
2190 // cursor event so we would have a huge history.
2191 // updateAxesRangeHistory();
2192
2193 // Now that the context has the right range values, we can emit the
2194 // signal that will be used by this plot widget users, typically to
2195 // abide by the x/y range lock required by the user.
2196
2197 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
2198
2199 replot();
2200}

References m_context, plotRangesChangedSignal(), and updateContextXandYAxisRanges().

Referenced by mouseMoveHandlerLeftButtonDraggingCursor(), and yMinMaxOnXAxisCurrentRange().

◆ axisReframe()

void pappso::BasePlotWidget::axisReframe ( )
virtual

Reimplemented in pappso::BaseTracePlotWidget.

Definition at line 2111 of file baseplotwidget.cpp.

2112{
2113
2114 // double sorted_start_drag_point_x =
2115 // std::min(m_context.m_startDragPoint.x(),
2116 // m_context.m_currentDragPoint.x());
2117
2118 // xAxis->setRange(sorted_start_drag_point_x,
2119 // sorted_start_drag_point_x + fabs(m_context.m_xDelta));
2120
2121 xAxis->setRange(QCPRange(m_context.m_xRegionRangeStart, m_context.m_xRegionRangeStop));
2122
2123 // Note that the y axis should be rescaled from current lower value to new
2124 // upper value matching the y-axis position of the cursor when the mouse
2125 // button was released.
2126
2127 yAxis->setRange(xAxis->range().lower,
2128 std::max<double>(m_context.m_yRegionRangeStart, m_context.m_yRegionRangeStop));
2129
2130 // qDebug() << "xaxis:" << xAxis->range().lower << "-" <<
2131 // xAxis->range().upper
2132 //<< "yaxis:" << yAxis->range().lower << "-" << yAxis->range().upper;
2133
2135
2137 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
2138
2139 replot();
2140}

References m_context, plotRangesChangedSignal(), updateAxesRangeHistory(), and updateContextXandYAxisRanges().

Referenced by mouseReleaseHandlerLeftButton(), and yMinMaxOnXAxisCurrentRange().

◆ axisRescale()

void pappso::BasePlotWidget::axisRescale ( )
virtual

RANGE-related functions.

PLOTTING / REPLOTTING functions

Reimplemented in pappso::BaseTracePlotWidget.

Definition at line 2056 of file baseplotwidget.cpp.

2057{
2058 // Get the current x lower/upper range, that is, leftmost/rightmost x
2059 // coordinate.
2060 double xLower = xAxis->range().lower;
2061 double xUpper = xAxis->range().upper;
2062
2063 // Get the current y lower/upper range, that is, bottommost/topmost y
2064 // coordinate.
2065 double yLower = yAxis->range().lower;
2066 double yUpper = yAxis->range().upper;
2067
2068 // This function is called only when the user has clicked on the x/y axis or
2069 // when the user has dragged the left mouse button with the Ctrl key
2070 // modifier. The m_context.m_wasClickOnXAxis is then simulated in the mouse
2071 // move handler. So we need to test which axis was clicked-on.
2072
2073 if(m_context.m_wasClickOnXAxis)
2074 {
2075 // We are changing the range of the X axis.
2076
2077 // If xDelta is < 0, then we were dragging from right to left, we are
2078 // compressing the view on the x axis, by adding new data to the right
2079 // hand size of the graph. So we add xDelta to the upper bound of the
2080 // range. Otherwise we are uncompressing the view on the x axis and
2081 // remove the xDelta from the upper bound of the range. This is why we
2082 // have the
2083 // '-'
2084 // and not '+' below;
2085
2086 xAxis->setRange(xLower, xUpper - m_context.m_xDelta);
2087 }
2088 // End of
2089 // if(m_context.m_wasClickOnXAxis)
2090 else // that is, if(m_context.m_wasClickOnYAxis)
2091 {
2092 // We are changing the range of the Y axis.
2093
2094 // See above for an explanation of the computation (the - sign below).
2095
2096 yAxis->setRange(yLower, yUpper - m_context.m_yDelta);
2097 }
2098 // End of
2099 // else // that is, if(m_context.m_wasClickOnYAxis)
2100
2101 // Update the context with the current axes ranges
2102
2104
2105 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
2106
2107 replot();
2108}

References m_context, plotRangesChangedSignal(), and updateContextXandYAxisRanges().

Referenced by mouseMoveHandlerLeftButtonDraggingCursor(), and yMinMaxOnXAxisCurrentRange().

◆ axisZoom()

void pappso::BasePlotWidget::axisZoom ( )
virtual

Reimplemented in pappso::BaseTracePlotWidget.

Definition at line 2143 of file baseplotwidget.cpp.

2144{
2145
2146 // Use the m_context.m_xRegionRangeStart/End values, but we need to sort the
2147 // values before using them, because now we want to really have the lower x
2148 // value. Simply craft a QCPRange that will swap the values if lower is not
2149 // < than upper QCustomPlot calls this normalization).
2150
2151 xAxis->setRange(QCPRange(m_context.m_xRegionRangeStart, m_context.m_xRegionRangeStop));
2152
2153 yAxis->setRange(QCPRange(m_context.m_yRegionRangeStart, m_context.m_yRegionRangeStop));
2154
2156
2158 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
2159
2160 replot();
2161}

References m_context, plotRangesChangedSignal(), updateAxesRangeHistory(), and updateContextXandYAxisRanges().

Referenced by mouseReleaseHandlerLeftButton(), and yMinMaxOnXAxisCurrentRange().

◆ beforeReplotSignal

void pappso::BasePlotWidget::beforeReplotSignal ( )
signal

Referenced by setupWidget().

◆ calculateDragDeltas()

void pappso::BasePlotWidget::calculateDragDeltas ( )
virtual

Definition at line 2580 of file baseplotwidget.cpp.

2581{
2582
2583 // We compute signed differentials. If the user does not want the sign,
2584 // fabs(double) is their friend.
2585
2586 // Compute the xAxis differential:
2587
2588 m_context.m_xDelta =
2589 m_context.m_currentDragPoint.x() - m_context.m_startDragPoint.x();
2590
2591 // Same with the Y-axis range:
2592
2593 m_context.m_yDelta =
2594 m_context.m_currentDragPoint.y() - m_context.m_startDragPoint.y();
2595
2596 return;
2597}

References m_context.

Referenced by mouseMoveHandlerDraggingCursor(), and yMinMaxOnXAxisCurrentRange().

◆ createAllAncillaryItems()

void pappso::BasePlotWidget::createAllAncillaryItems ( )
protectedvirtual

Definition at line 215 of file baseplotwidget.cpp.

216{
217 // Make a copy of the pen to just change its color and set that color to
218 // the tracer line.
219 QPen pen = m_pen;
220
221 // Create the lines that will act as tracers for position and selection of
222 // regions.
223 //
224 // We have the cross hair that serves as the cursor. That crosshair cursor is
225 // made of a vertical line (green, because when click-dragging the mouse it
226 // becomes the tracer that is being anchored at the region start. The second
227 // line i horizontal and is always black.
228
229 pen.setColor(QColor("steelblue"));
230
231 // The set of tracers (horizontal and vertical) that track the position of the
232 // mouse cursor.
233
234 mp_vPosTracerItem = new QCPItemLine(this);
235 mp_vPosTracerItem->setLayer("plotsLayer");
236 mp_vPosTracerItem->setPen(pen);
237 mp_vPosTracerItem->start->setType(QCPItemPosition::ptPlotCoords);
238 mp_vPosTracerItem->end->setType(QCPItemPosition::ptPlotCoords);
239 mp_vPosTracerItem->start->setCoords(0, 0);
240 mp_vPosTracerItem->end->setCoords(0, 0);
241
242 mp_hPosTracerItem = new QCPItemLine(this);
243 mp_hPosTracerItem->setLayer("plotsLayer");
244 mp_hPosTracerItem->setPen(pen);
245 mp_hPosTracerItem->start->setType(QCPItemPosition::ptPlotCoords);
246 mp_hPosTracerItem->end->setType(QCPItemPosition::ptPlotCoords);
247 mp_hPosTracerItem->start->setCoords(0, 0);
248 mp_hPosTracerItem->end->setCoords(0, 0);
249
250 // The set of tracers (horizontal only) that track the region
251 // spanning/selection regions.
252 //
253 // The start vertical tracer is colored in greeen.
254 pen.setColor(QColor("green"));
255
256 mp_vStartTracerItem = new QCPItemLine(this);
257 mp_vStartTracerItem->setLayer("plotsLayer");
258 mp_vStartTracerItem->setPen(pen);
259 mp_vStartTracerItem->start->setType(QCPItemPosition::ptPlotCoords);
260 mp_vStartTracerItem->end->setType(QCPItemPosition::ptPlotCoords);
261 mp_vStartTracerItem->start->setCoords(0, 0);
262 mp_vStartTracerItem->end->setCoords(0, 0);
263
264 // The end vertical tracer is colored in red.
265 pen.setColor(QColor("red"));
266
267 mp_vEndTracerItem = new QCPItemLine(this);
268 mp_vEndTracerItem->setLayer("plotsLayer");
269 mp_vEndTracerItem->setPen(pen);
270 mp_vEndTracerItem->start->setType(QCPItemPosition::ptPlotCoords);
271 mp_vEndTracerItem->end->setType(QCPItemPosition::ptPlotCoords);
272 mp_vEndTracerItem->start->setCoords(0, 0);
273 mp_vEndTracerItem->end->setCoords(0, 0);
274
275 // When the user click-drags the mouse, the X distance between the drag start
276 // point and the drag end point (current point) is the xDelta.
277 mp_xDeltaTextItem = new QCPItemText(this);
278 mp_xDeltaTextItem->setLayer("plotsLayer");
279 mp_xDeltaTextItem->setColor(QColor("steelblue"));
280 mp_xDeltaTextItem->setPositionAlignment(Qt::AlignBottom | Qt::AlignCenter);
281 mp_xDeltaTextItem->position->setType(QCPItemPosition::ptPlotCoords);
282 mp_xDeltaTextItem->setVisible(false);
283
284 // Same for the y delta
285 mp_yDeltaTextItem = new QCPItemText(this);
286 mp_yDeltaTextItem->setLayer("plotsLayer");
287 mp_yDeltaTextItem->setColor(QColor("steelblue"));
288 mp_yDeltaTextItem->setPositionAlignment(Qt::AlignBottom | Qt::AlignCenter);
289 mp_yDeltaTextItem->position->setType(QCPItemPosition::ptPlotCoords);
290 mp_yDeltaTextItem->setVisible(false);
291
292 // Make sure we prepare the four lines that will be needed to
293 // draw the selection rectangle.
294 pen = m_pen;
295
296 pen.setColor("steelblue");
297
298 mp_selectionRectangeLine1 = new QCPItemLine(this);
299 mp_selectionRectangeLine1->setLayer("plotsLayer");
300 mp_selectionRectangeLine1->setPen(pen);
301 mp_selectionRectangeLine1->start->setType(QCPItemPosition::ptPlotCoords);
302 mp_selectionRectangeLine1->end->setType(QCPItemPosition::ptPlotCoords);
303 mp_selectionRectangeLine1->start->setCoords(0, 0);
304 mp_selectionRectangeLine1->end->setCoords(0, 0);
305 mp_selectionRectangeLine1->setVisible(false);
306
307 mp_selectionRectangeLine2 = new QCPItemLine(this);
308 mp_selectionRectangeLine2->setLayer("plotsLayer");
309 mp_selectionRectangeLine2->setPen(pen);
310 mp_selectionRectangeLine2->start->setType(QCPItemPosition::ptPlotCoords);
311 mp_selectionRectangeLine2->end->setType(QCPItemPosition::ptPlotCoords);
312 mp_selectionRectangeLine2->start->setCoords(0, 0);
313 mp_selectionRectangeLine2->end->setCoords(0, 0);
314 mp_selectionRectangeLine2->setVisible(false);
315
316 mp_selectionRectangeLine3 = new QCPItemLine(this);
317 mp_selectionRectangeLine3->setLayer("plotsLayer");
318 mp_selectionRectangeLine3->setPen(pen);
319 mp_selectionRectangeLine3->start->setType(QCPItemPosition::ptPlotCoords);
320 mp_selectionRectangeLine3->end->setType(QCPItemPosition::ptPlotCoords);
321 mp_selectionRectangeLine3->start->setCoords(0, 0);
322 mp_selectionRectangeLine3->end->setCoords(0, 0);
323 mp_selectionRectangeLine3->setVisible(false);
324
325 mp_selectionRectangeLine4 = new QCPItemLine(this);
326 mp_selectionRectangeLine4->setLayer("plotsLayer");
327 mp_selectionRectangeLine4->setPen(pen);
328 mp_selectionRectangeLine4->start->setType(QCPItemPosition::ptPlotCoords);
329 mp_selectionRectangeLine4->end->setType(QCPItemPosition::ptPlotCoords);
330 mp_selectionRectangeLine4->start->setCoords(0, 0);
331 mp_selectionRectangeLine4->end->setCoords(0, 0);
332 mp_selectionRectangeLine4->setVisible(false);
333}
QCPItemText * mp_yDeltaTextItem
QCPItemLine * mp_selectionRectangeLine1
Rectangle defining the borders of zoomed-in/out data.
QCPItemLine * mp_selectionRectangeLine2
QCPItemText * mp_xDeltaTextItem
Text describing the x-axis delta value during a drag operation.
QCPItemLine * mp_hPosTracerItem
Horizontal position tracer.
QCPItemLine * mp_vPosTracerItem
Vertical position tracer.
QCPItemLine * mp_selectionRectangeLine4
QCPItemLine * mp_vStartTracerItem
Vertical selection start tracer (typically in green).
QCPItemLine * mp_selectionRectangeLine3
QCPItemLine * mp_vEndTracerItem
Vertical selection end tracer (typically in red).

References m_pen, mp_hPosTracerItem, mp_selectionRectangeLine1, mp_selectionRectangeLine2, mp_selectionRectangeLine3, mp_selectionRectangeLine4, mp_vEndTracerItem, mp_vPosTracerItem, mp_vStartTracerItem, mp_xDeltaTextItem, and mp_yDeltaTextItem.

Referenced by pappso::BaseTracePlotWidget::BaseTracePlotWidget(), pappso::BaseTracePlotWidget::BaseTracePlotWidget(), pappso::BaseColorMapPlotWidget::addColorMap(), and pappso::BaseColorMapPlotWidget::addColorMap().

◆ directionKeyPressEvent()

void pappso::BasePlotWidget::directionKeyPressEvent ( QKeyEvent * event)
virtual

Definition at line 823 of file baseplotwidget.cpp.

824{
825 // qDebug() << "event key:" << event->key();
826
827 // The user is trying to move the positional cursor/markers. There are
828 // multiple way they can do that:
829 //
830 // 1.a. Hitting the arrow left/right keys alone will search for next pixel.
831 // 1.b. Hitting the arrow left/right keys with Alt modifier will search for
832 // a multiple of pixels that might be equivalent to one 20th of the pixel
833 // width of the plot widget. 1.c Hitting the left/right keys with Alt and
834 // Shift modifiers will search for a multiple of pixels that might be the
835 // equivalent to half of the pixel width.
836 //
837 // 2. Hitting the Control modifier will move the cursor to the next data
838 // point of the graph.
839
840 int pixel_increment = 0;
841
842 if(m_context.m_keyboardModifiers == Qt::NoModifier)
843 pixel_increment = 1;
844 else if(m_context.m_keyboardModifiers == Qt::AltModifier)
845 pixel_increment = 50;
846
847 // The user is moving the positional markers. This is equivalent to a
848 // non-dragging cursor movement to the next pixel. Note that the origin is
849 // located at the top left, so key down increments and key up decrements.
850
851 if(event->key() == Qt::Key_Left)
852 horizontalMoveMouseCursorCountPixels(-pixel_increment);
853 else if(event->key() == Qt::Key_Right)
855 else if(event->key() == Qt::Key_Up)
856 verticalMoveMouseCursorCountPixels(-pixel_increment);
857 else if(event->key() == Qt::Key_Down)
858 verticalMoveMouseCursorCountPixels(pixel_increment);
859
860 event->accept();
861}
virtual void verticalMoveMouseCursorCountPixels(int pixel_count)
virtual void horizontalMoveMouseCursorCountPixels(int pixel_count)

References horizontalMoveMouseCursorCountPixels(), m_context, and verticalMoveMouseCursorCountPixels().

Referenced by keyPressEvent().

◆ directionKeyReleaseEvent()

void pappso::BasePlotWidget::directionKeyReleaseEvent ( QKeyEvent * event)
virtual

Definition at line 864 of file baseplotwidget.cpp.

865{
866 // qDebug() << "event key:" << event->key();
867 event->accept();
868}

Referenced by keyReleaseEvent().

◆ dragDirection()

int pappso::BasePlotWidget::dragDirection ( )

MOUSE-related EVENTS.

MOUSE MOVEMENTS mouse/keyboard-triggered

Definition at line 1801 of file baseplotwidget.cpp.

1802{
1803 // The user is dragging the mouse, probably to rescale the axes, but we need
1804 // to sort out in which direction the drag is happening.
1805
1806 // This function should be called after calculateDragDeltas, so that
1807 // m_context has the proper x/y delta values that we'll compare.
1808
1809 // Note that we cannot compare simply x or y deltas because the y axis might
1810 // have a different scale that the x axis. So we first need to convert the
1811 // positions to pixels.
1812
1813 double x_delta_pixel =
1814 fabs(xAxis->coordToPixel(m_context.m_currentDragPoint.x()) -
1815 xAxis->coordToPixel(m_context.m_startDragPoint.x()));
1816
1817 double y_delta_pixel =
1818 fabs(yAxis->coordToPixel(m_context.m_currentDragPoint.y()) -
1819 yAxis->coordToPixel(m_context.m_startDragPoint.y()));
1820
1821 if(x_delta_pixel > y_delta_pixel)
1822 return Qt::Horizontal;
1823
1824 return Qt::Vertical;
1825}

References m_context.

◆ drawSelectionRectangleAndPrepareZoom()

void pappso::BasePlotWidget::drawSelectionRectangleAndPrepareZoom ( bool as_line_segment = false,
bool for_integration = false )
virtual

Definition at line 2301 of file baseplotwidget.cpp.

2303{
2304 // The user has dragged the mouse left button on the graph, which means he
2305 // is willing to draw a selection rectangle, either for zooming-in or for
2306 // integration.
2307
2308 if(mp_xDeltaTextItem != nullptr)
2309 mp_xDeltaTextItem->setVisible(false);
2310 if(mp_yDeltaTextItem != nullptr)
2311 mp_yDeltaTextItem->setVisible(false);
2312
2313 // Ensure the right selection rectangle is drawn.
2314
2315 updateIntegrationScopeDrawing(as_line_segment, for_integration);
2316
2317 // Note that if we draw a zoom rectangle, then we are certainly not
2318 // measuring anything. So set the boolean value to false so that the user of
2319 // this widget or derived classes know that there is nothing to perform upon
2320 // (like deconvolution, for example).
2321
2322 m_context.m_isMeasuringDistance = false;
2323
2324 // Also remove the delta value from the pipeline by sending a simple
2325 // distance without measurement signal.
2326
2327 emit xAxisMeasurementSignal(m_context, false);
2328
2329 replot();
2330}
virtual void updateIntegrationScopeDrawing(bool as_line_segment=false, bool for_integration=false)
void xAxisMeasurementSignal(const pappso::BasePlotContext &context, bool with_delta)

References m_context, mp_xDeltaTextItem, mp_yDeltaTextItem, updateIntegrationScopeDrawing(), and xAxisMeasurementSignal().

Referenced by mouseMoveHandlerLeftButtonDraggingCursor(), mouseMoveHandlerRightButtonDraggingCursor(), and yMinMaxOnXAxisCurrentRange().

◆ drawXScopeSpanFeatures()

void pappso::BasePlotWidget::drawXScopeSpanFeatures ( )
virtual

Definition at line 2333 of file baseplotwidget.cpp.

2334{
2335 // Depending on the kind of integration scope, we will have to display
2336 // differently calculated values. We want to provide the user with
2337 // the horizontal span of the integration scope. There are different
2338 // situations.
2339
2340 // 1. The scope is mono-dimensional across the x axis: the span
2341 // is thus simply the width.
2342
2343 // 2. The scope is bi-dimensional and is a rectangle: the span is
2344 // thus simply the width.
2345
2346 // 3. The socpe is bi-dimensional and is a rhomboid: the span is
2347 // the width.
2348
2349 // In the first and second cases above, the width is equal to the
2350 // m_context.m_xDelta.
2351
2352 // In the case of the rhomboid, the span is not m_context.m_xDelta,
2353 // it is more than that if the rhomboid is horizontal because it is
2354 // the m_context.m_xDelta plus the rhomboid's horizontal size.
2355
2356 // FIXME: is this still true?
2357 //
2358 // We do not want to show the position markers because the only horiontal
2359 // line to be visible must be contained between the start and end vertical
2360 // tracer items.
2361 mp_hPosTracerItem->setVisible(false);
2362 mp_vPosTracerItem->setVisible(false);
2363
2364 // We want to draw the text in the middle position of the leftmost-rightmost
2365 // point, even with rhomboid scopes.
2366
2367 QPointF leftmost_point;
2368 if(!m_context.msp_integrationScope->getLeftMostPoint(leftmost_point))
2369 qFatal("Could not get the left-most point.");
2370
2371 double width;
2372 if(!m_context.msp_integrationScope->getWidth(width))
2373 qFatal("Could not get width.");
2374 // qDebug() << "width:" << width;
2375
2376 double x_axis_center_position = leftmost_point.x() + width / 2;
2377
2378 // We want the text to print inside the rectangle, always at the current
2379 // drag point so the eye can follow the delta value while looking where to
2380 // drag the mouse. To position the text inside the rectangle, we need to
2381 // know what is the drag direction.
2382
2383 // What is the distance between the rectangle line at current drag point and
2384 // the text itself. Think of this as a margin distance between the
2385 // point of interest and the actual position of the text.
2386 int pixels_away_from_line = 15;
2387
2388 QPointF reference_point_for_y_axis_label_position;
2389
2390 // ATTENTION: the pixel coordinates for the vertical direction go in reverse
2391 // order with respect to the y axis values !!! That is, pixel(0,0) is top
2392 // left of the graph.
2393 if(static_cast<int>(m_context.m_dragDirections) &
2394 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
2395 {
2396 // We need to print outside the rectangle, that is pixels_away_from_line
2397 // pixels to the top, so with pixel y value decremented of that
2398 // pixels_above_line value (one would have expected to increment that
2399 // value, along the y axis, but the coordinates in pixel go in reverse
2400 // order).
2401
2402 pixels_away_from_line *= -1;
2403
2404 if(!m_context.msp_integrationScope->getTopMostPoint(
2405 reference_point_for_y_axis_label_position))
2406 qFatal("Failed to get top most point.");
2407 }
2408 else
2409 {
2410 if(!m_context.msp_integrationScope->getBottomMostPoint(
2411 reference_point_for_y_axis_label_position))
2412 qFatal("Failed to get bottom most point.");
2413 }
2414
2415 // double y_axis_pixel_coordinate =
2416 // yAxis->coordToPixel(m_context.m_currentDragPoint.y());
2417 double y_axis_pixel_coordinate =
2418 yAxis->coordToPixel(reference_point_for_y_axis_label_position.y());
2419
2420 // Now that we have the coordinate in pixel units, we can correct
2421 // it by the value of the margin we want to give.
2422 double y_axis_modified_pixel_coordinate =
2423 y_axis_pixel_coordinate + pixels_away_from_line;
2424
2425 // Set aside a point instance to store the pixel coordinates of the text.
2426 QPointF pixel_coordinates;
2427
2428 pixel_coordinates.setX(x_axis_center_position);
2429 pixel_coordinates.setY(y_axis_modified_pixel_coordinate);
2430
2431 // Now convert back to graph coordinates.
2432 QPointF graph_coordinates(xAxis->pixelToCoord(pixel_coordinates.x()),
2433 yAxis->pixelToCoord(pixel_coordinates.y()));
2434
2435 // qDebug() << "Should print the label at point:" << graph_coordinates;
2436
2437 if(mp_xDeltaTextItem != nullptr)
2438 {
2439 mp_xDeltaTextItem->position->setCoords(x_axis_center_position,
2440 graph_coordinates.y());
2441
2442 // Dynamically set the number of decimals to ensure we can read
2443 // a meaning full delta value even if it is very very very small.
2444 // That is, allow one to read 0.00333, 0.000333, 1.333 and so on.
2445
2446 // The computation below only works properly when the passed
2447 // value is fabs() (not negative !!!).
2448
2449 int decimals = Utils::zeroDecimalsInValue(width) + 3;
2450
2451 QString label_text = QString("full x span %1 -- x drag delta %2")
2452 .arg(width, 0, 'f', decimals)
2453 .arg(fabs(m_context.m_xDelta), 0, 'f', decimals);
2454
2455 mp_xDeltaTextItem->setText(label_text);
2456
2457 mp_xDeltaTextItem->setFont(QFont(font().family(), 9));
2458 mp_xDeltaTextItem->setVisible(true);
2459 }
2460
2461 // Set the boolean to true so that derived widgets know that something is
2462 // being measured, and they can act accordingly, for example by computing
2463 // deconvolutions in a mass spectrum.
2464 m_context.m_isMeasuringDistance = true;
2465
2466 replot();
2467
2468 // Let the caller know that we were measuring something.
2470
2471 return;
2472}
static int zeroDecimalsInValue(pappso_double value)
Determine the number of zero decimals between the decimal point and the first non-zero decimal.
Definition utils.cpp:102

References pappso::BOTTOM_TO_TOP, m_context, mp_hPosTracerItem, mp_vPosTracerItem, mp_xDeltaTextItem, xAxisMeasurementSignal(), and pappso::Utils::zeroDecimalsInValue().

Referenced by mouseMoveHandlerLeftButtonDraggingCursor(), mouseMoveHandlerRightButtonDraggingCursor(), updateIntegrationScopeDrawing(), and yMinMaxOnXAxisCurrentRange().

◆ drawYScopeSpanFeatures()

void pappso::BasePlotWidget::drawYScopeSpanFeatures ( )
virtual

Definition at line 2475 of file baseplotwidget.cpp.

2476{
2477 // See drawXScopeSpanFeatures() for explanations.
2478
2479 // Check right away if there is height!
2480 double height;
2481 if(!m_context.msp_integrationScope->getHeight(height))
2482 qFatal("Could not get height.");
2483
2484 // If there is no height, we have nothing to do here.
2485 if(!height)
2486 return;
2487 // qDebug() << "height:" << height;
2488
2489 // FIXME: is this still true?
2490 //
2491 // We do not want to show the position markers because the only horiontal
2492 // line to be visible must be contained between the start and end vertical
2493 // tracer items.
2494 mp_hPosTracerItem->setVisible(false);
2495 mp_vPosTracerItem->setVisible(false);
2496
2497 // First the easy part: the vertical position: centered on the
2498 // scope Y span.
2499 QPointF bottom_most_point;
2500 if(!m_context.msp_integrationScope->getBottomMostPoint(bottom_most_point))
2501 qFatal("Could not get the bottom-most bottom point.");
2502
2503 double y_axis_center_position = bottom_most_point.y() + height / 2;
2504
2505 // We want to draw the text outside the rectangle (if normal rectangle)
2506 // at a small distance from the vertical limit of the scope at the
2507 // position of the current drag point. We need to check the horizontal
2508 // drag direction to put the text at the right place (left of
2509 // current drag point if dragging right to left, for example).
2510
2511 // What is the distance between the rectangle line at current drag point and
2512 // the text itself.
2513 int pixels_away_from_line = 15;
2514 double x_axis_coordinate;
2515 double x_axis_pixel_coordinate;
2516
2517 if(static_cast<int>(m_context.m_dragDirections) &
2518 static_cast<int>(DragDirections::RIGHT_TO_LEFT))
2519 {
2520 QPointF left_most_point;
2521
2522 if(!m_context.msp_integrationScope->getLeftMostPoint(left_most_point))
2523 qFatal("Failed to get left most point.");
2524
2525 x_axis_coordinate = left_most_point.x();
2526
2527 pixels_away_from_line *= -1;
2528 }
2529 else
2530 {
2531 QPointF right_most_point;
2532
2533 if(!m_context.msp_integrationScope->getRightMostPoint(right_most_point))
2534 qFatal("Failed to get right most point.");
2535
2536 x_axis_coordinate = right_most_point.x();
2537 }
2538 x_axis_pixel_coordinate = xAxis->coordToPixel(x_axis_coordinate);
2539
2540 double x_axis_modified_pixel_coordinate =
2541 x_axis_pixel_coordinate + pixels_away_from_line;
2542
2543 // Set aside a point instance to store the pixel coordinates of the text.
2544 QPointF pixel_coordinates;
2545
2546 pixel_coordinates.setX(x_axis_modified_pixel_coordinate);
2547 pixel_coordinates.setY(y_axis_center_position);
2548
2549 // Now convert back to graph coordinates.
2550
2551 QPointF graph_coordinates(xAxis->pixelToCoord(pixel_coordinates.x()),
2552 yAxis->pixelToCoord(pixel_coordinates.y()));
2553
2554 mp_yDeltaTextItem->position->setCoords(graph_coordinates.x(),
2555 y_axis_center_position);
2556
2557 int decimals = Utils::zeroDecimalsInValue(height) + 3;
2558
2559 QString label_text = QString("full y span %1 -- y drag delta %2")
2560 .arg(height, 0, 'f', decimals)
2561 .arg(fabs(m_context.m_yDelta), 0, 'f', decimals);
2562
2563 mp_yDeltaTextItem->setText(label_text);
2564 mp_yDeltaTextItem->setFont(QFont(font().family(), 9));
2565 mp_yDeltaTextItem->setVisible(true);
2566 mp_yDeltaTextItem->setRotation(90);
2567
2568 // Set the boolean to true so that derived widgets know that something is
2569 // being measured, and they can act accordingly, for example by computing
2570 // deconvolutions in a mass spectrum.
2571 m_context.m_isMeasuringDistance = true;
2572
2573 replot();
2574
2575 // Let the caller know that we were measuring something.
2577}

References m_context, mp_hPosTracerItem, mp_vPosTracerItem, mp_yDeltaTextItem, pappso::RIGHT_TO_LEFT, xAxisMeasurementSignal(), and pappso::Utils::zeroDecimalsInValue().

Referenced by mouseMoveHandlerLeftButtonDraggingCursor(), mouseMoveHandlerRightButtonDraggingCursor(), and yMinMaxOnXAxisCurrentRange().

◆ getContext()

const BasePlotContext & pappso::BasePlotWidget::getContext ( ) const
virtual

Definition at line 3322 of file baseplotwidget.cpp.

3323{
3324 return m_context;
3325}

References m_context.

Referenced by yMinMaxOnXAxisCurrentRange().

◆ getInnermostRangeX()

QCPRange pappso::BasePlotWidget::getInnermostRangeX ( bool & found_range) const
virtual

Definition at line 2025 of file baseplotwidget.cpp.

2026{
2027
2028 return getRange(Enums::Axis::x, RangeType::innermost, found_range);
2029}
QCPRange getRange(Enums::Axis axis, RangeType range_type, bool &found_range) const

References getRange(), pappso::innermost, and pappso::Enums::x.

◆ getInnermostRangeY()

QCPRange pappso::BasePlotWidget::getInnermostRangeY ( bool & found_range) const
virtual

Definition at line 2038 of file baseplotwidget.cpp.

2039{
2040
2041 return getRange(Enums::Axis::y, RangeType::innermost, found_range);
2042}

References getRange(), pappso::innermost, and pappso::Enums::y.

◆ getOutermostRangeX()

QCPRange pappso::BasePlotWidget::getOutermostRangeX ( bool & found_range) const
virtual

Definition at line 2032 of file baseplotwidget.cpp.

2033{
2034 return getRange(Enums::Axis::x, RangeType::outermost, found_range);
2035}

References getRange(), pappso::outermost, and pappso::Enums::x.

◆ getOutermostRangeY()

QCPRange pappso::BasePlotWidget::getOutermostRangeY ( bool & found_range) const
virtual

Definition at line 2045 of file baseplotwidget.cpp.

2046{
2047 return getRange(Enums::Axis::y, RangeType::outermost, found_range);
2048}

References getRange(), pappso::outermost, and pappso::Enums::y.

◆ getPen()

const QPen & pappso::BasePlotWidget::getPen ( ) const
virtual

Definition at line 405 of file baseplotwidget.cpp.

406{
407 return m_pen;
408}

References m_pen.

◆ getPlottingColor() [1/2]

QColor pappso::BasePlotWidget::getPlottingColor ( int index = 0) const
virtual

Reimplemented in pappso::BaseColorMapPlotWidget.

Definition at line 451 of file baseplotwidget.cpp.

452{
453 QCPGraph *graph_p = graph(index);
454
455 if(graph_p == nullptr)
456 qFatal("Programming error.");
457
458 return getPlottingColor(graph_p);
459}
virtual QColor getPlottingColor(QCPAbstractPlottable *plottable_p) const

References getPlottingColor().

◆ getPlottingColor() [2/2]

QColor pappso::BasePlotWidget::getPlottingColor ( QCPAbstractPlottable * plottable_p) const
virtual

Definition at line 442 of file baseplotwidget.cpp.

443{
444 if(plottable_p == nullptr)
445 qFatal("Programming error.");
446
447 return plottable_p->pen().color();
448}

Referenced by getPlottingColor().

◆ getRange()

QCPRange pappso::BasePlotWidget::getRange ( Enums::Axis axis,
RangeType range_type,
bool & found_range ) const

Definition at line 1934 of file baseplotwidget.cpp.

1937{
1938
1939 // Iterate in all the graphs in this widget and return a QCPRange that has
1940 // its lower member as the greatest lower value of all
1941 // its upper member as the smallest upper value of all
1942
1943 if(!graphCount())
1944 {
1945 found_range = false;
1946
1947 return QCPRange(0, 1);
1948 }
1949
1950 if(graphCount() == 1)
1951 return graph()->getKeyRange(found_range);
1952
1953 bool found_at_least_one_range = false;
1954
1955 // Create an invalid range.
1956 QCPRange result_range(QCPRange::minRange + 1, QCPRange::maxRange + 1);
1957
1958 for(int iter = 0; iter < graphCount(); ++iter)
1959 {
1960 QCPRange temp_range;
1961
1962 bool found_range_for_iter = false;
1963
1964 QCPGraph *graph_p = graph(iter);
1965
1966 // Depending on the axis param, select the key or value range.
1967
1968 if(axis == Enums::Axis::x)
1969 temp_range = graph_p->getKeyRange(found_range_for_iter);
1970 else if(axis == Enums::Axis::y)
1971 temp_range = graph_p->getValueRange(found_range_for_iter);
1972 else
1973 qFatal("Cannot reach this point. Programming error.");
1974
1975 // Was a range found for the iterated graph ? If not skip this
1976 // iteration.
1977
1978 if(!found_range_for_iter)
1979 continue;
1980
1981 // While the innermost_range is invalid, we need to seed it with a good
1982 // one. So check this.
1983
1984 if(!QCPRange::validRange(result_range))
1985 qFatal("The obtained range is invalid !");
1986
1987 // At this point we know the obtained range is OK.
1988 result_range = temp_range;
1989
1990 // We found at least one valid range!
1991 found_at_least_one_range = true;
1992
1993 // At this point we have two valid ranges to compare. Depending on
1994 // range_type, we need to perform distinct comparisons.
1995
1996 if(range_type == RangeType::innermost)
1997 {
1998 if(temp_range.lower > result_range.lower)
1999 result_range.lower = temp_range.lower;
2000 if(temp_range.upper < result_range.upper)
2001 result_range.upper = temp_range.upper;
2002 }
2003 else if(range_type == RangeType::outermost)
2004 {
2005 if(temp_range.lower < result_range.lower)
2006 result_range.lower = temp_range.lower;
2007 if(temp_range.upper > result_range.upper)
2008 result_range.upper = temp_range.upper;
2009 }
2010 else
2011 qFatal("Cannot reach this point. Programming error.");
2012
2013 // Continue to next graph, if any.
2014 }
2015 // End of
2016 // for(int iter = 0; iter < graphCount(); ++iter)
2017
2018 // Let the caller know if we found at least one range.
2019 found_range = found_at_least_one_range;
2020
2021 return result_range;
2022}

References pappso::innermost, pappso::outermost, pappso::Enums::x, and pappso::Enums::y.

Referenced by getInnermostRangeX(), getInnermostRangeY(), getOutermostRangeX(), and getOutermostRangeY().

◆ getRangeX()

QCPRange pappso::BasePlotWidget::getRangeX ( bool & found_range,
int index ) const
virtual

MOUSE MOVEMENTS mouse/keyboard-triggered.

RANGE-related functions

Definition at line 1912 of file baseplotwidget.cpp.

1913{
1914 QCPGraph *graph_p = graph(index);
1915
1916 if(graph_p == nullptr)
1917 qFatal("Programming error.");
1918
1919 return graph_p->getKeyRange(found_range);
1920}

◆ getRangeY()

QCPRange pappso::BasePlotWidget::getRangeY ( bool & found_range,
int index ) const
virtual

Definition at line 1923 of file baseplotwidget.cpp.

1924{
1925 QCPGraph *graph_p = graph(index);
1926
1927 if(graph_p == nullptr)
1928 qFatal("Programming error.");
1929
1930 return graph_p->getValueRange(found_range);
1931}

◆ hideAllPlotItems()

void pappso::BasePlotWidget::hideAllPlotItems ( )
virtual

PLOTTING / REPLOTTING functions.

PLOT ITEMS : TRACER TEXT ITEMS...

PLOT ITEMS : TRACER TEXT ITEMS... Hide the selection line, the xDelta text and the zoom rectangle items.

Definition at line 2254 of file baseplotwidget.cpp.

2255{
2256 mp_xDeltaTextItem->setVisible(false);
2257 mp_yDeltaTextItem->setVisible(false);
2258
2259 // mp_zoomRectItem->setVisible(false);
2261
2262 // Force a replot to make sure the action is immediately visible by the
2263 // user, even without moving the mouse.
2264 replot();
2265}
virtual void hideSelectionRectangle(bool reset_values=false)

References hideSelectionRectangle(), mp_xDeltaTextItem, and mp_yDeltaTextItem.

Referenced by restoreAxesRangeHistory(), and yMinMaxOnXAxisCurrentRange().

◆ hideSelectionRectangle()

void pappso::BasePlotWidget::hideSelectionRectangle ( bool reset_values = false)
virtual

◆ hideTracers()

void pappso::BasePlotWidget::hideTracers ( )
virtual

Hide the traces (vertical and horizontal).

Definition at line 2286 of file baseplotwidget.cpp.

2287{
2289 mp_hPosTracerItem->setVisible(false);
2290 mp_vPosTracerItem->setVisible(false);
2291
2292 mp_vStartTracerItem->setVisible(false);
2293 mp_vEndTracerItem->setVisible(false);
2294
2295 // Force a replot to make sure the action is immediately visible by the
2296 // user, even without moving the mouse.
2297 replot();
2298}
bool m_shouldTracersBeVisible
Tells if the tracers should be visible.

References m_shouldTracersBeVisible, mp_hPosTracerItem, mp_vEndTracerItem, mp_vPosTracerItem, and mp_vStartTracerItem.

Referenced by keyReleaseEvent(), and yMinMaxOnXAxisCurrentRange().

◆ horizontalGetGraphCoordNewPointCountPixels()

QPointF pappso::BasePlotWidget::horizontalGetGraphCoordNewPointCountPixels ( int pixel_count)
virtual

Definition at line 1861 of file baseplotwidget.cpp.

1862{
1863 QPointF pixel_coordinates(
1864 xAxis->coordToPixel(m_context.m_lastCursorHoveredPoint.x()) + pixel_count,
1865 yAxis->coordToPixel(m_context.m_lastCursorHoveredPoint.y()));
1866
1867 // Now convert back to local coordinates.
1868
1869 QPointF graph_coordinates(xAxis->pixelToCoord(pixel_coordinates.x()),
1870 yAxis->pixelToCoord(pixel_coordinates.y()));
1871
1872 return graph_coordinates;
1873}

References m_context.

Referenced by horizontalMoveMouseCursorCountPixels().

◆ horizontalMoveMouseCursorCountPixels()

void pappso::BasePlotWidget::horizontalMoveMouseCursorCountPixels ( int pixel_count)
virtual

Definition at line 1846 of file baseplotwidget.cpp.

1847{
1848 QPointF graph_coord = horizontalGetGraphCoordNewPointCountPixels(pixel_count);
1849
1850 QPointF pixel_coord(xAxis->coordToPixel(graph_coord.x()),
1851 yAxis->coordToPixel(graph_coord.y()));
1852
1853 // Now we need ton convert the new coordinates to the global position system
1854 // and to move the cursor to that new position. That will create an event to
1855 // move the mouse cursor.
1856
1857 moveMouseCursorPixelCoordToGlobal(pixel_coord.toPoint());
1858}
virtual void moveMouseCursorPixelCoordToGlobal(QPointF local_coordinates)
virtual QPointF horizontalGetGraphCoordNewPointCountPixels(int pixel_count)

References horizontalGetGraphCoordNewPointCountPixels(), and moveMouseCursorPixelCoordToGlobal().

Referenced by directionKeyPressEvent().

◆ integrationRequestedSignal

void pappso::BasePlotWidget::integrationRequestedSignal ( const BasePlotContext & context)
signal

◆ isClickOntoXAxis()

bool pappso::BasePlotWidget::isClickOntoXAxis ( const QPointF & mousePoint)

Definition at line 1746 of file baseplotwidget.cpp.

1747{
1748 QCPLayoutElement *layoutElement = layoutElementAt(mousePoint);
1749
1750 if(layoutElement &&
1751 layoutElement == dynamic_cast<QCPLayoutElement *>(axisRect()))
1752 {
1753 // The graph is *inside* the axisRect that is the outermost envelope of
1754 // the graph. Thus, if we want to know if the click was indeed on an
1755 // axis, we need to check what selectable part of the the axisRect we
1756 // were clicking:
1757 QCPAxis::SelectablePart selectablePart;
1758
1759 selectablePart = xAxis->getPartAt(mousePoint);
1760
1761 if(selectablePart == QCPAxis::spAxisLabel ||
1762 selectablePart == QCPAxis::spAxis ||
1763 selectablePart == QCPAxis::spTickLabels)
1764 return true;
1765 }
1766
1767 return false;
1768}

Referenced by mousePressHandler().

◆ isClickOntoYAxis()

bool pappso::BasePlotWidget::isClickOntoYAxis ( const QPointF & mousePoint)

Definition at line 1771 of file baseplotwidget.cpp.

1772{
1773 QCPLayoutElement *layoutElement = layoutElementAt(mousePoint);
1774
1775 if(layoutElement &&
1776 layoutElement == dynamic_cast<QCPLayoutElement *>(axisRect()))
1777 {
1778 // The graph is *inside* the axisRect that is the outermost envelope of
1779 // the graph. Thus, if we want to know if the click was indeed on an
1780 // axis, we need to check what selectable part of the the axisRect we
1781 // were clicking:
1782 QCPAxis::SelectablePart selectablePart;
1783
1784 selectablePart = yAxis->getPartAt(mousePoint);
1785
1786 if(selectablePart == QCPAxis::spAxisLabel ||
1787 selectablePart == QCPAxis::spAxis ||
1788 selectablePart == QCPAxis::spTickLabels)
1789 return true;
1790 }
1791
1792 return false;
1793}

Referenced by mousePressHandler().

◆ isSelectionRectangleVisible()

bool pappso::BasePlotWidget::isSelectionRectangleVisible ( )
virtual

Definition at line 3258 of file baseplotwidget.cpp.

3259{
3260 // Sanity check
3261 int check = 0;
3262
3263 check += mp_selectionRectangeLine1->visible();
3264 check += mp_selectionRectangeLine2->visible();
3265 check += mp_selectionRectangeLine3->visible();
3266 check += mp_selectionRectangeLine4->visible();
3267
3268 if(check > 0)
3269 return true;
3270
3271 return false;
3272}

References mp_selectionRectangeLine1, mp_selectionRectangeLine2, mp_selectionRectangeLine3, and mp_selectionRectangeLine4.

Referenced by yMinMaxOnXAxisCurrentRange().

◆ isVerticalDisplacementAboveThreshold()

bool pappso::BasePlotWidget::isVerticalDisplacementAboveThreshold ( )
virtual

Definition at line 2600 of file baseplotwidget.cpp.

2601{
2602 // First get the height of the plot.
2603 double plotHeight = yAxis->range().upper - yAxis->range().lower;
2604
2605 double heightDiff =
2606 fabs(m_context.m_startDragPoint.y() - m_context.m_currentDragPoint.y());
2607
2608 double heightDiffRatio = (heightDiff / plotHeight) * 100;
2609
2610 if(heightDiffRatio > 10)
2611 {
2612 return true;
2613 }
2614
2615 return false;
2616}

References m_context.

Referenced by keyReleaseEvent(), mouseMoveHandlerLeftButtonDraggingCursor(), mouseMoveHandlerRightButtonDraggingCursor(), and yMinMaxOnXAxisCurrentRange().

◆ keyPressEvent()

void pappso::BasePlotWidget::keyPressEvent ( QKeyEvent * event)
virtual

KEYBOARD-related EVENTS.

Reimplemented in pappso::DriftSpecMassSpecColorMapPlotWidget, pappso::DriftSpecTracePlotWidget, pappso::MassSpecTracePlotWidget, pappso::TicXicChromDriftSpecColorMapPlotWidget, pappso::TicXicChromMassSpecColorMapPlotWidget, and pappso::TicXicChromTracePlotWidget.

Definition at line 607 of file baseplotwidget.cpp.

608{
609 // qDebug() << "ENTER";
610
611 // We need this because some keys modify our behaviour.
612 m_context.m_pressedKeyCode = event->key();
613
614 m_context.m_pressedKeyCodes.insert(event->key());
615 m_context.m_releasedKeyCodes.remove(event->key());
616
617 m_context.m_pressedKeyText = event->text();
618
619 // qDebug() << "Pressed key code:" << m_context.m_pressedKeyCode;
620 // qDebug() << "Pressed key codes:" << m_context.m_pressedKeyCodes;
621
622 // qDebug() << "Pressed key text:" << m_context.m_pressedKeyText;
623
624 m_context.m_keyboardModifiers = QGuiApplication::queryKeyboardModifiers();
625
626 if(event->key() == Qt::Key_Left || event->key() == Qt::Key_Right ||
627 event->key() == Qt::Key_Up || event->key() == Qt::Key_Down)
628 {
629 return directionKeyPressEvent(event);
630 }
631 else if(event->key() == m_leftMousePseudoButtonKey ||
632 event->key() == m_rightMousePseudoButtonKey)
633 {
634 return mousePseudoButtonKeyPressEvent(event);
635 }
636
637 // Do not do anything here, because this function is used by derived classes
638 // that will emit the signal below. Otherwise there are going to be multiple
639 // signals sent.
640 // qDebug() << "Going to emit keyPressEventSignal(m_context);";
641 // emit keyPressEventSignal(m_context);
642}
virtual void mousePseudoButtonKeyPressEvent(QKeyEvent *event)
virtual void directionKeyPressEvent(QKeyEvent *event)

References directionKeyPressEvent(), m_context, m_leftMousePseudoButtonKey, m_rightMousePseudoButtonKey, and mousePseudoButtonKeyPressEvent().

Referenced by pappso::DriftSpecMassSpecColorMapPlotWidget::keyPressEvent(), pappso::DriftSpecTracePlotWidget::keyPressEvent(), pappso::MassSpecTracePlotWidget::keyPressEvent(), pappso::TicXicChromDriftSpecColorMapPlotWidget::keyPressEvent(), pappso::TicXicChromMassSpecColorMapPlotWidget::keyPressEvent(), and pappso::TicXicChromTracePlotWidget::keyPressEvent().

◆ keyPressEventSignal

◆ keyReleaseEvent()

void pappso::BasePlotWidget::keyReleaseEvent ( QKeyEvent * event)
virtual

Handle specific key codes and trigger respective actions.

Reimplemented in pappso::DriftSpecMassSpecColorMapPlotWidget, pappso::DriftSpecTracePlotWidget, pappso::MassSpecTracePlotWidget, pappso::TicXicChromDriftSpecColorMapPlotWidget, pappso::TicXicChromMassSpecColorMapPlotWidget, and pappso::TicXicChromTracePlotWidget.

Definition at line 646 of file baseplotwidget.cpp.

647{
648 m_context.m_releasedKeyCode = event->key();
649
650 m_context.m_releasedKeyCodes.insert(event->key());
651 m_context.m_pressedKeyCodes.remove(event->key());
652
653 m_context.m_releasedKeyText = event->text();
654
655 // qDebug() << "Released code:" << m_context.m_releasedKeyCode;
656 // qDebug() << "Released codes:" << m_context.m_releasedKeyCodes;
657 // qDebug() << "Released key:" << m_context.m_releasedKeyText;
658
659 // The keyboard key is being released, set the key code to 0.
660 m_context.m_pressedKeyCode = 0;
661 m_context.m_pressedKeyText = "";
662
663 m_context.m_keyboardModifiers = QGuiApplication::queryKeyboardModifiers();
664
665 // Now test if the key that was released is one of the housekeeping keys.
666 if(event->key() == Qt::Key_Backspace)
667 {
668 // qDebug();
669
670 // The user wants to iterate back in the x/y axis range history.
672
673 event->accept();
674 }
675 else if(event->key() == Qt::Key_Space)
676 {
677 return spaceKeyReleaseEvent(event);
678 }
679 else if(event->key() == Qt::Key_Delete)
680 {
681 // The user wants to delete a graph. What graph is to be determined
682 // programmatically:
683
684 // If there is a single graph, then that is the graph to be removed.
685 // If there are more than one graph, then only the ones that are selected
686 // are to be removed.
687
688 // Note that the user of this widget might want to provide the user with
689 // the ability to specify if all the children graph needs to be removed
690 // also. This can be coded in key modifiers. So provide the context.
691
692 int graph_count = plottableCount();
693
694 if(!graph_count)
695 {
696 // qDebug() << "Not a single graph in the plot widget. Doing
697 // nothing.";
698
699 event->accept();
700 return;
701 }
702
703 if(graph_count == 1)
704 {
705 // qDebug() << "A single graph is in the plot widget. Emitting a graph
706 // " "destruction requested signal for it:"
707 //<< graph();
708
710 }
711 else
712 {
713 // At this point we know there are more than one graph in the plot
714 // widget. We need to get the selected one (if any).
715 QList<QCPGraph *> selected_graph_list;
716
717 selected_graph_list = selectedGraphs();
718
719 if(!selected_graph_list.size())
720 {
721 event->accept();
722 return;
723 }
724
725 // qDebug() << "Number of selected graphs to be destrobyed:"
726 //<< selected_graph_list.size();
727
728 for(int iter = 0; iter < selected_graph_list.size(); ++iter)
729 {
730 // qDebug()
731 //<< "Emitting a graph destruction requested signal for graph:"
732 //<< selected_graph_list.at(iter);
733
735 this, selected_graph_list.at(iter), m_context);
736
737 // We do not do this, because we want the slot called by the
738 // signal above to handle that removal. Remember that it is not
739 // possible to delete graphs manually.
740 //
741 // removeGraph(selected_graph_list.at(iter));
742 }
743 event->accept();
744 }
745 }
746 // End of
747 // else if(event->key() == Qt::Key_Delete)
748 else if(event->key() == Qt::Key_T)
749 {
750 // The user wants to toggle the visibiity of the tracers.
752
754 hideTracers();
755 else
756 showTracers();
757
758 event->accept();
759 }
760 else if(event->key() == Qt::Key_Left || event->key() == Qt::Key_Right ||
761 event->key() == Qt::Key_Up || event->key() == Qt::Key_Down)
762 {
763 return directionKeyReleaseEvent(event);
764 }
765 else if(event->key() == m_leftMousePseudoButtonKey ||
766 event->key() == m_rightMousePseudoButtonKey)
767 {
769 }
770 else if(event->key() == Qt::Key_S)
771 {
772 // The user is defining the size of the rhomboid fixed side. That could be
773 // either a vertical side (less intuitive) or a horizontal size (more
774 // intuitive, first exclusive implementation). But, in order to be able to
775 // perform identical integrations starting from non-transposed color maps
776 // and transposed color maps, the ability to define a vertical fixed size
777 // side of the rhomboid integration scope has become necessary.
778
779 // Check if the vertical displacement is significant (>= 10% of the color
780 // map height.
781
783 {
784 // The user is dragging the cursor vertically in a sufficient delta to
785 // consider that they are willing to define a vertical fixed size
786 // of the rhomboid integration scope.
787
788 m_context.m_integrationScopeRhombWidth = 0;
789 m_context.m_integrationScopeRhombHeight = abs(
790 m_context.m_currentDragPoint.y() - m_context.m_startDragPoint.y());
791
792 // qDebug() << "Set m_context.m_integrationScopePolyHeight to"
793 // << m_context.m_integrationScopeRhombHeight
794 // << "upon release of S key";
795 }
796 else
797 {
798 // The user is dragging the cursor horiontally to define a horizontal
799 // fixed size of the rhomboid integration scope.
800
801 m_context.m_integrationScopeRhombWidth = abs(
802 m_context.m_currentDragPoint.x() - m_context.m_startDragPoint.x());
803 m_context.m_integrationScopeRhombHeight = 0;
804
805 // qDebug() << "Set m_context.m_integrationScopePolyWidth to"
806 // << m_context.m_integrationScopeRhombWidth
807 // << "upon release of S key";
808 }
809 }
810 // At this point emit the signal, since we did not treat it. Maybe the
811 // consumer widget wants to know that the keyboard key was released.
812
813 emit keyReleaseEventSignal(event, m_context);
814}
void plottableDestructionRequestedSignal(BasePlotWidget *base_plot_widget_p, QCPAbstractPlottable *plottable_p, const pappso::BasePlotContext &context)
virtual void directionKeyReleaseEvent(QKeyEvent *event)
virtual void spaceKeyReleaseEvent(QKeyEvent *event)
virtual bool isVerticalDisplacementAboveThreshold()
virtual void showTracers()
Show the traces (vertical and horizontal).
virtual void restorePreviousAxesRangeHistory()
Go up one history element in the axis history.
void keyReleaseEventSignal(QKeyEvent *event, const pappso::BasePlotContext &context)
virtual void hideTracers()
Hide the traces (vertical and horizontal).
virtual void mousePseudoButtonKeyReleaseEvent(QKeyEvent *event)

References directionKeyReleaseEvent(), hideTracers(), isVerticalDisplacementAboveThreshold(), keyReleaseEventSignal(), m_context, m_leftMousePseudoButtonKey, m_rightMousePseudoButtonKey, m_shouldTracersBeVisible, mousePseudoButtonKeyReleaseEvent(), plottableDestructionRequestedSignal(), restorePreviousAxesRangeHistory(), showTracers(), and spaceKeyReleaseEvent().

Referenced by pappso::DriftSpecMassSpecColorMapPlotWidget::keyReleaseEvent(), pappso::DriftSpecTracePlotWidget::keyReleaseEvent(), pappso::MassSpecTracePlotWidget::keyReleaseEvent(), pappso::TicXicChromDriftSpecColorMapPlotWidget::keyReleaseEvent(), pappso::TicXicChromMassSpecColorMapPlotWidget::keyReleaseEvent(), and pappso::TicXicChromTracePlotWidget::keyReleaseEvent().

◆ keyReleaseEventSignal

◆ lastCursorHoveredPointSignal

void pappso::BasePlotWidget::lastCursorHoveredPointSignal ( const QPointF & pointf)
signal

◆ layerableLayerIndex()

int pappso::BasePlotWidget::layerableLayerIndex ( QCPLayerable * layerable_p) const
protectedvirtual

Definition at line 198 of file baseplotwidget.cpp.

199{
200 if(layerable_p == nullptr)
201 qFatal("Programming error.");
202
203 QCPLayer *layer_p = layerable_p->layer();
204
205 for(int iter = 0; iter < layerCount(); ++iter)
206 {
207 if(layer(iter) == layer_p)
208 return iter;
209 }
210
211 return -1;
212}

◆ layerableLayerName()

QString pappso::BasePlotWidget::layerableLayerName ( QCPLayerable * layerable_p) const
protectedvirtual

Definition at line 187 of file baseplotwidget.cpp.

188{
189 if(layerable_p == nullptr)
190 qFatal("Programming error.");
191
192 QCPLayer *layer_p = layerable_p->layer();
193
194 return layer_p->name();
195}

◆ mouseMoveDraggingCursorSignal

void pappso::BasePlotWidget::mouseMoveDraggingCursorSignal ( QMouseEvent * event,
const pappso::BasePlotContext & context )
signal

Referenced by mouseMoveHandler().

◆ mouseMoveHandler()

void pappso::BasePlotWidget::mouseMoveHandler ( QMouseEvent * event)
virtual

KEYBOARD-related EVENTS.

MOUSE-related EVENTS

Reimplemented in pappso::DriftSpecMassSpecColorMapPlotWidget, pappso::DriftSpecTracePlotWidget, pappso::MassSpecTracePlotWidget, pappso::TicXicChromDriftSpecColorMapPlotWidget, pappso::TicXicChromMassSpecColorMapPlotWidget, and pappso::TicXicChromTracePlotWidget.

Definition at line 947 of file baseplotwidget.cpp.

948{
949
950 // If we have no focus, then get it. See setFocus() to understand why asking
951 // for focus is cosly and thus why we want to make this decision first.
952 if(!hasFocus())
953 setFocus();
954
955 // qDebug() << (graph() != nullptr);
956 // if(graph(0) != nullptr)
957 // { // check if the widget contains some graphs
958
959 // The event->button() must be by Qt instructions considered to be 0.
960
961 // Whatever happens, we want to store the plot coordinates of the current
962 // mouse cursor position (will be useful later for countless needs).
963
964 QPointF mousePoint = event->position();
965
966 // qDebug() << "local mousePoint position in pixels:" << mousePoint;
967
968 m_context.m_lastCursorHoveredPoint.setX(xAxis->pixelToCoord(mousePoint.x()));
969 m_context.m_lastCursorHoveredPoint.setY(yAxis->pixelToCoord(mousePoint.y()));
970
971 // qDebug() << "lastCursorHoveredPoint coord:"
972 //<< m_context.m_lastCursorHoveredPoint;
973
974 // Now, depending on the button(s) (if any) that are pressed or not, we
975 // have a different processing.
976
977 // qDebug();
978
979 if(m_context.m_pressedMouseButtons & Qt::LeftButton ||
980 m_context.m_pressedMouseButtons & Qt::RightButton)
981 {
983 // qDebug() << "Emitting mouseMoveDraggingCursorSignal";
985 }
986 else
988 // }
989 // qDebug();
990 event->accept();
991}
virtual void mouseMoveHandlerDraggingCursor(QMouseEvent *event)
virtual void mouseMoveHandlerNotDraggingCursor(QMouseEvent *event)
virtual void setFocus()
PLOT ITEMS : TRACER TEXT ITEMS...
void mouseMoveDraggingCursorSignal(QMouseEvent *event, const pappso::BasePlotContext &context)

References m_context, mouseMoveDraggingCursorSignal(), mouseMoveHandlerDraggingCursor(), mouseMoveHandlerNotDraggingCursor(), and setFocus().

Referenced by pappso::DriftSpecMassSpecColorMapPlotWidget::mouseMoveHandler(), pappso::DriftSpecTracePlotWidget::mouseMoveHandler(), pappso::MassSpecTracePlotWidget::mouseMoveHandler(), pappso::TicXicChromDriftSpecColorMapPlotWidget::mouseMoveHandler(), pappso::TicXicChromMassSpecColorMapPlotWidget::mouseMoveHandler(), pappso::TicXicChromTracePlotWidget::mouseMoveHandler(), and setupWidget().

◆ mouseMoveHandlerDraggingCursor()

void pappso::BasePlotWidget::mouseMoveHandlerDraggingCursor ( QMouseEvent * event)
virtual

Reimplemented in pappso::DriftSpecMassSpecColorMapPlotWidget, pappso::DriftSpecTracePlotWidget, pappso::MassSpecTracePlotWidget, pappso::TicXicChromDriftSpecColorMapPlotWidget, pappso::TicXicChromMassSpecColorMapPlotWidget, and pappso::TicXicChromTracePlotWidget.

Definition at line 1058 of file baseplotwidget.cpp.

1059{
1060 // qDebug();
1061
1062 m_context.m_isMouseDragging = true;
1063
1064 // Now store the mouse position data into the the current drag point
1065 // member datum, that will be used in countless occasions later.
1066 m_context.m_currentDragPoint = m_context.m_lastCursorHoveredPoint;
1067 m_context.m_keyboardModifiers = QGuiApplication::queryKeyboardModifiers();
1068
1069 // When we drag (either keyboard or mouse), we hide the position markers
1070 // (black) and we show the start and end vertical markers for the region.
1071 // Then, we draw the horizontal region range marker that delimits
1072 // horizontally the dragged-over region.
1073
1074 if(mp_hPosTracerItem != nullptr)
1075 mp_hPosTracerItem->setVisible(false);
1076 if(mp_vPosTracerItem != nullptr)
1077 mp_vPosTracerItem->setVisible(false);
1078
1079 // Only bother with the tracers if the user wants them to be visible.
1081 {
1082
1083 // The vertical end tracer position must be refreshed.
1084 mp_vEndTracerItem->start->setCoords(m_context.m_currentDragPoint.x(),
1085 yAxis->range().upper);
1086
1087 mp_vEndTracerItem->end->setCoords(m_context.m_currentDragPoint.x(),
1088 yAxis->range().lower);
1089
1090 mp_vEndTracerItem->setVisible(true);
1091 }
1092
1093 // Whatever the button, when we are dealing with the axes, we do not
1094 // want to show any of the tracers.
1095
1096 if(m_context.m_wasClickOnXAxis || m_context.m_wasClickOnYAxis)
1097 {
1098 if(mp_hPosTracerItem != nullptr)
1099 mp_hPosTracerItem->setVisible(false);
1100 if(mp_vPosTracerItem != nullptr)
1101 mp_vPosTracerItem->setVisible(false);
1102
1103 if(mp_vStartTracerItem != nullptr)
1104 mp_vStartTracerItem->setVisible(false);
1105 if(mp_vEndTracerItem != nullptr)
1106 mp_vEndTracerItem->setVisible(false);
1107 }
1108 else
1109 {
1110 // qDebug() << "Not moving the mouse cursor over any of the axes.";
1111
1112 // Since we are not dragging the mouse cursor over the axes, make sure
1113 // we store the drag directions in the context, as this might be
1114 // useful for later operations.
1115 // qDebug() << "Recording the drag direction(s).";
1116
1117 m_context.recordDragDirections();
1118
1119 // qDebug() << "Drag direction(s): " <<
1120 // m_context.dragDirectionsToString();
1121 }
1122
1123 // Because when we drag the mouse button (whatever the button) we need to
1124 // know what is the drag delta (distance between start point and current
1125 // point of the drag operation) on both axes, ask that these x|y deltas be
1126 // computed.
1128
1129 // Now deal with the BUTTON-SPECIFIC CODE.
1130
1131 if(m_context.m_mouseButtonsAtMousePress & Qt::LeftButton)
1132 {
1134 }
1135 else if(m_context.m_mouseButtonsAtMousePress & Qt::RightButton)
1136 {
1138 }
1139}
virtual void mouseMoveHandlerLeftButtonDraggingCursor(QMouseEvent *event)
virtual void mouseMoveHandlerRightButtonDraggingCursor(QMouseEvent *event)
virtual void calculateDragDeltas()

References calculateDragDeltas(), m_context, m_shouldTracersBeVisible, mouseMoveHandlerLeftButtonDraggingCursor(), mouseMoveHandlerRightButtonDraggingCursor(), mp_hPosTracerItem, mp_vEndTracerItem, mp_vPosTracerItem, and mp_vStartTracerItem.

Referenced by mouseMoveHandler(), pappso::DriftSpecMassSpecColorMapPlotWidget::mouseMoveHandlerDraggingCursor(), pappso::DriftSpecTracePlotWidget::mouseMoveHandlerDraggingCursor(), pappso::MassSpecTracePlotWidget::mouseMoveHandlerDraggingCursor(), pappso::TicXicChromDriftSpecColorMapPlotWidget::mouseMoveHandlerDraggingCursor(), pappso::TicXicChromMassSpecColorMapPlotWidget::mouseMoveHandlerDraggingCursor(), and pappso::TicXicChromTracePlotWidget::mouseMoveHandlerDraggingCursor().

◆ mouseMoveHandlerLeftButtonDraggingCursor()

void pappso::BasePlotWidget::mouseMoveHandlerLeftButtonDraggingCursor ( QMouseEvent * event)
virtual

Definition at line 1142 of file baseplotwidget.cpp.

1143{
1144 Q_UNUSED(event)
1145
1146 // qDebug() << "The left button is dragging.";
1147
1148 // Set the context.m_isMeasuringDistance to false, which later might be set
1149 // to true if effectively we are measuring a distance. This is required
1150 // because the derived widget classes might want to know if they have to
1151 // perform some action on the basis that context is measuring a distance,
1152 // for example the mass spectrum-specific widget might want to compute
1153 // deconvolutions.
1154
1155 m_context.m_isMeasuringDistance = false;
1156
1157 // Let's first check if the mouse drag operation originated on either
1158 // axis. In that case, the user is performing axis reframing or rescaling.
1159
1160 if(m_context.m_wasClickOnXAxis || m_context.m_wasClickOnYAxis)
1161 {
1162 // qDebug() << "Click was on one of the axes.";
1163
1164 if(m_context.m_keyboardModifiers & Qt::ControlModifier)
1165 {
1166 // The user is asking a rescale of the plot.
1167
1168 // We know that we do not want the tracers when we perform axis
1169 // rescaling operations.
1170
1171 if(mp_hPosTracerItem != nullptr)
1172 mp_hPosTracerItem->setVisible(false);
1173 if(mp_vPosTracerItem != nullptr)
1174 mp_vPosTracerItem->setVisible(false);
1175
1176 if(mp_vStartTracerItem != nullptr)
1177 mp_vStartTracerItem->setVisible(false);
1178 if(mp_vEndTracerItem != nullptr)
1179 mp_vEndTracerItem->setVisible(false);
1180
1181 // This operation is particularly intensive, thus we want to
1182 // reduce the number of calculations by skipping this calculation
1183 // a number of times. The user can ask for this feature by
1184 // clicking the 'Q' letter.
1185
1186 if(m_context.m_pressedKeyCode == Qt::Key_Q)
1187 {
1189 {
1191 return;
1192 }
1193 else
1194 {
1196 }
1197 }
1198
1199 // qDebug() << "Asking that the axes be rescaled.";
1200
1201 axisRescale();
1202 }
1203 else
1204 {
1205 // The user was simply dragging the axis. Just pan, that is slide
1206 // the plot in the same direction as the mouse movement and with the
1207 // same amplitude.
1208
1209 // qDebug() << "Asking that the axes be panned.";
1210
1211 axisPan();
1212 }
1213
1214 return;
1215 }
1216
1217 // At this point we understand that the user was not performing any
1218 // panning/rescaling operation by clicking on any one of the axes.. Go on
1219 // with other possibilities.
1220
1221 // Let's check if the user is actually drawing a rectangle (covering a
1222 // real area) or is drawing a line.
1223
1224 // qDebug() << "The mouse dragging did not originate on an axis.";
1225
1227 {
1228 // qDebug() << "Apparently the selection is two-dimensional.";
1229
1230 // When we draw a two-dimensional integration scope, the tracers are of no
1231 // use.
1232
1233 if(mp_hPosTracerItem != nullptr)
1234 mp_hPosTracerItem->setVisible(false);
1235 if(mp_vPosTracerItem != nullptr)
1236 mp_vPosTracerItem->setVisible(false);
1237
1238 if(mp_vStartTracerItem != nullptr)
1239 mp_vStartTracerItem->setVisible(false);
1240 if(mp_vEndTracerItem != nullptr)
1241 mp_vEndTracerItem->setVisible(false);
1242
1243 // Draw the rectangle, false, not as line segment and
1244 // false, not for integration
1245 drawSelectionRectangleAndPrepareZoom(false /*as_line_segment*/,
1246 false /* for_integration*/);
1247
1248 // Draw the selection width/height text
1251 }
1252 else
1253 {
1254 // qDebug() << "Apparently we are measuring a delta.";
1255
1256 // Draw the rectangle, true, as line segment and
1257 // false, not for integration
1259
1260 // The pure position tracers should be hidden.
1261 if(mp_hPosTracerItem != nullptr)
1262 mp_hPosTracerItem->setVisible(true);
1263 if(mp_vPosTracerItem != nullptr)
1264 mp_vPosTracerItem->setVisible(true);
1265
1266 // Then, make sure the region range vertical tracers are visible.
1267 if(mp_vStartTracerItem != nullptr)
1268 mp_vStartTracerItem->setVisible(true);
1269 if(mp_vEndTracerItem != nullptr)
1270 mp_vEndTracerItem->setVisible(true);
1271
1272 // Draw the selection width text
1274 }
1275}
int m_mouseMoveHandlerSkipAmount
How many mouse move events must be skipped *‍/.
virtual void drawSelectionRectangleAndPrepareZoom(bool as_line_segment=false, bool for_integration=false)
int m_mouseMoveHandlerSkipCount
Counter to handle the "fat data" mouse move event handling.
virtual void drawXScopeSpanFeatures()
virtual void drawYScopeSpanFeatures()
virtual void axisRescale()
RANGE-related functions.

References axisPan(), axisRescale(), drawSelectionRectangleAndPrepareZoom(), drawXScopeSpanFeatures(), drawYScopeSpanFeatures(), isVerticalDisplacementAboveThreshold(), m_context, m_mouseMoveHandlerSkipAmount, m_mouseMoveHandlerSkipCount, mp_hPosTracerItem, mp_vEndTracerItem, mp_vPosTracerItem, and mp_vStartTracerItem.

Referenced by mouseMoveHandlerDraggingCursor().

◆ mouseMoveHandlerNotDraggingCursor()

void pappso::BasePlotWidget::mouseMoveHandlerNotDraggingCursor ( QMouseEvent * event)
virtual

Reimplemented in pappso::DriftSpecMassSpecColorMapPlotWidget, pappso::DriftSpecTracePlotWidget, pappso::MassSpecTracePlotWidget, pappso::TicXicChromDriftSpecColorMapPlotWidget, pappso::TicXicChromMassSpecColorMapPlotWidget, and pappso::TicXicChromTracePlotWidget.

Definition at line 994 of file baseplotwidget.cpp.

995{
996 Q_UNUSED(event)
997
998 // qDebug();
999 m_context.m_isMouseDragging = false;
1000
1001 // qDebug();
1002 // We are not dragging the mouse (no button pressed), simply let this
1003 // widget's consumer know the position of the cursor and update the markers.
1004 // The consumer of this widget will update mouse cursor position at
1005 // m_context.m_lastCursorHoveredPoint if so needed.
1006
1007 emit lastCursorHoveredPointSignal(m_context.m_lastCursorHoveredPoint);
1008
1009 // qDebug();
1010
1011 // We are not dragging, so we do not show the region end tracer we only
1012 // show the anchoring start trace that might be of use if the user starts
1013 // using the arrow keys to move the cursor.
1014 if(mp_vEndTracerItem != nullptr)
1015 mp_vEndTracerItem->setVisible(false);
1016
1017 // qDebug();
1018 // Only bother with the tracers if the user wants them to be visible.
1019 // Their crossing point must be exactly at the last cursor-hovered point.
1020
1022 {
1023 // We are not dragging, so only show the position markers (v and h);
1024
1025 // qDebug();
1026 if(mp_hPosTracerItem != nullptr)
1027 {
1028 // Horizontal position tracer.
1029 mp_hPosTracerItem->setVisible(true);
1030 mp_hPosTracerItem->start->setCoords(
1031 xAxis->range().lower, m_context.m_lastCursorHoveredPoint.y());
1032 mp_hPosTracerItem->end->setCoords(
1033 xAxis->range().upper, m_context.m_lastCursorHoveredPoint.y());
1034 }
1035
1036 // qDebug();
1037 // Vertical position tracer.
1038 if(mp_vPosTracerItem != nullptr)
1039 {
1040 mp_vPosTracerItem->setVisible(true);
1041
1042 mp_vPosTracerItem->setVisible(true);
1043 mp_vPosTracerItem->start->setCoords(
1044 m_context.m_lastCursorHoveredPoint.x(), yAxis->range().upper);
1045 mp_vPosTracerItem->end->setCoords(
1046 m_context.m_lastCursorHoveredPoint.x(), yAxis->range().lower);
1047 }
1048
1049 // qDebug();
1050 replot();
1051 }
1052
1053
1054 return;
1055}
void lastCursorHoveredPointSignal(const QPointF &pointf)

References lastCursorHoveredPointSignal(), m_context, m_shouldTracersBeVisible, mp_hPosTracerItem, mp_vEndTracerItem, and mp_vPosTracerItem.

Referenced by mouseMoveHandler(), pappso::DriftSpecMassSpecColorMapPlotWidget::mouseMoveHandlerNotDraggingCursor(), pappso::DriftSpecTracePlotWidget::mouseMoveHandlerNotDraggingCursor(), pappso::MassSpecTracePlotWidget::mouseMoveHandlerNotDraggingCursor(), pappso::TicXicChromDriftSpecColorMapPlotWidget::mouseMoveHandlerNotDraggingCursor(), pappso::TicXicChromMassSpecColorMapPlotWidget::mouseMoveHandlerNotDraggingCursor(), and pappso::TicXicChromTracePlotWidget::mouseMoveHandlerNotDraggingCursor().

◆ mouseMoveHandlerRightButtonDraggingCursor()

void pappso::BasePlotWidget::mouseMoveHandlerRightButtonDraggingCursor ( QMouseEvent * event)
virtual

Definition at line 1278 of file baseplotwidget.cpp.

1279{
1280 Q_UNUSED(event)
1281 // qDebug() << "The right button is dragging.";
1282
1283 // Set the context.m_isMeasuringDistance to false, which later might be set
1284 // to true if effectively we are measuring a distance. This is required
1285 // because the derived widgets might want to know if they have to perform
1286 // some action on the basis that context is measuring a distance, for
1287 // example the mass spectrum-specific widget might want to compute
1288 // deconvolutions.
1289
1290 m_context.m_isMeasuringDistance = false;
1291
1293 {
1294 // qDebug() << "Apparently the selection has height.";
1295
1296 // When we draw a rectangle the tracers are of no use.
1297
1298 if(mp_hPosTracerItem != nullptr)
1299 mp_hPosTracerItem->setVisible(false);
1300 if(mp_vPosTracerItem != nullptr)
1301 mp_vPosTracerItem->setVisible(false);
1302
1303 if(mp_vStartTracerItem != nullptr)
1304 mp_vStartTracerItem->setVisible(false);
1305 if(mp_vEndTracerItem != nullptr)
1306 mp_vEndTracerItem->setVisible(false);
1307
1308 // Draw the rectangle, false for as_line_segment and true for
1309 // integration.
1311
1312 // Draw the selection width/height text
1315 }
1316 else
1317 {
1318 // qDebug() << "Apparently the selection is a not a rectangle.";
1319
1320 // Draw the rectangle, true as line segment and
1321 // true for integration
1323
1324 // Draw the selection width text
1326 }
1327}

References drawSelectionRectangleAndPrepareZoom(), drawXScopeSpanFeatures(), drawYScopeSpanFeatures(), isVerticalDisplacementAboveThreshold(), m_context, mp_hPosTracerItem, mp_vEndTracerItem, mp_vPosTracerItem, and mp_vStartTracerItem.

Referenced by mouseMoveHandlerDraggingCursor().

◆ mousePressEventSignal

void pappso::BasePlotWidget::mousePressEventSignal ( QMouseEvent * event,
const pappso::BasePlotContext & context )
signal

Referenced by mousePressHandler().

◆ mousePressHandler()

void pappso::BasePlotWidget::mousePressHandler ( QMouseEvent * event)
virtual

KEYBOARD-related EVENTS.

MOUSE-related EVENTS

Reimplemented in pappso::DriftSpecMassSpecColorMapPlotWidget, pappso::DriftSpecTracePlotWidget, pappso::MassSpecTracePlotWidget, pappso::TicXicChromDriftSpecColorMapPlotWidget, pappso::TicXicChromMassSpecColorMapPlotWidget, and pappso::TicXicChromTracePlotWidget.

Definition at line 1330 of file baseplotwidget.cpp.

1331{
1332 // qDebug() << "Entering";
1333
1334 // When the user clicks this widget it has to take focus.
1335 setFocus();
1336
1337 QPointF mousePoint = event->position();
1338
1339 m_context.m_lastPressedMouseButton = event->button();
1340 m_context.m_mouseButtonsAtMousePress = event->buttons();
1341
1342 // The pressedMouseButtons must continually inform on the status of
1343 // pressed buttons so add the pressed button.
1344 m_context.m_pressedMouseButtons |= event->button();
1345
1346 // qDebug().noquote() << m_context.toString();
1347
1348 // In all the processing of the events, we need to know if the user is
1349 // clicking somewhere with the intent to change the plot ranges (reframing
1350 // or rescaling the plot).
1351 //
1352 // Reframing the plot means that the new x and y axes ranges are modified
1353 // so that they match the region that the user has encompassed by left
1354 // clicking the mouse and dragging it over the plot. That is we reframe
1355 // the plot so that it contains only the "selected" region.
1356 //
1357 // Rescaling the plot means the the new x|y axis range is modified such
1358 // that the lower axis range is constant and the upper axis range is moved
1359 // either left or right by the same amont as the x|y delta encompassed by
1360 // the user moving the mouse. The axis is thus either compressed (mouse
1361 // movement is leftwards) or un-compressed (mouse movement is rightwards).
1362
1363 // There are two ways to perform axis range modifications:
1364 //
1365 // 1. By clicking on any of the axes
1366 // 2. By clicking on the plot region but using keyboard key modifiers,
1367 // like Alt and Ctrl.
1368 //
1369 // We need to know both cases separately which is why we need to perform a
1370 // number of tests below.
1371
1372 // Let's check if the click is on the axes, either X or Y, because that
1373 // will allow us to take proper actions.
1374
1375 if(isClickOntoXAxis(mousePoint))
1376 {
1377 // The X axis was clicked upon, we need to document that:
1378 // qDebug() << __FILE__ << __LINE__
1379 //<< "Layout element is axisRect and actually on an X axis part.";
1380
1381 m_context.m_wasClickOnXAxis = true;
1382
1383 // int currentInteractions = interactions();
1384 // currentInteractions |= QCP::iRangeDrag;
1385 // setInteractions((QCP::Interaction)currentInteractions);
1386 // axisRect()->setRangeDrag(xAxis->orientation());
1387 }
1388 else
1389 m_context.m_wasClickOnXAxis = false;
1390
1391 if(isClickOntoYAxis(mousePoint))
1392 {
1393 // The Y axis was clicked upon, we need to document that:
1394 // qDebug() << __FILE__ << __LINE__
1395 //<< "Layout element is axisRect and actually on an Y axis part.";
1396
1397 m_context.m_wasClickOnYAxis = true;
1398
1399 // int currentInteractions = interactions();
1400 // currentInteractions |= QCP::iRangeDrag;
1401 // setInteractions((QCP::Interaction)currentInteractions);
1402 // axisRect()->setRangeDrag(yAxis->orientation());
1403 }
1404 else
1405 m_context.m_wasClickOnYAxis = false;
1406
1407 // At this point, let's see if we need to remove the QCP::iRangeDrag bit:
1408
1409 if(!m_context.m_wasClickOnXAxis && !m_context.m_wasClickOnYAxis)
1410 {
1411 // qDebug() << __FILE__ << __LINE__
1412 // << "Click outside of axes.";
1413
1414 // int currentInteractions = interactions();
1415 // currentInteractions = currentInteractions & ~QCP::iRangeDrag;
1416 // setInteractions((QCP::Interaction)currentInteractions);
1417 }
1418
1419 m_context.m_startDragPoint.setX(xAxis->pixelToCoord(mousePoint.x()));
1420 m_context.m_startDragPoint.setY(yAxis->pixelToCoord(mousePoint.y()));
1421
1422 // Now install the vertical start tracer at the last cursor hovered
1423 // position.
1424 if((m_shouldTracersBeVisible) && (mp_vStartTracerItem != nullptr))
1425 mp_vStartTracerItem->setVisible(true);
1426
1427 if(mp_vStartTracerItem != nullptr)
1428 {
1429 mp_vStartTracerItem->start->setCoords(
1430 m_context.m_lastCursorHoveredPoint.x(), yAxis->range().upper);
1431 mp_vStartTracerItem->end->setCoords(
1432 m_context.m_lastCursorHoveredPoint.x(), yAxis->range().lower);
1433 }
1434
1435 replot();
1436
1437 emit mousePressEventSignal(event, m_context);
1438
1439 // qDebug() << "Exiting after having emitted mousePressEventSignal with base
1440 // context:"
1441 // << m_context.toString();
1442}
void mousePressEventSignal(QMouseEvent *event, const pappso::BasePlotContext &context)
bool isClickOntoYAxis(const QPointF &mousePoint)
bool isClickOntoXAxis(const QPointF &mousePoint)

References isClickOntoXAxis(), isClickOntoYAxis(), m_context, m_shouldTracersBeVisible, mousePressEventSignal(), mp_vStartTracerItem, and setFocus().

Referenced by pappso::DriftSpecMassSpecColorMapPlotWidget::mousePressHandler(), pappso::DriftSpecTracePlotWidget::mousePressHandler(), pappso::MassSpecTracePlotWidget::mousePressHandler(), pappso::TicXicChromDriftSpecColorMapPlotWidget::mousePressHandler(), pappso::TicXicChromMassSpecColorMapPlotWidget::mousePressHandler(), pappso::TicXicChromTracePlotWidget::mousePressHandler(), mousePseudoButtonKeyReleaseEvent(), and setupWidget().

◆ mousePseudoButtonKeyPressEvent()

void pappso::BasePlotWidget::mousePseudoButtonKeyPressEvent ( QKeyEvent * event)
virtual

Definition at line 871 of file baseplotwidget.cpp.

873{
874 // qDebug();
875}

Referenced by keyPressEvent().

◆ mousePseudoButtonKeyReleaseEvent()

void pappso::BasePlotWidget::mousePseudoButtonKeyReleaseEvent ( QKeyEvent * event)
virtual

Definition at line 878 of file baseplotwidget.cpp.

879{
880
881 QPointF pixel_coordinates(
882 xAxis->coordToPixel(m_context.m_lastCursorHoveredPoint.x()),
883 yAxis->coordToPixel(m_context.m_lastCursorHoveredPoint.y()));
884
885 Qt::MouseButton button = Qt::NoButton;
886 QEvent::Type q_event_type = QEvent::MouseButtonPress;
887
888 if(event->key() == m_leftMousePseudoButtonKey)
889 {
890 // Toggles the left mouse button on/off
891
892 button = Qt::LeftButton;
893
894 m_context.m_isLeftPseudoButtonKeyPressed =
895 !m_context.m_isLeftPseudoButtonKeyPressed;
896
897 if(m_context.m_isLeftPseudoButtonKeyPressed)
898 q_event_type = QEvent::MouseButtonPress;
899 else
900 q_event_type = QEvent::MouseButtonRelease;
901 }
902 else if(event->key() == m_rightMousePseudoButtonKey)
903 {
904 // Toggles the right mouse button.
905
906 button = Qt::RightButton;
907
908 m_context.m_isRightPseudoButtonKeyPressed =
909 !m_context.m_isRightPseudoButtonKeyPressed;
910
911 if(m_context.m_isRightPseudoButtonKeyPressed)
912 q_event_type = QEvent::MouseButtonPress;
913 else
914 q_event_type = QEvent::MouseButtonRelease;
915 }
916
917 // qDebug() << "pressed/released pseudo button:" << button
918 //<< "q_event_type:" << q_event_type;
919
920 // Synthesize a QMouseEvent and use it.
921
922 QMouseEvent *mouse_event_p =
923 new QMouseEvent(q_event_type,
924 pixel_coordinates,
925 mapToGlobal(pixel_coordinates.toPoint()),
926 mapToGlobal(pixel_coordinates.toPoint()),
927 button,
928 button,
929 m_context.m_keyboardModifiers,
930 Qt::MouseEventSynthesizedByApplication);
931
932 if(q_event_type == QEvent::MouseButtonPress)
933 mousePressHandler(mouse_event_p);
934 else
935 mouseReleaseHandler(mouse_event_p);
936
937 delete mouse_event_p;
938 // event->accept();
939}
virtual void mousePressHandler(QMouseEvent *event)
KEYBOARD-related EVENTS.
virtual void mouseReleaseHandler(QMouseEvent *event)

References m_context, m_leftMousePseudoButtonKey, m_rightMousePseudoButtonKey, mousePressHandler(), and mouseReleaseHandler().

Referenced by keyReleaseEvent().

◆ mouseReleaseEventSignal

void pappso::BasePlotWidget::mouseReleaseEventSignal ( QMouseEvent * event,
const pappso::BasePlotContext & context )
signal

Referenced by mouseReleaseHandler().

◆ mouseReleaseHandler()

void pappso::BasePlotWidget::mouseReleaseHandler ( QMouseEvent * event)
virtual

Reimplemented in pappso::DriftSpecMassSpecColorMapPlotWidget, pappso::DriftSpecTracePlotWidget, pappso::MassSpecTracePlotWidget, pappso::TicXicChromDriftSpecColorMapPlotWidget, pappso::TicXicChromMassSpecColorMapPlotWidget, and pappso::TicXicChromTracePlotWidget.

Definition at line 1445 of file baseplotwidget.cpp.

1446{
1447 // qDebug() << "Entering";
1448
1449 // Now the real code of this function.
1450
1451 m_context.m_lastReleasedMouseButton = event->button();
1452
1453 // The event->buttons() is the description of the buttons that are pressed
1454 // at the moment the handler is invoked, that is now. If left and right were
1455 // pressed, and left was released, event->buttons() would be right.
1456 m_context.m_mouseButtonsAtMouseRelease = event->buttons();
1457
1458 // The pressedMouseButtons must continually inform on the status of pressed
1459 // buttons so remove the released button.
1460 m_context.m_pressedMouseButtons ^= event->button();
1461
1462 // qDebug().noquote() << m_context.toString();
1463
1464 // We'll need to know if modifiers were pressed a the moment the user
1465 // released the mouse button.
1466 m_context.m_keyboardModifiers = QGuiApplication::keyboardModifiers();
1467
1468 if(!m_context.m_isMouseDragging)
1469 {
1470 // Let the user know that the mouse was *not* being dragged.
1471 m_context.m_wasMouseDragging = false;
1472
1473 event->accept();
1474
1475 return;
1476 }
1477
1478 // Let the user know that the mouse was being dragged.
1479 m_context.m_wasMouseDragging = true;
1480
1481 // We cannot hide all items in one go because we rely on their visibility
1482 // to know what kind of dragging operation we need to perform (line-only
1483 // X-based zoom or rectangle-based X- and Y-based zoom, for example). The
1484 // only thing we know is that we can make the text invisible.
1485
1486 // Same for the x delta text item
1487 mp_xDeltaTextItem->setVisible(false);
1488 mp_yDeltaTextItem->setVisible(false);
1489
1490 // We do not show the end vertical region range marker.
1491 mp_vEndTracerItem->setVisible(false);
1492
1493 // Horizontal position tracer.
1494 mp_hPosTracerItem->setVisible(true);
1495 mp_hPosTracerItem->start->setCoords(xAxis->range().lower,
1496 m_context.m_lastCursorHoveredPoint.y());
1497 mp_hPosTracerItem->end->setCoords(xAxis->range().upper,
1498 m_context.m_lastCursorHoveredPoint.y());
1499
1500 // Vertical position tracer.
1501 mp_vPosTracerItem->setVisible(true);
1502
1503 mp_vPosTracerItem->setVisible(true);
1504 mp_vPosTracerItem->start->setCoords(m_context.m_lastCursorHoveredPoint.x(),
1505 yAxis->range().upper);
1506 mp_vPosTracerItem->end->setCoords(m_context.m_lastCursorHoveredPoint.x(),
1507 yAxis->range().lower);
1508
1509 // Force replot now because later that call might not be performed.
1510 replot();
1511
1512 // If we were using the "quantum" display for the rescale of the axes
1513 // using the Ctrl-modified left button click drag in the axes, then reset
1514 // the count to 0.
1516
1517 // By definition we are stopping the drag operation by releasing the mouse
1518 // button. Whatever that mouse button was pressed before and if there was
1519 // one pressed before. We cannot set that boolean value to false before
1520 // this place, because we call a number of routines above that need to know
1521 // that dragging was occurring. Like mouseReleaseHandledEvent(event) for
1522 // example.
1523
1524 m_context.m_isMouseDragging = false;
1525
1526 // Now that we have computed the useful ranges, we need to check what to do
1527 // depending on the button that was pressed.
1528
1529 if(m_context.m_lastReleasedMouseButton == Qt::LeftButton)
1530 {
1531 return mouseReleaseHandlerLeftButton(event);
1532 }
1533 else if(m_context.m_lastReleasedMouseButton == Qt::RightButton)
1534 {
1535 return mouseReleaseHandlerRightButton(event);
1536 }
1537
1538 // FIXME: should we really accept ? No, since we pass the event on.
1539 // event->accept();
1540
1541 // Before returning, emit the signal for the user of
1542 // this class consumption.
1543 // qDebug() << "Emitting mouseReleaseEventSignal.";
1545
1546 // qDebug() << "Exiting after having emitted mouseReleaseEventSignal with base
1547 // context:"
1548 // << m_context.toString();
1549
1550 return;
1551}
virtual void mouseReleaseHandlerLeftButton(QMouseEvent *event)
void mouseReleaseEventSignal(QMouseEvent *event, const pappso::BasePlotContext &context)
virtual void mouseReleaseHandlerRightButton(QMouseEvent *event)

References m_context, m_mouseMoveHandlerSkipCount, mouseReleaseEventSignal(), mouseReleaseHandlerLeftButton(), mouseReleaseHandlerRightButton(), mp_hPosTracerItem, mp_vEndTracerItem, mp_vPosTracerItem, mp_xDeltaTextItem, and mp_yDeltaTextItem.

Referenced by mousePseudoButtonKeyReleaseEvent(), pappso::DriftSpecMassSpecColorMapPlotWidget::mouseReleaseHandler(), pappso::DriftSpecTracePlotWidget::mouseReleaseHandler(), pappso::MassSpecTracePlotWidget::mouseReleaseHandler(), pappso::TicXicChromDriftSpecColorMapPlotWidget::mouseReleaseHandler(), pappso::TicXicChromMassSpecColorMapPlotWidget::mouseReleaseHandler(), pappso::TicXicChromTracePlotWidget::mouseReleaseHandler(), and setupWidget().

◆ mouseReleaseHandlerLeftButton()

void pappso::BasePlotWidget::mouseReleaseHandlerLeftButton ( QMouseEvent * event)
virtual

Definition at line 1554 of file baseplotwidget.cpp.

1555{
1556 Q_UNUSED(event)
1557 // qDebug();
1558
1559 if(m_context.m_wasClickOnXAxis || m_context.m_wasClickOnYAxis)
1560 {
1561
1562 // When the mouse move handler pans the plot, we cannot store each axes
1563 // range history element that would mean store a huge amount of such
1564 // elements, as many element as there are mouse move event handled by
1565 // the Qt event queue. But we can store an axis range history element
1566 // for the last situation of the mouse move: when the button is
1567 // released:
1568
1570
1571 // qDebug() << "emit plotRangesChangedSignal(m_context);"
1572
1573 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
1574
1575 replot();
1576
1577 // Nothing else to do.
1578 return;
1579 }
1580
1581 // There are two possibilities:
1582 //
1583 // 1. The full integration scope (four lines) were currently drawn, which
1584 // means the user was willing to perform a zoom operation.
1585 //
1586 // 2. Only the first top line was drawn, which means the user was dragging
1587 // the cursor horizontally. That might have two ends, as shown below.
1588
1589 // So, first check what is drawn of the selection polygon.
1590
1591 SelectionDrawingLines selection_drawing_lines =
1593
1594 // Now that we know what was currently drawn of the selection polygon, we
1595 // can remove it. true to reset the values to 0.
1597
1598 // Force replot now because later that call might not be performed.
1599 replot();
1600
1601 if(selection_drawing_lines == SelectionDrawingLines::FULL_POLYGON)
1602 {
1603 // qDebug() << "Yes, the full polygon was visible";
1604
1605 // If we were dragging with the left button pressed and could draw a
1606 // rectangle, then we were preparing a zoom operation. Let's bring that
1607 // operation to its accomplishment.
1608
1609 axisZoom();
1610
1611 return;
1612 }
1613 else if(selection_drawing_lines == SelectionDrawingLines::TOP_LINE)
1614 {
1615 // qDebug() << "No, only the top line of the full polygon was visible";
1616
1617 // The user was dragging the left mouse cursor and that may mean they
1618 // were measuring a distance or willing to perform a special zoom
1619 // operation if the Ctrl key was down.
1620
1621 // If the user started by clicking in the plot region, dragged the mouse
1622 // cursor with the left button and pressed the Ctrl modifier, then that
1623 // means that they wanted to do a rescale over the x-axis in the form of
1624 // a reframing.
1625
1626 if(m_context.m_keyboardModifiers & Qt::ControlModifier)
1627 {
1628 return axisReframe();
1629 }
1630 }
1631 // else
1632 // qDebug() << "Another possibility.";
1633}
virtual SelectionDrawingLines whatIsVisibleOfTheSelectionRectangle()
SelectionDrawingLines

References axisReframe(), axisZoom(), pappso::FULL_POLYGON, hideSelectionRectangle(), m_context, plotRangesChangedSignal(), pappso::TOP_LINE, updateAxesRangeHistory(), and whatIsVisibleOfTheSelectionRectangle().

Referenced by mouseReleaseHandler().

◆ mouseReleaseHandlerRightButton()

void pappso::BasePlotWidget::mouseReleaseHandlerRightButton ( QMouseEvent * event)
virtual

Definition at line 1636 of file baseplotwidget.cpp.

1637{
1638 Q_UNUSED(event)
1639 // qDebug();
1640 // The right button is used for the integrations. Not for axis range
1641 // operations. So all we have to do is remove the various graphics items and
1642 // send a signal with the context that contains all the data required by the
1643 // user to perform the integrations over the right plot regions.
1644
1645 // Whatever we were doing we need to make the selection line invisible:
1646
1647 if(mp_xDeltaTextItem->visible())
1648 mp_xDeltaTextItem->setVisible(false);
1649 if(mp_yDeltaTextItem->visible())
1650 mp_yDeltaTextItem->setVisible(false);
1651
1652 // Also make the vertical end tracer invisible.
1653 mp_vEndTracerItem->setVisible(false);
1654
1655 // Once the integration is asked for, then the selection rectangle if of no
1656 // more use.
1658
1659 // Force replot now because later that call might not be performed.
1660 replot();
1661
1662 // Note that we only request an integration if the x-axis delta is enough.
1663
1664 double x_delta_pixel =
1665 fabs(xAxis->coordToPixel(m_context.m_currentDragPoint.x()) -
1666 xAxis->coordToPixel(m_context.m_startDragPoint.x()));
1667
1668 if(x_delta_pixel > 3)
1669 {
1670 // qDebug() << "Emitting integrationRequestedSignal(m_context)";
1672 }
1673 // else
1674 // qDebug() << "Not asking for integration.";
1675}
void integrationRequestedSignal(const BasePlotContext &context)

References hideSelectionRectangle(), integrationRequestedSignal(), m_context, mp_vEndTracerItem, mp_xDeltaTextItem, and mp_yDeltaTextItem.

Referenced by mouseReleaseHandler().

◆ mouseWheelEventSignal

void pappso::BasePlotWidget::mouseWheelEventSignal ( QWheelEvent * event,
const pappso::BasePlotContext & context )
signal

Referenced by mouseWheelHandler().

◆ mouseWheelHandler()

void pappso::BasePlotWidget::mouseWheelHandler ( QWheelEvent * event)
virtual

Definition at line 1678 of file baseplotwidget.cpp.

1679{
1680 // We should record the new range values each time the wheel is used to
1681 // zoom/unzoom.
1682
1683 m_context.m_xRange = QCPRange(xAxis->range());
1684 m_context.m_yRange = QCPRange(yAxis->range());
1685
1686 // qDebug() << "New x range: " << m_context.m_xRange;
1687 // qDebug() << "New y range: " << m_context.m_yRange;
1688
1690
1692 emit mouseWheelEventSignal(event, m_context);
1693
1694 event->accept();
1695}
void mouseWheelEventSignal(QWheelEvent *event, const pappso::BasePlotContext &context)
void plotRangesChangedWheelEventSignal(QWheelEvent *event, const pappso::BasePlotContext &context)

References m_context, mouseWheelEventSignal(), plotRangesChangedWheelEventSignal(), and updateAxesRangeHistory().

Referenced by setupWidget().

◆ moveMouseCursorGraphCoordToGlobal()

void pappso::BasePlotWidget::moveMouseCursorGraphCoordToGlobal ( QPointF plot_coordinates)
virtual

Definition at line 1828 of file baseplotwidget.cpp.

1829{
1830 // First convert the graph coordinates to pixel coordinates.
1831
1832 QPointF pixels_coordinates(xAxis->coordToPixel(graph_coordinates.x()),
1833 yAxis->coordToPixel(graph_coordinates.y()));
1834
1835 moveMouseCursorPixelCoordToGlobal(pixels_coordinates.toPoint());
1836}

References moveMouseCursorPixelCoordToGlobal().

◆ moveMouseCursorPixelCoordToGlobal()

void pappso::BasePlotWidget::moveMouseCursorPixelCoordToGlobal ( QPointF local_coordinates)
virtual

Definition at line 1839 of file baseplotwidget.cpp.

1840{
1841 // qDebug() << "Calling set pos with new cursor position.";
1842 QCursor::setPos(mapToGlobal(pixel_coordinates.toPoint()));
1843}

Referenced by horizontalMoveMouseCursorCountPixels(), moveMouseCursorGraphCoordToGlobal(), and verticalMoveMouseCursorCountPixels().

◆ plotRangesChangedSignal

◆ plotRangesChangedWheelEventSignal

void pappso::BasePlotWidget::plotRangesChangedWheelEventSignal ( QWheelEvent * event,
const pappso::BasePlotContext & context )
signal

Referenced by mouseWheelHandler().

◆ plottableDestructionRequestedSignal

void pappso::BasePlotWidget::plottableDestructionRequestedSignal ( BasePlotWidget * base_plot_widget_p,
QCPAbstractPlottable * plottable_p,
const pappso::BasePlotContext & context )
signal

References BasePlotWidget().

Referenced by keyReleaseEvent().

◆ plottableSelectionChangedSignal

void pappso::BasePlotWidget::plottableSelectionChangedSignal ( QCPAbstractPlottable * plottable_p,
bool selected )
signal

◆ redrawPlotBackground()

void pappso::BasePlotWidget::redrawPlotBackground ( QWidget * focusedPlotWidget)
virtual

Redraw the background of the focusedPlotWidget plot widget.

Definition at line 3288 of file baseplotwidget.cpp.

3289{
3290 if(focusedPlotWidget == nullptr)
3291 throw ExceptionNotPossible(
3292 "baseplotwidget.cpp @ redrawPlotBackground(QWidget *focusedPlotWidget "
3293 "-- "
3294 "ERROR focusedPlotWidget cannot be nullptr.");
3295
3296 if(dynamic_cast<QWidget *>(this) != focusedPlotWidget)
3297 {
3298 // The focused widget is not *this widget. We should make sure that
3299 // we were not the one that had the focus, because in this case we
3300 // need to redraw an unfocused background.
3301
3302 axisRect()->setBackground(m_unfocusedBrush);
3303 }
3304 else
3305 {
3306 axisRect()->setBackground(m_focusedBrush);
3307 }
3308
3309 replot();
3310}
QBrush m_focusedBrush
Color used for the background of focused plot.
QBrush m_unfocusedBrush
Color used for the background of unfocused plot.

References m_focusedBrush, and m_unfocusedBrush.

Referenced by yMinMaxOnXAxisCurrentRange().

◆ replotWithAxesRanges()

void pappso::BasePlotWidget::replotWithAxesRanges ( QCPRange xAxisRange,
QCPRange yAxisRange,
Enums::Axis axis )
virtual

Definition at line 2203 of file baseplotwidget.cpp.

2206{
2207 // qDebug() << "With axis:" << (int)axis;
2208
2209 if(static_cast<int>(axis) & static_cast<int>(Enums::Axis::x))
2210 {
2211 xAxis->setRange(xAxisRange.lower, xAxisRange.upper);
2212 }
2213
2214 if(static_cast<int>(axis) & static_cast<int>(Enums::Axis::y))
2215 {
2216 yAxis->setRange(yAxisRange.lower, yAxisRange.upper);
2217 }
2218
2219 // We do not want to update the history, because there would be way too
2220 // much history items, since this function is called upon mouse moving
2221 // handling and not only during mouse release events.
2222 // updateAxesRangeHistory();
2223
2224 replot();
2225}

References pappso::Enums::x, and pappso::Enums::y.

Referenced by yMinMaxOnXAxisCurrentRange().

◆ replotWithAxisRangeX()

void pappso::BasePlotWidget::replotWithAxisRangeX ( double lower,
double upper )
virtual

Definition at line 2228 of file baseplotwidget.cpp.

2229{
2230 // qDebug();
2231
2232 xAxis->setRange(lower, upper);
2233
2234 replot();
2235}

Referenced by yMinMaxOnXAxisCurrentRange().

◆ replotWithAxisRangeY()

void pappso::BasePlotWidget::replotWithAxisRangeY ( double lower,
double upper )
virtual

Definition at line 2238 of file baseplotwidget.cpp.

2239{
2240 // qDebug();
2241
2242 yAxis->setRange(lower, upper);
2243
2244 replot();
2245}

Referenced by yMinMaxOnXAxisCurrentRange().

◆ resetAxesRangeHistory()

void pappso::BasePlotWidget::resetAxesRangeHistory ( )
virtual

Definition at line 475 of file baseplotwidget.cpp.

476{
477 m_xAxisRangeHistory.clear();
478 m_yAxisRangeHistory.clear();
479
480 m_xAxisRangeHistory.push_back(new QCPRange(xAxis->range()));
481 m_yAxisRangeHistory.push_back(new QCPRange(yAxis->range()));
482
483 // qDebug() << "size of history:" << m_xAxisRangeHistory.size()
484 //<< "setting index to 0";
485
486 // qDebug() << "resetting axes history to values:" << xAxis->range().lower
487 //<< "--" << xAxis->range().upper << "and" << yAxis->range().lower
488 //<< "--" << yAxis->range().upper;
489
491}
std::size_t m_lastAxisRangeHistoryIndex
Index of the last axis range history item.

References m_lastAxisRangeHistoryIndex, m_xAxisRangeHistory, and m_yAxisRangeHistory.

Referenced by pappso::BaseTracePlotWidget::addBars(), pappso::BaseColorMapPlotWidget::addColorMap(), pappso::BaseColorMapPlotWidget::addColorMap(), pappso::BaseTracePlotWidget::addTrace(), axisDoubleClickHandler(), pappso::BaseTracePlotWidget::axisDoubleClickHandler(), pappso::BaseTracePlotWidget::clearGraphData(), and pappso::BaseTracePlotWidget::setGraphData().

◆ resetSelectionRectangle()

void pappso::BasePlotWidget::resetSelectionRectangle ( )
virtual

Definition at line 3208 of file baseplotwidget.cpp.

3209{
3210 std::const_pointer_cast<IntegrationScopeBase>(m_context.msp_integrationScope)
3211 ->reset();
3212}

References m_context.

Referenced by hideSelectionRectangle(), and yMinMaxOnXAxisCurrentRange().

◆ restoreAxesRangeHistory()

void pappso::BasePlotWidget::restoreAxesRangeHistory ( std::size_t index)
virtual

Get the axis histories at index index and update the plot ranges.

Parameters
indexindex at which to select the axis history item.
See also
updateAxesRangeHistory().

Definition at line 549 of file baseplotwidget.cpp.

550{
551 // qDebug() << "Axes history size:" << m_xAxisRangeHistory.size()
552 //<< "current index:" << m_lastAxisRangeHistoryIndex
553 //<< "asking to restore index:" << index;
554
555 if(index >= m_xAxisRangeHistory.size())
556 {
557 // qDebug() << "index >= history size. Returning.";
558 return;
559 }
560
561 // We want to go back to the range history item at index, which means we want
562 // to pop back all the items between index+1 and size-1.
563
564 while(m_xAxisRangeHistory.size() > index + 1)
565 m_xAxisRangeHistory.pop_back();
566
567 if(m_xAxisRangeHistory.size() - 1 != index)
568 qFatal("Programming error.");
569
570 xAxis->setRange(*(m_xAxisRangeHistory.at(index)));
571 yAxis->setRange(*(m_yAxisRangeHistory.at(index)));
572
574
575 mp_vPosTracerItem->setVisible(false);
576 mp_hPosTracerItem->setVisible(false);
577
578 mp_vStartTracerItem->setVisible(false);
579 mp_vEndTracerItem->setVisible(false);
580
581
582 // The start tracer will keep beeing represented at the last position and last
583 // size even if we call this function repetitively. So actually do not show,
584 // it will reappare as soon as the mouse is moved.
585 // if(m_shouldTracersBeVisible)
586 //{
587 // mp_vStartTracerItem->setVisible(true);
588 //}
589
590 replot();
591
593
594 // qDebug() << "restored axes history to index:" << index
595 //<< "with values:" << xAxis->range().lower << "--"
596 //<< xAxis->range().upper << "and" << yAxis->range().lower << "--"
597 //<< yAxis->range().upper;
598
599 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
600}
virtual void hideAllPlotItems()
PLOTTING / REPLOTTING functions.

References hideAllPlotItems(), m_context, m_xAxisRangeHistory, m_yAxisRangeHistory, mp_hPosTracerItem, mp_vEndTracerItem, mp_vPosTracerItem, mp_vStartTracerItem, plotRangesChangedSignal(), and updateContextXandYAxisRanges().

Referenced by restorePreviousAxesRangeHistory().

◆ restorePreviousAxesRangeHistory()

void pappso::BasePlotWidget::restorePreviousAxesRangeHistory ( )
virtual

Go up one history element in the axis history.

If possible, back up one history item in the axis histories and update the plot's x/y-axis ranges to match that history item.

Definition at line 522 of file baseplotwidget.cpp.

523{
524 // qDebug() << "axes history size:" << m_xAxisRangeHistory.size()
525 //<< "current index:" << m_lastAxisRangeHistoryIndex;
526
528 {
529 // qDebug() << "current index is 0 returning doing nothing";
530
531 return;
532 }
533
534 // qDebug() << "Setting index to:" << m_lastAxisRangeHistoryIndex - 1
535 //<< "and restoring axes history to that index";
536
538}
virtual void restoreAxesRangeHistory(std::size_t index)
Get the axis histories at index index and update the plot ranges.

References m_lastAxisRangeHistoryIndex, and restoreAxesRangeHistory().

Referenced by keyReleaseEvent().

◆ setAxisLabelX()

void pappso::BasePlotWidget::setAxisLabelX ( const QString & label)
virtual

Definition at line 462 of file baseplotwidget.cpp.

463{
464 xAxis->setLabel(label);
465}

◆ setAxisLabelY()

void pappso::BasePlotWidget::setAxisLabelY ( const QString & label)
virtual

Definition at line 468 of file baseplotwidget.cpp.

469{
470 yAxis->setLabel(label);
471}

◆ setFocus()

void pappso::BasePlotWidget::setFocus ( )
virtual

PLOT ITEMS : TRACER TEXT ITEMS...

Definition at line 3275 of file baseplotwidget.cpp.

3276{
3277 // qDebug() << "Setting focus to the QCustomPlot:" << this;
3278
3279 QCustomPlot::setFocus();
3280
3281 // qDebug() << "Emitting setFocusSignal().";
3282
3283 emit setFocusSignal();
3284}

References setFocusSignal().

Referenced by mouseMoveHandler(), mousePressHandler(), and yMinMaxOnXAxisCurrentRange().

◆ setFocusSignal

void pappso::BasePlotWidget::setFocusSignal ( )
signal

Referenced by setFocus().

◆ setPen()

void pappso::BasePlotWidget::setPen ( const QPen & pen)
virtual

Definition at line 399 of file baseplotwidget.cpp.

400{
401 m_pen = pen;
402}

References m_pen.

◆ setPlottingColor() [1/2]

void pappso::BasePlotWidget::setPlottingColor ( int index,
const QColor & new_color )
virtual

Definition at line 428 of file baseplotwidget.cpp.

429{
430 if(!new_color.isValid())
431 return;
432
433 QCPGraph *graph_p = graph(index);
434
435 if(graph_p == nullptr)
436 qFatal("Programming error.");
437
438 return setPlottingColor(graph_p, new_color);
439}
virtual void setPlottingColor(QCPAbstractPlottable *plottable_p, const QColor &new_color)

References setPlottingColor().

◆ setPlottingColor() [2/2]

void pappso::BasePlotWidget::setPlottingColor ( QCPAbstractPlottable * plottable_p,
const QColor & new_color )
virtual

Reimplemented in pappso::BaseColorMapPlotWidget.

Definition at line 411 of file baseplotwidget.cpp.

413{
414 if(plottable_p == nullptr)
415 qFatal("Pointer cannot be nullptr.");
416
417 // First this single-graph widget
418 QPen pen;
419
420 pen = plottable_p->pen();
421 pen.setColor(new_color);
422 plottable_p->setPen(pen);
423
424 replot();
425}

Referenced by setPlottingColor().

◆ setupWidget()

bool pappso::BasePlotWidget::setupWidget ( )
virtual

Definition at line 336 of file baseplotwidget.cpp.

337{
338 // qDebug();
339
340 // By default the widget comes with a graph. Remove it.
341
342 if(graphCount())
343 {
344 // QCPLayer *layer_p = graph(0)->layer();
345 // qDebug() << "The graph was on layer:" << layer_p->name();
346
347 // As of today 20210313, the graph is created on the currentLayer(), that
348 // is "main".
349
350 removeGraph(0);
351 }
352
353 // The general idea is that we do want custom layers for the trace|colormap
354 // plots.
355
356 // qDebug().noquote() << "Right before creating the new layer, layers:\n"
357 //<< allLayerNamesToString();
358
359 // Add the layer that will store all the plots and all the ancillary items.
360 addLayer(
361 "plotsLayer", layer("background"), QCustomPlot::LayerInsertMode::limAbove);
362 // Add the layer that will store the labels.
363 addLayer("labelsLayer", layer("background"), QCustomPlot::LayerInsertMode::limAbove);
364 // qDebug().noquote() << "Added new plotsLayer, layers:\n"
365 //<< allLayerNamesToString();
366
367 // This is required so that we get the keyboard events.
368 setFocusPolicy(Qt::StrongFocus);
369 setInteractions(QCP::iRangeZoom | QCP::iSelectPlottables | QCP::iMultiSelect);
370
371 // We want to capture the signals emitted by the QCustomPlot base class.
372 connect(
373 this, &QCustomPlot::mouseMove, this, &BasePlotWidget::mouseMoveHandler);
374
375 connect(
376 this, &QCustomPlot::mousePress, this, &BasePlotWidget::mousePressHandler);
377
378 connect(this,
379 &QCustomPlot::mouseRelease,
380 this,
382
383 connect(
384 this, &QCustomPlot::mouseWheel, this, &BasePlotWidget::mouseWheelHandler);
385
386 connect(this,
387 &QCustomPlot::axisDoubleClick,
388 this,
390
391 connect(this, &QCustomPlot::beforeReplot, this, [&]() { emit beforeReplotSignal(); });
392 connect(this, &QCustomPlot::afterLayout, this, [&]() { emit afterLayoutSignal(); });
393 connect(this, &QCustomPlot::afterReplot, this, [&]() { emit afterReplotSignal(); });
394
395 return true;
396}
virtual void mouseWheelHandler(QWheelEvent *event)
virtual void axisDoubleClickHandler(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)
virtual void mouseMoveHandler(QMouseEvent *event)
KEYBOARD-related EVENTS.

References afterLayoutSignal(), afterReplotSignal(), axisDoubleClickHandler(), beforeReplotSignal(), mouseMoveHandler(), mousePressHandler(), mouseReleaseHandler(), and mouseWheelHandler().

Referenced by BasePlotWidget(), and BasePlotWidget().

◆ showTracers()

void pappso::BasePlotWidget::showTracers ( )
virtual

Show the traces (vertical and horizontal).

Definition at line 2269 of file baseplotwidget.cpp.

2270{
2272
2273 mp_vPosTracerItem->setVisible(true);
2274 mp_hPosTracerItem->setVisible(true);
2275
2276 mp_vStartTracerItem->setVisible(true);
2277 mp_vEndTracerItem->setVisible(true);
2278
2279 // Force a replot to make sure the action is immediately visible by the
2280 // user, even without moving the mouse.
2281 replot();
2282}

References m_shouldTracersBeVisible, mp_hPosTracerItem, mp_vEndTracerItem, mp_vPosTracerItem, and mp_vStartTracerItem.

Referenced by keyReleaseEvent(), and yMinMaxOnXAxisCurrentRange().

◆ spaceKeyReleaseEvent()

void pappso::BasePlotWidget::spaceKeyReleaseEvent ( QKeyEvent * event)
virtual

Definition at line 817 of file baseplotwidget.cpp.

818{
819 // qDebug();
820}

Referenced by keyReleaseEvent().

◆ updateAxesRangeHistory()

void pappso::BasePlotWidget::updateAxesRangeHistory ( )
virtual

Create new axis range history items and append them to the history.

The plot widget is queried to get the current x/y-axis ranges and the current ranges are appended to the history for x-axis and for y-axis.

Definition at line 501 of file baseplotwidget.cpp.

502{
503 m_xAxisRangeHistory.push_back(new QCPRange(xAxis->range()));
504 m_yAxisRangeHistory.push_back(new QCPRange(yAxis->range()));
505
507
508 // qDebug() << "axes history size:" << m_xAxisRangeHistory.size()
509 //<< "current index:" << m_lastAxisRangeHistoryIndex
510 //<< xAxis->range().lower << "--" << xAxis->range().upper << "and"
511 //<< yAxis->range().lower << "--" << yAxis->range().upper;
512}

References m_lastAxisRangeHistoryIndex, m_xAxisRangeHistory, and m_yAxisRangeHistory.

Referenced by axisDoubleClickHandler(), pappso::BaseTracePlotWidget::axisDoubleClickHandler(), axisReframe(), pappso::BaseTracePlotWidget::axisReframe(), axisZoom(), pappso::BaseTracePlotWidget::axisZoom(), mouseReleaseHandlerLeftButton(), and mouseWheelHandler().

◆ updateContextXandYAxisRanges()

void pappso::BasePlotWidget::updateContextXandYAxisRanges ( )
virtual

Definition at line 3313 of file baseplotwidget.cpp.

3314{
3315 m_context.m_xRange = QCPRange(xAxis->range().lower, xAxis->range().upper);
3316 m_context.m_yRange = QCPRange(yAxis->range().lower, yAxis->range().upper);
3317
3318 // qDebug() << "The new updated context: " << m_context.toString();
3319}

References m_context.

Referenced by axisDoubleClickHandler(), pappso::BaseTracePlotWidget::axisDoubleClickHandler(), axisPan(), pappso::BaseTracePlotWidget::axisPan(), axisReframe(), pappso::BaseTracePlotWidget::axisReframe(), axisRescale(), pappso::BaseTracePlotWidget::axisRescale(), axisZoom(), pappso::BaseTracePlotWidget::axisZoom(), restoreAxesRangeHistory(), and yMinMaxOnXAxisCurrentRange().

◆ updateIntegrationScope()

void pappso::BasePlotWidget::updateIntegrationScope ( bool for_integration = false)
protectedvirtual

Definition at line 2619 of file baseplotwidget.cpp.

2620{
2621
2622 // if(for_integration)
2623 // qDebug() << "for_integration:" << for_integration;
2624
2625 // By essence, the one-dimension IntegrationScope is characterized
2626 // by the left-most point and the width. Using these two data bits
2627 // it is possible to compute the x value of the right-most point.
2628
2629 double x_range_start =
2630 std::min(m_context.m_currentDragPoint.x(), m_context.m_startDragPoint.x());
2631 double x_range_end =
2632 std::max(m_context.m_currentDragPoint.x(), m_context.m_startDragPoint.x());
2633
2634 // qDebug() << "x_range_start:" << x_range_start << "-" << "x_range_end:" <<
2635 // x_range_end;
2636
2637 double y_position = m_context.m_startDragPoint.y();
2638
2639 m_context.updateIntegrationScope();
2640
2641 // Top line
2642 mp_selectionRectangeLine1->start->setCoords(
2643 QPointF(x_range_start, y_position));
2644 mp_selectionRectangeLine1->end->setCoords(QPointF(x_range_end, y_position));
2645
2646 // Only if we are drawing a selection rectangle for integration, do we set
2647 // arrow heads to the line.
2648 if(for_integration)
2649 {
2650 mp_selectionRectangeLine1->setHead(QCPLineEnding::esSpikeArrow);
2651 mp_selectionRectangeLine1->setTail(QCPLineEnding::esSpikeArrow);
2652 }
2653 else
2654 {
2655 mp_selectionRectangeLine1->setHead(QCPLineEnding::esNone);
2656 mp_selectionRectangeLine1->setTail(QCPLineEnding::esNone);
2657 }
2658 mp_selectionRectangeLine1->setVisible(true);
2659
2660 // Right line: does not exist, start and end are the same end point of the
2661 // top line.
2662 mp_selectionRectangeLine2->start->setCoords(QPointF(x_range_end, y_position));
2663 mp_selectionRectangeLine2->end->setCoords(QPointF(x_range_end, y_position));
2664 mp_selectionRectangeLine2->setVisible(false);
2665
2666 // Bottom line: identical to the top line, but invisible
2667 mp_selectionRectangeLine3->start->setCoords(
2668 QPointF(x_range_start, y_position));
2669 mp_selectionRectangeLine3->end->setCoords(QPointF(x_range_end, y_position));
2670 mp_selectionRectangeLine3->setVisible(false);
2671
2672 // Left line: does not exist: start and end are the same end point of the
2673 // top line.
2674 mp_selectionRectangeLine4->start->setCoords(QPointF(x_range_end, y_position));
2675 mp_selectionRectangeLine4->end->setCoords(QPointF(x_range_end, y_position));
2676 mp_selectionRectangeLine4->setVisible(false);
2677}

References m_context, mp_selectionRectangeLine1, mp_selectionRectangeLine2, mp_selectionRectangeLine3, and mp_selectionRectangeLine4.

Referenced by updateIntegrationScopeDrawing().

◆ updateIntegrationScopeDrawing()

void pappso::BasePlotWidget::updateIntegrationScopeDrawing ( bool as_line_segment = false,
bool for_integration = false )
virtual

Definition at line 3074 of file baseplotwidget.cpp.

3076{
3077 // qDebug() << "as_line_segment:" << as_line_segment;
3078 // qDebug() << "for_integration:" << for_integration;
3079
3080 // We now need to construct the selection rectangle, either for zoom or for
3081 // integration.
3082
3083 // There are two situations :
3084 //
3085 // 1. if the rectangle should look like a line segment
3086 //
3087 // 2. if the rectangle should actually look like a rectangle. In this case,
3088 // there are two sub-situations:
3089 //
3090 // a. if the Alt modifier key is down, then the rectangle is rhomboid.
3091 //
3092 // b. otherwise the rectangle is conventional.
3093
3094 if(as_line_segment)
3095 {
3096 // qDebug() << "Updating the integration scope to an IntegrationScope.";
3097 updateIntegrationScope(for_integration);
3098 }
3099 else
3100 {
3101 if(!(m_context.m_keyboardModifiers & Qt::AltModifier))
3102 {
3103 // qDebug()
3104 // << "Updating the integration scope to an IntegrationScopeRect.";
3105 updateIntegrationScopeRect(for_integration);
3106 }
3107 else if(m_context.m_keyboardModifiers & Qt::AltModifier)
3108 {
3109 // The user might use the Alt modifier, but if no rhomboid side has
3110 // been defined using the S key, then we do not do any rhomboid
3111 // selection because we do not know the side size of that rhomboid.
3112
3113 if(!m_context.m_integrationScopeRhombHeight &&
3114 !m_context.m_integrationScopeRhombWidth)
3115 updateIntegrationScopeRect(for_integration);
3116 else
3117 // qDebug()
3118 // << "Updating the integration scope to an
3119 // IntegrationScopeRhomb.";
3120 updateIntegrationScopeRhomb(for_integration);
3121 }
3122 }
3123
3124 // Depending on the kind of IntegrationScope, (normal, rect or rhomb)
3125 // we have to measure things in different ways. We now set in the context
3126 // a number of parameters that will be used by its user.
3127
3128 QPointF point;
3129 double height;
3130 std::vector<QPointF> points;
3131
3132 // Integration scope values are sorted:
3133 // Line scope: point is left and width is right.x - left.x
3134 // Rect scope: point is bottom left.
3135 // Rhomb scope: points 1->4 are bottom left->bottom right->top right->top left
3136 // width is 2.x - 1.x.
3137
3138 if(m_context.msp_integrationScope->getPoints(points))
3139 {
3140 // We have defined a IntegrationScopeRhomb.
3141
3142 if(!m_context.msp_integrationScope->getLeftMostPoint(point))
3143 qFatal("Failed to get LeftMost point.");
3144 m_context.m_xRegionRangeStart = point.x();
3145
3146 if(!m_context.msp_integrationScope->getRightMostPoint(point))
3147 qFatal("Failed to get RightMost point.");
3148 m_context.m_xRegionRangeStop = point.x();
3149 }
3150 else if(m_context.msp_integrationScope->getHeight(height))
3151 {
3152 // We have defined a IntegrationScopeRect.
3153
3154 if(!m_context.msp_integrationScope->getPoint(point))
3155 qFatal("Failed to get point.");
3156 m_context.m_xRegionRangeStart = point.x();
3157
3158 double width;
3159
3160 if(!m_context.msp_integrationScope->getWidth(width))
3161 qFatal("Failed to get width.");
3162
3163 m_context.m_xRegionRangeStop = m_context.m_xRegionRangeStart + width;
3164
3165 m_context.m_yRegionRangeStart = point.y();
3166
3167 m_context.m_yRegionRangeStop = point.y() + height;
3168 }
3169 else
3170 {
3171 // We have defined a IntegrationScope.
3172
3173 if(!m_context.msp_integrationScope->getPoint(point))
3174 qFatal("Failed to get point.");
3175 m_context.m_xRegionRangeStart = point.x();
3176
3177 double width;
3178
3179 if(!m_context.msp_integrationScope->getWidth(width))
3180 qFatal("Failed to get width.");
3181 m_context.m_xRegionRangeStop = m_context.m_xRegionRangeStart + width;
3182 }
3183
3184 // At this point, draw the text describing the widths.
3185
3186 // We want the x-delta on the bottom of the rectangle, inside it
3187 // and the y-delta on the vertical side of the rectangle, inside it.
3188
3189 // Draw the selection width text
3191}
virtual void updateIntegrationScopeRect(bool for_integration=false)
virtual void updateIntegrationScope(bool for_integration=false)
virtual void updateIntegrationScopeRhomb(bool for_integration=false)

References drawXScopeSpanFeatures(), m_context, updateIntegrationScope(), updateIntegrationScopeRect(), and updateIntegrationScopeRhomb().

Referenced by drawSelectionRectangleAndPrepareZoom(), and yMinMaxOnXAxisCurrentRange().

◆ updateIntegrationScopeHorizontalRhomb()

void pappso::BasePlotWidget::updateIntegrationScopeHorizontalRhomb ( bool for_integration = false)
protectedvirtual

Definition at line 2764 of file baseplotwidget.cpp.

2765{
2766 // We are handling a rhomboid scope, that is, a rectangle that
2767 // is tilted either to the left or to the right.
2768
2769 // There are two kinds of rhomboid integration scopes: horizontal and
2770 // vertical.
2771
2772 /*
2773 * +----------+
2774 * | |
2775 * | |
2776 * | |
2777 * | |
2778 * | |
2779 * | |
2780 * | |
2781 * +----------+
2782 * ----width---
2783 */
2784
2785 // As visible here, the fixed size of the rhomboid (using the S key in the
2786 // plot widget) is the *horizontal* side (this is the plot context's
2787 // m_integrationScopeRhombWidth).
2788
2789 IntegrationScopeFeatures scope_features;
2790
2791 // Top horizontal line
2792 QPointF point_1;
2793 scope_features = m_context.msp_integrationScope->getLeftMostTopPoint(point_1);
2794
2795 // When the user rotates the horizontal rhomboid, at some point, if the
2796 // current drag point has the same y axis value as the start drag point, then
2797 // we say that the rhomboid is flattened on the x axis. In this case, we do
2798 // not draw anything as this is a purely unusable situation.
2799
2800 if(scope_features & IntegrationScopeFeatures::FLAT_ON_X_AXIS)
2801 {
2802 // qDebug() << "The horizontal rhomboid is flattened on the x axis.";
2803
2804 mp_selectionRectangeLine1->setVisible(false);
2805 mp_selectionRectangeLine2->setVisible(false);
2806 mp_selectionRectangeLine3->setVisible(false);
2807 mp_selectionRectangeLine4->setVisible(false);
2808
2809 return;
2810 }
2811
2813 qFatal("The rhomboid should be horizontal!");
2814
2815 // At this point we can draw the rhomboid fine.
2816
2817 if(!m_context.msp_integrationScope->getLeftMostTopPoint(point_1))
2818 qFatal("Failed to getLeftMostTopPoint.");
2819 QPointF point_2;
2820 if(!m_context.msp_integrationScope->getRightMostTopPoint(point_2))
2821 qFatal("Failed to getRightMostTopPoint.");
2822
2823 // qDebug() << "For top line, two points:" << point_1 << "--" << point_2;
2824
2825 mp_selectionRectangeLine1->start->setCoords(point_1);
2826 mp_selectionRectangeLine1->end->setCoords(point_2);
2827
2828 // Only if we are drawing a selection rectangle for integration, do we set
2829 // arrow heads to the line.
2830 if(for_integration)
2831 {
2832 mp_selectionRectangeLine1->setHead(QCPLineEnding::esSpikeArrow);
2833 mp_selectionRectangeLine1->setTail(QCPLineEnding::esSpikeArrow);
2834 }
2835 else
2836 {
2837 mp_selectionRectangeLine1->setHead(QCPLineEnding::esNone);
2838 mp_selectionRectangeLine1->setTail(QCPLineEnding::esNone);
2839 }
2840
2841 mp_selectionRectangeLine1->setVisible(true);
2842
2843 // Right line
2844 if(!m_context.msp_integrationScope->getRightMostBottomPoint(point_1))
2845 qFatal("Failed to getRightMostBottomPoint.");
2846 mp_selectionRectangeLine2->start->setCoords(point_2);
2847 mp_selectionRectangeLine2->end->setCoords(point_1);
2848 mp_selectionRectangeLine2->setVisible(true);
2849
2850 // qDebug() << "For right line, two points:" << point_2 << "--" << point_1;
2851
2852 // Bottom horizontal line
2853 if(!m_context.msp_integrationScope->getLeftMostBottomPoint(point_2))
2854 qFatal("Failed to getLeftMostBottomPoint.");
2855 mp_selectionRectangeLine3->start->setCoords(point_1);
2856 mp_selectionRectangeLine3->end->setCoords(point_2);
2857 mp_selectionRectangeLine3->setVisible(true);
2858
2859 // qDebug() << "For bottom line, two points:" << point_1 << "--" << point_2;
2860
2861 // Left line
2862 if(!m_context.msp_integrationScope->getLeftMostTopPoint(point_1))
2863 qFatal("Failed to getLeftMostTopPoint.");
2864 mp_selectionRectangeLine4->end->setCoords(point_2);
2865 mp_selectionRectangeLine4->start->setCoords(point_1);
2866 mp_selectionRectangeLine4->setVisible(true);
2867
2868 // qDebug() << "For left line, two points:" << point_2 << "--" << point_1;
2869}

References pappso::FLAT_ON_X_AXIS, m_context, mp_selectionRectangeLine1, mp_selectionRectangeLine2, mp_selectionRectangeLine3, mp_selectionRectangeLine4, and pappso::RHOMBOID_VERTICAL.

Referenced by updateIntegrationScopeRhomb().

◆ updateIntegrationScopeRect()

void pappso::BasePlotWidget::updateIntegrationScopeRect ( bool for_integration = false)
protectedvirtual

Definition at line 2680 of file baseplotwidget.cpp.

2681{
2682 // qDebug();
2683
2684 // if(for_integration)
2685 // qDebug() << "for_integration:" << for_integration;
2686
2687 // We are handling a conventional rectangle. Just create four points
2688 // from top left to bottom right. But we want the top left point to be
2689 // effectively the top left point and the bottom point to be the bottom
2690 // point. So we need to try all four direction combinations, left to right
2691 // or converse versus top to bottom or converse.
2692
2693 m_context.updateIntegrationScopeRect();
2694
2695 // Now that the integration scope has been updated as a rectangle,
2696 // use these newly set data to actually draw the integration
2697 // scope lines.
2698
2699 QPointF bottom_left_point;
2700 if(!m_context.msp_integrationScope->getPoint(bottom_left_point))
2701 qFatal("Failed to get point.");
2702 // qDebug() << "Starting point is left bottom point:" << bottom_left_point;
2703
2704 double width;
2705 if(!m_context.msp_integrationScope->getWidth(width))
2706 qFatal("Failed to get width.");
2707 // qDebug() << "Width:" << width;
2708
2709 double height;
2710 if(!m_context.msp_integrationScope->getHeight(height))
2711 qFatal("Failed to get height.");
2712 // qDebug() << "Height:" << height;
2713
2714 QPointF bottom_right_point(bottom_left_point.x() + width,
2715 bottom_left_point.y());
2716 // qDebug() << "bottom_right_point:" << bottom_right_point;
2717
2718 QPointF top_right_point(bottom_left_point.x() + width,
2719 bottom_left_point.y() + height);
2720 // qDebug() << "top_right_point:" << top_right_point;
2721
2722 QPointF top_left_point(bottom_left_point.x(), bottom_left_point.y() + height);
2723
2724 // qDebug() << "top_left_point:" << top_left_point;
2725
2726 // Start by drawing the bottom line because the IntegrationScopeRect has the
2727 // left bottom point and the width and the height to fully characterize it.
2728
2729 // Bottom line (left to right)
2730 mp_selectionRectangeLine3->start->setCoords(bottom_left_point);
2731 mp_selectionRectangeLine3->end->setCoords(bottom_right_point);
2732 mp_selectionRectangeLine3->setVisible(true);
2733
2734 // Right line (bottom to top)
2735 mp_selectionRectangeLine2->start->setCoords(bottom_right_point);
2736 mp_selectionRectangeLine2->end->setCoords(top_right_point);
2737 mp_selectionRectangeLine2->setVisible(true);
2738
2739 // Top line (right to left)
2740 mp_selectionRectangeLine1->start->setCoords(top_right_point);
2741 mp_selectionRectangeLine1->end->setCoords(top_left_point);
2742 mp_selectionRectangeLine1->setVisible(true);
2743
2744 // Left line (top to bottom)
2745 mp_selectionRectangeLine4->start->setCoords(top_left_point);
2746 mp_selectionRectangeLine4->end->setCoords(bottom_left_point);
2747 mp_selectionRectangeLine4->setVisible(true);
2748
2749 // Only if we are drawing a selection rectangle for integration, do we
2750 // set arrow heads to the line.
2751 if(for_integration)
2752 {
2753 mp_selectionRectangeLine1->setHead(QCPLineEnding::esSpikeArrow);
2754 mp_selectionRectangeLine1->setTail(QCPLineEnding::esSpikeArrow);
2755 }
2756 else
2757 {
2758 mp_selectionRectangeLine1->setHead(QCPLineEnding::esNone);
2759 mp_selectionRectangeLine1->setTail(QCPLineEnding::esNone);
2760 }
2761}

References m_context, mp_selectionRectangeLine1, mp_selectionRectangeLine2, mp_selectionRectangeLine3, and mp_selectionRectangeLine4.

Referenced by updateIntegrationScopeDrawing().

◆ updateIntegrationScopeRhomb()

void pappso::BasePlotWidget::updateIntegrationScopeRhomb ( bool for_integration = false)
protectedvirtual

Definition at line 2986 of file baseplotwidget.cpp.

2987{
2988 // qDebug();
2989
2990 // if(for_integration)
2991 // qDebug() << "for_integration:" << for_integration;
2992
2993 // We are handling a skewed rectangle (rhomboid), that is a rectangle that
2994 // is tilted either to the left or to the right.
2995
2996 // There are two kinds of rhomboid integration scopes:
2997
2998 /*
2999 4+----------+3
3000 | |
3001 | |
3002 | |
3003 | |
3004 | |
3005 | |
3006 | |
3007 1+----------+2
3008 ----width---
3009 */
3010
3011 // As visible here, the fixed size of the rhomboid (using the S key in the
3012 // plot widget) is the *horizontal* side (this is the plot context's
3013 // m_integrationScopeRhombWidth).
3014
3015 // and
3016
3017
3018 /*
3019 * +3
3020 * . |
3021 * . |
3022 * . |
3023 * . +2
3024 * . .
3025 * . .
3026 * . .
3027 * 4+ .
3028 * | | .
3029 * height | | .
3030 * | | .
3031 * 1+
3032 *
3033 */
3034
3035 // As visible here, the fixed size of the rhomboid (using the S key in the
3036 // plot widget) is the *vertical* side (this is the plot context's
3037 // m_integrationScopeRhombHeight).
3038
3039 // qDebug() << "Before calling updateIntegrationScopeRhomb(), "
3040 // "m_integrationScopeRhombWidth:"
3041 // << m_context.m_integrationScopeRhombWidth
3042 // << "and m_integrationScopeRhombHeight:"
3043 // << m_context.m_integrationScopeRhombHeight;
3044
3045 m_context.updateIntegrationScopeRhomb();
3046
3047 // qDebug() << "After, m_integrationScopeRhombWidth:"
3048 // << m_context.m_integrationScopeRhombWidth
3049 // << "and m_integrationScopeRhombHeight:"
3050 // << m_context.m_integrationScopeRhombHeight;
3051
3052 // Now that the integration scope has been updated as a rhomboid,
3053 // use these newly set data to actually draw the integration
3054 // scope lines.
3055
3056 // We thus need to first establish if we have a horiontal or a vertical
3057 // rhomboid scope. This information is located in
3058 // m_context.m_integrationScopeRhombWidth and
3059 // m_context.m_integrationScopeRhombHeight. If width > 0, height *has to be
3060 // 0*, which indicates a horizontal rhomb.Conversely, if height is > 0, then
3061 // the rhomb is vertical.
3062
3063 if(m_context.m_integrationScopeRhombWidth > 0)
3064 // We are dealing with a horizontal scope.
3066 else if(m_context.m_integrationScopeRhombHeight > 0)
3067 // We are dealing with a vertical scope.
3068 updateIntegrationScopeVerticalRhomb(for_integration);
3069 else
3070 qFatal("Cannot be both the width or height of rhomboid scope be 0.");
3071}
virtual void updateIntegrationScopeHorizontalRhomb(bool for_integration=false)
virtual void updateIntegrationScopeVerticalRhomb(bool for_integration=false)

References m_context, updateIntegrationScopeHorizontalRhomb(), and updateIntegrationScopeVerticalRhomb().

Referenced by updateIntegrationScopeDrawing().

◆ updateIntegrationScopeVerticalRhomb()

void pappso::BasePlotWidget::updateIntegrationScopeVerticalRhomb ( bool for_integration = false)
protectedvirtual

Definition at line 2872 of file baseplotwidget.cpp.

2873{
2874 // We are handling a rhomboid scope, that is, a rectangle that
2875 // is tilted either to the left or to the right.
2876
2877 // There are two kinds of rhomboid integration scopes: horizontal and
2878 // vertical.
2879
2880 /*
2881 * +3
2882 * . |
2883 * . |
2884 * . |
2885 * . +2
2886 * . .
2887 * . .
2888 * . .
2889 * 4+ .
2890 * | | .
2891 * height | | .
2892 * | | .
2893 * 1+
2894 *
2895 */
2896
2897 // As visible here, the fixed size of the rhomboid (using the S key in the
2898 // plot widget) is the *vertical* side (this is the plot context's
2899 // m_integrationScopeRhombHeight).
2900
2901 IntegrationScopeFeatures scope_features;
2902
2903 // Left vertical line
2904 QPointF point_1;
2905 scope_features = m_context.msp_integrationScope->getLeftMostTopPoint(point_1);
2906
2907 // When the user rotates the vertical rhomboid, at some point, if the current
2908 // drag point is on the same x axis value as the start drag point, then we say
2909 // that the rhomboid is flattened on the y axis. In this case, we do not draw
2910 // anything as this is a purely unusable situation.
2911
2912 if(scope_features & IntegrationScopeFeatures::FLAT_ON_Y_AXIS)
2913 {
2914 // qDebug() << "The vertical rhomboid is flattened on the y axis.";
2915
2916 mp_selectionRectangeLine1->setVisible(false);
2917 mp_selectionRectangeLine2->setVisible(false);
2918 mp_selectionRectangeLine3->setVisible(false);
2919 mp_selectionRectangeLine4->setVisible(false);
2920
2921 return;
2922 }
2923
2925 qFatal("The rhomboid should be vertical!");
2926
2927 // At this point we can draw the rhomboid fine.
2928
2929 QPointF point_2;
2930 if(!m_context.msp_integrationScope->getLeftMostBottomPoint(point_2))
2931 qFatal("Failed to getLeftMostBottomPoint.");
2932
2933 // qDebug() << "For left vertical line, two points:" << point_1 << "--"
2934 // << point_2;
2935
2936 mp_selectionRectangeLine1->start->setCoords(point_1);
2937 mp_selectionRectangeLine1->end->setCoords(point_2);
2938
2939 // Only if we are drawing a selection rectangle for integration, do we set
2940 // arrow heads to the line.
2941 if(for_integration)
2942 {
2943 mp_selectionRectangeLine1->setHead(QCPLineEnding::esSpikeArrow);
2944 mp_selectionRectangeLine1->setTail(QCPLineEnding::esSpikeArrow);
2945 }
2946 else
2947 {
2948 mp_selectionRectangeLine1->setHead(QCPLineEnding::esNone);
2949 mp_selectionRectangeLine1->setTail(QCPLineEnding::esNone);
2950 }
2951
2952 mp_selectionRectangeLine1->setVisible(true);
2953
2954 // Lower oblique line
2955 if(!m_context.msp_integrationScope->getRightMostBottomPoint(point_1))
2956 qFatal("Failed to getRightMostBottomPoint.");
2957 mp_selectionRectangeLine2->start->setCoords(point_2);
2958 mp_selectionRectangeLine2->end->setCoords(point_1);
2959 mp_selectionRectangeLine2->setVisible(true);
2960
2961 // qDebug() << "For lower oblique line, two points:" << point_2 << "--"
2962 // << point_1;
2963
2964 // Right vertical line
2965 if(!m_context.msp_integrationScope->getRightMostTopPoint(point_2))
2966 qFatal("Failed to getRightMostTopPoint.");
2967 mp_selectionRectangeLine3->start->setCoords(point_1);
2968 mp_selectionRectangeLine3->end->setCoords(point_2);
2969 mp_selectionRectangeLine3->setVisible(true);
2970
2971 // qDebug() << "For right vertical line, two points:" << point_1 << "--"
2972 // << point_2;
2973
2974 // Upper oblique line
2975 if(!m_context.msp_integrationScope->getLeftMostTopPoint(point_1))
2976 qFatal("Failed to get the LeftMostTopPoint.");
2977 mp_selectionRectangeLine4->end->setCoords(point_2);
2978 mp_selectionRectangeLine4->start->setCoords(point_1);
2979 mp_selectionRectangeLine4->setVisible(true);
2980
2981 // qDebug() << "For upper oblique line, two points:" << point_2 << "--"
2982 // << point_1;
2983}

References pappso::FLAT_ON_Y_AXIS, m_context, mp_selectionRectangeLine1, mp_selectionRectangeLine2, mp_selectionRectangeLine3, mp_selectionRectangeLine4, and pappso::RHOMBOID_HORIZONTAL.

Referenced by updateIntegrationScopeRhomb().

◆ verticalGetGraphCoordNewPointCountPixels()

QPointF pappso::BasePlotWidget::verticalGetGraphCoordNewPointCountPixels ( int pixel_count)
virtual

Definition at line 1892 of file baseplotwidget.cpp.

1893{
1894 QPointF pixel_coordinates(
1895 xAxis->coordToPixel(m_context.m_lastCursorHoveredPoint.x()),
1896 yAxis->coordToPixel(m_context.m_lastCursorHoveredPoint.y()) + pixel_count);
1897
1898 // Now convert back to local coordinates.
1899
1900 QPointF graph_coordinates(xAxis->pixelToCoord(pixel_coordinates.x()),
1901 yAxis->pixelToCoord(pixel_coordinates.y()));
1902
1903 return graph_coordinates;
1904}

References m_context.

Referenced by verticalMoveMouseCursorCountPixels().

◆ verticalMoveMouseCursorCountPixels()

void pappso::BasePlotWidget::verticalMoveMouseCursorCountPixels ( int pixel_count)
virtual

Definition at line 1876 of file baseplotwidget.cpp.

1877{
1878
1879 QPointF graph_coord = verticalGetGraphCoordNewPointCountPixels(pixel_count);
1880
1881 QPointF pixel_coord(xAxis->coordToPixel(graph_coord.x()),
1882 yAxis->coordToPixel(graph_coord.y()));
1883
1884 // Now we need ton convert the new coordinates to the global position system
1885 // and to move the cursor to that new position. That will create an event to
1886 // move the mouse cursor.
1887
1888 moveMouseCursorPixelCoordToGlobal(pixel_coord.toPoint());
1889}
virtual QPointF verticalGetGraphCoordNewPointCountPixels(int pixel_count)

References moveMouseCursorPixelCoordToGlobal(), and verticalGetGraphCoordNewPointCountPixels().

Referenced by directionKeyPressEvent().

◆ whatIsVisibleOfTheSelectionRectangle()

SelectionDrawingLines pappso::BasePlotWidget::whatIsVisibleOfTheSelectionRectangle ( )
virtual

Definition at line 3215 of file baseplotwidget.cpp.

3216{
3217 // There are four lines that make the selection polygon. We want to know
3218 // which lines are visible.
3219
3220 int current_selection_polygon =
3221 static_cast<int>(SelectionDrawingLines::NOT_SET);
3222
3223 if(mp_selectionRectangeLine1->visible())
3224 {
3225 current_selection_polygon |=
3226 static_cast<int>(SelectionDrawingLines::TOP_LINE);
3227 // qDebug() << "current_selection_polygon:" <<
3228 // current_selection_polygon;
3229 }
3230 if(mp_selectionRectangeLine2->visible())
3231 {
3232 current_selection_polygon |=
3233 static_cast<int>(SelectionDrawingLines::RIGHT_LINE);
3234 // qDebug() << "current_selection_polygon:" <<
3235 // current_selection_polygon;
3236 }
3237 if(mp_selectionRectangeLine3->visible())
3238 {
3239 current_selection_polygon |=
3240 static_cast<int>(SelectionDrawingLines::BOTTOM_LINE);
3241 // qDebug() << "current_selection_polygon:" <<
3242 // current_selection_polygon;
3243 }
3244 if(mp_selectionRectangeLine4->visible())
3245 {
3246 current_selection_polygon |=
3247 static_cast<int>(SelectionDrawingLines::LEFT_LINE);
3248 // qDebug() << "current_selection_polygon:" <<
3249 // current_selection_polygon;
3250 }
3251
3252 // qDebug() << "returning visibility:" << current_selection_polygon;
3253
3254 return static_cast<SelectionDrawingLines>(current_selection_polygon);
3255}

References pappso::BOTTOM_LINE, pappso::LEFT_LINE, mp_selectionRectangeLine1, mp_selectionRectangeLine2, mp_selectionRectangeLine3, mp_selectionRectangeLine4, pappso::NOT_SET, pappso::RIGHT_LINE, and pappso::TOP_LINE.

Referenced by mouseReleaseHandlerLeftButton(), and yMinMaxOnXAxisCurrentRange().

◆ xAxisMeasurementSignal

void pappso::BasePlotWidget::xAxisMeasurementSignal ( const pappso::BasePlotContext & context,
bool with_delta )
signal

◆ yMinMaxOnXAxisCurrentRange() [1/2]

◆ yMinMaxOnXAxisCurrentRange() [2/2]

void pappso::BasePlotWidget::yMinMaxOnXAxisCurrentRange ( double & min,
double & max,
QCPAbstractPlottable * plottable_p = nullptr )

Member Data Documentation

◆ m_axisLabelX

QString pappso::BasePlotWidget::m_axisLabelX
protected

Definition at line 280 of file baseplotwidget.h.

Referenced by BasePlotWidget().

◆ m_axisLabelY

QString pappso::BasePlotWidget::m_axisLabelY
protected

Definition at line 281 of file baseplotwidget.h.

Referenced by BasePlotWidget().

◆ m_context

BasePlotContext pappso::BasePlotWidget::m_context
protected

Definition at line 283 of file baseplotwidget.h.

Referenced by pappso::DriftSpecTracePlotWidget::DriftSpecTracePlotWidget(), pappso::MassSpecTracePlotWidget::MassSpecTracePlotWidget(), pappso::MassSpecTracePlotWidget::MassSpecTracePlotWidget(), pappso::TicXicChromTracePlotWidget::TicXicChromTracePlotWidget(), axisDoubleClickHandler(), pappso::BaseTracePlotWidget::axisDoubleClickHandler(), axisPan(), pappso::BaseTracePlotWidget::axisPan(), axisReframe(), pappso::BaseTracePlotWidget::axisReframe(), axisRescale(), pappso::BaseTracePlotWidget::axisRescale(), axisZoom(), pappso::BaseTracePlotWidget::axisZoom(), calculateDragDeltas(), pappso::BaseColorMapPlotWidget::currentXaxisRangeIndices(), pappso::BaseColorMapPlotWidget::currentYaxisRangeIndices(), directionKeyPressEvent(), dragDirection(), drawSelectionRectangleAndPrepareZoom(), drawXScopeSpanFeatures(), drawYScopeSpanFeatures(), getContext(), horizontalGetGraphCoordNewPointCountPixels(), isVerticalDisplacementAboveThreshold(), keyPressEvent(), pappso::DriftSpecMassSpecColorMapPlotWidget::keyPressEvent(), pappso::DriftSpecTracePlotWidget::keyPressEvent(), pappso::TicXicChromDriftSpecColorMapPlotWidget::keyPressEvent(), pappso::TicXicChromMassSpecColorMapPlotWidget::keyPressEvent(), pappso::TicXicChromTracePlotWidget::keyPressEvent(), keyReleaseEvent(), pappso::DriftSpecMassSpecColorMapPlotWidget::keyReleaseEvent(), pappso::DriftSpecTracePlotWidget::keyReleaseEvent(), pappso::TicXicChromDriftSpecColorMapPlotWidget::keyReleaseEvent(), pappso::TicXicChromTracePlotWidget::keyReleaseEvent(), mouseMoveHandler(), mouseMoveHandlerDraggingCursor(), mouseMoveHandlerLeftButtonDraggingCursor(), mouseMoveHandlerNotDraggingCursor(), mouseMoveHandlerRightButtonDraggingCursor(), mousePressHandler(), pappso::TicXicChromTracePlotWidget::mousePressHandler(), mousePseudoButtonKeyReleaseEvent(), mouseReleaseHandler(), pappso::TicXicChromTracePlotWidget::mouseReleaseHandler(), mouseReleaseHandlerLeftButton(), mouseReleaseHandlerRightButton(), mouseWheelHandler(), pappso::MassSpecTracePlotWidget::refreshBaseContext(), resetSelectionRectangle(), restoreAxesRangeHistory(), updateContextXandYAxisRanges(), updateIntegrationScope(), updateIntegrationScopeDrawing(), updateIntegrationScopeHorizontalRhomb(), updateIntegrationScopeRect(), updateIntegrationScopeRhomb(), updateIntegrationScopeVerticalRhomb(), and verticalGetGraphCoordNewPointCountPixels().

◆ m_desc

QString pappso::BasePlotWidget::m_desc = "NOT_SET"
protected

Description of the plot widget.

Definition at line 275 of file baseplotwidget.h.

◆ m_fileName

QString pappso::BasePlotWidget::m_fileName
protected

The name of the data file from which the mass data were read.

Definition at line 278 of file baseplotwidget.h.

◆ m_focusedBrush

QBrush pappso::BasePlotWidget::m_focusedBrush = QBrush(m_focusedColor)
protected

Color used for the background of focused plot.

Definition at line 364 of file baseplotwidget.h.

Referenced by redrawPlotBackground().

◆ m_focusedColor

QColor pappso::BasePlotWidget::m_focusedColor = QColor(Qt::transparent)
protected

Color used for the background of focused plot.

Definition at line 362 of file baseplotwidget.h.

◆ m_lastAxisRangeHistoryIndex

std::size_t pappso::BasePlotWidget::m_lastAxisRangeHistoryIndex = 0
protected

Index of the last axis range history item.

Each time the user modifies the ranges (x/y axis) during panning or zooming of the graph, the new axis ranges are stored in a axis ranges history list. This index allows to point to the last range of that history.

Definition at line 325 of file baseplotwidget.h.

Referenced by resetAxesRangeHistory(), restorePreviousAxesRangeHistory(), and updateAxesRangeHistory().

◆ m_leftMousePseudoButtonKey

int pappso::BasePlotWidget::m_leftMousePseudoButtonKey = Qt::Key_Less
protected

◆ m_mouseMoveHandlerSkipAmount

int pappso::BasePlotWidget::m_mouseMoveHandlerSkipAmount = 10
protected

How many mouse move events must be skipped *‍/.

when the data are so massive that the graph panning becomes sluggish. By default, the value is 10 events to be skipped before accounting one. The "fat data" mouse movement handler mechanism is actuated by using a keyboard key combination. There is no automatic shift between normal processing and "fat data" processing.

Definition at line 343 of file baseplotwidget.h.

Referenced by mouseMoveHandlerLeftButtonDraggingCursor().

◆ m_mouseMoveHandlerSkipCount

int pappso::BasePlotWidget::m_mouseMoveHandlerSkipCount = 0
protected

Counter to handle the "fat data" mouse move event handling.

See also
m_mouseMoveHandlerSkipAmount.

Definition at line 351 of file baseplotwidget.h.

Referenced by mouseMoveHandlerLeftButtonDraggingCursor(), and mouseReleaseHandler().

◆ m_name

QString pappso::BasePlotWidget::m_name = "NOT_SET"
protected

Name of the plot widget.

Definition at line 272 of file baseplotwidget.h.

◆ m_pen

QPen pappso::BasePlotWidget::m_pen
protected

Pen used to draw the graph and textual elements in the plot widget.

Definition at line 367 of file baseplotwidget.h.

Referenced by BasePlotWidget(), BasePlotWidget(), createAllAncillaryItems(), getPen(), pappso::BaseTracePlotWidget::setGraphData(), and setPen().

◆ m_rightMousePseudoButtonKey

int pappso::BasePlotWidget::m_rightMousePseudoButtonKey = Qt::Key_Greater
protected

◆ m_shouldTracersBeVisible

bool pappso::BasePlotWidget::m_shouldTracersBeVisible = true
protected

Tells if the tracers should be visible.

Definition at line 302 of file baseplotwidget.h.

Referenced by hideTracers(), keyReleaseEvent(), mouseMoveHandlerDraggingCursor(), mouseMoveHandlerNotDraggingCursor(), mousePressHandler(), and showTracers().

◆ m_unfocusedBrush

QBrush pappso::BasePlotWidget::m_unfocusedBrush = QBrush(m_unfocusedColor)
protected

Color used for the background of unfocused plot.

Definition at line 359 of file baseplotwidget.h.

Referenced by redrawPlotBackground().

◆ m_unfocusedColor

QColor pappso::BasePlotWidget::m_unfocusedColor = QColor("lightgray")
protected

Color used for the background of unfocused plot.

Definition at line 357 of file baseplotwidget.h.

◆ m_xAxisRangeHistory

std::vector<QCPRange *> pappso::BasePlotWidget::m_xAxisRangeHistory
protected

List of x axis ranges occurring during the panning zooming actions.

Definition at line 328 of file baseplotwidget.h.

Referenced by ~BasePlotWidget(), resetAxesRangeHistory(), restoreAxesRangeHistory(), and updateAxesRangeHistory().

◆ m_yAxisRangeHistory

std::vector<QCPRange *> pappso::BasePlotWidget::m_yAxisRangeHistory
protected

List of y axis ranges occurring during the panning zooming actions.

Definition at line 331 of file baseplotwidget.h.

Referenced by ~BasePlotWidget(), resetAxesRangeHistory(), restoreAxesRangeHistory(), and updateAxesRangeHistory().

◆ mp_hPosTracerItem

◆ mp_selectionRectangeLine1

QCPItemLine* pappso::BasePlotWidget::mp_selectionRectangeLine1 = nullptr
protected

◆ mp_selectionRectangeLine2

◆ mp_selectionRectangeLine3

◆ mp_selectionRectangeLine4

◆ mp_vEndTracerItem

◆ mp_vPosTracerItem

◆ mp_vStartTracerItem

QCPItemLine* pappso::BasePlotWidget::mp_vStartTracerItem = nullptr
protected

◆ mp_xDeltaTextItem

QCPItemText* pappso::BasePlotWidget::mp_xDeltaTextItem = nullptr
protected

Text describing the x-axis delta value during a drag operation.

Definition at line 298 of file baseplotwidget.h.

Referenced by createAllAncillaryItems(), drawSelectionRectangleAndPrepareZoom(), drawXScopeSpanFeatures(), hideAllPlotItems(), mouseReleaseHandler(), and mouseReleaseHandlerRightButton().

◆ mp_yDeltaTextItem

QCPItemText* pappso::BasePlotWidget::mp_yDeltaTextItem = nullptr
protected

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