JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
jkqtplotter.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3
4
5
6 This software is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef JKQTPLOTTER_H
21#define JKQTPLOTTER_H
22
23
24#include <QWidget>
25#include <QVector>
26#include <QSettings>
27#include <QColor>
28#include <QMap>
29#include <QVector>
30#include <QScrollArea>
31#include <QVBoxLayout>
32#include <QToolBar>
33#include <QGridLayout>
34#include <QListWidget>
35#include <QListWidgetItem>
36#include <QToolBar>
37#include <QPointer>
38#include <QTimer>
39#include <QHash>
40#include <vector>
41#include <cmath>
42#include <iostream>
43#include <atomic>
44
45#include "jkqtplotter/jkqtpbaseplotter.h"
46#include "jkqtplotter/jkqtplotterstyle.h"
47#include "jkqtplotter/jkqtpbaseplotterstyle.h"
48#include "jkqtplotter/jkqtptools.h"
49#include "jkqtplotter/jkqtpgraphsbase.h"
50#include "jkqtplotter/jkqtplotter_imexport.h"
51#include "jkqtplotter/gui/jkvanishqtoolbar.h"
52#include <QKeyEvent>
53
54/** \brief initialized Qt-ressources necessary for JKQTPlotter
55 * \ingroup jkqtpplottersupprt
56*/
58
59
60/** \brief plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
61 * \ingroup jkqtpplotterclasses
62 *
63 * This class is a QWidget-wrapper around JKQTBasePlotter. It uses the tools from JKQTBasePlotter
64 * to display scientific plots. This class mostly adds the Widget for the output and adds different
65 * types of user interactions.
66 *
67 * <b>Please have a look at the documentation of JKQTBasePlotter for details on the management of graphs
68 * and the formating/styling of the plot and graphs!</b>
69 *
70 * The rest of this documentation ins split into sections that each treat a special topic, as outlines below:
71 *
72 * \tableofcontents
73 *
74 *
75 * \section JKQTPLOTTER_BASICUSAGE Basic Usage of JKQTPlotter
76 *
77 * \copydetails jkqtplotter_general_usage_jkqtplotter
78 *
79 *
80 * \section JKQTPLOTTER_SYNCMULTIPLOT Synchronizing Several Plots
81 *
82 * Often a single plot is not sufficient, but several plots need to be aligned with respect to each other:
83 *
84 * \image html multiplot.png
85 *
86 * In the Qt Window this is achieved by placing several JKQTPlotter objects into a <a href="http://doc.qt.io/qt-5/qgridlayout.html">QGridLayout</a>.
87 * In order to support this alignment, also when exporting/printing a plot, and when the user interactions with the plot (e.g. zooming),
88 * JKQTPlotter offers an API which allows to :
89 * <ul>
90 * <li> <b>declare (grid-like) relations between plots for export/printing</b>
91 * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos() and \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_SYNC</li>
92 * <li> <b>synchronize axes/plots</b>
93 * \see synchronizeXToMaster(), synchronizeYToMaster(), resetMasterSynchronization() and \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT</li>
94 * </ul>
95 *
96 *
97 * \note This API adopts and extends the possibilities of JKQTBasePlotter. Please see the documentation there for details:
98 * <ul>
99 * <li> \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
100 * <ul>
101 * <li> \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_SYNC</li>
102 * <li> \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT</li>
103 * </ul>
104 * </ul>
105 *
106 *
107 *
108 * \section JKQTPLOTTER_USERINTERACTION User-Interactions/GUI Features
109 *
110 * JKQTPlotter offers a lot of user-interaction features out of the box. These are detailed below.
111 *
112 * \subsection JKQTPLOTTER_CONTEXTMENU Context Menu of JKQTPlotter
113 *
114 * The class JKQTPlotter has a context menu that already offers a lot of functionality.
115 *
116 * \image html jkqtplotter_defaultcontextmenu.png
117 *
118 * \image html contextmenu_graphvisibility.gif
119 *
120 * It allows to:
121 * <ul>
122 * <li> copy or save the data from the internal JKQTPDatastore</li>
123 * <li> copy or save the plot to an image file (PNG, PDF, ...), includes a softisticated export-preview dialog:
124 *
125 * \image html jkqtplotter_exportpreviewdialog.png
126 * </li>
127 * <li> print the plot (includes a softisticated print-preview dialog):
128 *
129 * \image html jkqtplotter_printpreview.png "Print Preview Dialog"
130 *
131 * \image html jkqtplotter_printpreview_relsize_mullinewidth_mulfonts.png "Print Preview Dialog with modified (relative) size, line-width and font-size"
132 * </li>
133 * <li> open a dialog with a table of the plot data:
134 *
135 * \image html jkqtplotter_datatabledialog.png "Data Table Dialog (with buttons to save or copy the data)"
136 * </li>
137 * <li> zoom into/out of the plot and determine an auto-zoom, which shows all of the plot data</li>
138 * <li> switch the visibility of the different graphs in the plot</li>
139 * </ul>
140 *
141 * You can activate this menu, by setting \c setContextMenuMode(jkqtpcmmStandardContextMenu); and binding a mouse-action (typically the right-click)
142 * to the context menu by calling \c deregisterMouseDragAction(Qt::RightButton,Qt::NoModifier) which deregisters any user actions from the rhs single
143 * mouse click. In that case, the context menu is opened by default (see setContextMenuMode() to choose the mode of the context menu).
144 *
145 *
146 * In addition JKQTPlotter provides several ways to customize this menu:
147 * - You can add additional actions to the JKQTPlotter, by calling `JKQTPlotter::addAction()` (i.e. using the default Qt mechanism)
148 * and/or by adding actions to the internal JKQTBasePlotter, using `JKQTBasePlotter::registerAdditionalAction()`
149 * - You can modify the menu, when it is displayed, by connecting a slot to the signal `JKQTPlotter::contextMenuOPened(x,y,menu)`:
150 * \code
151 * connect(plot, SIGNAL(contextMenuOpened(double, double, QMenu*)), this, SLOT(contextMenuOpened(double, double, QMenu*)));
152 *
153 * // ...
154 *
155 * void TestUserInteraction::contextMenuOpened(double x, double y, QMenu *contextMenu)
156 * {
157 * contextMenu->addSeparator();
158 * QAction* act=contextMenu->addMenu(QString("contextMenuOpened(x=%1, y=%2)").arg(x).arg(y))->addAction("user-added action");
159 * connect(act, &QAction::triggered, [x,y]() { QMessageBox::warning(nullptr, tr("Plot Context Menu"),
160 * tr("Context Menu was opened at x/y=%1/%2!").arg(x).arg(y),
161 * QMessageBox::Ok,
162 * QMessageBox::Ok); });
163 * labMouseAction->setText(QString("contextMenuOpened(x=%1, y=%2)").arg(x).arg(y));
164 * }
165 * \endcode
166 * .
167 *
168 * \subsection JKQTPLOTTER_SPECIALCONTEXTMENU Special (User-Defined) Context Menu of JKQTPlotter
169 *
170 * In addition to the standard context menu, JKQTPlotter can also be configures to display a special, user-defined context menu.
171 * To do so, call `\c setContextMenuMode(jkqtpcmmSpecialContextMenu) and set your menu, by calling \c setSpecialContextMenu()
172 * You can also combine the special menu and the standard menu, by calling \c setContextMenuMode(jkqtpcmmStandardAndSpecialContextMenu) .
173 *
174 * You can also use the signal contextMenuOpened() to modify the special context menu, but note that alterations to this menu are permanently
175 * stored in the special menu object. See contextMenuOpened() for a detailed discussion and ways to circumvent this!
176 *
177 *
178 * \subsection JKQTPLOTTER_TOOLBAR Toolbar of JKQTPlotter
179 *
180 * In addition to the context-menu, a JKQtPlotter also also provides a toolbar at its top that offers
181 * most of the functionality of the context menu. Usually this toolbar is enabled (see toolbarEnabled)
182 * and is in a mode where it is hidden, until the mouse moves over an area at the top of the plot (see toolbarAlwaysOn):
183 *
184 * \image html jkqtplotter_toolbar_hidden.png "Hidden Toolbar"
185 * \image html jkqtplotter_toolbar_shown.png "Shown Toolbar"
186 *
187 * \image html jkqtvanishtoolbar.gif
188 *
189 * If toolbarAlwaysOn is set to \c true (setToolbarAlwaysOn() ), the toolbar is always displayed:
190 *
191 * \image html jkqtplotter_toolbar_alwayson.png
192 *
193 * \see toolbarEnabled, toolbarAlwaysOn, \ref JKQTPlotterUserInteraction
194 *
195 *
196 *
197 * \subsection JKQTPLOTTER_ACTIONS QActions from a JKQTPlotter
198 * Often you want to allow the suer to operate a plot from a user-defined QToolBar or a QMenu/QMenuBar in your
199 * application (e.g. provide zooming commands ...). there are generally two ways to achieve this:
200 * <ol>
201 * <li> Simply connect home-brewn QAction instances to the slots provided by JKQTPlotter and JKQTBasePlotter.
202 * This also allows you to connect different plot properties to edit widgets in your forms.
203 * \code
204 * // add a checkbox to show and hide the position display label in the plot
205 * chkPositionDisplay=new QCheckBox(tr("show mouse cursor position"), this);
206 * chkPositionDisplay->setChecked(plot->isMousePositionShown());
207 * connect(chkPositionDisplay, SIGNAL(toggled(bool)), plot, SLOT(setMousePositionShown(bool)));
208 * \endcode
209 * </li>
210 * <li> For several functions (especially those also present in JKQTPlotter's context-emun, you can also find
211 * readily available QAction instances. these are available from JKQTBasePlotter (e.g. by JKQTBasePlotter::getActionPrint() ...).
212 * From JKQTPlotter you therefor have to use: <code>getPlotter()->getActionPrint()</code>
213 * \code
214 * // add some of the default QActions from the JKQTPlotter to the window menu
215 * // Some of the are also available in the context menu and toolbar of the JKQTPlotter
216 * // others are not
217 * QMenu* menuPlot=menuBar()->addMenu("Plot-Menu");
218 * menuPlot->addAction(plot->getPlotter()->getActionPrint());
219 * QMenu* menuPlotS=menuPlot->addMenu("Save ...");
220 * menuPlotS->addAction(plot->getPlotter()->getActionSaveData());
221 * menuPlotS->addAction(plot->getPlotter()->getActionSavePDF()); // not available from JKQTPlotter by default
222 * menuPlotS->addAction(plot->getPlotter()->getActionSavePlot());
223 * \endcode
224 * </li>
225 * </ol>
226 * \see \ref JKQTPlotterUserInteraction
227 *
228 *
229 *
230 * \subsection JKQTPLOTTER_USERMOUSEINTERACTION Mouse-Interaction in JKQTPlotter
231 *
232 * This section summarizes all user-interaction functions in JKQTPlotter that somehow relate to the mouse.
233 * These are:
234 * - \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG
235 * - \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSECLICK
236 * - \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEWHEEL
237 * - \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE
238 * .
239 *
240 * \note Zooming and Paning interactions apply to both axes when they are performed with the mouse
241 * inside the plot. They are limited to one of the two axes, when the mouse hovers over that axis
242 * (e.g. when you zoom by mouse-wheel while the mouse pointer is below the plot, over the x-axis,
243 * only the x-axis is affected by the operation).
244 *
245 * \subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG Actions When Dragging the Mouse
246 * JKQTPlotter offers several methods that allow to customize, how it reacts to mouse actions:
247 * - registerMouseDragAction() tells JKQTPlotter to perform a certain action (selected from JKQTPlotter::MouseActionMode)
248 * when a specified mouse button is pushed while a specified (or no) keyborad modifiers (e.g. CTRL,ALT,SHIFT...) is pressed.
249 * By default JKQTPlotter calls these two registers in its constructors:
250 * \code
251 * registerMouseDragAction(Qt::LeftButton, Qt::NoModifier, JKQTPlotter::MouseActionMode::jkqtpmdaZoomByRectangle);
252 * registerMouseDragAction(Qt::LeftButton, Qt::ControlModifier, JKQTPlotter::MouseActionMode::jkqtpmdaPanPlotOnMove);
253 * \endcode
254 * Therefore by default you can draw a zoom rectangle with the left mouse button without modifiers
255 * and you can pan/drag the plot with the left mouse-button while keeping CTRL pressed.
256 * - deregisterMouseDragAction() deletes a previously defined user-interaction
257 * - clearAllRegisteredMouseDragActions() deletes all previously specified user-actions
258 * .
259 *
260 * Pressing the \c ESC key will stop the current JKQTPlotter::MouseActionMode.
261 *
262 * If e.g. the mode JKQTPlotter::MouseActionMode::jkqtpmdaZoomByRectangle is selected, while you drag the mouse, the
263 * zoom rectangle is drawn over the plot. You can modify the style of drawing using these functions:
264 * - setUserActionOverlayPen() sets the pen for (semi-transparent) overlay shapes, e.g. zoom rectangles
265 * - setUserActionOverlayBrush() sets the brush for (semi-transparent) overlay shapes, e.g. zoom rectangles
266 * - setUserActionOpaquePen() sets the pen for opaque overlay shapes, e.g. tool-tips
267 * - setUserActionOpaqueBrush() sets the brush for opaque overlay shapes, e.g. tool-tips
268 * - setUserActionMarkerPen() sets the pen for marker overlay shapes, e.g. with tool-tips
269 * - setUserActionMarkerBrush() sets the brush for marker overlay shapes, e.g. with tool-tips
270 * - setUserActionMarkerDiameter() sets the size of user-action markers
271 * - setUserActionMarkerType() sets the type of user-action markers
272 * .
273 *
274 * \image html zoomin_mouse_contextmenu.gif "Zooming with the mouse"
275 *
276 * \image html draw_rectangle.gif "Draw Rectangle User-Action"
277 *
278 * \image html drag_viewport.gif "Drag the Plot Viewport"
279 *
280 * \image html rulertool.gif "Measurement Ruler Tool"
281 *
282 * \image html tooltiptool.gif "Data Point Tooltip Tool"
283 *
284 *
285 * \subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSECLICK Actions After (Double-)Clicks on the Mouse Buttons
286 * The right mouse button has a special role: If it is single-clicked and no JKQTPlotter::MouseActionMode is specified
287 * for the vent, it opens the context menu, unless you call \c setContextMenuMode(jkqtpcmmNoContextMenu) .
288 * You can also use setContextMenuMode() to specify which type of context menu is shown. See JKQTPContextMenuModes
289 * for details on the available modes.
290 *
291 * For any mouse-click, one of the following signals is emitted:
292 * - plotMouseClicked() for any single-click (during the pressDown-Event!)
293 * - plotMouseDoubleClicked() for any double-click
294 * .
295 *
296 * The reaction to double-clicks of the mouse buttons can be specified separately. The possible
297 * actions are listed in JKQTPMouseDoubleClickActions. You can bind one of these actions
298 * to a specific click with these functions:
299 * - registerMouseDoubleClickAction() tells JKQTPlotter to perform a certain action (selected from JKQTPMouseDoubleClickActions)
300 * when a specified mouse button is pushed while a specified (or no) keyborad modifiers (e.g. CTRL,ALT,SHIFT...) is pressed.
301 * By default JKQTPlotter calls this in its constructors:
302 * \code
303 * registerMouseDoubleClickAction(Qt::LeftButton, Qt::NoModifier, JKQTPMouseDoubleClickActions::jkqtpdcaClickMovesViewport);
304 * \endcode
305 * Therefore by default you can pan the plot/move the viewport by double clicking a location
306 * - deregisterMouseDoubleClickAction() deletes a previously defined user-interaction
307 * - clearAllRegisteredMouseDoubleClickAction() deletes all previously specified user-actions
308 * .
309 * The button to react to is specified as a parameter.
310 *
311 * \image html contextmenu_graphvisibility.gif
312 *
313 * \subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEWHEEL Actions When a Mouse Wheel Event Occurs
314 * The actions to be performed when the mouse wheel is operated are specified in JKQTPMouseWheelActions.
315 * You can bind one of these actions to the mouse-wheel (under the condition that a specified Qt::KeyboardModifiers
316 * is pressed) by using these functions:
317 * - registerMouseWheelAction() tells JKQTPlotter to perform a certain action (selected from JKQTPMouseWheelActions)
318 * when a specified mouse button is pushed while a specified (or no) keyborad modifiers (e.g. CTRL,ALT,SHIFT...) is pressed.
319 * By default JKQTPlotter calls this in its constructors:
320 * \code
321 * registerMouseWheelAction(Qt::NoModifier, JKQTPMouseWheelActions::jkqtpmwaZoomByWheel);
322 * \endcode
323 * Therefore by default you can zoom into and out of the plot, using the mouse wheel.
324 * - deregisterMouseWheelAction() deletes a previously defined user-interaction
325 * - clearAllMouseWheelActions() deletes all previously specified user-actions
326 * .
327 * In addition the signal void plotMouseWheelOperated() is emitted whenever a mouse-wheel event occurs.
328 *
329 *
330 * \subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE Mouse Move Signaling and Actions
331 * In addition the signal plotMouseMove() is called whenever the mouse moves over the plot.
332 * Additional signals may be emitted, depending on the currently active JKQTPlotter::MouseActionMode.
333 *
334 * Also the current mouse position is shown above the graph by default (can be switched on or off
335 * using setMousePositionShown() ).
336 *
337 * \image html mousepositiondisplay.gif
338 *
339 * The actions to be performed when the mouse moves without a mouse-button pressed are specified in JKQTPMouseMoveActions.
340 * You can bind one of these actions to the mouse (under the condition that a specified Qt::KeyboardModifiers
341 * is pressed) by using these functions:
342 * - registerMouseMoveAction() tells JKQTPlotter to perform a certain action (selected from JKQTPMouseMoveActions)
343 * when a specified mouse button is pushed while a specified (or no) keyborad modifiers (e.g. CTRL,ALT,SHIFT...) is pressed.
344 * - deregisterMouseMoveAction() deletes a previously defined user-interaction
345 * - clearAllMouseMoveActions() deletes all previously specified user-actions
346 * .
347 *
348 * \subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_FASTRESIZING Fast Resizing of a Plot Widget
349 * When the user resized the widget, the graph would in principle have to be readrawn for every intermediate step.
350 * As this is very timeconsuming, JKQTPlotter uses a different approach: Actual Redrawing is delayed a few 100ms
351 * and this delay is reset whenever the widget size changes. Only after the last delay expires, the plot is redrawn.
352 * In between an image of the last state of the plot is simple stretched/compressed to fill the new/current
353 * widget size. In sum this looks like this:
354 *
355 * \image html jkqtplotter_fastresizing.gif
356 *
357 *
358 *
359 *
360 * \section JKQTPLOTTER_USEQTCREATOR How to use JKQTPlotter in the Qt Form Designer
361 *
362 * \copydetails jkqtplotter_general_usage_qtcreator
363 */
364class JKQTPLOTTER_LIB_EXPORT JKQTPlotter: public QWidget {
365 Q_OBJECT
366 public:
367 /** \brief sets the global resize delay in milliseconds \a delayMS. After calling this function all plots will use the new delay. Setting the the delay to 0 disables the delayed resize feature. This function is thread-safe!
368 *
369 * \see jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer */
370 static void setGlobalResizeDelay(int delayMS);
371 /** \brief returns the currently set global resize delay in milliseconds \a delayMS. This function is thread-safe!
372 *
373 * \see jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer */
375
376 /** \brief class constructor
377 *
378 * If \a datastore_internal \c ==false, you can supply an external JKQTPDatastore with the parameter \a datast
379 */
380 explicit JKQTPlotter(bool datastore_internal, QWidget* parent=nullptr, JKQTPDatastore* datast=nullptr);
381 /** \brief class constructor for a JKQTPlotter using an external JKQTPDatastore \a dataset
382 */
383 explicit JKQTPlotter(JKQTPDatastore* datast, QWidget* parent=nullptr);
384 /** \brief class constructor
385 *
386 * generated a new internal JKQTPDatastore
387 */
388 explicit JKQTPlotter(QWidget* parent=nullptr);
389
390 /** \brief class destructor */
391 virtual ~JKQTPlotter();
392
393 /** reinitializes the toolbar, i.e. fills in QActions added to the QWidget since its creation/the last call to this function */
395
396
397 /** \brief set the width/height of the icons in the toolbar in pt */
398 void setToolbarIconSize(int value);
399
400 /** \brief get the width/height of the icons in the toolbar in pt */
402
403 /** \brief returns the JKQTBasePlotter object internally used for plotting */
404 JKQTBasePlotter* getPlotter() { return plotter; }
405 /** \brief returns the JKQTBasePlotter object internally used for plotting */
406 const JKQTBasePlotter* getPlotter() const { return plotter; }
407 /** \brief returns the JKQTBasePlotter object internally used for plotting */
408 const JKQTBasePlotter* getConstplotter() const { return const_cast<const JKQTBasePlotter*>(plotter); }
409
410
411 /** \copydoc JKQTBasePlotter::getMainKey() */
413 {
414 return plotter->getMainKey();
415 }
416
417 /** \copydoc JKQTBasePlotter::getMainKey() */
418 inline const JKQTPBaseKey* getMainKey() const
419 {
420 return plotter->getMainKey();
421 }
422
423 /** \brief returns whether the toolbar is enabled
424 *
425 * \copydetails JKQTPlotterStyle::toolbarEnabled
426 *
427 * \see setToolbarEnabled(), JKQTPlotterStyle::toolbarEnabled
428 */
429 bool isToolbarEnabled() const;
430 /** \brief returns whether the toolbar is always visible or only when the mouse moves to the upper left area
431 *
432 * \copydetails JKQTPlotterStyle::toolbarAlwaysOn
433 *
434 * \see setToolbarAlwaysOn(), JKQTPlotterStyle::toolbarAlwaysOn
435 */
436 bool isToolbarAlwaysOn() const;
437 /** \brief specifies whether to display the current position of the mouse in the top border of the plot (this may automatically extent the
438 * top border, so the position fits in. The default widget font is used for the output.
439 *
440 * \copydetails JKQTPlotterStyle::displayMousePosition
441 *
442 * \see setMousePositionShown(), JKQTPlotterStyle::displayMousePosition, \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE */
444
445 /** \copydoc JKQTPlotterStyle::userActionOverlayPen
446 *
447 * \see setUserActionOverlayPen(), getUserActionOverlayPen(), JKQTPlotterStyle::userActionOverlayPen \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
449
450 /** \copydoc JKQTPlotterStyle::userActionOverlayBrush
451 *
452 * \see setUserActionOverlayBrush(), getUserActionOverlayBrush(), JKQTPlotterStyle::userActionOverlayBrush \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
454
455 /** \copydoc JKQTPlotterStyle::userActionOpaquePen
456 *
457 * \see setUserActionOpaquePen(), getUserActionOpaquePen(), JKQTPlotterStyle::userActionOpaquePen \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
459
460 /** \copydoc JKQTPlotterStyle::userActionOpaqueBrush
461 *
462 * \see setUserActionOpaqueBrush(), getUserActionOpaqueBrush(), JKQTPlotterStyle::userActionOpaqueBrush \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
464
465 /** \copydoc JKQTPlotterStyle::userActionMarkerPen
466 *
467 * \see setUserActionMarkerPen(), getUserActionMarkerPen(), JKQTPlotterStyle::userActionMarkerPen \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
469
470 /** \copydoc JKQTPlotterStyle::userActionMarkerBrush
471 *
472 * \see setUserActionMarkerBrush(), getUserActionMarkerBrush(), JKQTPlotterStyle::userActionMarkerBrush \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
474
475 /** \copydoc JKQTPlotterStyle::maxTooltipDistance */
477
478 /** \copydoc JKQTPlotterStyle::userActionCatchSensitivity */
480
481 /** \copydoc JKQTPlotterStyle::userActionMarkerDiameter */
483
484 /** \copydoc JKQTPlotterStyle::userActionMarkerType */
486
487
488 /** \brief loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object */
489 void loadSettings(const QSettings &settings, const QString& group=QString("plots/"));
490
491 /** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
492 *
493 * This method only saves those properties that differ from their default value.
494 */
495 void saveSettings(QSettings& settings, const QString& group=QString("plots/")) const;
496
497 /** \brief returns the minimum size of the widget */
498 QSize minimumSizeHint() const override;
499
500 /** \brief returns the size of the widget */
501 QSize sizeHint() const override;
502
503 /** \brief returns \c true, if the JKQTPlotter::resizeTimer is currently running and the widget is waiting for the resize-event to finish
504 *
505 * \see jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer */
507
508
509
510
511 /*! \brief synchronize the plot borders (and zooming) with a given plotter (master --> slave/this)
512
513 This function allows two plotters to draw a graph with exactly the same height or width
514 as in another graph. For example if you want to have two plotters which are positioned one
515 above the other (and have the same widget widths, which could be guaranteed by a QLayout)
516 you may want to make sure that their plotWidth s are always the same. In this case call
517 \code plotter2->synchronizeToMaster(plotter1, sdXAxis, true) \endcode of the lower plotter \c plotter2 .
518 Now whenever the size of plotter1 changes, also plotter2 is redrawn with the changed
519 borders.
520
521 \image html jkqtbaseplotter_synchronization.png "Different Synchronization Settings for synchronizeDirection=sdXAxis"
522
523 \param master the plotter widget to synchronize to
524 \param synchronizeDirection direction in which to synchronize
525 \param synchronizeAxisLength do you want the axis length to be synchronized?
526 \param synchronizeZoomingMasterToSlave if set, also zooming in the master leads to a modification of the linked axes in the slave
527 \param synchronizeZoomingSlaveToMaster if set, also zooming in the slave leads to a modification of the linked axes in the master
528
529 \see synchronizeXToMaster(), synchronizeYToMaster(), resetMasterSynchronization(), \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
530 */
531 void synchronizeToMaster(JKQTPlotter* master, JKQTBasePlotter::SynchronizationDirection synchronizeDirection, bool synchronizeAxisLength=true, bool synchronizeZoomingMasterToSlave=true, bool synchronizeZoomingSlaveToMaster=true);
532
533 /*! \brief synchronize the plot x-axis width (and x-zooming) with a given master plotter (master --> slave/this)
534
535 \param master the plotter widget to synchronize to
536 \param synchronizeAxisLength do you want the axis length to be synchronized?
537 \param synchronizeZoomingMasterToSlave if set, also zooming in the master leads to a modification of the linked axes in the slave
538 \param synchronizeZoomingSlaveToMaster if set, also zooming in the slave leads to a modification of the linked axes in the master
539
540 \image html jkqtbaseplotter_synchronization.png "Different Synchronization Settings for synchronizeDirection=sdXAxis"
541
542 \note This is a short-cut to synchronizeToMaster() with \c synchronizeDirection=csXAxis
543 \see synchronizeToMaster(), synchronizeYToMaster(), resetMasterSynchronization(), \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
544 */
545 void synchronizeXToMaster(JKQTPlotter* master, bool synchronizeAxisLength=true, bool synchronizeZoomingMasterToSlave=true, bool synchronizeZoomingSlaveToMaster=true);
546
547 /*! \brief synchronize the plot y-axis height (and y-zooming) with a given master plotter (master --> slave/this)
548
549 \param master the plotter widget to synchronize to
550 \param synchronizeAxisLength do you want the axis length to be synchronized?
551 \param synchronizeZoomingMasterToSlave if set, also zooming in the master leads to a modification of the linked axes in the slave
552 \param synchronizeZoomingSlaveToMaster if set, also zooming in the slave leads to a modification of the linked axes in the master
553
554 \note This function internally calls JKQTBasePlotter::synchronizeToMaster()
555 \note This is a short-cut to synchronizeToMaster() with \c synchronizeDirection=csXAxis
556 \see synchronizeToMaster(), synchronizeXToMaster(), resetMasterSynchronization(), \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
557
558 */
559 void synchronizeYToMaster(JKQTPlotter* master, bool synchronizeAxisLength=true, bool synchronizeZoomingMasterToSlave=true, bool synchronizeZoomingSlaveToMaster=true);
560
561 /** \brief switches any synchronization off, that has been created by synchronizeToMaster()
562 *
563 * \note This function internally calls JKQTBasePlotter::synchronizeToMaster()
564 \see synchronizeToMaster(), synchronizeXToMaster(), resetMasterSynchronization(), \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
565 */
567
568
569 /*! \brief enables grid-printing for this plot
570 *
571 * \note This function call forwards to JKQTBasePlotter::setGridPrinting()
572 * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
573 */
574 void setGridPrinting(bool enabled);
575
576 /** \brief add a new plotter \a plotterOther for grid printing mode, at location \a x / \a y
577 *
578 * \note This function call forwards to JKQTBasePlotter::addGridPrintingPlotter()
579 * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
580 */
581 void addGridPrintingPlotter(size_t x, size_t y, JKQTPlotter* plotterOther) ;
582
583 /** \brief clear all additional plotters for grid printing mode
584 *
585 * \note This function call forwards to JKQTBasePlotter::clearGridPrintingPlotters()
586 * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
587 */
589 /** \brief set the x-position of this JKQTPlotter in the grid-printing grid
590 *
591 * \note This function call forwards to JKQTBasePlotter::setGridPrintingCurrentX()
592 * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), setGridPrintingCurrentY(), \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
593 */
595 /** \brief set the y-position of this JKQTPlotter in the grid-printing grid
596 *
597 * \note This function call forwards to JKQTBasePlotter::setGridPrintingCurrentY()
598 * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentPos(), setGridPrintingCurrentX(), \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
599 */
601 /** \brief set the x- and y-positions of this JKQTPlotter in the grid-printing grid
602 *
603 * \note This function call forwards to JKQTBasePlotter::setGridPrintingCurrentPos()
604 * \see setGridPrinting(), addGridPrintingPlotter(), clearGridPrintingPlotters(), setGridPrintingCurrentX(), setGridPrintingCurrentY() \ref JKQTBASEPLOTTER_SYNCMULTIPLOT
605 */
606 void setGridPrintingCurrentPos(size_t x, size_t y);
607
608
609
610 /** \copydoc JKQTBasePlotter::getDatastore() */
611 inline JKQTPDatastore* getDatastore() { return plotter->getDatastore(); }
612
613 /** \copydoc JKQTBasePlotter::getDatastore() */
614 inline const JKQTPDatastore* getDatastore() const { return plotter->getDatastore(); }
615
616 /** \copydoc JKQTBasePlotter::useExternalDatastore() */
617 inline void useExternalDatastore(JKQTPDatastore* newStore) { plotter->useExternalDatastore(newStore); }
618
619 /** \copydoc JKQTBasePlotter::useAsInternalDatastore() */
620 inline void useAsInternalDatastore(JKQTPDatastore* newStore) { plotter->useAsInternalDatastore(newStore); }
621
622 /** \copydoc JKQTBasePlotter::useInternalDatastore() */
623 inline void useInternalDatastore() { plotter->useInternalDatastore(); }
624
625 /** \copydoc JKQTBasePlotter::forceInternalDatastore() */
626 inline void forceInternalDatastore() { plotter->forceInternalDatastore(); }
627
628 /** \copydoc JKQTBasePlotter::setEmittingSignalsEnabled() */
629 inline void setEmittingSignalsEnabled(bool sig) { plotter->setEmittingSignalsEnabled(sig); }
630 /** \copydoc JKQTBasePlotter::isEmittingSignalsEnabled() */
631 inline bool isEmittingSignalsEnabled() const { return plotter->isEmittingSignalsEnabled(); }
632
633 /** \brief returns, whether automatic redrawing the plot is currently activated (e.g. you can deactivate this with setPlotUpdateEnabled() while performing major updates on the plot)
634 *
635 * \see setPlotUpdateEnabled()
636 */
638 /** \brief sets whether automatic redrawing the plot is currently activated (e.g. you can sett his to \c false while performing major updates on the plot)
639 *
640 * \see isPlotUpdateEnabled()
641 */
642 void setPlotUpdateEnabled(bool enable);
643
644 /** \brief registeres a certain mouse drag action \a action to be executed when a mouse drag operation is
645 * initialized with the given \a button and \a modifier */
646 void registerMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifier, JKQTPMouseDragActions action);
647 /** \brief deregisteres the mouse drag action to be executed when a mouse drag operation is
648 * initialized with the given \a button and \a modifier */
649 void deregisterMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifier);
650 /** \brief clear all registeres mouse drag actions */
652
653 /** \brief registeres a certain mouse action \a action to be executed when a mouse double-click occurs
654 * with the given \a button and \a modifier */
655 void registerMouseDoubleClickAction(Qt::MouseButton button, Qt::KeyboardModifiers modifier, JKQTPMouseDoubleClickActions action);
656 /** \brief deregisteres the mouse action \a action to be executed when a mouse double-click occurs
657 * with the given \a button and \a modifier */
658 void deregisterMouseDoubleClickAction(Qt::MouseButton button, Qt::KeyboardModifiers modifier);
659 /** \brief clear all registered mouse double-click actions */
661
662 /** \brief specifies the action to perform on a mouse wheel event when a given modifier is pressed \see deregisterMouseWheelAction(), clearAllMouseWheelActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
663 void registerMouseWheelAction(Qt::KeyboardModifiers modifier, JKQTPMouseWheelActions action);
664 /** \brief deletes all mouse-wheel actions registered for a given \a modifier \see registerMouseWheelAction(), clearAllMouseWheelActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
665 void deregisterMouseWheelAction(Qt::KeyboardModifiers modifier);
666 /** \brief deletes all mouse-wheel actions \see registerMouseWheelAction(), deregisterMouseWheelAction(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
668
669 /** \brief specifies the action to perform on a mouse move event when a given modifier is pressed \see deregisterMouseMoveAction(), clearAllMouseMoveActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
670 void registerMouseMoveAction(Qt::KeyboardModifiers modifier, JKQTPMouseMoveActions action);
671 /** \brief deletes all mouse-move actions registered for a given \a modifier \see registerMouseMoveAction(), clearAllMouseMoveActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
672 void deregisterMouseMoveAction(Qt::KeyboardModifiers modifier);
673 /** \brief deletes all mouse-move actions \see registerMouseMoveAction(), deregisterMouseMoveAction(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
675
676 /*! \brief returns the currently set special context menu object
677 *
678 * \see \ref JKQTPLOTTER_SPECIALCONTEXTMENU, setSpecialContextMenu(), menuSpecialContextMenu, contextMenuOpened(), \ref JKQTPlotterUserInteraction
679 */
680 QMenu *getSpecialContextMenu() const;
681
682 /*! \brief sets a QMenu object to be used as special context menu
683 *
684 * \see \ref JKQTPLOTTER_SPECIALCONTEXTMENU, getSpecialContextMenu(), menuSpecialContextMenu, contextMenuOpened()
685 */
686 void setSpecialContextMenu(QMenu* menu);
687
688
689 /** \brief x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)
690 *
691 * \see \ref JKQTPLOTTER_CONTEXTMENU , getMouseContextY(), getMouseLastClickX(), getMouseLastClickY()
692 */
693 double getMouseContextX() const;
694 /** \brief y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)
695 *
696 * \see \ref JKQTPLOTTER_CONTEXTMENU , getMouseContextX(), getMouseLastClickX(), getMouseLastClickY()
697 */
698 double getMouseContextY() const;
699 /** \brief x-position of the last mouse-click (in screen pixels)
700 *
701 * \see getMouseLastClickY(), getMouseContextX(), getMouseContextY()
702 */
704 /** \brief y-position of the last mouse-click (in screen pixels)
705 *
706 * \see getMouseLastClickX(), getMouseContextX(), getMouseContextY()
707 */
709
710 /** \copydoc JKQTBasePlotter::getXAxis() */
711 inline JKQTPHorizontalAxisBase* getXAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis) { return plotter->getXAxis(axis); }
712 /** \copydoc JKQTBasePlotter::getYAxis() */
713 inline JKQTPVerticalAxisBase* getYAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis) { return plotter->getYAxis(axis); }
714 /** \copydoc JKQTBasePlotter::getXAxis() */
715 inline const JKQTPHorizontalAxisBase* getXAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis) const { return plotter->getXAxis(axis); }
716 /** \copydoc JKQTBasePlotter::getYAxis() */
717 inline const JKQTPVerticalAxisBase* getYAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis) const { return plotter->getYAxis(axis); }
718
719
720
721
722 /** \copydoc JKQTBasePlotter::beginGraphs() */
724 return plotter->cbeginGraphs();
725 }
726 /** \copydoc JKQTBasePlotter::endGraphs() */
728 return plotter->cendGraphs();
729 }
730
731 /** \copydoc JKQTBasePlotter::beginGraphs() */
733 return plotter->beginGraphs();
734 }
735 /** \copydoc JKQTBasePlotter::endGraphs() */
737 return plotter->endGraphs();
738 }
739 /** \copydoc JKQTBasePlotter::beginGraphs() */
741 return plotter->beginGraphs();
742 }
743 /** \copydoc JKQTBasePlotter::endGraphs() */
745 return plotter->endGraphs();
746 }
747 /** \copydoc JKQTBasePlotter::modifyGraphs() */
748 inline void modifyGraphs(const std::function<void(JKQTPPlotElement*)>& func) {
749 plotter->modifyGraphs(func);
750 }
751 /** \copydoc JKQTBasePlotter::sortGraphs() */
752 inline void sortGraphs(const std::function<bool(const JKQTPPlotElement* , const JKQTPPlotElement* )>& compareLess) {
753 plotter->sortGraphs(compareLess);
754 }
755 /** \copydoc JKQTBasePlotter::getGraphs() */
756 inline const typename JKQTBasePlotter::GraphsList& getGraphs() const {
757 return plotter->getGraphs();
758 }
759 /** \copydoc JKQTBasePlotter::getGraphs() */
761 return plotter->getGraphs();
762 }
763 /** \copydoc JKQTBasePlotter::getGraph() */
764 inline JKQTPPlotElement* getGraph(size_t i) { return plotter->getGraph(i); }
765 /** \copydoc JKQTBasePlotter::getGraph() */
766 inline const JKQTPPlotElement* getGraph(size_t i) const { return plotter->getGraph(i); }
767
768 /** \copydoc JKQTBasePlotter::getGraphCount() */
769 inline size_t getGraphCount() { return plotter->getGraphCount(); }
770
771 /** \copydoc JKQTBasePlotter::deleteGraph() */
772 inline void deleteGraph(size_t i, bool deletegraph=true) { plotter->deleteGraph(i, deletegraph); }
773
774 /** \copydoc JKQTBasePlotter::containsGraph() */
775 inline bool containsGraph(JKQTPPlotElement* gr) { return plotter->containsGraph(gr); }
776
777 /** \copydoc JKQTBasePlotter::deleteGraph() */
778 inline void deleteGraph(JKQTPPlotElement* gr, bool deletegraph=true) { plotter->deleteGraph(gr, deletegraph); }
779
780 /** \copydoc JKQTBasePlotter::clearGraphs() */
781 inline void clearGraphs(bool deleteGraphs=true) { plotter->clearGraphs(deleteGraphs); }
782
783 /** \copydoc JKQTBasePlotter::addGraph() */
784 inline size_t addGraph(JKQTPPlotElement* gr) { return plotter->addGraph(gr); }
785 /** \copydoc JKQTBasePlotter::addGraphOnTop() */
786 inline size_t addGraphOnTop(JKQTPPlotElement* gr) { return plotter->addGraphOnTop(gr); }
787 /** \copydoc JKQTBasePlotter::addGraphAtBottom() */
788 inline size_t addGraphAtBottom(JKQTPPlotElement* gr) { return plotter->addGraphAtBottom(gr); }
789
790 /** \copydoc JKQTBasePlotter::moveGraphTop() */
791 inline void moveGraphTop(JKQTPPlotElement* gr) { plotter->moveGraphTop(gr); }
792
793 /** \copydoc JKQTBasePlotter::moveGraphBottom() */
794 inline void moveGraphBottom(JKQTPPlotElement* gr) { plotter->moveGraphBottom(gr); }
795
796 /** \copydoc JKQTBasePlotter::moveGraphUp() */
797 inline void moveGraphUp(JKQTPPlotElement* gr) { plotter->moveGraphUp(gr); }
798
799 /** \copydoc JKQTBasePlotter::moveGraphDown() */
800 inline void moveGraphDown(JKQTPPlotElement* gr) { plotter->moveGraphDown(gr); }
801
802 /** \copydoc JKQTBasePlotter::moveGraphTop() */
803 inline void moveGraphTop(int idx) { plotter->moveGraphTop(idx); }
804
805 /** \copydoc JKQTBasePlotter::moveGraphBottom() */
806 inline void moveGraphBottom(int idx) { plotter->moveGraphBottom(idx); }
807
808 /** \copydoc JKQTBasePlotter::moveGraphUp() */
809 inline void moveGraphUp(int idx) { plotter->moveGraphUp(idx); }
810
811 /** \copydoc JKQTBasePlotter::moveGraphDown() */
812 inline void moveGraphDown(int idx) { plotter->moveGraphDown(idx); }
813
814 /** \copydoc JKQTBasePlotter::addGraphs() */
815 template <class TJKQTPGraphContainer>
816 inline void addGraphs(const TJKQTPGraphContainer& gr, QVector<size_t>* graphIDsOut=nullptr) { plotter->addGraphs(gr, graphIDsOut); }
817
818
819 /** \copydoc JKQTBasePlotter::getXMin() */
820 inline double getXMin() const {return plotter->getXMin(); }
821 /** \copydoc JKQTBasePlotter::getXMax() */
822 inline double getXMax() const {return plotter->getXMax(); }
823 /** \copydoc JKQTBasePlotter::getYMin() */
824 inline double getYMin() const {return plotter->getYMin(); }
825 /** \copydoc JKQTBasePlotter::getYMax() */
826 inline double getYMax() const {return plotter->getYMax(); }
827 /** \copydoc JKQTBasePlotter::getAbsoluteXMin() */
828 inline double getAbsoluteXMin() const {return plotter->getAbsoluteXMin(); }
829 /** \copydoc JKQTBasePlotter::getAbsoluteXMax() */
830 inline double getAbsoluteXMax() const {return plotter->getAbsoluteXMax(); }
831 /** \copydoc JKQTBasePlotter::getAbsoluteYMin() */
832 inline double getAbsoluteYMin() const {return plotter->getAbsoluteYMin(); }
833 /** \copydoc JKQTBasePlotter::getAbsoluteYMax() */
834 inline double getAbsoluteYMax() const {return plotter->getAbsoluteYMax(); }
835
836 /** \brief returns the current magnification factor */
837 inline double getMagnification() const { return magnification; }
838
839 /** \copydoc JKQTBasePlotter::getNextStyle() */
840 inline int getNextStyle() {
841 return getPlotter()->getNextStyle();
842 }
843
844 /** \copydoc JKQTBasePlotter::getPlotStyle() */
846 return getConstplotter()->getPlotStyle(i);
847 }
848
849
850
851 /** \brief returns the currently set mode for the context menu \see JKQTPContextMenuModes, \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_SPECIALCONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
853
854 /** \brief current style properties for this JKQTPlotter
855 *
856 * \see JKQTPSetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), \ref jkqtpplotter_styling
857 */
859
860 /** \brief replace the current style properties for this JKQTBasePlotter
861 *
862 * \see JKQTPSetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), getCurrentPlotterStyle(), \ref jkqtpplotter_styling
863 */
865 /** \brief replace the current style properties for this JKQTBasePlotter
866 *
867 * \see JKQTPSetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), getCurrentPlotterStyle(), \ref jkqtpplotter_styling
868 */
870 /** \brief replace the current style properties for this JKQTBasePlotter with properties loaded from \a settings
871 *
872 * \param settings the QSettings object to read from
873 * \param group group in \a settings to read from
874 * \param alsoLoadBaseStyle if \c true, then also JKQTBasePlotter::loadCurrentPlotterStyle() of the internal JKQTBasePlotter is called
875 *
876 * \see JKQTPSetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), getCurrentPlotterStyle(), \ref jkqtpplotter_styling
877 */
878 void loadCurrentPlotterStyle(const QSettings& settings, const QString& group="plots/", bool alsoLoadBaseStyle=true);
879 /** \brief store the current style properties for this JKQTBasePlotter with properties loaded from \a settings
880 *
881 * \param settings the QSettings object to write to
882 * \param group group in \a settings to write to
883 * \param alsoSaveBaseStyle if \c true, then also JKQTBasePlotter::saveCurrentPlotterStyle() of the internal JKQTBasePlotter is called
884 *
885 * \see JKQTPSetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), getCurrentPlotterStyle(), \ref jkqtpplotter_styling
886 */
887 void saveCurrentPlotterStyle(QSettings& settings, const QString& group="plots/", bool alsoSaveBaseStyle=true) const;
888
889 /** \brief \copydoc actMouseMoveToolTip */
891 /** \brief \copydoc actMouseLeftAsRuler */
893 /** \brief \copydoc actMouseLeftAsDefault */
895 /** \brief \copydoc actMouseLeftAsZoomRect */
897 /** \brief \copydoc actMouseLeftAsPanView */
899 /** \brief \copydoc actMouseMoveToolTip */
900 const QAction *getActMouseMoveToolTip() const;
901 /** \brief \copydoc actMouseLeftAsRuler */
902 const QAction *getActMouseLeftAsRuler() const;
903 /** \brief \copydoc actMouseLeftAsDefault */
904 const QAction *getActMouseLeftAsDefault() const;
905 /** \brief \copydoc actMouseLeftAsZoomRect */
906 const QAction *getActMouseLeftAsZoomRect() const;
907 /** \brief \copydoc actMouseLeftAsPanView */
908 const QAction *getActMouseLeftAsPanView() const;
909
910 /** \copydoc JKQTBasePlotter::grabPixelImage() */
911 inline QImage grabPixelImage(QSize size=QSize(), bool showPreview=false) {
912 return plotter->grabPixelImage(size,showPreview);
913 }
914 /** \copydoc JKQTBasePlotter::copyPixelImage() */
915 inline void copyPixelImage(bool showPreview=true) {
916 plotter->copyPixelImage(showPreview);
917 }
918
919 public Q_SLOTS:
920 /** \brief set the current plot magnification */
921 void setMagnification(double m);
922 /** \copydoc JKQTBasePlotter::zoom()
923 * \deprecated The function JKQTPlotter::zoom() is deprecated and will be removed in future version, use JKQTPlotter::setXY() instead!
924 */
925 inline void zoom(double xminn, double xmaxn, double yminn, double ymaxn, bool affectsSecondaryAxes=false) {
926 plotter->zoom(xminn, xmaxn, yminn, ymaxn, affectsSecondaryAxes);
927 }
928
929 /** \copydoc JKQTBasePlotter::setGrid() */
930 inline void setGrid(bool val) {
931 plotter->setGrid(val);
932 }
933
934 /** \copydoc JKQTBasePlotter::setGridColor() */
935 inline void setGridColor(QColor color) {
936 plotter->setGridColor(color);
937 }
938
939 /** \brief sets the color of all minor grid lines
940 * */
941 inline void setMinorGridColor(QColor color) {
942 plotter->setMinorGridColor(color);
943 }
944
945 /** \brief sets the width of all Major grid lines
946 * */
947 inline void setGridWidth(double __value) {
948 plotter->setGridWidth(__value);
949 }
950
951 /** \brief sets the width of all minor grid lines
952 * */
953 inline void setMinorGridWidth(double __value) {
954 plotter->setMinorGridWidth(__value);
955 }
956
957 /** \brief sets the style of all Major grid lines
958 * */
959 inline void setGridStyle(Qt::PenStyle __value) {
960 plotter->setGridStyle(__value);
961 }
962
963 /** \brief sets the style of all minor grid lines
964 * */
965 inline void setMinorGridStyle(Qt::PenStyle __value) {
966 plotter->setMinorGridStyle(__value);
967 }
968
969 /** \brief switches the visibility of the zero-axes associated with the x- and y-axis
970 *
971 * \param showX indicates whether to show the zero-axis associated with the x-axis (i.e. x==0 or the vertical zero-axis)
972 * \param showY indicates whether to show the zero-axis associated with the y-axis (i.e. y==0 or the horizontal zero-axis)
973 * */
974 inline void setShowZeroAxes(bool showX, bool showY) {
975 plotter->setShowZeroAxes(showX, showY);
976 }
977 /** \copydoc JKQTBasePlotter::setShowZeroAxes() */
978 inline void setShowZeroAxes(bool showXY) {
979 plotter->setShowZeroAxes(showXY);
980 }
981
982 /** \copydoc JKQTBasePlotter::saveImage() */
983 inline bool saveImage(const QString& filename=QString(""), bool displayPreview=true) {
984 return plotter->saveImage(filename, displayPreview);
985 }
986
987 /** \copydoc JKQTBasePlotter::saveAsPixelImage() */
988 inline bool saveAsPixelImage(const QString& filename=QString(""), bool displayPreview=true, const QByteArray &outputFormat=QByteArray(), const QSize& outputSizeIncrease=QSize(0,0)) {
989 return plotter->saveAsPixelImage(filename, displayPreview, outputFormat, outputSizeIncrease);
990 }
991
992#ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
993 /** \copydoc JKQTBasePlotter::saveAsSVG() */
994 inline bool saveAsSVG(const QString& filename=QString(""), bool displayPreview=true) { return plotter->saveAsSVG(filename, displayPreview); }
995 /** \copydoc JKQTBasePlotter::saveAsPDF() */
996 inline bool saveAsPDF(const QString& filename=QString(""), bool displayPreview=true) { return plotter->saveAsPDF(filename, displayPreview); }
997#endif
998
999 /** \copydoc JKQTBasePlotter::saveAsCSV() */
1000 inline void saveAsCSV(const QString& filename=QString("")) { plotter->saveAsCSV(filename); }
1001 /** \copydoc JKQTBasePlotter::saveAsSemicolonSV() */
1002 inline void saveAsSemicolonSV(const QString& filename=QString("")) { plotter->saveAsSemicolonSV(filename); }
1003 /** \copydoc JKQTBasePlotter::saveAsTabSV() */
1004 inline void saveAsTabSV(const QString& filename=QString("")) { plotter->saveAsTabSV(filename); }
1005 /** \copydoc JKQTBasePlotter::saveAsDIF() */
1006 inline void saveAsDIF(const QString& filename=QString("")) { plotter->saveAsDIF(filename); }
1007 /** \copydoc JKQTBasePlotter::saveAsSYLK() */
1008 inline void saveAsSYLK(const QString& filename=QString("")) { plotter->saveAsSYLK(filename); }
1009 /** \copydoc JKQTBasePlotter::saveAsMatlab() */
1010 inline void saveAsMatlab(const QString& filename=QString("")) { plotter->saveAsMatlab(filename); }
1011 /** \copydoc JKQTBasePlotter::saveAsGerExcelCSV() */
1012 inline void saveAsGerExcelCSV(const QString& filename=QString("")) { plotter->saveAsGerExcelCSV(filename); }
1013
1014
1015 /** \copydoc JKQTBasePlotter::saveData() */
1016 inline void saveData(const QString& filename=QString(""), const QString& format=QString("")) {
1017 plotter->saveData(filename, format);
1018 }
1019
1020#ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
1021 /** \copydoc JKQTBasePlotter::print() */
1022 inline void print(QPrinter* printer=nullptr) {
1023 plotter->print(printer);
1024 }
1025#endif
1026
1027 /** \copydoc JKQTBasePlotter::copyData() */
1028 inline void copyData() {
1029 plotter->copyData();
1030 }
1031
1032 /** \copydoc JKQTBasePlotter::copyDataMatlab() */
1033 inline void copyDataMatlab() {
1034 plotter->copyDataMatlab();
1035 }
1036
1037
1038 /** \copydoc JKQTBasePlotter::zoomToFit() */
1039 inline void zoomToFit(bool zoomX=true, bool zoomY=true, bool includeX0=false, bool includeY0=false, double scaleX=1.05, double scaleY=1.05) {
1040 plotter->zoomToFit(zoomX, zoomY, includeX0, includeY0, scaleX, scaleY);
1041 }
1042
1043 /** \copydoc JKQTBasePlotter::zoomIn() */
1044 inline void zoomIn(double factor=2.0) { plotter->zoomIn(factor); }
1045 /** \copydoc JKQTBasePlotter::zoomOut() */
1046 inline void zoomOut(double factor=2.0) { plotter->zoomOut(factor); }
1047
1048 /** \brief update the plot and the overlays */
1050
1051 /** \brief allows to activate/deactivate toolbar buttons that can activate certain mouse drag actions
1052 *
1053 * \see getActMouseLeftAsDefault(), getActMouseLeftAsRuler(), getActMouseLeftAsToolTip()
1054 */
1056
1057 /** \brief returns whether the toolbar is enabled
1058 *
1059 * \copydetails JKQTPlotterStyle::toolbarEnabled
1060 *
1061 * \see isToolbarEnabled(), JKQTPlotterStyle::toolbarEnabled
1062 */
1063 void setToolbarEnabled(bool __value);
1064 /** \brief returns whether the toolbar is always visible or only when the mouse moves to the upper left area
1065 *
1066 * \copydetails JKQTPlotterStyle::toolbarAlwaysOn
1067 *
1068 * \see isToolbarAlwaysOn(), JKQTPlotterStyle::toolbarAlwaysOn
1069 */
1070 void setToolbarAlwaysOn(bool __value);
1071 /** \brief specifies whether to display the current position of the mouse in the top border of the plot (this may automatically extent the
1072 * top border, so the position fits in. The default widget font is used for the output.
1073 *
1074 * \copydetails JKQTPlotterStyle::displayMousePosition
1075 *
1076 * \see isMousePositionShown(), JKQTPlotterStyle::displayMousePosition, \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE */
1077 void setMousePositionShown(bool __value);
1078 /** \copydoc JKQTPlotterStyle::userActionOverlayPen
1079 *
1080 * \see setUserActionOverlayPen(), getUserActionOverlayPen(), JKQTPlotterStyle::userActionOverlayPen \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
1081 void setUserActionOverlayPen(const QPen & __value);
1082 /** \copydoc JKQTPlotterStyle::userActionOverlayPen
1083 *
1084 * \see setUserActionOverlayBrush(), getUserActionOverlayBrush(), JKQTPlotterStyle::userActionOverlayBrush \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
1085 void setUserActionOverlayBrush(const QBrush & __value);
1086 /** \copydoc JKQTPlotterStyle::userActionOpaquePen
1087 *
1088 * \see setUserActionOpaquePen(), getUserActionOpaquePen(), JKQTPlotterStyle::userActionOpaquePen \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
1089 void setUserActionOpaquePen(const QPen & __value);
1090 /** \copydoc JKQTPlotterStyle::userActionOpaquePen
1091 *
1092 * \see setUserActionOpaqueBrush(), getUserActionOpaqueBrush(), JKQTPlotterStyle::userActionOpaqueBrush \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
1093 void setUserActionOpaqueBrush(const QBrush & __value);
1094 /** \copydoc JKQTPlotterStyle::userActionMarkerPen
1095 *
1096 * \see setUserActionMarkerPen(), getUserActionMarkerPen(), JKQTPlotterStyle::userActionMarkerPen \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
1097 void setUserActionMarkerPen(const QPen & __value);
1098 /** \copydoc JKQTPlotterStyle::userActionMarkerPen
1099 *
1100 * \see setUserActionMarkerBrush(), getUserActionMarkerBrush(), JKQTPlotterStyle::userActionMarkerBrush \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
1101 void setUserActionMarkerBrush(const QBrush & __value);
1102
1103 /** \copydoc JKQTPlotterStyle::maxTooltipDistance */
1105
1106 /** \copydoc JKQTPlotterStyle::userActionCatchSensitivity */
1108
1109 /** \copydoc JKQTPlotterStyle::userActionMarkerDiameter */
1111
1112 /** \copydoc JKQTPlotterStyle::userActionMarkerType */
1114
1115 /** \brief sets the mode if the standard context menu \see JKQTPContextMenuModes, \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_SPECIALCONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
1117
1118 /** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local x-axis to the other x-axis \see \ref JKQTBASEPLOTTER_SYNCMULTIPLOT */
1119 void synchronizeXAxis(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender);
1120 /** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local y-axis to the other y-axis \see \ref JKQTBASEPLOTTER_SYNCMULTIPLOT */
1121 void synchronizeYAxis(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender);
1122 /** \brief may be connected to zoomChangedLocally() of a different plot and synchronizes the local x- and y-axis to the other x- and y-axis \see \ref JKQTBASEPLOTTER_SYNCMULTIPLOT */
1123 void synchronizeXYAxis(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender);
1124
1125
1126 /** \brief popuplate the given toolbar \a toolbar with all actions shown in a toolbar from this class ...
1127 *
1128 * This function can be used to populate an external toolbar with actions for this JKQTPlotter.
1129 */
1130 void populateToolbar(QToolBar* toolbar) const;
1131
1132 /** \brief open the context menu at the mouse position of the last click \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
1134 /** \brief open the context menu at the mouse position \a x and \a y \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
1135 void openContextMenu(int x, int y);
1136
1137 /** \brief open the standard context menu at the mouse position of the last click \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
1139 /** \brief open the standard context menu at the mouse position \a x and \a y \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
1140 void openStandardContextMenu(int x, int y);
1141 /** \brief open the special context menu at the mouse position of the last click \see \ref JKQTPLOTTER_SPECIALCONTEXTMENU, \ref JKQTPLOTTER_USERMOUSEINTERACTION */
1143 /** \brief open the special context menu at the mouse position \a x and \a y \see \ref JKQTPLOTTER_SPECIALCONTEXTMENU, \ref JKQTPLOTTER_USERMOUSEINTERACTION */
1144 void openSpecialContextMenu(int x, int y);
1145
1146 /** \brief open the standard context menu with the special context menu integrated at the mouse position of the last click \see \ref JKQTPLOTTER_SPECIALCONTEXTMENU, \ref JKQTPLOTTER_USERMOUSEINTERACTION */
1148 /** \brief open the standard context menu with the special context menu integrated at the mouse position \a x and \a y \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_SPECIALCONTEXTMENU, \ref JKQTPLOTTER_USERMOUSEINTERACTION */
1150
1151 /** \copydoc JKQTBasePlotter::setAbsoluteX() */
1152 inline void setAbsoluteX(double xminn, double xmaxx) { plotter->setAbsoluteX(xminn, xmaxx); }
1153
1154 /** \copydoc JKQTBasePlotter::setAbsoluteY() */
1155 inline void setAbsoluteY(double yminn, double ymaxx) { plotter->setAbsoluteY(yminn, ymaxx); }
1156
1157 /** \copydoc JKQTBasePlotter::setAbsoluteXY() */
1158 inline void setAbsoluteXY(double xminn, double xmaxx, double yminn, double ymaxx) { plotter->setAbsoluteXY(xminn, xmaxx, yminn, ymaxx); }
1159
1160 /** \copydoc JKQTBasePlotter::setX() */
1161 inline void setX(double xminn, double xmaxx) { plotter->setX(xminn, xmaxx); }
1162
1163 /** \copydoc JKQTBasePlotter::setY() */
1164 inline void setY(double yminn, double ymaxx) { plotter->setY(yminn, ymaxx); }
1165
1166 /** \copydoc JKQTBasePlotter::setXY() */
1167 inline void setXY(double xminn, double xmaxx, double yminn, double ymaxx, bool affectsSecondaryAxes=false) { plotter->setXY(xminn, xmaxx, yminn, ymaxx, affectsSecondaryAxes); }
1168 Q_SIGNALS:
1169 /** \brief emitted whenever the mouse moves
1170 *
1171 * \param x x-position of the mouse (in plot coordinates)
1172 * \param y y-position of the mouse (in plot coordinates)
1173 */
1174 void plotMouseMove(double x, double y);
1175 /** \brief emitted when a single-click event from the mouse occurs inside the plot
1176 *
1177 * \param x x-position of the mouse (in plot coordinates)
1178 * \param y y-position of the mouse (in plot coordinates)
1179 * \param modifiers key-modifiers when the click occured
1180 * \param button mouse-button that was used for the click
1181 */
1182 void plotMouseClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button);
1183 /** \brief emitted when a double-click event from the mouse occurs inside the plot
1184 *
1185 * \param x x-position of the mouse (in plot coordinates)
1186 * \param y y-position of the mouse (in plot coordinates)
1187 * \param modifiers key-modifiers when the click occured
1188 * \param button mouse-button that was used for the click
1189 */
1190 void plotMouseDoubleClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button);
1191 /** \brief emitted when a single-click event from the mouse occurs inside the plot
1192 *
1193 * \param x x-position of the mouse (in plot coordinates)
1194 * \param y y-position of the mouse (in plot coordinates)
1195 * \param modifiers key-modifiers when the click occured
1196 * \param deltaAngleX amount of rotation (in eighths of a degree) of the wheel in x-direction
1197 * \param deltaAngleY amount of rotation (in eighths of a degree) of the wheel in y-direction
1198 */
1199 void plotMouseWheelOperated(double x, double y, Qt::KeyboardModifiers modifiers, int deltaAngleX, int deltaAngleY);
1200 /** \brief emitted when the mouse action jkqtpmdaZoomByRectangle and the drawing of the new zoom rectangle is finished (=mouse key released)
1201 *
1202 * \param mouseDragRectXStart start of the selected x-range (in plot coordinates)
1203 * \param mouseDragRectXEnd end of the selected x-range (in plot coordinates)
1204 * \param mouseDragRectYStart start of the selected x-range (in plot coordinates)
1205 * \param mouseDragRectYEnd end of the selected x-range (in plot coordinates)
1206 * \param modifiers key-modifiers when the click occured
1207 */
1208 void plotNewZoomRectangle(double mouseDragRectXStart, double mouseDragRectXEnd, double mouseDragRectYStart, double mouseDragRectYEnd, Qt::KeyboardModifiers modifiers);
1209 /** \brief emitted when the plot scaling has been recalculated */
1211 /** \brief emitted before the plot scaling has been recalculated */
1213 /** \brief emitted whenever a context menu is opened. You can modify the menu via the parameter \a contextMenu!
1214 *
1215 * \param x x-position of the context-menu (in plot coordinates)
1216 * \param y y-position of the context-menu (in plot coordinates)
1217 * \param contextMenu QMenu-object of the context menu. This object may be altered to display additional items ... Here is an example:
1218 * \code
1219 * contextMenu->addSeparator();
1220 * QAction* act=contextMenu->addMenu(QString("contextMenuOpened(x=%1, y=%2)").arg(x).arg(y))->addAction("user-added action");
1221 * connect(act, &QAction::triggered, [x,y]() { QMessageBox::warning(nullptr, tr("Plot Context Menu"),
1222 * tr("Context Menu was opened at x/y=%1/%2!").arg(x).arg(y),
1223 * QMessageBox::Ok,
1224 * QMessageBox::Ok); });
1225 * \endcode
1226 * <b>Please read the warning below!!!</b>
1227 *
1228 * \warning A note of care: This signal can be used to alter the context menu. It behaves differently, depending on
1229 * whether you use the standard context menu, or the special context menu (setSpecialContextMenu()). If the
1230 * standard menu is opened, your alterations are valid until it is shown the next time (i.e. the internal
1231 * context menu object is deleted in between). If you show the special context menu only, your alterations
1232 * are <b>permanently stored</b> in the menu object. I.e. if you use the code example above and open the menu
1233 * several times, it will accumulate additional menu entries!
1234 * If you must modify the special menu, just access actions and do not add or delete any in a slot bound to
1235 * this signal! You can recognize the special menu with code like this:
1236 * \code
1237 * if (contextMenu == plot->getSpecialContextMenu()) {
1238 * //...
1239 * // do something with the special menu, do not add/remove entries
1240 * } else {
1241 * //...
1242 * // do something with the standard menu, you are free to do anything!
1243 * }
1244 * \endcode
1245 *
1246 * \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_SPECIALCONTEXTMENU, \ref JKQTPLOTTER_USERMOUSEINTERACTION
1247 */
1248 void contextMenuOpened(double x, double y, QMenu* contextMenu);
1249
1250
1251 /** \brief signal: emitted whenever the user selects a new x-y zoom range (in the major axes, e.g. by mouse, setX(), setY(), setXY(), zoomToFit()... )
1252 *
1253 * \param newxmin start of the selected x-range (in plot coordinates)
1254 * \param newxmax end of the selected x-range (in plot coordinates)
1255 * \param newymin start of the selected x-range (in plot coordinates)
1256 * \param newymax end of the selected x-range (in plot coordinates)
1257 * \param sender JKQTPlotter sending this event
1258 *
1259 * This signal is designed to be connected to these Q_SLOTS: synchronizeXAxis(), synchronizeYAxis(), synchronizeXYAxis()
1260 *
1261 * \see JKQTBasePlotter::zoomChangedLocally()
1262 */
1263 void zoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender);
1264
1265 /** \brief signal: emitted whenever the widget is resized
1266 *
1267 * \param new_width new width of the widget (in pixels)
1268 * \param new_height new height of the widget (in pixels)
1269 * \param sender JKQTPlotter sending this event
1270 *
1271 * This signal is designed to be connected to these Q_SLOTS: synchronizeXAxis(), synchronizeYAxis(), synchronizeXYAxis()
1272 */
1273 void widgetResized(int new_width, int new_height, JKQTPlotter* sender);
1274
1275 /** \brief emitted when the mouse action JKQTPlotter::ScribbleEvents and a click event from the mouse occurs inside the plot,
1276 * or the mouse moved while the left button is pressed down
1277 *
1278 * \param x x-position of the mouse (in plot coordinates)
1279 * \param y y-position of the mouse (in plot coordinates)
1280 * \param modifiers key-modifiers when the event was generated
1281 * \param first if \c true: this is the first event of a series that starts with pressing the mouse-button down, within the series, this is \c false
1282 * \param last if \c true: this is the last event of a series that ends when releasing the mouse-button, within the series, this is \c false
1283 */
1284 void userScribbleClick(double x, double y, Qt::KeyboardModifiers modifiers, bool first, bool last);
1285 /** \brief emitted when the mouse action JKQTPlotter::RectangleEvents and the drawing of the new rectangle is finished (=mouse key released)
1286 *
1287 * \param x x-coordinate of the bottom left corner of the rectangle (in plot coordinates)
1288 * \param y y-coordinate of the bottom left corner of the rectangle (in plot coordinates)
1289 * \param width width of the rectangle (in plot coordinates)
1290 * \param height height of the rectangle (in plot coordinates)
1291 * \param modifiers key-modifiers when the rectangle was finished
1292 */
1293 void userRectangleFinished(double x, double y, double width, double height, Qt::KeyboardModifiers modifiers);
1294 /** \brief emitted when the mouse action JKQTPlotter::LineEvents and the drawing of the new line is finished (=mouse key released)
1295 *
1296 * \param x1 x-coordinate of the start of the line (in plot coordinates)
1297 * \param y1 y-coordinate of the start of the line (in plot coordinates)
1298 * \param x2 x-coordinate of the end of the line (in plot coordinates)
1299 * \param y2 y-coordinate of the end of the line (in plot coordinates)
1300 * \param modifiers key-modifiers when the rectangle was finished
1301 */
1302 void userLineFinished(double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers);
1303 /** \brief emitted when the mouse action JKQTPlotter::CircleEvents and the drawing of the new circle is finished (=mouse key released)
1304 *
1305 * \param x x-coordinate of the center of the circle (in plot coordinates)
1306 * \param y y-coordinate of the center of the circle (in plot coordinates)
1307 * \param radius radius of the circle (in plot coordinates)
1308 * \param modifiers key-modifiers when the rectangle was finished
1309 */
1310 void userCircleFinished(double x, double y, double radius, Qt::KeyboardModifiers modifiers);
1311 /** \brief emitted when the mouse action JKQTPlotter::EllipseEvents and the drawing of the new ellipse is finished (=mouse key released)
1312 *
1313 * \param x x-coordinate of the center of the ellipse (in plot coordinates)
1314 * \param y y-coordinate of the center of the ellipse (in plot coordinates)
1315 * \param radiusX half-axis in x-direction of the ellipse (in plot coordinates)
1316 * \param radiusY half-axis in y-direction of the ellipse (in plot coordinates)
1317 * \param modifiers key-modifiers when the rectangle was finished
1318 */
1319 void userEllipseFinished(double x, double y, double radiusX, double radiusY, Qt::KeyboardModifiers modifiers);
1320 /** \brief emitted when a tooltip for a datapoint is displayed
1321 *
1322 * \param x x-coordinate of the center of the marked datapoint (in plot coordinates)
1323 * \param y y-coordinate of the center of the marked datapoint (in plot coordinates)
1324 * \param entries contents of the tooltip
1325 * \param graphs graph objects that created the entries
1326 */
1327 void tooltipDisplayed(double x, double y, const QStringList& entries, const QList<JKQTPPlotElement*>& graphs);
1328 /** \brief emitted when a new ruler between two points is displayed
1329 *
1330 * \param x1 x-coordinate of the start of the line (in plot coordinates)
1331 * \param y1 y-coordinate of the start of the line (in plot coordinates)
1332 * \param x2 x-coordinate of the end of the line (in plot coordinates)
1333 * \param y2 y-coordinate of the end of the line (in plot coordinates)
1334 * \param modifiers key-modifiers when the rectangle was finished
1335 */
1336 void rulerDisplayed(double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers);
1337
1338
1339 protected:
1340
1341 /** \brief ties a MouseActionMode to a mouse-button and a keyboard-modifier
1342 * \internal
1343 * \ingroup jkqtpplottersupprt
1344 */
1346 /** \brief constructs an invalid object */
1348 MouseDragAction(Qt::MouseButton _mouseButton, Qt::KeyboardModifiers _modifier, JKQTPMouseDragActions _mode);
1350 Qt::KeyboardModifiers modifier;
1351 Qt::MouseButton mouseButton;
1352 bool isValid() const;
1353 void clear();
1354 private:
1355 bool valid;
1356 };
1357
1358 /** \brief the currently executed MouseDragAction */
1360
1361
1362 /** \brief the currently executed MouseMoveActions */
1363 QSet<JKQTPMouseMoveActions> currentMouseMoveAction;
1364
1365 enum class WheelActionType {
1366 Zoom,
1367 Pan,
1368 None
1369 };
1370
1371 /** \brief storage for last WheelActionType (used in wheelAction() to distinguish trackpad-pan ations in mode jkqtpmwaZoomByWheelAndTrackpadPan) */
1373 /** \brief storage for timestammp of the last QWheelEvent (used in wheelAction() to distinguish trackpad-pan ations in mode jkqtpmwaZoomByWheelAndTrackpadPan) */
1375 /** \brief max. time between two QWheelEvents that are recognized as one series */
1377
1378 /** \brief searches JKQTPlotterStyle::registeredMouseActionModes for a matching action, returns in \a found whether an action was found */
1379 JKQTPMouseDragActionsHashMapIterator findMatchingMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, bool *found=nullptr) const;
1380
1381 /** \brief searches JKQTPlotterStyle::registeredMouseMoveActions for a matching action */
1382 JKQTPMouseMoveActionsHashMapIterator findMatchingMouseMoveAction(Qt::KeyboardModifiers modifiers, bool *found=nullptr) const;
1383
1384 /** \brief searches JKQTPlotterStyle::registeredMouseWheelActions for a matching action */
1385 JKQTPMouseWheelActionsHashMapIterator findMatchingMouseWheelAction(Qt::KeyboardModifiers modifiers, bool *found=nullptr) const;
1386
1387 /** \brief searches JKQTPlotterStyle::registeredMouseDoubleClickActions for a matching action */
1388 JKQTPMouseDoubleClickActionsHashMapIterator findMatchingMouseDoubleClickAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, bool *found=nullptr) const;
1389
1390 /** \brief you may overwrite this method to modify the given context menu before it is displayed.
1391 *
1392 * The plotter will fill the menu with the default items and then call this method. The default implementation does NOTHING.
1393 *
1394 * \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION
1395 */
1396 void modifyContextMenu(QMenu* menu);
1397
1398 /** \brief indicates whether the plot is updated automatically at the moment
1399 *
1400 * \see setPlotUpdateEnabled(), isPlotUpdateEnabled()
1401 */
1403
1404 /** \brief JKQTBasePlotter used to plot */
1406
1407 /** \brief modifies the settings of \a plotter to match those of this object */
1409
1410
1411 /** \brief this is set \c true if we are drawing a zoom rectangle */
1413
1414 /** \brief when draging the mouse this contains the x-coordinate the user clicked on (in plot coordinates) */
1416
1417 /** \brief when draging the mouse this contains the x-coordinate the user clicked on (in pixels) */
1419
1420 /** \brief when draging the mouse this contains the x-coordinate the mouse is currently
1421 * pointing to (in pixels) */
1423
1424 /** \brief when draging the mouse this contains the y-coordinate the mouse is currently
1425 * pointing to (in pixels) */
1427
1428 /** \brief when draging the mouse this contains the x-coordinate the mouse is currently
1429 * pointing to
1430 */
1432
1433 /** \brief when draging the mouse this contains the y-coordinate the user clicked on (in plot coordinates) */
1435
1436 /** \brief when zooming by moving the mouse this contains the y-coordinate the user clicked on (in pixels) */
1438
1439 /** \brief when zooming by moving the mouse this contains the y-coordinate the mouse is currently
1440 * pointing to
1441 */
1443
1444 /** \brief describes a marker to be drawn by paintUserAction() */
1446 inline MouseDragMarker(const QPoint& pos_, const QString& label_, const QString& title_, const QColor& color_, const QImage& keymarker_=QImage(), JKQTPPlotElement* _graph=nullptr):
1447 pos(pos_), label(label_), title(title_), color(color_), keyMarker(keymarker_), graph(_graph)
1448 {}
1449 /** \brief position of the marker in screen pixels */
1450 QPoint pos;
1451 /** \brief marker label */
1452 QString label;
1453 /** \brief graph label */
1454 QString title;
1455 /** \brief color for the marker */
1456 QColor color;
1457 /** \brief key marker image */
1459 /** \brief graph that created that marker */
1461 };
1462 /** \brief internal list of markers to be drawn by paintUserAction() */
1463 QList<MouseDragMarker> mouseDragMarkers;
1464
1466
1467 /** \brief this stores the currently displayed plot */
1469
1470 /** \brief this can be used when drawing a zoom rectangle to store an unchanged
1471 * copy of the currently displayed image.
1472 */
1474
1475 /** \brief constructs a new image for the internal double-buffering
1476 * \internal
1477 */
1479
1480 /** \brief returns the required size of an image for the internal double-buffering
1481 * \internal
1482 */
1483 QSize getImageBufferSize(float* scale_out=nullptr) const;
1484
1485
1486 /** \brief use this QMenu instance instead of the standard context menu of this widget
1487 * \see \ref JKQTPLOTTER_SPECIALCONTEXTMENU
1488 */
1490
1491
1492
1493 /** \brief toolbar class used for user input */
1495
1496
1497 /** \brief paint the user action (rectangle, ellipse, ... */
1499
1500 /** \brief tool function, which corrects the given rectangle (in pixels!) during a panning action. The correction is necesary towards getAbsoluteXY() to prevent an unwanted zooming in. */
1501 void correctZoomRectForPanning(QRectF& rect) const;
1502
1503
1504 /** \brief event handler for a double click
1505 *
1506 * \see registerMouseDoubleClickAction(), deregisterMouseDoubleClickAction()
1507 */
1508 void mouseDoubleClickEvent ( QMouseEvent * event ) override;
1509
1510 /*! \brief react on key presses.
1511
1512 These shortcuts are defined:
1513 - ESC stops current zooming/drawing action
1514 .
1515 */
1516 void keyReleaseEvent(QKeyEvent* event) override;
1517
1518 /** \brief event handler for a mouse move
1519 *
1520 * This implements two behaviours:
1521 * - if displayMousePosition is \c true , stores the current mouse position in mousePosX, mousePosY
1522 * - if necessary, contributes to user-actions started by mousePressEvent()
1523 * - emits plotMouseMove() if the mouse is inside the plot rectangle .
1524 * - execute mouseMoveActions
1525 * .
1526 *
1527 * \see mousePosX, mousePosY
1528 * \see registerMouseWheelAction(), deregisterMouseWheelAction(), registeredMouseWheelActions
1529 */
1530 void mouseMoveEvent ( QMouseEvent * event ) override;
1531
1532 /** \brief event handler for a mouse down event
1533 *
1534 * This event determines the action to be performed from registeredMouseActionModes
1535 * and then sets currentMouseDragAction accordingly and starts the mouse action.
1536 *
1537 * \see registerMouseDragAction(), deregisterMouseDragAction(), registeredJKQTPMouseDragActions
1538 */
1539 void mousePressEvent ( QMouseEvent * event ) override;
1540
1541 /** \brief event handler for a mouse release event
1542 *
1543 * this finishes the action, started by mousePressEvent()
1544 */
1545 void mouseReleaseEvent ( QMouseEvent * event ) override;
1546
1547 /** \brief event handler for a turn of the mouse wheel
1548 *
1549 * Executes the user action defined for the mouse wheel.
1550 *
1551 * \see registerMouseWheelAction(), deregisterMouseWheelAction(), registeredMouseWheelActions
1552 */
1553 void wheelEvent(QWheelEvent * event) override;
1554
1555 /** \brief this simply paints the stored image to the widget's surface */
1556 void paintEvent(QPaintEvent *event) override;
1557
1558 /** \brief resizes the internal representation (image) of the graphs */
1559 void resizeEvent(QResizeEvent *event) override;
1560
1561 /** \brief called, when the mouse leaves the widget, hides the toolbar (if visible) */
1562 void leaveEvent ( QEvent * event ) override;
1563
1564
1565 /** \brief update settings of the toolbar */
1567
1568
1569 /** \brief the master plotter, this plotter is connected to in x-direction. */
1570 QPointer<JKQTPlotter> masterPlotterX;
1571 /** \brief the master plotter, this plotter is connected to in y-direction. */
1572 QPointer<JKQTPlotter> masterPlotterY;
1573
1574 /** \brief calculate the y-axis shift of the plot, so there is space for the potentially displayed mouse position label */
1575 int getPlotYOffset() const;
1576
1577 /** \brief x-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates) */
1579 /** \brief y-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates) */
1581 /** \brief magnification factor for the display of the plot */
1583 /** \brief current minimal size of the JKQTPlotter widget to properly display the plot */
1584 QSize minSize;
1585
1586 /** \brief the context menu object used by this JKQTPlotter
1587 *
1588 * \note this might be \c ==nullptr occasionally, therefore you need to check it, before accessing it!
1589 *
1590 * \see \ref JKQTPLOTTER_CONTEXTMENU , resetContextMenu(), initContextMenu(), contextMenuMode
1591 */
1593 /** \brief current mode for the default context menu (i.e. the right-click context menu) \see \ref JKQTPLOTTER_CONTEXTMENU */
1595 /** \brief x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle) */
1597 /** \brief y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle) */
1599 /** \brief x-position of the last mouse-click (in screen pixels) */
1601 /** \brief y-position of the last mouse-click (in screen pixels) */
1603 /** \brief internal storage for sub-menu entries of the internal contextMenu object, based on the actions returned by JKQTBasePlotter::getLstAdditionalPlotterActions()
1604 * \internal
1605 */
1606 QList<QMenu*> contextSubMenus;
1607 /** \brief fills the member contextMenu with all default and additionally registered actions, also calls modifyContextMenu()
1608 *
1609 * \note This function calls resetContextMenu() internally!
1610 *
1611 * \see resetContextMenu(), contextMenuMode
1612 */
1614 /** \brief set the current mouse cursor shappe according to currentMouseDragAction */
1616
1617 /** \brief current style properties for this JKQTPlotter
1618 *
1619 * \see JKQTPSetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), getCurrentPlotterStyle(), \ref jkqtpplotter_styling
1620 */
1622
1623
1624 /** \brief timer used while the graph is resized to delay the redrawing with new size (in the meantime, an intermediate graphic is displayed)
1625 * \internal
1626 * \see delayedResizeEvent()
1627 *
1628 * \image html jkqtplotter_fastresizing.gif
1629 *
1630 * \see jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer
1631 */
1633
1634 /** \brief delay for resizing in milliseconds. If set to 0, resize delay is disabled and resizeTimer is unused.
1635 *
1636 * \see jkqtp_RESIZE_DELAY, setGlobalResizeDelay(), getGlobalResizeDelay(), resizeTimer
1637 */
1638 static std::atomic<int> jkqtp_RESIZE_DELAY;
1639
1640 /** \brief destroys the internal contextMenu and optionally creates a new one
1641 *
1642 * \param createnew if \c ==true, contextMenu is reinitialized with a (shiny) new QMenu,
1643 * otherwise it is set to \c nullptr after destroying the old menu.
1644 *
1645 * \see initContextMenu(), contextMenuMode
1646 */
1647 void resetContextMenu(bool createnew=true);
1648
1649 /** \brief fills the inertnal mouseDragMarkers structure with data to display tooltips close to (x0, y0)
1650 *
1651 * if \a emitEvent is \c true, the signal is emitted before the function returns
1652 */
1653 void fillInternalStructForToolTipOfClosestDataPoint(double x0, double y0, bool emitEvent=true);
1654 /** \brief resets the currently activated mouse drag action, e.g. called by mouseReleaseEvent() */
1656
1657 /** \brief list of override mouse drag action modes, that override the settings ing plotterStyle.registeredMouseDragActionModes \see setOverrideMouseDragAction(), resetOverrideMouseDragAction(), JKQTPlotterStyle::registeredMouseDragActionModes */
1659
1660 /** \brief sets an override mouse drag action for the given button/modifiers combination \see setOverrideMouseDragAction(), resetOverrideMouseDragAction(), registeredOverrideMouseDragActionModes */
1661 void setOverrideMouseDragAction(Qt::MouseButton button,Qt::KeyboardModifiers modifiers, JKQTPMouseDragActions action);
1662 /** \brief removes a previously set override mouse drag action for the given button/modifiers combination \see setOverrideMouseDragAction(), resetOverrideMouseDragAction(), registeredOverrideMouseDragActionModes */
1663 void resetOverrideMouseDragAction(Qt::MouseButton button,Qt::KeyboardModifiers modifiers);
1664
1665 /** \brief action group, that groups the actMouseLeft... actions */
1666 QActionGroup* actgrpMouseLeft;
1667 /** \brief action that activates the default action, set in plotterStyle! */
1669 /** \brief action that activates the ruler tool (override!) */
1671 /** \brief action that activates the tooltip tool (override!) */
1673 /** \brief action that activates the zoom rectangle tool (override!) */
1675 /** \brief action that activates the pan view tool (override!) */
1677
1678 virtual bool event(QEvent *event) override;
1679 protected Q_SLOTS:
1680 /** \brief while the window is resized, the plot is only redrawn after a restartable delay, implemented by this function and resizeTimer
1681 * \internal
1682 * \see resizeTimer
1683 *
1684 * \image html jkqtplotter_fastresizing.gif
1685 */
1687
1688 /** \brief connected to plotScalingRecalculated() of the masterPlotter */
1690
1691 /** \brief called whenever the zoom changes in plotter */
1692 void pzoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTBasePlotter* sender);
1693
1694 /** \brief emitted before the plot scaling has been recalculated */
1696 /** \brief called from a menu entry that encodes the graph ID */
1697 void reactGraphVisible(bool visible);
1698
1699 /** \brief action that activates the pan viewport tool \see resetMouseLeftAction(), setMouseLeftActionAsToolTip() */
1701 /** \brief action that activates the zoom rectangle tool \see resetMouseLeftAction(), setMouseLeftActionAsToolTip() */
1703 /** \brief action that activates the ruler tool \see resetMouseLeftAction(), setMouseLeftActionAsToolTip() */
1705 /** \brief action that activates the tooltip tool, when dragging the mouse with the left button pressed \see resetMouseLeftAction() */
1707 /** \brief resets any previously set override action for the left mouse-button, un-modified \see setMouseLeftActionAsRuler(), setMouseLeftActionAsToolTip() */
1709 /** \brief action that (de)activates the tooltip tool, when moving the mouse without any button pressed \see setMouseLeftActionAsRuler(), resetMouseLeftAction() */
1711
1712};
1713
1714QT_BEGIN_NAMESPACE
1715
1716/** \brief qHash-variant used by JKQTPlotter
1717 * \internal
1718 * \ingroup jkqtpplottersupprt
1719*/
1720#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
1721inline size_t qHash(const QPair<Qt::MouseButton,Qt::KeyboardModifiers> &key, size_t /*seed=0*/) {
1722#else
1723inline uint qHash(const QPair<Qt::MouseButton,Qt::KeyboardModifiers> &key, uint /*seed=0*/) {
1724#endif
1725 std::size_t seed=0;
1726 jkqtp_hash_combine(seed, key.first);
1727 jkqtp_hash_combine(seed, key.second);
1728 return seed;
1729}
1730
1731/** \brief qHash-variant used by JKQTPlotter
1732 * \internal
1733 * \ingroup jkqtpplottersupprt
1734*/
1735#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
1736inline size_t qHash(const Qt::MouseButton &key, size_t /*seed=0*/) {
1737#else
1738inline uint qHash(const Qt::MouseButton &key, uint /*seed=0*/) {
1739#endif
1740 return qHash(static_cast<uint>(key),0);
1741}
1742
1743/** \brief qHash-variant used by JKQTPlotter
1744 * \internal
1745 * \ingroup jkqtpplottersupprt
1746*/
1747#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
1748inline size_t qHash(const Qt::KeyboardModifiers &key, size_t /*seed=0*/) {
1749#else
1750inline uint qHash(const Qt::KeyboardModifiers &key, uint /*seed=0*/) {
1751#endif
1752 return qHash(static_cast<uint>(key),0);
1753}
1754
1755QT_END_NAMESPACE
1756
1757#endif // JKQTPLOTTER_H
represents a pen, when plotting in JKQTPlotter/JKQTBasePlotter
Definition jkqtpbaseplotter.h:764
base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
Definition jkqtpbaseplotter.h:394
QVector< JKQTPPlotElement * > GraphsList
Definition jkqtpbaseplotter.h:487
SynchronizationDirection
denotes, which axes to synchronize in synchronizeToMaster()
Definition jkqtpbaseplotter.h:1348
@ sdXYAxes
x- and y-axis
Definition jkqtpbaseplotter.h:1351
QVector< JKQTPPlotElement * >::const_iterator GraphsConstIterator
Definition jkqtpbaseplotter.h:489
QVector< JKQTPPlotElement * >::iterator GraphsIterator
Definition jkqtpbaseplotter.h:488
Support Class for JKQTBasePlotter, which summarizes all properties that define the visual styling of ...
Definition jkqtpbaseplotterstyle.h:47
base class for drawing a key (or legend)
Definition jkqtpkey.h:83
This class manages data columns (with entries of type double ), used by JKQTPlotter/JKQTBasePlotter t...
Definition jkqtpdatastorage.h:282
base class for horizontal axes, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoo...
Definition jkqtpcoordinateaxes.h:1154
this virtual base class of every element, which is part of a JKQTPlotter plot and may appear in its k...
Definition jkqtpgraphsbase.h:62
base class for vertical axes, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoord...
Definition jkqtpcoordinateaxes.h:967
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
void clearAllRegisteredMouseDoubleClickActions()
clear all registered mouse double-click actions
QPointer< JKQTPlotter > masterPlotterX
the master plotter, this plotter is connected to in x-direction.
Definition jkqtplotter.h:1570
void setGridStyle(Qt::PenStyle __value)
sets the style of all Major grid lines
Definition jkqtplotter.h:959
void setUserActionCatchSensitivity(int v)
sensitivity (i.e. max. distance to see as one point) for user actions
void openStandardAndSpecialContextMenu(int x, int y)
open the standard context menu with the special context menu integrated at the mouse position x and y
void resetMasterSynchronization(JKQTBasePlotter::SynchronizationDirection synchronizeDirection=JKQTBasePlotter::sdXYAxes)
switches any synchronization off, that has been created by synchronizeToMaster()
JKQTBasePlotter::GraphsConstIterator endGraphs() const
returns an iterator behind the last graph
Definition jkqtplotter.h:736
void plotMouseWheelOperated(double x, double y, Qt::KeyboardModifiers modifiers, int deltaAngleX, int deltaAngleY)
emitted when a single-click event from the mouse occurs inside the plot
JKQTBasePlotter::GraphsConstIterator cendGraphs() const
returns an iterator behind the last graph
Definition jkqtplotter.h:727
void saveAsGerExcelCSV(const QString &filename=QString(""))
save the current plot data as a Semicolon Separated Values (CSV) file for german Excel,...
Definition jkqtplotter.h:1012
void clearGridPrintingPlotters()
clear all additional plotters for grid printing mode
InternalBufferImageType createImageBuffer() const
constructs a new image for the internal double-buffering
JKQTBasePlotter::JKQTPPen getPlotStyle(int i) const
returns a QPen object for the i-th plot style
Definition jkqtplotter.h:845
void setX(double xminn, double xmaxx)
sets the x-range of the plot (minimum and maximum x-value on the x-axis)
Definition jkqtplotter.h:1161
void openSpecialContextMenu()
open the special context menu at the mouse position of the last click
void reactGraphVisible(bool visible)
called from a menu entry that encodes the graph ID
double getYMax() const
returns the current y-axis max of the primary y-axis
Definition jkqtplotter.h:826
void setUserActionMarkerBrush(const QBrush &__value)
pen for location markers of user actions on the plot
void userCircleFinished(double x, double y, double radius, Qt::KeyboardModifiers modifiers)
emitted when the mouse action JKQTPlotter::CircleEvents and the drawing of the new circle is finished...
int getToolbarIconSize() const
get the width/height of the icons in the toolbar in pt
int getMouseLastClickY() const
y-position of the last mouse-click (in screen pixels)
void zoomToFit(bool zoomX=true, bool zoomY=true, bool includeX0=false, bool includeY0=false, double scaleX=1.05, double scaleY=1.05)
this method zooms the graph so that all plotted datapoints are visible.
Definition jkqtplotter.h:1039
MouseDragAction currentMouseDragAction
the currently executed MouseDragAction
Definition jkqtplotter.h:1359
void setY(double yminn, double ymaxx)
sets the y-range of the plot (minimum and maximum y-value on the y-axis)
Definition jkqtplotter.h:1164
void userEllipseFinished(double x, double y, double radiusX, double radiusY, Qt::KeyboardModifiers modifiers)
emitted when the mouse action JKQTPlotter::EllipseEvents and the drawing of the new ellipse is finish...
void saveAsTabSV(const QString &filename=QString(""))
save the current plot data as a Tabulator Separated Values (CSV) file
Definition jkqtplotter.h:1004
virtual ~JKQTPlotter()
class destructor
QMenu * menuSpecialContextMenu
use this QMenu instance instead of the standard context menu of this widget
Definition jkqtplotter.h:1489
void masterPlotScalingRecalculated()
connected to plotScalingRecalculated() of the masterPlotter
void setGridWidth(double __value)
sets the width of all Major grid lines
Definition jkqtplotter.h:947
JKQTPUserActionMarkerType getUserActionMarkerType() const
type of the location markers of user actions on the plot
void leaveEvent(QEvent *event) override
called, when the mouse leaves the widget, hides the toolbar (if visible)
JKQTPMouseDragActionsHashMap registeredOverrideMouseDragActionModes
list of override mouse drag action modes, that override the settings ing plotterStyle....
Definition jkqtplotter.h:1658
void synchronizeYToMaster(JKQTPlotter *master, bool synchronizeAxisLength=true, bool synchronizeZoomingMasterToSlave=true, bool synchronizeZoomingSlaveToMaster=true)
synchronize the plot y-axis height (and y-zooming) with a given master plotter (master --> slave/this...
void openSpecialContextMenu(int x, int y)
open the special context menu at the mouse position x and y
void paintEvent(QPaintEvent *event) override
this simply paints the stored image to the widget's surface
const JKQTPDatastore * getDatastore() const
returns a pointer to the datastore used by this object
Definition jkqtplotter.h:614
void setCurrentPlotterStyle(const JKQTPlotterStyle &style)
replace the current style properties for this JKQTBasePlotter
double mousePosY
y-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates)
Definition jkqtplotter.h:1580
void addGraphs(const TJKQTPGraphContainer &gr, QVector< size_t > *graphIDsOut=nullptr)
add a new graphs from a QVector<JKQTPPlotElement*>, QList<JKQTPPlotElement*>, std::vector<JKQTPPlotEl...
Definition jkqtplotter.h:816
int getNextStyle()
gets the next unused style id, i.e. the smalles number >=0 which is not contained in usedStyles
Definition jkqtplotter.h:840
WheelActionType
Definition jkqtplotter.h:1365
const QAction * getActMouseLeftAsZoomRect() const
action that activates the zoom rectangle tool (override!)
void setSpecialContextMenu(QMenu *menu)
sets a QMenu object to be used as special context menu
void saveAsCSV(const QString &filename=QString(""))
save the current plot data as a Comma Separated Values (CSV) file
Definition jkqtplotter.h:1000
QPen getUserActionOpaquePen() const
pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
int mouseDragRectYStartPixel
when zooming by moving the mouse this contains the y-coordinate the user clicked on (in pixels)
Definition jkqtplotter.h:1437
void useExternalDatastore(JKQTPDatastore *newStore)
tells the plotter object to use the given external datastore.
Definition jkqtplotter.h:617
QAction * getActMouseLeftAsPanView()
action that activates the pan view tool (override!)
void synchronizeYAxis(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter *sender)
may be connected to zoomChangedLocally() of a different plot and synchronizes the local y-axis to the...
int getMouseLastClickX() const
x-position of the last mouse-click (in screen pixels)
int getMaxTooltipDistance() const
maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaTool...
void resizeEvent(QResizeEvent *event) override
resizes the internal representation (image) of the graphs
double getMouseContextX() const
x-position of the mouse (in plot coordinates) when a user mouse-action was started (e....
const JKQTPPlotElement * getGraph(size_t i) const
returns description of i'th graph
Definition jkqtplotter.h:766
double getAbsoluteXMin() const
returns the absolute x-axis min of the primary x-axis. This is the lowest allowed value the the axis ...
Definition jkqtplotter.h:828
JKQTBasePlotter * plotter
JKQTBasePlotter used to plot.
Definition jkqtplotter.h:1405
void openContextMenu(int x, int y)
open the context menu at the mouse position x and y
void openStandardContextMenu(int x, int y)
open the standard context menu at the mouse position x and y
void pzoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTBasePlotter *sender)
called whenever the zoom changes in plotter
void deregisterMouseDoubleClickAction(Qt::MouseButton button, Qt::KeyboardModifiers modifier)
deregisteres the mouse action action to be executed when a mouse double-click occurs with the given b...
void openStandardContextMenu()
open the standard context menu at the mouse position of the last click
void copyData()
copy the data used for the current plot to the clipboard
Definition jkqtplotter.h:1028
void resetMouseLeftAction()
resets any previously set override action for the left mouse-button, un-modified
static int getGlobalResizeDelay()
returns the currently set global resize delay in milliseconds delayMS. This function is thread-safe!
void modifyGraphs(const std::function< void(JKQTPPlotElement *)> &func)
apply functor func to all graphs in the plotter. After completing the operation, the graph is updated
Definition jkqtplotter.h:748
void paintUserAction()
paint the user action (rectangle, ellipse, ...
bool isToolbarAlwaysOn() const
returns whether the toolbar is always visible or only when the mouse moves to the upper left area
void setMinorGridColor(QColor color)
sets the color of all minor grid lines
Definition jkqtplotter.h:941
void moveGraphBottom(JKQTPPlotElement *gr)
move the given graph gr to the bottom of all graphs
Definition jkqtplotter.h:794
JKQTPlotter(JKQTPDatastore *datast, QWidget *parent=nullptr)
class constructor for a JKQTPlotter using an external JKQTPDatastore dataset
bool containsGraph(JKQTPPlotElement *gr)
returns true, if the given graph is in this plot
Definition jkqtplotter.h:775
void zoom(double xminn, double xmaxn, double yminn, double ymaxn, bool affectsSecondaryAxes=false)
sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)
Definition jkqtplotter.h:925
double mouseContextY
y-position of the mouse (in plot coordinates) when a user mouse-action was started (e....
Definition jkqtplotter.h:1598
JKQTPMouseWheelActionsHashMapIterator findMatchingMouseWheelAction(Qt::KeyboardModifiers modifiers, bool *found=nullptr) const
searches JKQTPlotterStyle::registeredMouseWheelActions for a matching action
void setMouseMoveActionAsToolTip(bool enabled)
action that (de)activates the tooltip tool, when moving the mouse without any button pressed
bool saveAsSVG(const QString &filename=QString(""), bool displayPreview=true)
save the current plot as a SVG file, with the current widget aspect ratio, if filename is empty a fil...
Definition jkqtplotter.h:994
JKQTBasePlotter::GraphsConstIterator cbeginGraphs() const
returns an iterator to the first graph
Definition jkqtplotter.h:723
void setMinorGridWidth(double __value)
sets the width of all minor grid lines
Definition jkqtplotter.h:953
JKQTPVerticalAxisBase * getYAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis)
returns the y-axis objet of the plot
Definition jkqtplotter.h:713
void resetContextMenu(bool createnew=true)
destroys the internal contextMenu and optionally creates a new one
void delayedResizeEvent()
while the window is resized, the plot is only redrawn after a restartable delay, implemented by this ...
void moveGraphUp(JKQTPPlotElement *gr)
move the given graph gr one item up (i.e. it is drawn later/higher in the z-stack)
Definition jkqtplotter.h:797
void setGridPrinting(bool enabled)
enables grid-printing for this plot
void mouseDoubleClickEvent(QMouseEvent *event) override
event handler for a double click
QMenu * contextMenu
the context menu object used by this JKQTPlotter
Definition jkqtplotter.h:1592
void setAbsoluteX(double xminn, double xmaxx)
sets absolutely limiting x-range of the plot
Definition jkqtplotter.h:1152
QTimer resizeTimer
timer used while the graph is resized to delay the redrawing with new size (in the meantime,...
Definition jkqtplotter.h:1632
QBrush getUserActionOpaqueBrush() const
brush for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
QAction * getActMouseLeftAsZoomRect()
action that activates the zoom rectangle tool (override!)
void deleteGraph(size_t i, bool deletegraph=true)
remove the i-th graph
Definition jkqtplotter.h:772
void saveData(const QString &filename=QString(""), const QString &format=QString(""))
save the data used for the current plot. The file format is extracted from the file extension (csv,...
Definition jkqtplotter.h:1016
double getAbsoluteYMax() const
returns the absolute y-axis max of the primary y-axis This is the highest allowed value the the axis ...
Definition jkqtplotter.h:834
QSet< JKQTPMouseMoveActions > currentMouseMoveAction
the currently executed MouseMoveActions
Definition jkqtplotter.h:1363
const quint64 maxWheelEventSeriesTimestampDifference
max. time between two QWheelEvents that are recognized as one series
Definition jkqtplotter.h:1376
size_t addGraphAtBottom(JKQTPPlotElement *gr)
add a new graph before all other graphs (i.e. at the top of the list of graphs), if the graph is alre...
Definition jkqtplotter.h:788
void setGridPrintingCurrentY(size_t y)
set the y-position of this JKQTPlotter in the grid-printing grid
void userScribbleClick(double x, double y, Qt::KeyboardModifiers modifiers, bool first, bool last)
emitted when the mouse action JKQTPlotter::ScribbleEvents and a click event from the mouse occurs ins...
quint64 lastWheelActionTimestamp
storage for timestammp of the last QWheelEvent (used in wheelAction() to distinguish trackpad-pan ati...
Definition jkqtplotter.h:1374
void setMinorGridStyle(Qt::PenStyle __value)
sets the style of all minor grid lines
Definition jkqtplotter.h:965
JKQTBasePlotter * getPlotter()
returns the JKQTBasePlotter object internally used for plotting
Definition jkqtplotter.h:404
bool isPlotUpdateEnabled() const
returns, whether automatic redrawing the plot is currently activated (e.g. you can deactivate this wi...
void saveCurrentPlotterStyle(QSettings &settings, const QString &group="plots/", bool alsoSaveBaseStyle=true) const
store the current style properties for this JKQTBasePlotter with properties loaded from settings
void plotScalingRecalculated()
emitted when the plot scaling has been recalculated
double getXMin() const
returns the current x-axis min of the primary x-axis
Definition jkqtplotter.h:820
double mouseDragRectXEnd
when draging the mouse this contains the x-coordinate the mouse is currently pointing to
Definition jkqtplotter.h:1431
void synchronizeToMaster(JKQTPlotter *master, JKQTBasePlotter::SynchronizationDirection synchronizeDirection, bool synchronizeAxisLength=true, bool synchronizeZoomingMasterToSlave=true, bool synchronizeZoomingSlaveToMaster=true)
synchronize the plot borders (and zooming) with a given plotter (master --> slave/this)
void deregisterMouseWheelAction(Qt::KeyboardModifiers modifier)
deletes all mouse-wheel actions registered for a given modifier
JKQTPContextMenuModes getContextMenuMode() const
returns the currently set mode for the context menu
void mouseMoveEvent(QMouseEvent *event) override
event handler for a mouse move
void clearAllMouseMoveActions()
deletes all mouse-move actions
size_t addGraphOnTop(JKQTPPlotElement *gr)
add a new graph at the end of the graphs, if the graph is already in the plot, it is moved to the end...
Definition jkqtplotter.h:786
void saveSettings(QSettings &settings, const QString &group=QString("plots/")) const
saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object.
size_t addGraph(JKQTPPlotElement *gr)
Definition jkqtplotter.h:784
int mouseDragRectXEndPixel
when draging the mouse this contains the x-coordinate the mouse is currently pointing to (in pixels)
Definition jkqtplotter.h:1422
void moveGraphTop(JKQTPPlotElement *gr)
move the given graph gr to the end of all graphs, so it is drawn
Definition jkqtplotter.h:791
QAction * actMouseLeftAsDefault
action that activates the default action, set in plotterStyle!
Definition jkqtplotter.h:1668
void copyDataMatlab()
copy the data used for the current plot to the clipboard as a Matlab script
Definition jkqtplotter.h:1033
void setGrid(bool val)
sets whether the major grid lines of the major axes are shown
Definition jkqtplotter.h:930
void contextMenuOpened(double x, double y, QMenu *contextMenu)
emitted whenever a context menu is opened. You can modify the menu via the parameter contextMenu!
QBrush getUserActionOverlayBrush() const
brush for user actions (typically semi-transparent, like e.g. zoom-rectangles)
void populateToolbar(QToolBar *toolbar) const
popuplate the given toolbar toolbar with all actions shown in a toolbar from this class ....
JKQTPMouseMoveActionsHashMapIterator findMatchingMouseMoveAction(Qt::KeyboardModifiers modifiers, bool *found=nullptr) const
searches JKQTPlotterStyle::registeredMouseMoveActions for a matching action
QSize getImageBufferSize(float *scale_out=nullptr) const
returns the required size of an image for the internal double-buffering
void zoomIn(double factor=2.0)
zooms into the graph (the same as turning the mouse wheel) by the given factor
Definition jkqtplotter.h:1044
void updateToolbar()
update settings of the toolbar
QActionGroup * actgrpMouseLeft
action group, that groups the actMouseLeft... actions
Definition jkqtplotter.h:1666
void setMousePositionShown(bool __value)
specifies whether to display the current position of the mouse in the top border of the plot (this ma...
void setToolbarIconSize(int value)
set the width/height of the icons in the toolbar in pt
bool isMousePositionShown() const
specifies whether to display the current position of the mouse in the top border of the plot (this ma...
void setShowZeroAxes(bool showXY)
switches the visibility of the zero-axes associated with the major x- and y-axis
Definition jkqtplotter.h:978
void setUserActionOpaqueBrush(const QBrush &__value)
pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
void setUserActionOverlayPen(const QPen &__value)
pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)
void moveGraphDown(int idx)
move the given graph gr one item down (i.e. it is drawn earlier/lower in the z-stack)
Definition jkqtplotter.h:812
void clearAllMouseWheelActions()
deletes all mouse-wheel actions
void registerMouseMoveAction(Qt::KeyboardModifiers modifier, JKQTPMouseMoveActions action)
specifies the action to perform on a mouse move event when a given modifier is pressed
void tooltipDisplayed(double x, double y, const QStringList &entries, const QList< JKQTPPlotElement * > &graphs)
emitted when a tooltip for a datapoint is displayed
JKQTPMouseDragActionsHashMapIterator findMatchingMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, bool *found=nullptr) const
searches JKQTPlotterStyle::registeredMouseActionModes for a matching action, returns in found whether...
double getMagnification() const
returns the current magnification factor
Definition jkqtplotter.h:837
int mouseLastClickY
y-position of the last mouse-click (in screen pixels)
Definition jkqtplotter.h:1602
bool isEmittingSignalsEnabled() const
returns whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate()
Definition jkqtplotter.h:631
void setMouseLeftActionAsRuler()
action that activates the ruler tool
void setGridPrintingCurrentX(size_t x)
set the x-position of this JKQTPlotter in the grid-printing grid
void plotMouseDoubleClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button)
emitted when a double-click event from the mouse occurs inside the plot
const JKQTPHorizontalAxisBase * getXAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis) const
returns the x-axis objet of the plot
Definition jkqtplotter.h:715
void saveAsMatlab(const QString &filename=QString(""))
save the current plot data as a Matlab Script
Definition jkqtplotter.h:1010
int getUserActionMarkerDiameter() const
size (diameter) of markers drawn by user actions
void setXY(double xminn, double xmaxx, double yminn, double ymaxx, bool affectsSecondaryAxes=false)
sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)
Definition jkqtplotter.h:1167
QAction * getActMouseMoveToolTip()
action that activates the tooltip tool (override!)
void clearAllRegisteredMouseDragActions()
clear all registeres mouse drag actions
void setToolbarAlwaysOn(bool __value)
returns whether the toolbar is always visible or only when the mouse moves to the upper left area
JKQTPlotterStyle plotterStyle
current style properties for this JKQTPlotter
Definition jkqtplotter.h:1621
int mouseDragRectXStartPixel
when draging the mouse this contains the x-coordinate the user clicked on (in pixels)
Definition jkqtplotter.h:1418
void updateCursor()
set the current mouse cursor shappe according to currentMouseDragAction
void userLineFinished(double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers)
emitted when the mouse action JKQTPlotter::LineEvents and the drawing of the new line is finished (=m...
void synchronizeXToMaster(JKQTPlotter *master, bool synchronizeAxisLength=true, bool synchronizeZoomingMasterToSlave=true, bool synchronizeZoomingSlaveToMaster=true)
synchronize the plot x-axis width (and x-zooming) with a given master plotter (master --> slave/this)
double getXMax() const
returns the current x-axis max of the primary x-axis
Definition jkqtplotter.h:822
bool saveImage(const QString &filename=QString(""), bool displayPreview=true)
save the current plot as an image file, with the current widget aspect ratio, if filename is empty a ...
Definition jkqtplotter.h:983
void setPlotUpdateEnabled(bool enable)
sets whether automatic redrawing the plot is currently activated (e.g. you can sett his to false whil...
QPointer< JKQTPlotter > masterPlotterY
the master plotter, this plotter is connected to in y-direction.
Definition jkqtplotter.h:1572
QMenu * getSpecialContextMenu() const
returns the currently set special context menu object
JKQTPlotter(bool datastore_internal, QWidget *parent=nullptr, JKQTPDatastore *datast=nullptr)
class constructor
bool isResizeTimerRunning() const
returns true, if the JKQTPlotter::resizeTimer is currently running and the widget is waiting for the ...
void setAbsoluteXY(double xminn, double xmaxx, double yminn, double ymaxx)
sets absolutely limiting x- and y-range of the plot
Definition jkqtplotter.h:1158
void setUserActionOpaquePen(const QPen &__value)
pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
QAction * getActMouseLeftAsRuler()
action that activates the ruler tool (override!)
InternalBufferImageType oldImage
this can be used when drawing a zoom rectangle to store an unchanged copy of the currently displayed ...
Definition jkqtplotter.h:1473
QAction * getActMouseLeftAsDefault()
action that activates the default action, set in plotterStyle!
void moveGraphBottom(int idx)
move the given graph gr to the bottom of all graphs
Definition jkqtplotter.h:806
void moveGraphTop(int idx)
move the given graph gr to the end of all graphs, so it is drawn
Definition jkqtplotter.h:803
JKQTPMouseDoubleClickActionsHashMapIterator findMatchingMouseDoubleClickAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, bool *found=nullptr) const
searches JKQTPlotterStyle::registeredMouseDoubleClickActions for a matching action
void plotNewZoomRectangle(double mouseDragRectXStart, double mouseDragRectXEnd, double mouseDragRectYStart, double mouseDragRectYEnd, Qt::KeyboardModifiers modifiers)
emitted when the mouse action jkqtpmdaZoomByRectangle and the drawing of the new zoom rectangle is fi...
QList< QMenu * > contextSubMenus
internal storage for sub-menu entries of the internal contextMenu object, based on the actions return...
Definition jkqtplotter.h:1606
void setToolbarEnabled(bool __value)
returns whether the toolbar is enabled
void forceInternalDatastore()
tells the plotter object to use an internal datastore (just like useInternalDatastore() ),...
Definition jkqtplotter.h:626
void zoomOut(double factor=2.0)
zooms out of the graph (the same as turning the mouse wheel) by the given factor
Definition jkqtplotter.h:1046
void setGridPrintingCurrentPos(size_t x, size_t y)
set the x- and y-positions of this JKQTPlotter in the grid-printing grid
JKQTPPlotElement * getGraph(size_t i)
returns description of i'th graph
Definition jkqtplotter.h:764
void resetCurrentMouseDragAction()
resets the currently activated mouse drag action, e.g. called by mouseReleaseEvent()
JKQTPBaseKey * getMainKey()
retuns the main key object
Definition jkqtplotter.h:412
JKQTBasePlotter::GraphsIterator beginGraphs()
returns an iterator to the first graph
Definition jkqtplotter.h:740
QPen getUserActionOverlayPen() const
pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)
void setGridColor(QColor color)
sets the color of all major grid lines (of the major x- and y-axis)
Definition jkqtplotter.h:935
void setCurrentPlotterStyle(const JKQTPlotterStyle &style, const JKQTBasePlotterStyle &baseStyle)
replace the current style properties for this JKQTBasePlotter
double getMouseContextY() const
y-position of the mouse (in plot coordinates) when a user mouse-action was started (e....
double getAbsoluteXMax() const
returns the absolute x-axis max of the primary x-axis This is the highest allowed value the the axis ...
Definition jkqtplotter.h:830
JKQTBasePlotter::GraphsConstIterator beginGraphs() const
returns an iterator to the first graph
Definition jkqtplotter.h:732
const QAction * getActMouseLeftAsRuler() const
action that activates the ruler tool (override!)
void saveAsDIF(const QString &filename=QString(""))
save the current plot data as a Data Interchange Format file (see https://en.wikipedia....
Definition jkqtplotter.h:1006
const JKQTBasePlotter::GraphsList & getGraphs() const
returns a list of all graphs
Definition jkqtplotter.h:756
void deleteGraph(JKQTPPlotElement *gr, bool deletegraph=true)
remove the i-th graph
Definition jkqtplotter.h:778
void setMaxTooltipDistance(int v)
maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaTool...
void sortGraphs(const std::function< bool(const JKQTPPlotElement *, const JKQTPPlotElement *)> &compareLess)
sort the graphs, using functor compareLess to find whether a first graph shall be before (i....
Definition jkqtplotter.h:752
QAction * actMouseLeftAsZoomRect
action that activates the zoom rectangle tool (override!)
Definition jkqtplotter.h:1674
void plotMouseClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button)
emitted when a single-click event from the mouse occurs inside the plot
void print(QPrinter *printer=nullptr)
print the current plot, if printer is nullptr a printer selection dialog is displayed
Definition jkqtplotter.h:1022
void wheelEvent(QWheelEvent *event) override
event handler for a turn of the mouse wheel
void userRectangleFinished(double x, double y, double width, double height, Qt::KeyboardModifiers modifiers)
emitted when the mouse action JKQTPlotter::RectangleEvents and the drawing of the new rectangle is fi...
void moveGraphUp(int idx)
move the given graph gr one item up (i.e. it is drawn later/higher in the z-stack)
Definition jkqtplotter.h:809
void keyReleaseEvent(QKeyEvent *event) override
react on key presses.
void setUserActionOverlayBrush(const QBrush &__value)
pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)
bool saveAsPixelImage(const QString &filename=QString(""), bool displayPreview=true, const QByteArray &outputFormat=QByteArray(), const QSize &outputSizeIncrease=QSize(0, 0))
save the current plot as a pixel image image (PNG ...), if filename is empty a file selection dialog ...
Definition jkqtplotter.h:988
void mouseReleaseEvent(QMouseEvent *event) override
event handler for a mouse release event
const QAction * getActMouseLeftAsPanView() const
action that activates the pan view tool (override!)
void openContextMenu()
open the context menu at the mouse position of the last click
const QAction * getActMouseMoveToolTip() const
action that activates the tooltip tool (override!)
QSize minSize
current minimal size of the JKQTPlotter widget to properly display the plot
Definition jkqtplotter.h:1584
const JKQTBasePlotter * getPlotter() const
returns the JKQTBasePlotter object internally used for plotting
Definition jkqtplotter.h:406
size_t getGraphCount()
returns the number of graphs
Definition jkqtplotter.h:769
int getUserActionCatchSensitivity() const
sensitivity (i.e. max. distance to see as one point) for user actions
bool isToolbarEnabled() const
returns whether the toolbar is enabled
void deregisterMouseMoveAction(Qt::KeyboardModifiers modifier)
deletes all mouse-move actions registered for a given modifier
void saveAsSYLK(const QString &filename=QString(""))
save the current plot data as a SYmbolik LinK (SYLK) spreadsheet file (see https://en....
Definition jkqtplotter.h:1008
const JKQTPBaseKey * getMainKey() const
retuns the main key object
Definition jkqtplotter.h:418
void useInternalDatastore()
tells the plotter object to use an internal datastore. A new internal datastore object is generated o...
Definition jkqtplotter.h:623
void intBeforePlotScalingRecalculate()
emitted before the plot scaling has been recalculated
QAction * actMouseMoveToolTip
action that activates the tooltip tool (override!)
Definition jkqtplotter.h:1672
double mouseDragRectYEnd
when zooming by moving the mouse this contains the y-coordinate the mouse is currently pointing to
Definition jkqtplotter.h:1442
void mousePressEvent(QMouseEvent *event) override
event handler for a mouse down event
void openStandardAndSpecialContextMenu()
open the standard context menu with the special context menu integrated at the mouse position of the ...
void setMagnification(double m)
set the current plot magnification
void moveGraphDown(JKQTPPlotElement *gr)
move the given graph gr one item down (i.e. it is drawn earlier/lower in the z-stack)
Definition jkqtplotter.h:800
QSize sizeHint() const override
returns the size of the widget
void setMouseLeftDragActionAsToolTip()
action that activates the tooltip tool, when dragging the mouse with the left button pressed
double mouseContextX
x-position of the mouse (in plot coordinates) when a user mouse-action was started (e....
Definition jkqtplotter.h:1596
void setUserActionMarkerPen(const QPen &__value)
pen for location markers of user actions on the plot
JKQTBasePlotter::GraphsList & getGraphs()
returns a list of all graphs
Definition jkqtplotter.h:760
void widgetResized(int new_width, int new_height, JKQTPlotter *sender)
signal: emitted whenever the widget is resized
QImage grabPixelImage(QSize size=QSize(), bool showPreview=false)
returns a rendering of the current plot as a QImage (pixel image) with the given size
Definition jkqtplotter.h:911
void registerMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifier, JKQTPMouseDragActions action)
registeres a certain mouse drag action action to be executed when a mouse drag operation is initializ...
void setEmittingSignalsEnabled(bool sig)
specifies whether this class emits signals, like zoomChangedLocally() or beforePlotScalingRecaluclate...
Definition jkqtplotter.h:629
void resetOverrideMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
removes a previously set override mouse drag action for the given button/modifiers combination
JKQTBasePlotter::GraphsIterator endGraphs()
returns an iterator behind the last graph
Definition jkqtplotter.h:744
void fixBasePlotterSettings()
modifies the settings of plotter to match those of this object
void updateToolbarActions()
void setAbsoluteY(double yminn, double ymaxx)
sets absolute minimum and maximum y-value to plot
Definition jkqtplotter.h:1155
JKQTPContextMenuModes contextMenuMode
current mode for the default context menu (i.e. the right-click context menu)
Definition jkqtplotter.h:1594
void setMouseActionToolbarActionsActive(bool __value)
allows to activate/deactivate toolbar buttons that can activate certain mouse drag actions
void initContextMenu()
fills the member contextMenu with all default and additionally registered actions,...
InternalBufferImageType image
this stores the currently displayed plot
Definition jkqtplotter.h:1468
void setMouseLeftActionAsPanView()
action that activates the pan viewport tool
void beforePlotScalingRecalculate()
emitted before the plot scaling has been recalculated
QAction * actMouseLeftAsRuler
action that activates the ruler tool (override!)
Definition jkqtplotter.h:1670
JKVanishQToolBar * toolbar
toolbar class used for user input
Definition jkqtplotter.h:1494
void rulerDisplayed(double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers)
emitted when a new ruler between two points is displayed
void zoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter *sender)
signal: emitted whenever the user selects a new x-y zoom range (in the major axes,...
void modifyContextMenu(QMenu *menu)
you may overwrite this method to modify the given context menu before it is displayed.
WheelActionType lastWheelActionType
storage for last WheelActionType (used in wheelAction() to distinguish trackpad-pan ations in mode jk...
Definition jkqtplotter.h:1372
int getPlotYOffset() const
calculate the y-axis shift of the plot, so there is space for the potentially displayed mouse positio...
double getYMin() const
returns the current y-axis min of the primary y-axis
Definition jkqtplotter.h:824
QBrush getUserActionMarkerBrush() const
brush for location markers of user actions on the plot
bool doDrawing
indicates whether the plot is updated automatically at the moment
Definition jkqtplotter.h:1402
void useAsInternalDatastore(JKQTPDatastore *newStore)
tells the plotter object to use the given external datastore and treat it as an internal one (i....
Definition jkqtplotter.h:620
JKQTPDatastore * getDatastore()
returns a pointer to the datastore used by this object
Definition jkqtplotter.h:611
void setOverrideMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, JKQTPMouseDragActions action)
sets an override mouse drag action for the given button/modifiers combination
void setUserActionMarkerType(JKQTPUserActionMarkerType v)
type of the location markers of user actions on the plot
void fillInternalStructForToolTipOfClosestDataPoint(double x0, double y0, bool emitEvent=true)
fills the inertnal mouseDragMarkers structure with data to display tooltips close to (x0,...
void setUserActionMarkerDiameter(int v)
size (diameter) of markers drawn by user actions
void copyPixelImage(bool showPreview=true)
copy the current plot as a pixel+svg image to the clipboard
Definition jkqtplotter.h:915
const JKQTPVerticalAxisBase * getYAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis) const
returns the y-axis objet of the plot
Definition jkqtplotter.h:717
double mouseDragRectXStart
when draging the mouse this contains the x-coordinate the user clicked on (in plot coordinates)
Definition jkqtplotter.h:1415
void synchronizeXAxis(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter *sender)
may be connected to zoomChangedLocally() of a different plot and synchronizes the local x-axis to the...
double mousePosX
x-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates)
Definition jkqtplotter.h:1578
void setContextMenuMode(JKQTPContextMenuModes mode)
sets the mode if the standard context menu
void loadSettings(const QSettings &settings, const QString &group=QString("plots/"))
loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object
void redrawPlot()
update the plot and the overlays
void deregisterMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifier)
deregisteres the mouse drag action to be executed when a mouse drag operation is initialized with the...
QSize minimumSizeHint() const override
returns the minimum size of the widget
void saveAsSemicolonSV(const QString &filename=QString(""))
save the current plot data as a Semicolon Separated Values (SSV) file
Definition jkqtplotter.h:1002
QPixmap InternalBufferImageType
Definition jkqtplotter.h:1465
void loadCurrentPlotterStyle(const QSettings &settings, const QString &group="plots/", bool alsoLoadBaseStyle=true)
replace the current style properties for this JKQTBasePlotter with properties loaded from settings
void addGridPrintingPlotter(size_t x, size_t y, JKQTPlotter *plotterOther)
add a new plotter plotterOther for grid printing mode, at location x / y
double magnification
magnification factor for the display of the plot
Definition jkqtplotter.h:1582
const JKQTBasePlotter * getConstplotter() const
returns the JKQTBasePlotter object internally used for plotting
Definition jkqtplotter.h:408
JKQTPHorizontalAxisBase * getXAxis(JKQTPCoordinateAxisRef axis=JKQTPPrimaryAxis)
returns the x-axis objet of the plot
Definition jkqtplotter.h:711
JKQTPlotter(QWidget *parent=nullptr)
class constructor
const QAction * getActMouseLeftAsDefault() const
action that activates the default action, set in plotterStyle!
void correctZoomRectForPanning(QRectF &rect) const
tool function, which corrects the given rectangle (in pixels!) during a panning action....
static std::atomic< int > jkqtp_RESIZE_DELAY
delay for resizing in milliseconds. If set to 0, resize delay is disabled and resizeTimer is unused.
Definition jkqtplotter.h:1638
bool mouseDragingRectangle
this is set true if we are drawing a zoom rectangle
Definition jkqtplotter.h:1412
QList< MouseDragMarker > mouseDragMarkers
internal list of markers to be drawn by paintUserAction()
Definition jkqtplotter.h:1463
bool saveAsPDF(const QString &filename=QString(""), bool displayPreview=true)
save the current plot as a PDF file, with the current widget aspect ratio, if filename is empty a fil...
Definition jkqtplotter.h:996
int mouseLastClickX
x-position of the last mouse-click (in screen pixels)
Definition jkqtplotter.h:1600
void synchronizeXYAxis(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter *sender)
may be connected to zoomChangedLocally() of a different plot and synchronizes the local x- and y-axis...
void registerMouseWheelAction(Qt::KeyboardModifiers modifier, JKQTPMouseWheelActions action)
specifies the action to perform on a mouse wheel event when a given modifier is pressed
const JKQTPlotterStyle & getCurrentPlotterStyle() const
current style properties for this JKQTPlotter
void clearGraphs(bool deleteGraphs=true)
remove all plots
Definition jkqtplotter.h:781
int mouseDragRectYEndPixel
when draging the mouse this contains the y-coordinate the mouse is currently pointing to (in pixels)
Definition jkqtplotter.h:1426
double getAbsoluteYMin() const
returns the absolute y-axis min of the primary y-axis This is the lowest allowed value the the axis m...
Definition jkqtplotter.h:832
void plotMouseMove(double x, double y)
emitted whenever the mouse moves
QAction * actMouseLeftAsPanView
action that activates the pan view tool (override!)
Definition jkqtplotter.h:1676
double mouseDragRectYStart
when draging the mouse this contains the y-coordinate the user clicked on (in plot coordinates)
Definition jkqtplotter.h:1434
void setShowZeroAxes(bool showX, bool showY)
switches the visibility of the zero-axes associated with the x- and y-axis
Definition jkqtplotter.h:974
void setMouseLeftActionAsZoomRect()
action that activates the zoom rectangle tool
void registerMouseDoubleClickAction(Qt::MouseButton button, Qt::KeyboardModifiers modifier, JKQTPMouseDoubleClickActions action)
registeres a certain mouse action action to be executed when a mouse double-click occurs with the giv...
QPen getUserActionMarkerPen() const
pen for location markers of user actions on the plot
virtual bool event(QEvent *event) override
static void setGlobalResizeDelay(int delayMS)
sets the global resize delay in milliseconds delayMS. After calling this function all plots will use ...
Support Class for JKQTPlotter, which summarizes all properties that define the visual styling of a JK...
Definition jkqtplotterstyle.h:40
a modified QToolBar which vanishes when the mouse leaves the toolbar.
Definition jkvanishqtoolbar.h:38
JKQTPMouseMoveActionsHashMap::const_iterator JKQTPMouseMoveActionsHashMapIterator
iterator for JKQTPMouseMoveActionsHashMap
Definition jkqtptools.h:256
JKQTPMouseDoubleClickActionsHashMap::const_iterator JKQTPMouseDoubleClickActionsHashMapIterator
iterator for JKQTPMouseDoubleClickActionsHashMap
Definition jkqtptools.h:248
JKQTPCoordinateAxes
named references for different oordinate axes in the plot
Definition jkqtpcoordinateaxes.h:42
JKQTPMouseMoveActions
Availble action this JKQtPlotter can perform when mouse events occur. This allows you to e....
Definition jkqtptools.h:188
JKQTPMouseDragActionsHashMap::const_iterator JKQTPMouseDragActionsHashMapIterator
iterator for JKQTPMouseDragActionsHashMap
Definition jkqtptools.h:234
JKQTPMouseDragActions
Availble action this JKQtPlotter can perform when mouse events occur. This allows you to e....
Definition jkqtptools.h:110
JKQTPUserActionMarkerType
Styles in which to mark single positions during user actions in JKQTPlotter.
Definition jkqtptools.h:83
JKQTPMouseWheelActions
actions that can be bound to a mouse wheel event
Definition jkqtptools.h:164
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89
JKQTPContextMenuModes
modes for the context menu
Definition jkqtptools.h:209
QT_BEGIN_NAMESPACE size_t qHash(const QPair< Qt::MouseButton, Qt::KeyboardModifiers > &key, size_t)
qHash-variant used by JKQTPlotter
Definition jkqtplotter.h:1721
JKQTPMouseDoubleClickActions
actions that can be bound to a double-click of the mouse
Definition jkqtptools.h:140
QHash< QPair< Qt::MouseButton, Qt::KeyboardModifiers >, JKQTPMouseDragActions > JKQTPMouseDragActionsHashMap
data structure for storage of assigned JKQTPMouseDragActions
Definition jkqtptools.h:231
JKQTPLOTTER_LIB_EXPORT void initJKQTPlotterResources()
initialized Qt-ressources necessary for JKQTPlotter
JKQTPMouseWheelActionsHashMap::const_iterator JKQTPMouseWheelActionsHashMapIterator
iterator for JKQTPMouseWheelActionsHashMap
Definition jkqtptools.h:241
@ JKQTPPrimaryAxis
Definition jkqtpcoordinateaxes.h:43
void jkqtp_hash_combine(std::size_t &seed, const T &v)
can be used to build a hash-values from several hash-values
Definition jkqtpmathtools.h:686
ties a MouseActionMode to a mouse-button and a keyboard-modifier
Definition jkqtplotter.h:1345
MouseDragAction(Qt::MouseButton _mouseButton, Qt::KeyboardModifiers _modifier, JKQTPMouseDragActions _mode)
Qt::KeyboardModifiers modifier
Definition jkqtplotter.h:1350
Qt::MouseButton mouseButton
Definition jkqtplotter.h:1351
bool valid
Definition jkqtplotter.h:1355
MouseDragAction()
constructs an invalid object
JKQTPMouseDragActions mode
Definition jkqtplotter.h:1349
describes a marker to be drawn by paintUserAction()
Definition jkqtplotter.h:1445
QColor color
color for the marker
Definition jkqtplotter.h:1456
QPoint pos
position of the marker in screen pixels
Definition jkqtplotter.h:1450
QImage keyMarker
key marker image
Definition jkqtplotter.h:1458
QString title
graph label
Definition jkqtplotter.h:1454
JKQTPPlotElement * graph
graph that created that marker
Definition jkqtplotter.h:1460
QString label
marker label
Definition jkqtplotter.h:1452
MouseDragMarker(const QPoint &pos_, const QString &label_, const QString &title_, const QColor &color_, const QImage &keymarker_=QImage(), JKQTPPlotElement *_graph=nullptr)
Definition jkqtplotter.h:1446