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, RangeType range_type) const
 MOUSE MOVEMENTS mouse/keyboard-triggered.
virtual void getRangeX (bool &found_range, int index, RangeType range_type, double &start, double &stop) const
virtual void getRangeX (bool &found_range, int index, RangeType range_type, std::pair< double, double > &start_stop_pair) const
virtual QCPRange getRangeY (bool &found_range, int index, RangeType range_type) const
virtual void getRangeY (bool &found_range, int index, RangeType range_type, double &start, double &stop) const
virtual void getRangeY (bool &found_range, int index, RangeType range_type, std::pair< double, double > &start_stop_pair) 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 BasePlotContext & getContext () const
virtual int getPlotIndex (QCPAbstractPlottable *plottable_p)

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 2228 of file baseplotwidget.cpp.

2229{
2230 // Sanity check
2231 if(!m_context.m_wasClickOnXAxis && !m_context.m_wasClickOnYAxis)
2232 qFatal(
2233 "This function can only be called if the mouse click was on one of the "
2234 "axes");
2235
2236 if(m_context.m_wasClickOnXAxis)
2237 {
2238 xAxis->setRange(m_context.m_xRange.lower - m_context.m_xDelta,
2239 m_context.m_xRange.upper - m_context.m_xDelta);
2240 }
2241
2242 if(m_context.m_wasClickOnYAxis)
2243 {
2244 yAxis->setRange(m_context.m_yRange.lower - m_context.m_yDelta,
2245 m_context.m_yRange.upper - m_context.m_yDelta);
2246 }
2247
2249
2250 // qDebug() << "The updated context:" << m_context.toString();
2251
2252 // We cannot store the new ranges in the history, because the pan operation
2253 // involved a huge quantity of micro-movements elicited upon each mouse move
2254 // cursor event so we would have a huge history.
2255 // updateAxesRangeHistory();
2256
2257 // Now that the context has the right range values, we can emit the
2258 // signal that will be used by this plot widget users, typically to
2259 // abide by the x/y range lock required by the user.
2260
2261 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
2262
2263 replot();
2264}

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

Referenced by mouseMoveHandlerLeftButtonDraggingCursor(), and yMinMaxOnXAxisCurrentRange().

◆ axisReframe()

void pappso::BasePlotWidget::axisReframe ( )
virtual

Reimplemented in pappso::BaseTracePlotWidget.

Definition at line 2175 of file baseplotwidget.cpp.

2176{
2177
2178 // double sorted_start_drag_point_x =
2179 // std::min(m_context.m_startDragPoint.x(),
2180 // m_context.m_currentDragPoint.x());
2181
2182 // xAxis->setRange(sorted_start_drag_point_x,
2183 // sorted_start_drag_point_x + fabs(m_context.m_xDelta));
2184
2185 xAxis->setRange(QCPRange(m_context.m_xRegionRangeStart, m_context.m_xRegionRangeStop));
2186
2187 // Note that the y axis should be rescaled from current lower value to new
2188 // upper value matching the y-axis position of the cursor when the mouse
2189 // button was released.
2190
2191 yAxis->setRange(xAxis->range().lower,
2192 std::max<double>(m_context.m_yRegionRangeStart, m_context.m_yRegionRangeStop));
2193
2194 // qDebug() << "xaxis:" << xAxis->range().lower << "-" <<
2195 // xAxis->range().upper
2196 //<< "yaxis:" << yAxis->range().lower << "-" << yAxis->range().upper;
2197
2199
2201 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
2202
2203 replot();
2204}

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 2120 of file baseplotwidget.cpp.

2121{
2122 // Get the current x lower/upper range, that is, leftmost/rightmost x
2123 // coordinate.
2124 double xLower = xAxis->range().lower;
2125 double xUpper = xAxis->range().upper;
2126
2127 // Get the current y lower/upper range, that is, bottommost/topmost y
2128 // coordinate.
2129 double yLower = yAxis->range().lower;
2130 double yUpper = yAxis->range().upper;
2131
2132 // This function is called only when the user has clicked on the x/y axis or
2133 // when the user has dragged the left mouse button with the Ctrl key
2134 // modifier. The m_context.m_wasClickOnXAxis is then simulated in the mouse
2135 // move handler. So we need to test which axis was clicked-on.
2136
2137 if(m_context.m_wasClickOnXAxis)
2138 {
2139 // We are changing the range of the X axis.
2140
2141 // If xDelta is < 0, then we were dragging from right to left, we are
2142 // compressing the view on the x axis, by adding new data to the right
2143 // hand size of the graph. So we add xDelta to the upper bound of the
2144 // range. Otherwise we are uncompressing the view on the x axis and
2145 // remove the xDelta from the upper bound of the range. This is why we
2146 // have the
2147 // '-'
2148 // and not '+' below;
2149
2150 xAxis->setRange(xLower, xUpper - m_context.m_xDelta);
2151 }
2152 // End of
2153 // if(m_context.m_wasClickOnXAxis)
2154 else // that is, if(m_context.m_wasClickOnYAxis)
2155 {
2156 // We are changing the range of the Y axis.
2157
2158 // See above for an explanation of the computation (the - sign below).
2159
2160 yAxis->setRange(yLower, yUpper - m_context.m_yDelta);
2161 }
2162 // End of
2163 // else // that is, if(m_context.m_wasClickOnYAxis)
2164
2165 // Update the context with the current axes ranges
2166
2168
2169 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
2170
2171 replot();
2172}

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

Referenced by mouseMoveHandlerLeftButtonDraggingCursor(), and yMinMaxOnXAxisCurrentRange().

◆ axisZoom()

void pappso::BasePlotWidget::axisZoom ( )
virtual

Reimplemented in pappso::BaseTracePlotWidget.

Definition at line 2207 of file baseplotwidget.cpp.

2208{
2209
2210 // Use the m_context.m_xRegionRangeStart/End values, but we need to sort the
2211 // values before using them, because now we want to really have the lower x
2212 // value. Simply craft a QCPRange that will swap the values if lower is not
2213 // < than upper QCustomPlot calls this normalization).
2214
2215 xAxis->setRange(QCPRange(m_context.m_xRegionRangeStart, m_context.m_xRegionRangeStop));
2216
2217 yAxis->setRange(QCPRange(m_context.m_yRegionRangeStart, m_context.m_yRegionRangeStop));
2218
2220
2222 emit plotRangesChangedSignal((QMouseEvent *)nullptr, m_context);
2223
2224 replot();
2225}

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 2644 of file baseplotwidget.cpp.

2645{
2646
2647 // We compute signed differentials. If the user does not want the sign,
2648 // fabs(double) is their friend.
2649
2650 // Compute the xAxis differential:
2651
2652 m_context.m_xDelta =
2653 m_context.m_currentDragPoint.x() - m_context.m_startDragPoint.x();
2654
2655 // Same with the Y-axis range:
2656
2657 m_context.m_yDelta =
2658 m_context.m_currentDragPoint.y() - m_context.m_startDragPoint.y();
2659
2660 return;
2661}

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 2365 of file baseplotwidget.cpp.

2367{
2368 // The user has dragged the mouse left button on the graph, which means he
2369 // is willing to draw a selection rectangle, either for zooming-in or for
2370 // integration.
2371
2372 if(mp_xDeltaTextItem != nullptr)
2373 mp_xDeltaTextItem->setVisible(false);
2374 if(mp_yDeltaTextItem != nullptr)
2375 mp_yDeltaTextItem->setVisible(false);
2376
2377 // Ensure the right selection rectangle is drawn.
2378
2379 updateIntegrationScopeDrawing(as_line_segment, for_integration);
2380
2381 // Note that if we draw a zoom rectangle, then we are certainly not
2382 // measuring anything. So set the boolean value to false so that the user of
2383 // this widget or derived classes know that there is nothing to perform upon
2384 // (like deconvolution, for example).
2385
2386 m_context.m_isMeasuringDistance = false;
2387
2388 // Also remove the delta value from the pipeline by sending a simple
2389 // distance without measurement signal.
2390
2391 emit xAxisMeasurementSignal(m_context, false);
2392
2393 replot();
2394}
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 2397 of file baseplotwidget.cpp.

2398{
2399 // Depending on the kind of integration scope, we will have to display
2400 // differently calculated values. We want to provide the user with
2401 // the horizontal span of the integration scope. There are different
2402 // situations.
2403
2404 // 1. The scope is mono-dimensional across the x axis: the span
2405 // is thus simply the width.
2406
2407 // 2. The scope is bi-dimensional and is a rectangle: the span is
2408 // thus simply the width.
2409
2410 // 3. The socpe is bi-dimensional and is a rhomboid: the span is
2411 // the width.
2412
2413 // In the first and second cases above, the width is equal to the
2414 // m_context.m_xDelta.
2415
2416 // In the case of the rhomboid, the span is not m_context.m_xDelta,
2417 // it is more than that if the rhomboid is horizontal because it is
2418 // the m_context.m_xDelta plus the rhomboid's horizontal size.
2419
2420 // FIXME: is this still true?
2421 //
2422 // We do not want to show the position markers because the only horiontal
2423 // line to be visible must be contained between the start and end vertical
2424 // tracer items.
2425 mp_hPosTracerItem->setVisible(false);
2426 mp_vPosTracerItem->setVisible(false);
2427
2428 // We want to draw the text in the middle position of the leftmost-rightmost
2429 // point, even with rhomboid scopes.
2430
2431 QPointF leftmost_point;
2432 if(!m_context.mpa_integrationScope->getLeftMostPoint(leftmost_point))
2433 qFatal("Could not get the left-most point.");
2434
2435 double width;
2436 if(!m_context.mpa_integrationScope->getWidth(width))
2437 qFatal("Could not get width.");
2438 // qDebug() << "width:" << width;
2439
2440 double x_axis_center_position = leftmost_point.x() + width / 2;
2441
2442 // We want the text to print inside the rectangle, always at the current
2443 // drag point so the eye can follow the delta value while looking where to
2444 // drag the mouse. To position the text inside the rectangle, we need to
2445 // know what is the drag direction.
2446
2447 // What is the distance between the rectangle line at current drag point and
2448 // the text itself. Think of this as a margin distance between the
2449 // point of interest and the actual position of the text.
2450 int pixels_away_from_line = 15;
2451
2452 QPointF reference_point_for_y_axis_label_position;
2453
2454 // ATTENTION: the pixel coordinates for the vertical direction go in reverse
2455 // order with respect to the y axis values !!! That is, pixel(0,0) is top
2456 // left of the graph.
2457 if(static_cast<int>(m_context.m_dragDirections) &
2458 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
2459 {
2460 // We need to print outside the rectangle, that is pixels_away_from_line
2461 // pixels to the top, so with pixel y value decremented of that
2462 // pixels_above_line value (one would have expected to increment that
2463 // value, along the y axis, but the coordinates in pixel go in reverse
2464 // order).
2465
2466 pixels_away_from_line *= -1;
2467
2468 if(!m_context.mpa_integrationScope->getTopMostPoint(
2469 reference_point_for_y_axis_label_position))
2470 qFatal("Failed to get top most point.");
2471 }
2472 else
2473 {
2474 if(!m_context.mpa_integrationScope->getBottomMostPoint(
2475 reference_point_for_y_axis_label_position))
2476 qFatal("Failed to get bottom most point.");
2477 }
2478
2479 // double y_axis_pixel_coordinate =
2480 // yAxis->coordToPixel(m_context.m_currentDragPoint.y());
2481 double y_axis_pixel_coordinate =
2482 yAxis->coordToPixel(reference_point_for_y_axis_label_position.y());
2483
2484 // Now that we have the coordinate in pixel units, we can correct
2485 // it by the value of the margin we want to give.
2486 double y_axis_modified_pixel_coordinate =
2487 y_axis_pixel_coordinate + pixels_away_from_line;
2488
2489 // Set aside a point instance to store the pixel coordinates of the text.
2490 QPointF pixel_coordinates;
2491
2492 pixel_coordinates.setX(x_axis_center_position);
2493 pixel_coordinates.setY(y_axis_modified_pixel_coordinate);
2494
2495 // Now convert back to graph coordinates.
2496 QPointF graph_coordinates(xAxis->pixelToCoord(pixel_coordinates.x()),
2497 yAxis->pixelToCoord(pixel_coordinates.y()));
2498
2499 // qDebug() << "Should print the label at point:" << graph_coordinates;
2500
2501 if(mp_xDeltaTextItem != nullptr)
2502 {
2503 mp_xDeltaTextItem->position->setCoords(x_axis_center_position,
2504 graph_coordinates.y());
2505
2506 // Dynamically set the number of decimals to ensure we can read
2507 // a meaning full delta value even if it is very very very small.
2508 // That is, allow one to read 0.00333, 0.000333, 1.333 and so on.
2509
2510 // The computation below only works properly when the passed
2511 // value is fabs() (not negative !!!).
2512
2513 int decimals = Utils::zeroDecimalsInValue(width) + 3;
2514
2515 QString label_text = QString("full x span %1 -- x drag delta %2")
2516 .arg(width, 0, 'f', decimals)
2517 .arg(fabs(m_context.m_xDelta), 0, 'f', decimals);
2518
2519 mp_xDeltaTextItem->setText(label_text);
2520
2521 mp_xDeltaTextItem->setFont(QFont(font().family(), 9));
2522 mp_xDeltaTextItem->setVisible(true);
2523 }
2524
2525 // Set the boolean to true so that derived widgets know that something is
2526 // being measured, and they can act accordingly, for example by computing
2527 // deconvolutions in a mass spectrum.
2528 m_context.m_isMeasuringDistance = true;
2529
2530 replot();
2531
2532 // Let the caller know that we were measuring something.
2534
2535 return;
2536}
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:103

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 2539 of file baseplotwidget.cpp.

2540{
2541 // See drawXScopeSpanFeatures() for explanations.
2542
2543 // Check right away if there is height!
2544 double height;
2545 if(!m_context.mpa_integrationScope->getHeight(height))
2546 qFatal("Could not get height.");
2547
2548 // If there is no height, we have nothing to do here.
2549 if(!height)
2550 return;
2551 // qDebug() << "height:" << height;
2552
2553 // FIXME: is this still true?
2554 //
2555 // We do not want to show the position markers because the only horiontal
2556 // line to be visible must be contained between the start and end vertical
2557 // tracer items.
2558 mp_hPosTracerItem->setVisible(false);
2559 mp_vPosTracerItem->setVisible(false);
2560
2561 // First the easy part: the vertical position: centered on the
2562 // scope Y span.
2563 QPointF bottom_most_point;
2564 if(!m_context.mpa_integrationScope->getBottomMostPoint(bottom_most_point))
2565 qFatal("Could not get the bottom-most bottom point.");
2566
2567 double y_axis_center_position = bottom_most_point.y() + height / 2;
2568
2569 // We want to draw the text outside the rectangle (if normal rectangle)
2570 // at a small distance from the vertical limit of the scope at the
2571 // position of the current drag point. We need to check the horizontal
2572 // drag direction to put the text at the right place (left of
2573 // current drag point if dragging right to left, for example).
2574
2575 // What is the distance between the rectangle line at current drag point and
2576 // the text itself.
2577 int pixels_away_from_line = 15;
2578 double x_axis_coordinate;
2579 double x_axis_pixel_coordinate;
2580
2581 if(static_cast<int>(m_context.m_dragDirections) &
2582 static_cast<int>(DragDirections::RIGHT_TO_LEFT))
2583 {
2584 QPointF left_most_point;
2585
2586 if(!m_context.mpa_integrationScope->getLeftMostPoint(left_most_point))
2587 qFatal("Failed to get left most point.");
2588
2589 x_axis_coordinate = left_most_point.x();
2590
2591 pixels_away_from_line *= -1;
2592 }
2593 else
2594 {
2595 QPointF right_most_point;
2596
2597 if(!m_context.mpa_integrationScope->getRightMostPoint(right_most_point))
2598 qFatal("Failed to get right most point.");
2599
2600 x_axis_coordinate = right_most_point.x();
2601 }
2602 x_axis_pixel_coordinate = xAxis->coordToPixel(x_axis_coordinate);
2603
2604 double x_axis_modified_pixel_coordinate =
2605 x_axis_pixel_coordinate + pixels_away_from_line;
2606
2607 // Set aside a point instance to store the pixel coordinates of the text.
2608 QPointF pixel_coordinates;
2609
2610 pixel_coordinates.setX(x_axis_modified_pixel_coordinate);
2611 pixel_coordinates.setY(y_axis_center_position);
2612
2613 // Now convert back to graph coordinates.
2614
2615 QPointF graph_coordinates(xAxis->pixelToCoord(pixel_coordinates.x()),
2616 yAxis->pixelToCoord(pixel_coordinates.y()));
2617
2618 mp_yDeltaTextItem->position->setCoords(graph_coordinates.x(),
2619 y_axis_center_position);
2620
2621 int decimals = Utils::zeroDecimalsInValue(height) + 3;
2622
2623 QString label_text = QString("full y span %1 -- y drag delta %2")
2624 .arg(height, 0, 'f', decimals)
2625 .arg(fabs(m_context.m_yDelta), 0, 'f', decimals);
2626
2627 mp_yDeltaTextItem->setText(label_text);
2628 mp_yDeltaTextItem->setFont(QFont(font().family(), 9));
2629 mp_yDeltaTextItem->setVisible(true);
2630 mp_yDeltaTextItem->setRotation(90);
2631
2632 // Set the boolean to true so that derived widgets know that something is
2633 // being measured, and they can act accordingly, for example by computing
2634 // deconvolutions in a mass spectrum.
2635 m_context.m_isMeasuringDistance = true;
2636
2637 replot();
2638
2639 // Let the caller know that we were measuring something.
2641}

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 3385 of file baseplotwidget.cpp.

3386{
3387 return m_context;
3388}

References m_context.

Referenced by yMinMaxOnXAxisCurrentRange().

◆ getInnermostRangeX()

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

Definition at line 2089 of file baseplotwidget.cpp.

2090{
2091
2092 return getRange(Enums::Axis::x, RangeType::INNERMOST, found_range);
2093}
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 2102 of file baseplotwidget.cpp.

2103{
2104
2105 return getRange(Enums::Axis::y, RangeType::INNERMOST, found_range);
2106}

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

◆ getOutermostRangeX()

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

Definition at line 2096 of file baseplotwidget.cpp.

2097{
2098 return getRange(Enums::Axis::x, RangeType::OUTERMOST, found_range);
2099}

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

◆ getOutermostRangeY()

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

Definition at line 2109 of file baseplotwidget.cpp.

2110{
2111 return getRange(Enums::Axis::y, RangeType::OUTERMOST, found_range);
2112}

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.

◆ getPlotIndex()

int pappso::BasePlotWidget::getPlotIndex ( QCPAbstractPlottable * plottable_p)
virtual

Definition at line 3392 of file baseplotwidget.cpp.

3393{
3394 int plottable_count = plottableCount();
3395
3396 for(int iter = 0; iter < plottable_count; ++iter)
3397 if(plottable(iter) == plottable_p)
3398 return iter;
3399
3400 return -1;
3401}

Referenced by yMinMaxOnXAxisCurrentRange().

◆ 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 1999 of file baseplotwidget.cpp.

2002{
2003 // Iterate in all the graphs in this widget and return a QCPRange that has
2004 // its lower member as the greatest lower value of all
2005 // its upper member as the smallest upper value of all
2006
2007 if(!graphCount())
2008 {
2009 found_range = false;
2010
2011 return QCPRange(0, 1);
2012 }
2013
2014 if(graphCount() == 1)
2015 return graph()->getKeyRange(found_range);
2016
2017 bool found_at_least_one_range = false;
2018
2019 // Create an invalid range.
2020 QCPRange result_range(QCPRange::minRange + 1, QCPRange::maxRange + 1);
2021
2022 for(int iter = 0; iter < graphCount(); ++iter)
2023 {
2024 QCPRange temp_range;
2025
2026 bool found_range_for_iter = false;
2027
2028 QCPGraph *graph_p = graph(iter);
2029
2030 // Depending on the axis param, select the key or value range.
2031
2032 if(axis == Enums::Axis::x)
2033 temp_range = graph_p->getKeyRange(found_range_for_iter);
2034 else if(axis == Enums::Axis::y)
2035 temp_range = graph_p->getValueRange(found_range_for_iter);
2036 else
2037 qFatal("Cannot reach this point. Programming error.");
2038
2039 // Was a range found for the iterated graph ? If not skip this
2040 // iteration.
2041
2042 if(!found_range_for_iter)
2043 continue;
2044
2045 // While the innermost_range is invalid, we need to seed it with a good
2046 // one. So check this.
2047
2048 if(!QCPRange::validRange(result_range))
2049 qFatal("The obtained range is invalid !");
2050
2051 // At this point we know the obtained range is OK.
2052 result_range = temp_range;
2053
2054 // We found at least one valid range!
2055 found_at_least_one_range = true;
2056
2057 // At this point we have two valid ranges to compare. Depending on
2058 // range_type, we need to perform distinct comparisons.
2059
2060 if(range_type == RangeType::INNERMOST)
2061 {
2062 if(temp_range.lower > result_range.lower)
2063 result_range.lower = temp_range.lower;
2064 if(temp_range.upper < result_range.upper)
2065 result_range.upper = temp_range.upper;
2066 }
2067 else if(range_type == RangeType::OUTERMOST)
2068 {
2069 if(temp_range.lower < result_range.lower)
2070 result_range.lower = temp_range.lower;
2071 if(temp_range.upper > result_range.upper)
2072 result_range.upper = temp_range.upper;
2073 }
2074 else
2075 qFatal("Cannot reach this point. Programming error.");
2076
2077 // Continue to next graph, if any.
2078 }
2079 // End of
2080 // for(int iter = 0; iter < graphCount(); ++iter)
2081
2082 // Let the caller know if we found at least one range.
2083 found_range = found_at_least_one_range;
2084
2085 return result_range;
2086}

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

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

◆ getRangeX() [1/3]

QCPRange pappso::BasePlotWidget::getRangeX ( bool & found_range,
int index,
RangeType range_type ) 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 if(range_type == RangeType::OUTERMOST)
1920 return graph_p->getKeyRange(found_range);
1921 else if(range_type == RangeType::INNERMOST)
1922 {
1923 found_range = true;
1924 // qDebug() << "Setting found_range to true;";
1925 return graph_p->keyAxis()->range();
1926 }
1927 else
1928 qFatal("Programming error.");
1929
1930 return QCPRange();
1931}

References pappso::INNERMOST, and pappso::OUTERMOST.

Referenced by getRangeX(), and getRangeX().

◆ getRangeX() [2/3]

void pappso::BasePlotWidget::getRangeX ( bool & found_range,
int index,
RangeType range_type,
double & start,
double & stop ) const
virtual

Definition at line 1934 of file baseplotwidget.cpp.

1936{
1937 QCPRange range = getRangeX(found_range, index, range_type);
1938
1939 start = range.lower;
1940 stop = range.upper;
1941}
virtual QCPRange getRangeX(bool &found_range, int index, RangeType range_type) const
MOUSE MOVEMENTS mouse/keyboard-triggered.

References getRangeX().

◆ getRangeX() [3/3]

void pappso::BasePlotWidget::getRangeX ( bool & found_range,
int index,
RangeType range_type,
std::pair< double, double > & start_stop_pair ) const
virtual

Definition at line 1944 of file baseplotwidget.cpp.

1948{
1949 QCPRange range = getRangeX(found_range, index, range_type);
1950
1951 start_stop_pair.first = range.lower;
1952 start_stop_pair.second = range.upper;
1953}

References getRangeX().

◆ getRangeY() [1/3]

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

Definition at line 1956 of file baseplotwidget.cpp.

1957{
1958 QCPGraph *graph_p = graph(index);
1959
1960 if(graph_p == nullptr)
1961 qFatal("Programming error.");
1962
1963 if(range_type == RangeType::OUTERMOST)
1964 return graph_p->getValueRange(found_range);
1965 else if(range_type == RangeType::INNERMOST)
1966 {
1967 found_range = true;
1968 return graph_p->valueAxis()->range();
1969 }
1970 else
1971 qFatal("Programming error.");
1972
1973 return QCPRange();
1974}

References pappso::INNERMOST, and pappso::OUTERMOST.

Referenced by getRangeY(), and getRangeY().

◆ getRangeY() [2/3]

void pappso::BasePlotWidget::getRangeY ( bool & found_range,
int index,
RangeType range_type,
double & start,
double & stop ) const
virtual

Definition at line 1977 of file baseplotwidget.cpp.

1979{
1980 QCPRange range = getRangeY(found_range, index, range_type);
1981
1982 start = range.lower;
1983 stop = range.upper;
1984}
virtual QCPRange getRangeY(bool &found_range, int index, RangeType range_type) const

References getRangeY().

◆ getRangeY() [3/3]

void pappso::BasePlotWidget::getRangeY ( bool & found_range,
int index,
RangeType range_type,
std::pair< double, double > & start_stop_pair ) const
virtual

Definition at line 1987 of file baseplotwidget.cpp.

1991{
1992 QCPRange range = getRangeY(found_range, index, range_type);
1993
1994 start_stop_pair.first = range.lower;
1995 start_stop_pair.second = range.upper;
1996}

References getRangeY().

◆ 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 2318 of file baseplotwidget.cpp.

2319{
2320 mp_xDeltaTextItem->setVisible(false);
2321 mp_yDeltaTextItem->setVisible(false);
2322
2323 // mp_zoomRectItem->setVisible(false);
2325
2326 // Force a replot to make sure the action is immediately visible by the
2327 // user, even without moving the mouse.
2328 replot();
2329}
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 2350 of file baseplotwidget.cpp.

2351{
2353 mp_hPosTracerItem->setVisible(false);
2354 mp_vPosTracerItem->setVisible(false);
2355
2356 mp_vStartTracerItem->setVisible(false);
2357 mp_vEndTracerItem->setVisible(false);
2358
2359 // Force a replot to make sure the action is immediately visible by the
2360 // user, even without moving the mouse.
2361 replot();
2362}
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 3321 of file baseplotwidget.cpp.

3322{
3323 // Sanity check
3324 int check = 0;
3325
3326 check += mp_selectionRectangeLine1->visible();
3327 check += mp_selectionRectangeLine2->visible();
3328 check += mp_selectionRectangeLine3->visible();
3329 check += mp_selectionRectangeLine4->visible();
3330
3331 if(check > 0)
3332 return true;
3333
3334 return false;
3335}

References mp_selectionRectangeLine1, mp_selectionRectangeLine2, mp_selectionRectangeLine3, and mp_selectionRectangeLine4.

Referenced by yMinMaxOnXAxisCurrentRange().

◆ isVerticalDisplacementAboveThreshold()

bool pappso::BasePlotWidget::isVerticalDisplacementAboveThreshold ( )
virtual

Definition at line 2664 of file baseplotwidget.cpp.

2665{
2666 // First get the height of the plot.
2667 double plotHeight = yAxis->range().upper - yAxis->range().lower;
2668
2669 double heightDiff =
2670 fabs(m_context.m_startDragPoint.y() - m_context.m_currentDragPoint.y());
2671
2672 double heightDiffRatio = (heightDiff / plotHeight) * 100;
2673
2674 if(heightDiffRatio > 10)
2675 {
2676 return true;
2677 }
2678
2679 return false;
2680}

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 3351 of file baseplotwidget.cpp.

3352{
3353 if(focusedPlotWidget == nullptr)
3354 throw ExceptionNotPossible(
3355 "baseplotwidget.cpp @ redrawPlotBackground(QWidget *focusedPlotWidget "
3356 "-- "
3357 "ERROR focusedPlotWidget cannot be nullptr.");
3358
3359 if(dynamic_cast<QWidget *>(this) != focusedPlotWidget)
3360 {
3361 // The focused widget is not *this widget. We should make sure that
3362 // we were not the one that had the focus, because in this case we
3363 // need to redraw an unfocused background.
3364
3365 axisRect()->setBackground(m_unfocusedBrush);
3366 }
3367 else
3368 {
3369 axisRect()->setBackground(m_focusedBrush);
3370 }
3371
3372 replot();
3373}
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 2267 of file baseplotwidget.cpp.

2270{
2271 // qDebug() << "With axis:" << (int)axis;
2272
2273 if(static_cast<int>(axis) & static_cast<int>(Enums::Axis::x))
2274 {
2275 xAxis->setRange(xAxisRange.lower, xAxisRange.upper);
2276 }
2277
2278 if(static_cast<int>(axis) & static_cast<int>(Enums::Axis::y))
2279 {
2280 yAxis->setRange(yAxisRange.lower, yAxisRange.upper);
2281 }
2282
2283 // We do not want to update the history, because there would be way too
2284 // much history items, since this function is called upon mouse moving
2285 // handling and not only during mouse release events.
2286 // updateAxesRangeHistory();
2287
2288 replot();
2289}

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

Referenced by yMinMaxOnXAxisCurrentRange().

◆ replotWithAxisRangeX()

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

Definition at line 2292 of file baseplotwidget.cpp.

2293{
2294 // qDebug();
2295
2296 xAxis->setRange(lower, upper);
2297
2298 replot();
2299}

Referenced by yMinMaxOnXAxisCurrentRange().

◆ replotWithAxisRangeY()

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

Definition at line 2302 of file baseplotwidget.cpp.

2303{
2304 // qDebug();
2305
2306 yAxis->setRange(lower, upper);
2307
2308 replot();
2309}

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::addBarsPlot(), pappso::BaseColorMapPlotWidget::addColorMap(), pappso::BaseColorMapPlotWidget::addColorMap(), pappso::BaseTracePlotWidget::addGraphPlot(), axisDoubleClickHandler(), pappso::BaseTracePlotWidget::axisDoubleClickHandler(), pappso::BaseTracePlotWidget::clearGraphData(), and pappso::BaseTracePlotWidget::setGraphData().

◆ resetSelectionRectangle()

void pappso::BasePlotWidget::resetSelectionRectangle ( )
virtual

Definition at line 3272 of file baseplotwidget.cpp.

3273{
3274 static_cast<IntegrationScopeBase *>(m_context.mpa_integrationScope)->reset();
3275}

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 3338 of file baseplotwidget.cpp.

3339{
3340 // qDebug() << "Setting focus to the QCustomPlot:" << this;
3341
3342 QCustomPlot::setFocus();
3343
3344 // qDebug() << "Emitting setFocusSignal().";
3345
3346 emit setFocusSignal();
3347}

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 2333 of file baseplotwidget.cpp.

2334{
2336
2337 mp_vPosTracerItem->setVisible(true);
2338 mp_hPosTracerItem->setVisible(true);
2339
2340 mp_vStartTracerItem->setVisible(true);
2341 mp_vEndTracerItem->setVisible(true);
2342
2343 // Force a replot to make sure the action is immediately visible by the
2344 // user, even without moving the mouse.
2345 replot();
2346}

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 3376 of file baseplotwidget.cpp.

3377{
3378 m_context.m_xRange = QCPRange(xAxis->range().lower, xAxis->range().upper);
3379 m_context.m_yRange = QCPRange(yAxis->range().lower, yAxis->range().upper);
3380
3381 // qDebug() << "The new updated context: " << m_context.toString();
3382}

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 2683 of file baseplotwidget.cpp.

2684{
2685
2686 // if(for_integration)
2687 // qDebug() << "for_integration:" << for_integration;
2688
2689 // By essence, the one-dimension IntegrationScope is characterized
2690 // by the left-most point and the width. Using these two data bits
2691 // it is possible to compute the x value of the right-most point.
2692
2693 double x_range_start =
2694 std::min(m_context.m_currentDragPoint.x(), m_context.m_startDragPoint.x());
2695 double x_range_end =
2696 std::max(m_context.m_currentDragPoint.x(), m_context.m_startDragPoint.x());
2697
2698 // qDebug() << "x_range_start:" << x_range_start << "-" << "x_range_end:" <<
2699 // x_range_end;
2700
2701 double y_position = m_context.m_startDragPoint.y();
2702
2703 m_context.updateIntegrationScope();
2704
2705 // Top line
2706 mp_selectionRectangeLine1->start->setCoords(
2707 QPointF(x_range_start, y_position));
2708 mp_selectionRectangeLine1->end->setCoords(QPointF(x_range_end, y_position));
2709
2710 // Only if we are drawing a selection rectangle for integration, do we set
2711 // arrow heads to the line.
2712 if(for_integration)
2713 {
2714 mp_selectionRectangeLine1->setHead(QCPLineEnding::esSpikeArrow);
2715 mp_selectionRectangeLine1->setTail(QCPLineEnding::esSpikeArrow);
2716 }
2717 else
2718 {
2719 mp_selectionRectangeLine1->setHead(QCPLineEnding::esNone);
2720 mp_selectionRectangeLine1->setTail(QCPLineEnding::esNone);
2721 }
2722 mp_selectionRectangeLine1->setVisible(true);
2723
2724 // Right line: does not exist, start and end are the same end point of the
2725 // top line.
2726 mp_selectionRectangeLine2->start->setCoords(QPointF(x_range_end, y_position));
2727 mp_selectionRectangeLine2->end->setCoords(QPointF(x_range_end, y_position));
2728 mp_selectionRectangeLine2->setVisible(false);
2729
2730 // Bottom line: identical to the top line, but invisible
2731 mp_selectionRectangeLine3->start->setCoords(
2732 QPointF(x_range_start, y_position));
2733 mp_selectionRectangeLine3->end->setCoords(QPointF(x_range_end, y_position));
2734 mp_selectionRectangeLine3->setVisible(false);
2735
2736 // Left line: does not exist: start and end are the same end point of the
2737 // top line.
2738 mp_selectionRectangeLine4->start->setCoords(QPointF(x_range_end, y_position));
2739 mp_selectionRectangeLine4->end->setCoords(QPointF(x_range_end, y_position));
2740 mp_selectionRectangeLine4->setVisible(false);
2741}

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 3138 of file baseplotwidget.cpp.

3140{
3141 // qDebug() << "as_line_segment:" << as_line_segment;
3142 // qDebug() << "for_integration:" << for_integration;
3143
3144 // We now need to construct the selection rectangle, either for zoom or for
3145 // integration.
3146
3147 // There are two situations :
3148 //
3149 // 1. if the rectangle should look like a line segment
3150 //
3151 // 2. if the rectangle should actually look like a rectangle. In this case,
3152 // there are two sub-situations:
3153 //
3154 // a. if the Alt modifier key is down, then the rectangle is rhomboid.
3155 //
3156 // b. otherwise the rectangle is conventional.
3157
3158 if(as_line_segment)
3159 {
3160 // qDebug() << "Updating the integration scope to an IntegrationScope.";
3161 updateIntegrationScope(for_integration);
3162 }
3163 else
3164 {
3165 if(!(m_context.m_keyboardModifiers & Qt::AltModifier))
3166 {
3167 // qDebug()
3168 // << "Updating the integration scope to an IntegrationScopeRect.";
3169 updateIntegrationScopeRect(for_integration);
3170 }
3171 else if(m_context.m_keyboardModifiers & Qt::AltModifier)
3172 {
3173 // The user might use the Alt modifier, but if no rhomboid side has
3174 // been defined using the S key, then we do not do any rhomboid
3175 // selection because we do not know the side size of that rhomboid.
3176
3177 if(!m_context.m_integrationScopeRhombHeight &&
3178 !m_context.m_integrationScopeRhombWidth)
3179 updateIntegrationScopeRect(for_integration);
3180 else
3181 // qDebug()
3182 // << "Updating the integration scope to an
3183 // IntegrationScopeRhomb.";
3184 updateIntegrationScopeRhomb(for_integration);
3185 }
3186 }
3187
3188 // Depending on the kind of IntegrationScope, (normal, rect or rhomb)
3189 // we have to measure things in different ways. We now set in the context
3190 // a number of parameters that will be used by its user.
3191
3192 QPointF point;
3193 double height;
3194 std::vector<QPointF> points;
3195
3196 // Integration scope values are sorted:
3197 // Line scope: point is left and width is right.x - left.x
3198 // Rect scope: point is bottom left.
3199 // Rhomb scope: points 1->4 are bottom left->bottom right->top right->top left
3200 // width is 2.x - 1.x.
3201
3202 if(m_context.mpa_integrationScope->getPoints(points))
3203 {
3204 // We have defined a IntegrationScopeRhomb.
3205
3206 if(!m_context.mpa_integrationScope->getLeftMostPoint(point))
3207 qFatal("Failed to get LeftMost point.");
3208 m_context.m_xRegionRangeStart = point.x();
3209
3210 if(!m_context.mpa_integrationScope->getRightMostPoint(point))
3211 qFatal("Failed to get RightMost point.");
3212 m_context.m_xRegionRangeStop = point.x();
3213 }
3214 else if(m_context.mpa_integrationScope->getHeight(height))
3215 {
3216 // We have defined a IntegrationScopeRect.
3217
3218 if(!m_context.mpa_integrationScope->getPoint(point))
3219 qFatal("Failed to get point.");
3220 m_context.m_xRegionRangeStart = point.x();
3221
3222 double width;
3223
3224 if(!m_context.mpa_integrationScope->getWidth(width))
3225 qFatal("Failed to get width.");
3226
3227 m_context.m_xRegionRangeStop = m_context.m_xRegionRangeStart + width;
3228
3229 m_context.m_yRegionRangeStart = point.y();
3230
3231 m_context.m_yRegionRangeStop = point.y() + height;
3232 }
3233 else
3234 {
3235 // We have defined a IntegrationScope.
3236
3237 if(!m_context.mpa_integrationScope->getPoint(point))
3238 qFatal("Failed to get point.");
3239 m_context.m_xRegionRangeStart = point.x();
3240
3241 double width;
3242
3243 if(!m_context.mpa_integrationScope->getWidth(width))
3244 qFatal("Failed to get width.");
3245 m_context.m_xRegionRangeStop = m_context.m_xRegionRangeStart + width;
3246 }
3247
3248 // At this point, draw the text describing the widths.
3249
3250 // We want the x-delta on the bottom of the rectangle, inside it
3251 // and the y-delta on the vertical side of the rectangle, inside it.
3252
3253 // Draw the selection width text
3255}
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 2828 of file baseplotwidget.cpp.

2829{
2830 // We are handling a rhomboid scope, that is, a rectangle that
2831 // is tilted either to the left or to the right.
2832
2833 // There are two kinds of rhomboid integration scopes: horizontal and
2834 // vertical.
2835
2836 /*
2837 * +----------+
2838 * | |
2839 * | |
2840 * | |
2841 * | |
2842 * | |
2843 * | |
2844 * | |
2845 * +----------+
2846 * ----width---
2847 */
2848
2849 // As visible here, the fixed size of the rhomboid (using the S key in the
2850 // plot widget) is the *horizontal* side (this is the plot context's
2851 // m_integrationScopeRhombWidth).
2852
2853 IntegrationScopeFeatures scope_features;
2854
2855 // Top horizontal line
2856 QPointF point_1;
2857 scope_features = m_context.mpa_integrationScope->getLeftMostTopPoint(point_1);
2858
2859 // When the user rotates the horizontal rhomboid, at some point, if the
2860 // current drag point has the same y axis value as the start drag point, then
2861 // we say that the rhomboid is flattened on the x axis. In this case, we do
2862 // not draw anything as this is a purely unusable situation.
2863
2864 if(scope_features & IntegrationScopeFeatures::FLAT_ON_X_AXIS)
2865 {
2866 // qDebug() << "The horizontal rhomboid is flattened on the x axis.";
2867
2868 mp_selectionRectangeLine1->setVisible(false);
2869 mp_selectionRectangeLine2->setVisible(false);
2870 mp_selectionRectangeLine3->setVisible(false);
2871 mp_selectionRectangeLine4->setVisible(false);
2872
2873 return;
2874 }
2875
2877 qFatal("The rhomboid should be horizontal!");
2878
2879 // At this point we can draw the rhomboid fine.
2880
2881 if(!m_context.mpa_integrationScope->getLeftMostTopPoint(point_1))
2882 qFatal("Failed to getLeftMostTopPoint.");
2883 QPointF point_2;
2884 if(!m_context.mpa_integrationScope->getRightMostTopPoint(point_2))
2885 qFatal("Failed to getRightMostTopPoint.");
2886
2887 // qDebug() << "For top line, two points:" << point_1 << "--" << point_2;
2888
2889 mp_selectionRectangeLine1->start->setCoords(point_1);
2890 mp_selectionRectangeLine1->end->setCoords(point_2);
2891
2892 // Only if we are drawing a selection rectangle for integration, do we set
2893 // arrow heads to the line.
2894 if(for_integration)
2895 {
2896 mp_selectionRectangeLine1->setHead(QCPLineEnding::esSpikeArrow);
2897 mp_selectionRectangeLine1->setTail(QCPLineEnding::esSpikeArrow);
2898 }
2899 else
2900 {
2901 mp_selectionRectangeLine1->setHead(QCPLineEnding::esNone);
2902 mp_selectionRectangeLine1->setTail(QCPLineEnding::esNone);
2903 }
2904
2905 mp_selectionRectangeLine1->setVisible(true);
2906
2907 // Right line
2908 if(!m_context.mpa_integrationScope->getRightMostBottomPoint(point_1))
2909 qFatal("Failed to getRightMostBottomPoint.");
2910 mp_selectionRectangeLine2->start->setCoords(point_2);
2911 mp_selectionRectangeLine2->end->setCoords(point_1);
2912 mp_selectionRectangeLine2->setVisible(true);
2913
2914 // qDebug() << "For right line, two points:" << point_2 << "--" << point_1;
2915
2916 // Bottom horizontal line
2917 if(!m_context.mpa_integrationScope->getLeftMostBottomPoint(point_2))
2918 qFatal("Failed to getLeftMostBottomPoint.");
2919 mp_selectionRectangeLine3->start->setCoords(point_1);
2920 mp_selectionRectangeLine3->end->setCoords(point_2);
2921 mp_selectionRectangeLine3->setVisible(true);
2922
2923 // qDebug() << "For bottom line, two points:" << point_1 << "--" << point_2;
2924
2925 // Left line
2926 if(!m_context.mpa_integrationScope->getLeftMostTopPoint(point_1))
2927 qFatal("Failed to getLeftMostTopPoint.");
2928 mp_selectionRectangeLine4->end->setCoords(point_2);
2929 mp_selectionRectangeLine4->start->setCoords(point_1);
2930 mp_selectionRectangeLine4->setVisible(true);
2931
2932 // qDebug() << "For left line, two points:" << point_2 << "--" << point_1;
2933}

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 2744 of file baseplotwidget.cpp.

2745{
2746 // qDebug();
2747
2748 // if(for_integration)
2749 // qDebug() << "for_integration:" << for_integration;
2750
2751 // We are handling a conventional rectangle. Just create four points
2752 // from top left to bottom right. But we want the top left point to be
2753 // effectively the top left point and the bottom point to be the bottom
2754 // point. So we need to try all four direction combinations, left to right
2755 // or converse versus top to bottom or converse.
2756
2757 m_context.updateIntegrationScopeRect();
2758
2759 // Now that the integration scope has been updated as a rectangle,
2760 // use these newly set data to actually draw the integration
2761 // scope lines.
2762
2763 QPointF bottom_left_point;
2764 if(!m_context.mpa_integrationScope->getPoint(bottom_left_point))
2765 qFatal("Failed to get point.");
2766 // qDebug() << "Starting point is left bottom point:" << bottom_left_point;
2767
2768 double width;
2769 if(!m_context.mpa_integrationScope->getWidth(width))
2770 qFatal("Failed to get width.");
2771 // qDebug() << "Width:" << width;
2772
2773 double height;
2774 if(!m_context.mpa_integrationScope->getHeight(height))
2775 qFatal("Failed to get height.");
2776 // qDebug() << "Height:" << height;
2777
2778 QPointF bottom_right_point(bottom_left_point.x() + width,
2779 bottom_left_point.y());
2780 // qDebug() << "bottom_right_point:" << bottom_right_point;
2781
2782 QPointF top_right_point(bottom_left_point.x() + width,
2783 bottom_left_point.y() + height);
2784 // qDebug() << "top_right_point:" << top_right_point;
2785
2786 QPointF top_left_point(bottom_left_point.x(), bottom_left_point.y() + height);
2787
2788 // qDebug() << "top_left_point:" << top_left_point;
2789
2790 // Start by drawing the bottom line because the IntegrationScopeRect has the
2791 // left bottom point and the width and the height to fully characterize it.
2792
2793 // Bottom line (left to right)
2794 mp_selectionRectangeLine3->start->setCoords(bottom_left_point);
2795 mp_selectionRectangeLine3->end->setCoords(bottom_right_point);
2796 mp_selectionRectangeLine3->setVisible(true);
2797
2798 // Right line (bottom to top)
2799 mp_selectionRectangeLine2->start->setCoords(bottom_right_point);
2800 mp_selectionRectangeLine2->end->setCoords(top_right_point);
2801 mp_selectionRectangeLine2->setVisible(true);
2802
2803 // Top line (right to left)
2804 mp_selectionRectangeLine1->start->setCoords(top_right_point);
2805 mp_selectionRectangeLine1->end->setCoords(top_left_point);
2806 mp_selectionRectangeLine1->setVisible(true);
2807
2808 // Left line (top to bottom)
2809 mp_selectionRectangeLine4->start->setCoords(top_left_point);
2810 mp_selectionRectangeLine4->end->setCoords(bottom_left_point);
2811 mp_selectionRectangeLine4->setVisible(true);
2812
2813 // Only if we are drawing a selection rectangle for integration, do we
2814 // set arrow heads to the line.
2815 if(for_integration)
2816 {
2817 mp_selectionRectangeLine1->setHead(QCPLineEnding::esSpikeArrow);
2818 mp_selectionRectangeLine1->setTail(QCPLineEnding::esSpikeArrow);
2819 }
2820 else
2821 {
2822 mp_selectionRectangeLine1->setHead(QCPLineEnding::esNone);
2823 mp_selectionRectangeLine1->setTail(QCPLineEnding::esNone);
2824 }
2825}

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 3050 of file baseplotwidget.cpp.

3051{
3052 // qDebug();
3053
3054 // if(for_integration)
3055 // qDebug() << "for_integration:" << for_integration;
3056
3057 // We are handling a skewed rectangle (rhomboid), that is a rectangle that
3058 // is tilted either to the left or to the right.
3059
3060 // There are two kinds of rhomboid integration scopes:
3061
3062 /*
3063 4+----------+3
3064 | |
3065 | |
3066 | |
3067 | |
3068 | |
3069 | |
3070 | |
3071 1+----------+2
3072 ----width---
3073 */
3074
3075 // As visible here, the fixed size of the rhomboid (using the S key in the
3076 // plot widget) is the *horizontal* side (this is the plot context's
3077 // m_integrationScopeRhombWidth).
3078
3079 // and
3080
3081
3082 /*
3083 * +3
3084 * . |
3085 * . |
3086 * . |
3087 * . +2
3088 * . .
3089 * . .
3090 * . .
3091 * 4+ .
3092 * | | .
3093 * height | | .
3094 * | | .
3095 * 1+
3096 *
3097 */
3098
3099 // As visible here, the fixed size of the rhomboid (using the S key in the
3100 // plot widget) is the *vertical* side (this is the plot context's
3101 // m_integrationScopeRhombHeight).
3102
3103 // qDebug() << "Before calling updateIntegrationScopeRhomb(), "
3104 // "m_integrationScopeRhombWidth:"
3105 // << m_context.m_integrationScopeRhombWidth
3106 // << "and m_integrationScopeRhombHeight:"
3107 // << m_context.m_integrationScopeRhombHeight;
3108
3109 m_context.updateIntegrationScopeRhomb();
3110
3111 // qDebug() << "After, m_integrationScopeRhombWidth:"
3112 // << m_context.m_integrationScopeRhombWidth
3113 // << "and m_integrationScopeRhombHeight:"
3114 // << m_context.m_integrationScopeRhombHeight;
3115
3116 // Now that the integration scope has been updated as a rhomboid,
3117 // use these newly set data to actually draw the integration
3118 // scope lines.
3119
3120 // We thus need to first establish if we have a horiontal or a vertical
3121 // rhomboid scope. This information is located in
3122 // m_context.m_integrationScopeRhombWidth and
3123 // m_context.m_integrationScopeRhombHeight. If width > 0, height *has to be
3124 // 0*, which indicates a horizontal rhomb.Conversely, if height is > 0, then
3125 // the rhomb is vertical.
3126
3127 if(m_context.m_integrationScopeRhombWidth > 0)
3128 // We are dealing with a horizontal scope.
3130 else if(m_context.m_integrationScopeRhombHeight > 0)
3131 // We are dealing with a vertical scope.
3132 updateIntegrationScopeVerticalRhomb(for_integration);
3133 else
3134 qFatal("Cannot be both the width or height of rhomboid scope be 0.");
3135}
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 2936 of file baseplotwidget.cpp.

2937{
2938 // We are handling a rhomboid scope, that is, a rectangle that
2939 // is tilted either to the left or to the right.
2940
2941 // There are two kinds of rhomboid integration scopes: horizontal and
2942 // vertical.
2943
2944 /*
2945 * +3
2946 * . |
2947 * . |
2948 * . |
2949 * . +2
2950 * . .
2951 * . .
2952 * . .
2953 * 4+ .
2954 * | | .
2955 * height | | .
2956 * | | .
2957 * 1+
2958 *
2959 */
2960
2961 // As visible here, the fixed size of the rhomboid (using the S key in the
2962 // plot widget) is the *vertical* side (this is the plot context's
2963 // m_integrationScopeRhombHeight).
2964
2965 IntegrationScopeFeatures scope_features;
2966
2967 // Left vertical line
2968 QPointF point_1;
2969 scope_features = m_context.mpa_integrationScope->getLeftMostTopPoint(point_1);
2970
2971 // When the user rotates the vertical rhomboid, at some point, if the current
2972 // drag point is on the same x axis value as the start drag point, then we say
2973 // that the rhomboid is flattened on the y axis. In this case, we do not draw
2974 // anything as this is a purely unusable situation.
2975
2976 if(scope_features & IntegrationScopeFeatures::FLAT_ON_Y_AXIS)
2977 {
2978 // qDebug() << "The vertical rhomboid is flattened on the y axis.";
2979
2980 mp_selectionRectangeLine1->setVisible(false);
2981 mp_selectionRectangeLine2->setVisible(false);
2982 mp_selectionRectangeLine3->setVisible(false);
2983 mp_selectionRectangeLine4->setVisible(false);
2984
2985 return;
2986 }
2987
2989 qFatal("The rhomboid should be vertical!");
2990
2991 // At this point we can draw the rhomboid fine.
2992
2993 QPointF point_2;
2994 if(!m_context.mpa_integrationScope->getLeftMostBottomPoint(point_2))
2995 qFatal("Failed to getLeftMostBottomPoint.");
2996
2997 // qDebug() << "For left vertical line, two points:" << point_1 << "--"
2998 // << point_2;
2999
3000 mp_selectionRectangeLine1->start->setCoords(point_1);
3001 mp_selectionRectangeLine1->end->setCoords(point_2);
3002
3003 // Only if we are drawing a selection rectangle for integration, do we set
3004 // arrow heads to the line.
3005 if(for_integration)
3006 {
3007 mp_selectionRectangeLine1->setHead(QCPLineEnding::esSpikeArrow);
3008 mp_selectionRectangeLine1->setTail(QCPLineEnding::esSpikeArrow);
3009 }
3010 else
3011 {
3012 mp_selectionRectangeLine1->setHead(QCPLineEnding::esNone);
3013 mp_selectionRectangeLine1->setTail(QCPLineEnding::esNone);
3014 }
3015
3016 mp_selectionRectangeLine1->setVisible(true);
3017
3018 // Lower oblique line
3019 if(!m_context.mpa_integrationScope->getRightMostBottomPoint(point_1))
3020 qFatal("Failed to getRightMostBottomPoint.");
3021 mp_selectionRectangeLine2->start->setCoords(point_2);
3022 mp_selectionRectangeLine2->end->setCoords(point_1);
3023 mp_selectionRectangeLine2->setVisible(true);
3024
3025 // qDebug() << "For lower oblique line, two points:" << point_2 << "--"
3026 // << point_1;
3027
3028 // Right vertical line
3029 if(!m_context.mpa_integrationScope->getRightMostTopPoint(point_2))
3030 qFatal("Failed to getRightMostTopPoint.");
3031 mp_selectionRectangeLine3->start->setCoords(point_1);
3032 mp_selectionRectangeLine3->end->setCoords(point_2);
3033 mp_selectionRectangeLine3->setVisible(true);
3034
3035 // qDebug() << "For right vertical line, two points:" << point_1 << "--"
3036 // << point_2;
3037
3038 // Upper oblique line
3039 if(!m_context.mpa_integrationScope->getLeftMostTopPoint(point_1))
3040 qFatal("Failed to get the LeftMostTopPoint.");
3041 mp_selectionRectangeLine4->end->setCoords(point_2);
3042 mp_selectionRectangeLine4->start->setCoords(point_1);
3043 mp_selectionRectangeLine4->setVisible(true);
3044
3045 // qDebug() << "For upper oblique line, two points:" << point_2 << "--"
3046 // << point_1;
3047}

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 3278 of file baseplotwidget.cpp.

3279{
3280 // There are four lines that make the selection polygon. We want to know
3281 // which lines are visible.
3282
3283 int current_selection_polygon =
3284 static_cast<int>(SelectionDrawingLines::NOT_SET);
3285
3286 if(mp_selectionRectangeLine1->visible())
3287 {
3288 current_selection_polygon |=
3289 static_cast<int>(SelectionDrawingLines::TOP_LINE);
3290 // qDebug() << "current_selection_polygon:" <<
3291 // current_selection_polygon;
3292 }
3293 if(mp_selectionRectangeLine2->visible())
3294 {
3295 current_selection_polygon |=
3296 static_cast<int>(SelectionDrawingLines::RIGHT_LINE);
3297 // qDebug() << "current_selection_polygon:" <<
3298 // current_selection_polygon;
3299 }
3300 if(mp_selectionRectangeLine3->visible())
3301 {
3302 current_selection_polygon |=
3303 static_cast<int>(SelectionDrawingLines::BOTTOM_LINE);
3304 // qDebug() << "current_selection_polygon:" <<
3305 // current_selection_polygon;
3306 }
3307 if(mp_selectionRectangeLine4->visible())
3308 {
3309 current_selection_polygon |=
3310 static_cast<int>(SelectionDrawingLines::LEFT_LINE);
3311 // qDebug() << "current_selection_polygon:" <<
3312 // current_selection_polygon;
3313 }
3314
3315 // qDebug() << "returning visibility:" << current_selection_polygon;
3316
3317 return static_cast<SelectionDrawingLines>(current_selection_polygon);
3318}

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 290 of file baseplotwidget.h.

Referenced by BasePlotWidget().

◆ m_axisLabelY

QString pappso::BasePlotWidget::m_axisLabelY
protected

Definition at line 291 of file baseplotwidget.h.

Referenced by BasePlotWidget().

◆ m_context

BasePlotContext pappso::BasePlotWidget::m_context
protected

Definition at line 293 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 285 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 288 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 374 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 372 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 335 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 353 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 361 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 282 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 377 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 312 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 369 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 367 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 338 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 341 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 308 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: