2015-07-11 18:56:02 +08:00
/*
2022-07-19 19:40:43 +08:00
Copyright ( c ) 2008 - 2022 Jan W . Krieger ( < jan @ jkrieger . de > )
2015-07-11 18:56:02 +08:00
2015-07-12 22:34:27 +08:00
2015-07-11 18:56:02 +08:00
This software is free software : you can redistribute it and / or modify
2019-02-08 00:24:46 +08:00
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation , either version 2.1 of the License , or
2015-07-11 18:56:02 +08:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
2019-02-08 00:24:46 +08:00
GNU Lesser General Public License for more details .
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
You should have received a copy of the GNU Lesser General Public License
2015-07-11 18:56:02 +08:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
2022-04-25 04:07:39 +08:00
# ifndef JKQTPLOTTER_H
# define JKQTPLOTTER_H
2015-07-11 18:56:02 +08:00
# include <QWidget>
# include <QVector>
# include <QSettings>
# include <QColor>
# include <QMap>
# include <QVector>
# include <QScrollArea>
# include <QVBoxLayout>
# include <QToolBar>
# include <QGridLayout>
# include <QListWidget>
# include <QListWidgetItem>
# include <QToolBar>
# include <QPointer>
# include <QTimer>
# include <vector>
# include <cmath>
# include <iostream>
2018-11-26 03:25:44 +08:00
# include "jkqtplotter/jkqtpbaseplotter.h"
2019-02-08 00:24:46 +08:00
# include "jkqtplotter/jkqtplotterstyle.h"
# include "jkqtplotter/jkqtpbaseplotterstyle.h"
2019-05-30 04:40:02 +08:00
# include "jkqtplotter/jkqtptools.h"
2022-04-25 04:07:39 +08:00
# include "jkqtplotter/jkqtpgraphsbase.h"
2019-06-22 20:21:32 +08:00
# include "jkqtplotter/jkqtplotter_imexport.h"
2019-06-20 21:18:58 +08:00
# include "jkqtplotter/gui/jkvanishqtoolbar.h"
2015-07-11 18:56:02 +08:00
# include <QKeyEvent>
2019-01-20 23:15:10 +08:00
/** \brief initialized Qt-ressources necessary for JKQTPlotter
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-01-13 01:53:16 +08:00
*/
2019-06-22 20:21:32 +08:00
JKQTPLOTTER_LIB_EXPORT void initJKQTPlotterResources ( ) ;
2018-12-03 01:30:12 +08:00
2015-07-11 18:56:02 +08:00
2019-01-27 03:12:54 +08:00
/** \brief plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
2019-01-19 16:40:52 +08:00
* \ ingroup jkqtpplotterclasses
2015-07-11 18:56:02 +08:00
*
2019-01-29 05:14:27 +08:00
* This class is a QWidget - wrapper around JKQTBasePlotter . It uses the tools from JKQTBasePlotter
* to display scientific plots . This class mostly adds the Widget for the output and adds different
* types of user interactions .
2019-01-26 03:16:04 +08:00
*
* < b > Please have a look at the documentation of JKQTBasePlotter for details on the management of graphs
* and the formating / styling of the plot and graphs ! < / b >
*
2019-01-29 05:14:27 +08:00
* The rest of this documentation ins split into sections that each treat a special topic , as outlines below :
2019-01-26 03:16:04 +08:00
*
2019-01-29 05:14:27 +08:00
* \ tableofcontents
2019-01-26 03:16:04 +08:00
*
2019-01-25 05:49:10 +08:00
*
2019-02-08 00:24:46 +08:00
* \ section JKQTPLOTTER_BASICUSAGE Basic Usage of JKQTPlotter
*
* JKQTPlotter is a plotter widget which wraps around a JKQTBasePlotter instanced that does the actual drawing .
* A basic usage of JKQTPlotter looks like this :
*
* \ code { . cpp }
* // create a new JKQTPlotter instance
* JKQTPlotter * plot = new JKQTPlotter ( parentWidget ) ;
*
* // fill two vectors with dtaa for a graph:
* QVector < double > X , Y ;
* fillDataVectors ( X , Y ) ;
*
* // make data available to the internal datastore of the plotter:
* size_t columnX = plot - > getDatastore ( ) - > addCopiedColumn ( X , " x " ) ;
* size_t columnY = plot - > getDatastore ( ) - > addCopiedColumn ( Y , " y " ) ;
*
* // create a graph/curve, which displays the data
* JKQTPXYLineGraph * graph1 = new JKQTPXYLineGraph ( plot ) ;
* graph1 - > setXColumn ( columnX ) ;
* graph1 - > setYColumn ( columnY ) ;
* graph1 - > setTitle ( QObject : : tr ( " graph title " ) ) ;
* plot - > addGraph ( graph1 ) ;
*
* // autoscale the plot
* plot - > zoomToFit ( ) ;
* // alternatively set the axis dimension by hand:
* plot - > setXY ( - 10 , 10 , - 10 , 10 ) ;
* \ endcode
*
* The result should look something like this :
*
* \ image html jkqtplotter_simpletest1 . png
*
* Starting from this basic example , you can observe several important principles :
* # Data is stored in an ( internal ) instance of JKQTPDatastore , which is accessible through
* JKQTPlotter : : getDatastore ( ) .
* This datastore can either own its data ( which is done here , as we copy the data into the store
* by calling JKQTPDatastore : : addCopiedColumn ( ) , or it can merely reference to the data ( then
* data needs to be available as array of \ c double values ) .
* # Naming conventions :
* - \ b plot is the complete drawn image , including the axes , the graphs , the key and all other visual elements
* - < b > plot element < / b > any sub element of the plot , e . g . a single coordinate axis , the key , but also any graph / curve
* - \ b graph is a single curve / image / geometric element in the plot
* - < b > geometric element < / b > is a special graph that does not represent a curve based on data from the JKQTPDatastore ,
* but a single graphic element , like a rectangle / circle / line / . . . , some text , a single symbol
* - \ b key is the legend of the plot
* - < b > coordinate axis < / b > is each of the x - or y - axis ( there might be addition axes , e . g . when showing a color - scale )
* .
* # Each graph is represented by a class derived from JKQTPPlotElement ( in the example we instanciated a JKQTPXYLineGraph ,
* which shows data as a scatter of symbols that may ( or may not ) be connected by a line ) .
* Creating the graph class does not yet add it to the plotter . To add it , call JKQTPlotter : : addGraph ( ) . Only
* after this sep , the graph is displayed . You can modify the apperance of the graph ( e . g . colors ,
* name in the key . . . ) by setting properties in the graph class instance .
* # You can auto - zoom the axis ranges of the plot by calling JKQTPlotter : : zoomToFit ( ) , or set them
* exlicitly by calling JKQTPlotter : : setXY ( ) . The user can later zoom in / out by the mouse ( and other means ) .
* You can limit this zoom range by setting an absolute axis range , calling e . g . JKQTPlotter : : setAbsoluteXY ( ) .
* The the user cannot zoom farther out than the given range ( s ) .
* # If you want to style the plot itself , you need to set properties of the underlying JKQTBasePloter instance , which
* is accessible through JKQTPlotter : : getPlotter ( ) . If you want to style the coordinate axes , you can acces their
* representing objects by caling JKQTPlotter : : getXAxis ( ) or JKQTPlotter : : getYAxis ( ) .
* .
*
* \ see \ ref JKQTPlotterSimpleTest and \ see JKQTPlotterQtCreator
*
2019-01-29 05:14:27 +08:00
* \ section JKQTPLOTTER_SYNCMULTIPLOT Synchronizing Several Plots
*
* Often a single plot is not sufficient , but several plots need to be aligned with respect to each other :
*
* \ image html test_multiplot . png
*
2019-02-03 21:04:48 +08:00
* 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 > .
* In order to support this alignment , also when exporting / printing a plot , and when the user interactions with the plot ( e . g . zooming ) ,
* JKQTPlotter offers an API which allows to :
* < ul >
* < li > < b > declare ( grid - like ) relations between plots for export / printing < / b >
* \ see setGridPrinting ( ) , addGridPrintingPlotter ( ) , clearGridPrintingPlotters ( ) , setGridPrintingCurrentPos ( ) and \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT_SYNC < / li >
* < li > < b > synchronize axes / plots < / b >
* \ see synchronizeXToMaster ( ) , synchronizeYToMaster ( ) , resetMasterSynchronization ( ) and \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT < / li >
* < / ul >
2019-01-29 05:14:27 +08:00
*
*
2019-02-03 21:04:48 +08:00
* \ note This API adopts and extends the possibilities of JKQTBasePlotter . Please see the documentation there for details :
* < ul >
* < li > \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
* < ul >
* < li > \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT_SYNC < / li >
* < li > \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT < / li >
* < / ul >
* < / ul >
2019-01-29 05:14:27 +08:00
*
*
*
* \ section JKQTPLOTTER_USERINTERACTION User - Interactions / GUI Features
2019-01-25 05:49:10 +08:00
*
* JKQTPlotter offers a lot of user - interaction features out of the box . These are detailed below .
*
2019-05-01 18:46:17 +08:00
* \ subsection JKQTPLOTTER_CONTEXTMENU Context Menu of JKQTPlotter
2019-01-25 05:49:10 +08:00
*
2019-05-01 18:46:17 +08:00
* The class JKQTPlotter has a context menu that already offers a lot of functionality .
2019-01-25 05:49:10 +08:00
*
* \ image html jkqtplotter_defaultcontextmenu . png
*
2019-02-03 22:54:41 +08:00
* \ image html contextmenu_graphvisibility . gif
*
2019-01-25 05:49:10 +08:00
* It allows to :
2019-01-26 03:16:04 +08:00
* < ul >
* < li > copy or save the data from the internal JKQTPDatastore < / li >
* < li > copy or save the plot to an image file ( PNG , PDF , . . . ) , includes a softisticated export - preview dialog :
2019-01-25 05:49:10 +08:00
*
* \ image html jkqtplotter_exportpreviewdialog . png
2019-01-26 03:16:04 +08:00
* < / li >
* < li > print the plot ( includes a softisticated print - preview dialog ) :
2019-01-25 05:49:10 +08:00
*
2019-01-26 03:16:04 +08:00
* \ image html jkqtplotter_printpreview . png " Print Preview Dialog "
2019-01-25 05:49:10 +08:00
*
2019-01-26 03:16:04 +08:00
* \ image html jkqtplotter_printpreview_relsize_mullinewidth_mulfonts . png " Print Preview Dialog with modified (relative) size, line-width and font-size "
* < / li >
* < li > open a dialog with a table of the plot data :
2019-01-25 05:49:10 +08:00
*
2019-01-26 03:16:04 +08:00
* \ image html jkqtplotter_datatabledialog . png " Data Table Dialog (with buttons to save or copy the data) "
* < / li >
* < li > zoom into / out of the plot and determine an auto - zoom , which shows all of the plot data < / li >
* < li > switch the visibility of the different graphs in the plot < / li >
* < / ul >
2019-01-25 05:49:10 +08:00
*
2019-05-01 18:46:17 +08:00
* You can activate this menu , by setting \ c setContextMenuMode ( jkqtpcmmStandardContextMenu ) ; and binding a mouse - action ( typically the right - click )
* to the context menu by calling \ c deregisterMouseDragAction ( Qt : : RightButton , Qt : : NoModifier ) which deregisters any user actions from the rhs single
* mouse click . In that case , the context menu is opened by default ( see setContextMenuMode ( ) to choose the mode of the context menu ) .
*
*
* In addition JKQTPlotter provides several ways to customize this menu :
* - You can add additional actions to the JKQTPlotter , by calling ` JKQTPlotter : : addAction ( ) ` ( i . e . using the default Qt mechanism )
* and / or by adding actions to the internal JKQTBasePlotter , using ` JKQTBasePlotter : : registerAdditionalAction ( ) `
* - You can modify the menu , when it is displayed , by connecting a slot to the signal ` JKQTPlotter : : contextMenuOPened ( x , y , menu ) ` :
* \ code
* connect ( plot , SIGNAL ( contextMenuOpened ( double , double , QMenu * ) ) , this , SLOT ( contextMenuOpened ( double , double , QMenu * ) ) ) ;
*
* // ...
*
* void TestUserInteraction : : contextMenuOpened ( double x , double y , QMenu * contextMenu )
* {
* contextMenu - > addSeparator ( ) ;
* QAction * act = contextMenu - > addMenu ( QString ( " contextMenuOpened(x=%1, y=%2) " ) . arg ( x ) . arg ( y ) ) - > addAction ( " user-added action " ) ;
* connect ( act , & QAction : : triggered , [ x , y ] ( ) { QMessageBox : : warning ( nullptr , tr ( " Plot Context Menu " ) ,
* tr ( " Context Menu was opened at x/y=%1/%2! " ) . arg ( x ) . arg ( y ) ,
* QMessageBox : : Ok ,
* QMessageBox : : Ok ) ; } ) ;
* labMouseAction - > setText ( QString ( " contextMenuOpened(x=%1, y=%2) " ) . arg ( x ) . arg ( y ) ) ;
* }
* \ endcode
* .
*
* \ subsection JKQTPLOTTER_SPECIALCONTEXTMENU Special ( User - Defined ) Context Menu of JKQTPlotter
*
* In addition to the standard context menu , JKQTPlotter can also be configures to display a special , user - defined context menu .
* To do so , call ` \ c setContextMenuMode ( jkqtpcmmSpecialContextMenu ) and set your menu , by calling \ c setSpecialContextMenu ( )
* You can also combine the special menu and the standard menu , by calling \ c setContextMenuMode ( jkqtpcmmStandardAndSpecialContextMenu ) .
*
* You can also use the signal contextMenuOpened ( ) to modify the special context menu , but note that alterations to this menu are permanently
* stored in the special menu object . See contextMenuOpened ( ) for a detailed discussion and ways to circumvent this !
*
*
2019-01-25 05:49:10 +08:00
* \ subsection JKQTPLOTTER_TOOLBAR Toolbar of JKQTPlotter
*
* In addition to the context - menu , a JKQtPlotter also also provides a toolbar at its top that offers
2019-02-08 00:24:46 +08:00
* most of the functionality of the context menu . Usually this toolbar is enabled ( see toolbarEnabled )
2019-01-25 05:49:10 +08:00
* and is in a mode where it is hidden , until the mouse moves over an area at the top of the plot ( see toolbarAlwaysOn ) :
*
* \ image html jkqtplotter_toolbar_hidden . png " Hidden Toolbar "
* \ image html jkqtplotter_toolbar_shown . png " Shown Toolbar "
*
2019-02-03 22:54:41 +08:00
* \ image html jkqtvanishtoolbar . gif
*
2019-01-26 03:16:04 +08:00
* If toolbarAlwaysOn is set to \ c true ( setToolbarAlwaysOn ( ) ) , the toolbar is always displayed :
2019-01-25 05:49:10 +08:00
*
* \ image html jkqtplotter_toolbar_alwayson . png
*
2019-02-08 00:24:46 +08:00
* \ see toolbarEnabled , toolbarAlwaysOn , \ ref JKQTPlotterUserInteraction
2019-01-25 05:49:10 +08:00
*
*
*
* \ subsection JKQTPLOTTER_ACTIONS QActions from a JKQTPlotter
* Often you want to allow the suer to operate a plot from a user - defined QToolBar or a QMenu / QMenuBar in your
* application ( e . g . provide zooming commands . . . ) . there are generally two ways to achieve this :
2019-01-26 03:16:04 +08:00
* < ol >
* < li > Simply connect home - brewn QAction instances to the slots provided by JKQTPlotter and JKQTBasePlotter .
* This also allows you to connect different plot properties to edit widgets in your forms .
* \ code
* // add a checkbox to show and hide the position display label in the plot
* chkPositionDisplay = new QCheckBox ( tr ( " show mouse cursor position " ) , this ) ;
* chkPositionDisplay - > setChecked ( plot - > isMousePositionShown ( ) ) ;
* connect ( chkPositionDisplay , SIGNAL ( toggled ( bool ) ) , plot , SLOT ( setMousePositionShown ( bool ) ) ) ;
* \ endcode
* < / li >
* < li > For several functions ( especially those also present in JKQTPlotter ' s context - emun , you can also find
* readily available QAction instances . these are available from JKQTBasePlotter ( e . g . by JKQTBasePlotter : : getActionPrint ( ) . . . ) .
* From JKQTPlotter you therefor have to use : < code > getPlotter ( ) - > getActionPrint ( ) < / code >
* \ code
* // add some of the default QActions from the JKQTPlotter to the window menu
* // Some of the are also available in the context menu and toolbar of the JKQTPlotter
* // others are not
* QMenu * menuPlot = menuBar ( ) - > addMenu ( " Plot-Menu " ) ;
* menuPlot - > addAction ( plot - > getPlotter ( ) - > getActionPrint ( ) ) ;
* QMenu * menuPlotS = menuPlot - > addMenu ( " Save ... " ) ;
* menuPlotS - > addAction ( plot - > getPlotter ( ) - > getActionSaveData ( ) ) ;
* menuPlotS - > addAction ( plot - > getPlotter ( ) - > getActionSavePDF ( ) ) ; // not available from JKQTPlotter by default
* menuPlotS - > addAction ( plot - > getPlotter ( ) - > getActionSavePlot ( ) ) ;
* \ endcode
* < / li >
* < / ol >
* \ see \ ref JKQTPlotterUserInteraction
2019-01-25 05:49:10 +08:00
*
*
*
2019-01-26 03:16:04 +08:00
* \ subsection JKQTPLOTTER_USERMOUSEINTERACTION Mouse - Interaction in JKQTPlotter
2019-01-25 05:49:10 +08:00
*
2019-01-29 05:14:27 +08:00
* This section summarizes all user - interaction functions in JKQTPlotter that somehow relate to the mouse .
* These are :
* - \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG
* - \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSECLICK
* - \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEWHEEL
* - \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE
* .
*
* \ note Zooming and Paning interactions apply to both axes when they are performed with the mouse
* inside the plot . They are limited to one of the two axes , when the mouse hovers over that axis
* ( e . g . when you zoom by mouse - wheel while the mouse pointer is below the plot , over the x - axis ,
* only the x - axis is affected by the operation ) .
2019-01-29 00:05:03 +08:00
*
* \ subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG Actions When Dragging the Mouse
2019-01-28 06:24:12 +08:00
* JKQTPlotter offers several methods that allow to customize , how it reacts to mouse actions :
* - registerMouseDragAction ( ) tells JKQTPlotter to perform a certain action ( selected from JKQTPlotter : : MouseActionMode )
* when a specified mouse button is pushed while a specified ( or no ) keyborad modifiers ( e . g . CTRL , ALT , SHIFT . . . ) is pressed .
* By default JKQTPlotter calls these two registers in its constructors :
* \ code
2019-02-08 00:24:46 +08:00
* registerMouseDragAction ( Qt : : LeftButton , Qt : : NoModifier , JKQTPlotter : : MouseActionMode : : jkqtpmdaZoomByRectangle ) ;
* registerMouseDragAction ( Qt : : LeftButton , Qt : : ControlModifier , JKQTPlotter : : MouseActionMode : : jkqtpmdaPanPlotOnMove ) ;
2019-01-28 06:24:12 +08:00
* \ endcode
* Therefore by default you can draw a zoom rectangle with the left mouse button without modifiers
* and you can pan / drag the plot with the left mouse - button while keeping CTRL pressed .
2019-01-29 00:05:03 +08:00
* - deregisterMouseDragAction ( ) deletes a previously defined user - interaction
2019-01-28 06:24:12 +08:00
* - clearAllRegisteredMouseDragActions ( ) deletes all previously specified user - actions
* .
2019-01-25 05:49:10 +08:00
*
2019-01-29 00:05:03 +08:00
* Pressing the \ c ESC key will stop the current JKQTPlotter : : MouseActionMode .
*
2019-02-08 00:24:46 +08:00
* If e . g . the mode JKQTPlotter : : MouseActionMode : : jkqtpmdaZoomByRectangle is selected , while you drag the mouse , the
2019-01-29 05:14:27 +08:00
* zoom rectangle is drawn over the plot . You can modify the style of drawing using these functions :
2019-05-06 01:31:20 +08:00
* - setUserActionOverlayPen ( ) sets the pen for ( semi - transparent ) overlay shapes , e . g . zoom rectangles
* - setUserActionOverlayBrush ( ) sets the brush for ( semi - transparent ) overlay shapes , e . g . zoom rectangles
* - setUserActionOpaquePen ( ) sets the pen for opaque overlay shapes , e . g . tool - tips
* - setUserActionOpaqueBrush ( ) sets the brush for opaque overlay shapes , e . g . tool - tips
* - setUserActionMarkerPen ( ) sets the pen for marker overlay shapes , e . g . with tool - tips
* - setUserActionMarkerBrush ( ) sets the brush for marker overlay shapes , e . g . with tool - tips
* - setUserActionMarkerDiameter ( ) sets the size of user - action markers
* - setUserActionMarkerType ( ) sets the type of user - action markers
2019-01-29 05:14:27 +08:00
* .
*
2019-02-03 22:54:41 +08:00
* \ image html zoomin_mouse_contextmenu . gif " Zooming with the mouse "
*
* \ image html draw_rectangle . gif " Draw Rectangle User-Action "
*
* \ image html drag_viewport . gif " Drag the Plot Viewport "
*
2019-05-06 01:31:20 +08:00
* \ image html rulertool . gif " Measurement Ruler Tool "
*
* \ image html tooltiptool . gif " Data Point Tooltip Tool "
*
2019-02-03 22:54:41 +08:00
*
2019-01-29 05:14:27 +08:00
* \ subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSECLICK Actions After ( Double - ) Clicks on the Mouse Buttons
2019-01-28 06:24:12 +08:00
* The right mouse button has a special role : If it is single - clicked and no JKQTPlotter : : MouseActionMode is specified
2019-05-01 18:46:17 +08:00
* for the vent , it opens the context menu , unless you call \ c setContextMenuMode ( jkqtpcmmNoContextMenu ) .
* You can also use setContextMenuMode ( ) to specify which type of context menu is shown . See JKQTPContextMenuModes
2019-01-28 17:46:38 +08:00
* for details on the available modes .
2019-01-28 06:24:12 +08:00
*
* For any mouse - click , one of the following signals is emitted :
* - plotMouseClicked ( ) for any single - click ( during the pressDown - Event ! )
* - plotMouseDoubleClicked ( ) for any double - click
* .
*
2019-01-29 00:05:03 +08:00
* The reaction to double - clicks of the mouse buttons can be specified separately . The possible
2019-02-08 00:24:46 +08:00
* actions are listed in JKQTPMouseDoubleClickActions . You can bind one of these actions
2019-01-29 00:05:03 +08:00
* to a specific click with these functions :
2019-02-08 00:24:46 +08:00
* - registerMouseDoubleClickAction ( ) tells JKQTPlotter to perform a certain action ( selected from JKQTPMouseDoubleClickActions )
2019-01-29 00:05:03 +08:00
* when a specified mouse button is pushed while a specified ( or no ) keyborad modifiers ( e . g . CTRL , ALT , SHIFT . . . ) is pressed .
* By default JKQTPlotter calls this in its constructors :
* \ code
2019-02-08 00:24:46 +08:00
* registerMouseDoubleClickAction ( Qt : : LeftButton , Qt : : NoModifier , JKQTPMouseDoubleClickActions : : jkqtpdcaClickMovesViewport ) ;
2019-01-29 00:05:03 +08:00
* \ endcode
* Therefore by default you can pan the plot / move the viewport by double clicking a location
* - deregisterMouseDoubleClickAction ( ) deletes a previously defined user - interaction
* - clearAllRegisteredMouseDoubleClickAction ( ) deletes all previously specified user - actions
* .
* The button to react to is specified as a parameter .
*
2019-02-03 22:54:41 +08:00
* \ image html contextmenu_graphvisibility . gif
*
2019-01-29 00:05:03 +08:00
* \ subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEWHEEL Actions When a Mouse Wheel Event Occurs
2022-05-15 20:15:15 +08:00
* The actions to be performed when the mouse wheel is operated are specified in JKQTPMouseWheelActions .
2019-02-08 00:24:46 +08:00
* You can bind one of these actions to the mouse - wheel ( under the condition that a specified Qt : : KeyboardModifiers
2019-01-29 00:05:03 +08:00
* is pressed ) by using these functions :
2019-02-08 00:24:46 +08:00
* - registerMouseWheelAction ( ) tells JKQTPlotter to perform a certain action ( selected from JKQTPMouseWheelActions )
2019-01-29 00:05:03 +08:00
* when a specified mouse button is pushed while a specified ( or no ) keyborad modifiers ( e . g . CTRL , ALT , SHIFT . . . ) is pressed .
* By default JKQTPlotter calls this in its constructors :
* \ code
2019-02-08 00:24:46 +08:00
* registerMouseWheelAction ( Qt : : NoModifier , JKQTPMouseWheelActions : : jkqtpmwaZoomByWheel ) ;
2019-01-29 00:05:03 +08:00
* \ endcode
* Therefore by default you can zoom into and out of the plot , using the mouse wheel .
* - deregisterMouseWheelAction ( ) deletes a previously defined user - interaction
* - clearAllMouseWheelActions ( ) deletes all previously specified user - actions
* .
* In addition the signal void plotMouseWheelOperated ( ) is emitted whenever a mouse - wheel event occurs .
2019-01-25 05:49:10 +08:00
*
2019-01-29 00:05:03 +08:00
*
2022-05-15 20:15:15 +08:00
* \ subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE Mouse Move Signaling and Actions
2019-01-29 00:05:03 +08:00
* In addition the signal plotMouseMove ( ) is called whenever the mouse moves over the plot .
* Additional signals may be emitted , depending on the currently active JKQTPlotter : : MouseActionMode .
2019-01-25 05:49:10 +08:00
*
2019-01-29 05:14:27 +08:00
* Also the current mouse position is shown above the graph by default ( can be switched on or off
* using setMousePositionShown ( ) ) .
*
2019-02-03 22:54:41 +08:00
* \ image html mousepositiondisplay . gif
2019-01-25 05:49:10 +08:00
*
2022-05-15 20:15:15 +08:00
* The actions to be performed when the mouse moves without a mouse - button pressed are specified in JKQTPMouseMoveActions .
* You can bind one of these actions to the mouse ( under the condition that a specified Qt : : KeyboardModifiers
* is pressed ) by using these functions :
* - registerMouseMoveAction ( ) tells JKQTPlotter to perform a certain action ( selected from JKQTPMouseMoveActions )
* when a specified mouse button is pushed while a specified ( or no ) keyborad modifiers ( e . g . CTRL , ALT , SHIFT . . . ) is pressed .
* - deregisterMouseMoveAction ( ) deletes a previously defined user - interaction
* - clearAllMouseMoveActions ( ) deletes all previously specified user - actions
* .
2019-02-08 00:24:46 +08:00
*
* \ subsubsection JKQTPLOTTER_USERMOUSEINTERACTION_FASTRESIZING Fast Resizing of a Plot Widget
* When the user resized the widget , the graph would in principle have to be readrawn for every intermediate step .
* As this is very timeconsuming , JKQTPlotter uses a different approach : Actual Redrawing is delayed a few 100 ms
* and this delay is reset whenever the widget size changes . Only after the last delay expires , the plot is redrawn .
* In between an image of the last state of the plot is simple stretched / compressed to fill the new / current
* widget size . In sum this looks like this :
*
* \ image html jkqtplotter_fastresizing . gif
*
*
*
*
2019-01-25 05:49:10 +08:00
* \ section JKQTPLOTTER_USEQTCREATOR How to use JKQTPlotter in the Qt Form Designer
*
* As JKQTPlotter is a standard Qt widget , you can also use it in Qt UI - files designed with the Qt From Designer ( e . g . from within QTCreator ) .
2019-01-26 03:16:04 +08:00
* For this to work you have to use the < a href = " http://doc.qt.io/archives/qt-4.8/designer-using-custom-widgets.html " > Promote QWidget " -feature</a> of the form designer. The steps you need to take are detailed below:
* < ol >
* < li > add a new UI - file to your project and open it in the Form Editor . Then right - click the form and select ` Promote Widgets . . . ` :
*
* \ image html uidesigner_step1 . png
* < / li >
* < li > In the dialog that opens , you have to define ` JKQTPlotter ` as a promotion to ` QWidget ` as shown below . Finally store the settings by clicking ` Add ` and closing the dialog with ` Close ` .
2019-01-25 05:49:10 +08:00
*
2019-01-26 03:16:04 +08:00
* \ image html uidesigner_step2 . png
* < / li >
* < li > Now you can add a ` QWidget ` from the side - bar to the form and then promote it to ` JKQTPlotter ` , by selecting and right - clicking the ` QWidget ` and then selecting ` Promote To | JKQTPlotter ` :
2019-01-25 05:49:10 +08:00
*
2019-01-26 03:16:04 +08:00
* \ image html uidesigner_step3 . png
* < / li >
* < / ol >
2019-01-25 05:49:10 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see \ ref JKQTPlotterQtCreator < br > Also see \ ref JKQTPlotterStyling for another example of using the Qt UI Designer with JKQTPlotter
2019-01-25 05:49:10 +08:00
*
2015-07-11 18:56:02 +08:00
*/
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPlotter : public QWidget {
2015-07-11 18:56:02 +08:00
Q_OBJECT
public :
/** \brief class constructor
2019-01-25 05:49:10 +08:00
*
* If \ a datastore_internal \ c = = false , you can supply an external JKQTPDatastore with the parameter \ a datast
2015-07-11 18:56:02 +08:00
*/
2019-01-20 23:15:10 +08:00
explicit JKQTPlotter ( bool datastore_internal , QWidget * parent = nullptr , JKQTPDatastore * datast = nullptr ) ;
2019-01-25 05:49:10 +08:00
/** \brief class constructor for a JKQTPlotter using an external JKQTPDatastore \a dataset
*/
explicit JKQTPlotter ( JKQTPDatastore * datast , QWidget * parent = nullptr ) ;
/** \brief class constructor
*
* generated a new internal JKQTPDatastore
*/
2019-01-20 23:15:10 +08:00
explicit JKQTPlotter ( QWidget * parent = nullptr ) ;
2015-07-11 18:56:02 +08:00
/** \brief class destructor */
2019-01-20 23:15:10 +08:00
virtual ~ JKQTPlotter ( ) ;
2015-07-11 18:56:02 +08:00
/** reinitializes the toolbar, i.e. fills in QActions added to the QWidget since its creation/the last call to this function */
2019-01-26 19:28:44 +08:00
void updateToolbarActions ( ) ;
2015-07-11 18:56:02 +08:00
2019-01-20 23:15:10 +08:00
/** \brief set the width/height of the icons in the toolbar in pt */
2019-01-26 03:16:04 +08:00
void setToolbarIconSize ( int value ) ;
2015-07-11 18:56:02 +08:00
2019-01-20 23:15:10 +08:00
/** \brief get the width/height of the icons in the toolbar in pt */
2019-01-26 03:16:04 +08:00
int getToolbarIconSize ( ) ;
2015-07-11 18:56:02 +08:00
/** \brief returns the class internally used for plotting */
2019-01-26 03:16:04 +08:00
JKQTBasePlotter * getPlotter ( ) const { return plotter ; }
2015-08-02 19:36:54 +08:00
/** \brief returns the class internally used for plotting */
2019-01-26 20:00:40 +08:00
const JKQTBasePlotter * getConstplotter ( ) const { return const_cast < const JKQTBasePlotter * > ( plotter ) ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns whether the toolbar is enabled
*
* \ copydetails JKQTPlotterStyle : : toolbarEnabled
*
* \ see setToolbarEnabled ( ) , JKQTPlotterStyle : : toolbarEnabled
*/
bool isToolbarEnabled ( ) const ;
/** \brief returns whether the toolbar is always visible or only when the mouse moves to the upper left area
*
* \ copydetails JKQTPlotterStyle : : toolbarAlwaysOn
*
* \ see setToolbarAlwaysOn ( ) , JKQTPlotterStyle : : toolbarAlwaysOn
*/
2019-01-26 19:28:44 +08:00
bool isToolbarAlwaysOn ( ) const ;
2019-02-08 00:24:46 +08:00
/** \brief specifies whether to display the current position of the mouse in the top border of the plot (this may automatically extent the
* top border , so the position fits in . The default widget font is used for the output .
*
* \ copydetails JKQTPlotterStyle : : displayMousePosition
*
* \ see setMousePositionShown ( ) , JKQTPlotterStyle : : displayMousePosition , \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE */
2019-01-26 19:28:44 +08:00
bool isMousePositionShown ( ) const ;
2019-01-25 05:49:10 +08:00
2019-05-06 01:31:20 +08:00
/** \copydoc JKQTPlotterStyle::userActionOverlayPen
*
* \ see setUserActionOverlayPen ( ) , getUserActionOverlayPen ( ) , JKQTPlotterStyle : : userActionOverlayPen \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
QPen getUserActionOverlayPen ( ) const ;
/** \copydoc JKQTPlotterStyle::userActionOverlayBrush
*
* \ see setUserActionOverlayBrush ( ) , getUserActionOverlayBrush ( ) , JKQTPlotterStyle : : userActionOverlayBrush \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
QBrush getUserActionOverlayBrush ( ) const ;
/** \copydoc JKQTPlotterStyle::userActionOpaquePen
*
* \ see setUserActionOpaquePen ( ) , getUserActionOpaquePen ( ) , JKQTPlotterStyle : : userActionOpaquePen \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
QPen getUserActionOpaquePen ( ) const ;
/** \copydoc JKQTPlotterStyle::userActionOpaqueBrush
*
* \ see setUserActionOpaqueBrush ( ) , getUserActionOpaqueBrush ( ) , JKQTPlotterStyle : : userActionOpaqueBrush \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
QBrush getUserActionOpaqueBrush ( ) const ;
/** \copydoc JKQTPlotterStyle::userActionMarkerPen
*
* \ see setUserActionMarkerPen ( ) , getUserActionMarkerPen ( ) , JKQTPlotterStyle : : userActionMarkerPen \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
QPen getUserActionMarkerPen ( ) const ;
/** \copydoc JKQTPlotterStyle::userActionMarkerBrush
*
* \ see setUserActionMarkerBrush ( ) , getUserActionMarkerBrush ( ) , JKQTPlotterStyle : : userActionMarkerBrush \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
QBrush getUserActionMarkerBrush ( ) const ;
/** \copydoc JKQTPlotterStyle::maxTooltipDistance */
int getMaxTooltipDistance ( ) const ;
/** \copydoc JKQTPlotterStyle::userActionCatchSensitivity */
int getUserActionCatchSensitivity ( ) const ;
/** \copydoc JKQTPlotterStyle::userActionMarkerDiameter */
int getUserActionMarkerDiameter ( ) const ;
/** \copydoc JKQTPlotterStyle::userActionMarkerType */
JKQTPUserActionMarkerType getUserActionMarkerType ( ) const ;
2019-01-25 05:49:10 +08:00
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object */
void loadSettings ( const QSettings & settings , const QString & group = QString ( " plots/ " ) ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
2015-07-11 18:56:02 +08:00
*
* This method only saves those properties that differ from their default value .
*/
2019-02-08 00:24:46 +08:00
void saveSettings ( QSettings & settings , const QString & group = QString ( " plots/ " ) ) const ;
2015-07-11 18:56:02 +08:00
/** \brief returns the minimum size of the widget */
QSize minimumSizeHint ( ) const ;
/** \brief returns the size of the widget */
QSize sizeHint ( ) const ;
2019-02-03 21:04:48 +08:00
/*! \brief synchronize the plot borders (and zooming) with a given plotter (master --> slave/this)
2015-07-11 18:56:02 +08:00
This function allows two plotters to draw a graph with exactly the same height or width
as in another graph . For example if you want to have two plotters which are positioned one
above the other ( and have the same widget widths , which could be guaranteed by a QLayout )
you may want to make sure that their plotWidth s are always the same . In this case call
2019-02-03 21:04:48 +08:00
\ code plotter2 - > synchronizeToMaster ( plotter1 , sdXAxis , true ) \ endcode of the lower plotter \ c plotter2 .
2015-07-11 18:56:02 +08:00
Now whenever the size of plotter1 changes , also plotter2 is redrawn with the changed
borders .
2019-02-03 21:04:48 +08:00
\ image html jkqtbaseplotter_synchronization . png " Different Synchronization Settings for synchronizeDirection=sdXAxis "
2015-07-11 18:56:02 +08:00
\ param master the plotter widget to synchronize to
2019-02-03 21:04:48 +08:00
\ param synchronizeDirection direction in which to synchronize
\ param synchronizeAxisLength do you want the axis length to be synchronized ?
2019-01-29 05:14:27 +08:00
\ param synchronizeZoomingMasterToSlave if set , also zooming in the master leads to a modification of the linked axes in the slave
\ param synchronizeZoomingSlaveToMaster if set , also zooming in the slave leads to a modification of the linked axes in the master
2019-02-03 21:04:48 +08:00
\ see synchronizeXToMaster ( ) , synchronizeYToMaster ( ) , resetMasterSynchronization ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
*/
void synchronizeToMaster ( JKQTPlotter * master , JKQTBasePlotter : : SynchronizationDirection synchronizeDirection , bool synchronizeAxisLength = true , bool synchronizeZoomingMasterToSlave = true , bool synchronizeZoomingSlaveToMaster = true ) ;
2019-01-29 05:14:27 +08:00
2019-02-03 21:04:48 +08:00
/*! \brief synchronize the plot x-axis width (and x-zooming) with a given master plotter (master --> slave/this)
2019-01-29 05:14:27 +08:00
2019-02-03 21:04:48 +08:00
\ param master the plotter widget to synchronize to
\ param synchronizeAxisLength do you want the axis length to be synchronized ?
\ param synchronizeZoomingMasterToSlave if set , also zooming in the master leads to a modification of the linked axes in the slave
\ param synchronizeZoomingSlaveToMaster if set , also zooming in the slave leads to a modification of the linked axes in the master
\ image html jkqtbaseplotter_synchronization . png " Different Synchronization Settings for synchronizeDirection=sdXAxis "
\ note This is a short - cut to synchronizeToMaster ( ) with \ c synchronizeDirection = csXAxis
\ see synchronizeToMaster ( ) , synchronizeYToMaster ( ) , resetMasterSynchronization ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
2015-07-11 18:56:02 +08:00
*/
2019-02-03 21:04:48 +08:00
void synchronizeXToMaster ( JKQTPlotter * master , bool synchronizeAxisLength = true , bool synchronizeZoomingMasterToSlave = true , bool synchronizeZoomingSlaveToMaster = true ) ;
/*! \brief synchronize the plot y-axis height (and y-zooming) with a given master plotter (master --> slave/this)
2015-07-11 18:56:02 +08:00
2019-02-03 21:04:48 +08:00
\ param master the plotter widget to synchronize to
\ param synchronizeAxisLength do you want the axis length to be synchronized ?
\ param synchronizeZoomingMasterToSlave if set , also zooming in the master leads to a modification of the linked axes in the slave
\ param synchronizeZoomingSlaveToMaster if set , also zooming in the slave leads to a modification of the linked axes in the master
\ note This function internally calls JKQTBasePlotter : : synchronizeToMaster ( )
\ note This is a short - cut to synchronizeToMaster ( ) with \ c synchronizeDirection = csXAxis
\ see synchronizeToMaster ( ) , synchronizeXToMaster ( ) , resetMasterSynchronization ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
*/
void synchronizeYToMaster ( JKQTPlotter * master , bool synchronizeAxisLength = true , bool synchronizeZoomingMasterToSlave = true , bool synchronizeZoomingSlaveToMaster = true ) ;
2019-01-29 05:14:27 +08:00
/** \brief switches any synchronization off, that has been created by synchronizeToMaster()
*
2019-02-03 21:04:48 +08:00
* \ note This function internally calls JKQTBasePlotter : : synchronizeToMaster ( )
\ see synchronizeToMaster ( ) , synchronizeXToMaster ( ) , resetMasterSynchronization ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
2019-01-29 05:14:27 +08:00
*/
2019-02-03 21:04:48 +08:00
void resetMasterSynchronization ( JKQTBasePlotter : : SynchronizationDirection synchronizeDirection = JKQTBasePlotter : : sdXYAxes ) ;
2015-07-11 18:56:02 +08:00
2019-01-29 05:14:27 +08:00
/*! \brief enables grid-printing for this plot
*
* \ note This function call forwards to JKQTBasePlotter : : setGridPrinting ( )
2019-02-03 21:04:48 +08:00
* \ see setGridPrinting ( ) , addGridPrintingPlotter ( ) , clearGridPrintingPlotters ( ) , setGridPrintingCurrentPos ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
2019-01-29 05:14:27 +08:00
*/
void setGridPrinting ( bool enabled ) ;
/** \brief add a new plotter \a plotterOther for grid printing mode, at location \a x / \a y
*
* \ note This function call forwards to JKQTBasePlotter : : addGridPrintingPlotter ( )
2019-02-03 21:04:48 +08:00
* \ see setGridPrinting ( ) , addGridPrintingPlotter ( ) , clearGridPrintingPlotters ( ) , setGridPrintingCurrentPos ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
2019-01-29 05:14:27 +08:00
*/
void addGridPrintingPlotter ( size_t x , size_t y , JKQTPlotter * plotterOther ) ;
/** \brief clear all additional plotters for grid printing mode
*
* \ note This function call forwards to JKQTBasePlotter : : clearGridPrintingPlotters ( )
2019-02-03 21:04:48 +08:00
* \ see setGridPrinting ( ) , addGridPrintingPlotter ( ) , clearGridPrintingPlotters ( ) , setGridPrintingCurrentPos ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
2019-01-29 05:14:27 +08:00
*/
void clearGridPrintingPlotters ( ) ;
/** \brief set the x-position of this JKQTPlotter in the grid-printing grid
*
* \ note This function call forwards to JKQTBasePlotter : : setGridPrintingCurrentX ( )
2019-02-03 21:04:48 +08:00
* \ see setGridPrinting ( ) , addGridPrintingPlotter ( ) , clearGridPrintingPlotters ( ) , setGridPrintingCurrentPos ( ) , setGridPrintingCurrentY ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
2019-01-29 05:14:27 +08:00
*/
void setGridPrintingCurrentX ( size_t x ) ;
/** \brief set the y-position of this JKQTPlotter in the grid-printing grid
*
* \ note This function call forwards to JKQTBasePlotter : : setGridPrintingCurrentY ( )
2019-02-03 21:04:48 +08:00
* \ see setGridPrinting ( ) , addGridPrintingPlotter ( ) , clearGridPrintingPlotters ( ) , setGridPrintingCurrentPos ( ) , setGridPrintingCurrentX ( ) , \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
2019-01-29 05:14:27 +08:00
*/
void setGridPrintingCurrentY ( size_t y ) ;
/** \brief set the x- and y-positions of this JKQTPlotter in the grid-printing grid
*
* \ note This function call forwards to JKQTBasePlotter : : setGridPrintingCurrentPos ( )
2019-02-03 21:04:48 +08:00
* \ see setGridPrinting ( ) , addGridPrintingPlotter ( ) , clearGridPrintingPlotters ( ) , setGridPrintingCurrentX ( ) , setGridPrintingCurrentY ( ) \ ref JKQTBASEPLOTTER_SYNCMULTIPLOT
2019-01-29 05:14:27 +08:00
*/
void setGridPrintingCurrentPos ( size_t x , size_t y ) ;
2015-07-11 18:56:02 +08:00
/** \brief returns a pointer to the datastore used by this object */
2019-01-20 17:49:29 +08:00
inline JKQTPDatastore * getDatastore ( ) { return plotter - > getDatastore ( ) ; }
2020-09-11 18:06:27 +08:00
/** \brief returns a pointer to the datastore used by this object */
inline const JKQTPDatastore * getDatastore ( ) const { return plotter - > getDatastore ( ) ; }
2015-07-11 18:56:02 +08:00
/** \brief tells the plotter object to use the given external datastore.
*
* If the current datastore is internally managed , this method will free that object and use the supplied datastore
* with external management . If the current datastore is already external , this method will simply replace it by the
* new one .
*/
2019-01-20 17:49:29 +08:00
inline void useExternalDatastore ( JKQTPDatastore * newStore ) { plotter - > useExternalDatastore ( newStore ) ; }
2015-07-11 18:56:02 +08:00
2019-01-26 19:28:44 +08:00
/** \copydoc JKQTBasePlotter::useAsInternalDatastore() */
2019-01-20 17:49:29 +08:00
inline void useAsInternalDatastore ( JKQTPDatastore * newStore ) { plotter - > useAsInternalDatastore ( newStore ) ; }
2015-07-11 18:56:02 +08:00
2019-01-26 19:28:44 +08:00
/** \copydoc JKQTBasePlotter::useInternalDatastore() */
2015-07-11 18:56:02 +08:00
inline void useInternalDatastore ( ) { plotter - > useInternalDatastore ( ) ; }
2019-01-26 19:28:44 +08:00
/** \copydoc JKQTBasePlotter::forceInternalDatastore() */
2015-07-11 18:56:02 +08:00
inline void forceInternalDatastore ( ) { plotter - > forceInternalDatastore ( ) ; }
2019-01-26 19:28:44 +08:00
/** \copydoc JKQTBasePlotter::setEmittingSignalsEnabled() */
2019-01-26 03:16:04 +08:00
inline void setEmittingSignalsEnabled ( bool sig ) { plotter - > setEmittingSignalsEnabled ( sig ) ; }
2019-01-26 19:28:44 +08:00
/** \copydoc JKQTBasePlotter::isEmittingSignalsEnabled() */
inline bool isEmittingSignalsEnabled ( ) { return plotter - > isEmittingSignalsEnabled ( ) ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \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)
2019-01-25 05:49:10 +08:00
*
2019-01-26 03:16:04 +08:00
* \ see setPlotUpdateEnabled ( )
2019-01-25 05:49:10 +08:00
*/
2019-01-26 03:16:04 +08:00
bool isPlotUpdateEnabled ( ) const ;
2019-02-08 00:24:46 +08:00
/** \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)
2019-01-25 05:49:10 +08:00
*
2019-02-08 00:24:46 +08:00
* \ see isPlotUpdateEnabled ( )
2019-01-25 05:49:10 +08:00
*/
2019-01-26 03:16:04 +08:00
void setPlotUpdateEnabled ( bool enable ) ;
2015-07-11 18:56:02 +08:00
2019-01-29 00:05:03 +08:00
/** \brief registeres a certain mouse drag action \a action to be executed when a mouse drag operation is
2019-01-28 06:24:12 +08:00
* initialized with the given \ a button and \ a modifier */
2019-02-08 00:24:46 +08:00
void registerMouseDragAction ( Qt : : MouseButton button , Qt : : KeyboardModifiers modifier , JKQTPMouseDragActions action ) ;
2019-01-29 00:05:03 +08:00
/** \brief deregisteres the mouse drag action to be executed when a mouse drag operation is
2019-01-28 06:24:12 +08:00
* initialized with the given \ a button and \ a modifier */
2019-02-08 00:24:46 +08:00
void deregisterMouseDragAction ( Qt : : MouseButton button , Qt : : KeyboardModifiers modifier ) ;
2019-01-29 00:05:03 +08:00
/** \brief clear all registeres mouse drag actions */
2019-01-28 06:24:12 +08:00
void clearAllRegisteredMouseDragActions ( ) ;
2019-01-29 00:05:03 +08:00
/** \brief registeres a certain mouse action \a action to be executed when a mouse double-click occurs
* with the given \ a button and \ a modifier */
2019-02-08 00:24:46 +08:00
void registerMouseDoubleClickAction ( Qt : : MouseButton button , Qt : : KeyboardModifiers modifier , JKQTPMouseDoubleClickActions action ) ;
2019-01-29 00:05:03 +08:00
/** \brief deregisteres the mouse action \a action to be executed when a mouse double-click occurs
* with the given \ a button and \ a modifier */
2019-02-08 00:24:46 +08:00
void deregisterMouseDoubleClickAction ( Qt : : MouseButton button , Qt : : KeyboardModifiers modifier ) ;
2019-01-29 00:05:03 +08:00
/** \brief clear all registered mouse double-click actions */
void clearAllRegisteredMouseDoubleClickActions ( ) ;
2019-01-29 05:14:27 +08:00
/** \brief specifies the action to perform on a mouse wheel event when a given modifier is pressed \see deregisterMouseWheelAction(), clearAllMouseWheelActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2019-02-08 00:24:46 +08:00
void registerMouseWheelAction ( Qt : : KeyboardModifiers modifier , JKQTPMouseWheelActions action ) ;
2019-01-29 05:14:27 +08:00
/** \brief deletes all mouse-wheel actions registered for a given \a modifier \see registerMouseWheelAction(), clearAllMouseWheelActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2019-02-08 00:24:46 +08:00
void deregisterMouseWheelAction ( Qt : : KeyboardModifiers modifier ) ;
2019-01-29 05:14:27 +08:00
/** \brief deletes all mouse-wheel actions \see registerMouseWheelAction(), deregisterMouseWheelAction(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2019-01-29 00:05:03 +08:00
void clearAllMouseWheelActions ( ) ;
2022-05-15 20:15:15 +08:00
/** \brief specifies the action to perform on a mouse move event when a given modifier is pressed \see deregisterMouseMoveAction(), clearAllMouseMoveActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
void registerMouseMoveAction ( Qt : : KeyboardModifiers modifier , JKQTPMouseMoveActions action ) ;
/** \brief deletes all mouse-move actions registered for a given \a modifier \see registerMouseMoveAction(), clearAllMouseMoveActions(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
void deregisterMouseMoveAction ( Qt : : KeyboardModifiers modifier ) ;
/** \brief deletes all mouse-move actions \see registerMouseMoveAction(), deregisterMouseMoveAction(), \ref JKQTPLOTTER_USERMOUSEINTERACTION */
void clearAllMouseMoveActions ( ) ;
2019-05-01 18:46:17 +08:00
/*! \brief returns the currently set special context menu object
*
* \ see \ ref JKQTPLOTTER_SPECIALCONTEXTMENU , setSpecialContextMenu ( ) , menuSpecialContextMenu , contextMenuOpened ( ) , \ ref JKQTPlotterUserInteraction
*/
2019-01-28 17:46:38 +08:00
QMenu * getSpecialContextMenu ( ) const ;
2019-01-25 05:49:10 +08:00
2019-05-01 18:46:17 +08:00
/*! \brief sets a QMenu object to be used as special context menu
*
* \ see \ ref JKQTPLOTTER_SPECIALCONTEXTMENU , getSpecialContextMenu ( ) , menuSpecialContextMenu , contextMenuOpened ( )
*/
2019-01-28 17:46:38 +08:00
void setSpecialContextMenu ( QMenu * menu ) ;
2019-01-29 00:05:03 +08:00
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)
*
2019-05-01 18:46:17 +08:00
* \ see \ ref JKQTPLOTTER_CONTEXTMENU , getMouseContextY ( ) , getMouseLastClickX ( ) , getMouseLastClickY ( )
2019-02-08 00:24:46 +08:00
*/
2019-01-26 03:16:04 +08:00
double getMouseContextX ( ) const ;
2019-02-08 00:24:46 +08:00
/** \brief y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle)
*
2019-05-01 18:46:17 +08:00
* \ see \ ref JKQTPLOTTER_CONTEXTMENU , getMouseContextX ( ) , getMouseLastClickX ( ) , getMouseLastClickY ( )
2019-02-08 00:24:46 +08:00
*/
2019-01-26 03:16:04 +08:00
double getMouseContextY ( ) const ;
2019-02-08 00:24:46 +08:00
/** \brief x-position of the last mouse-click (in screen pixels)
*
* \ see getMouseLastClickY ( ) , getMouseContextX ( ) , getMouseContextY ( )
*/
2019-01-26 03:16:04 +08:00
int getMouseLastClickX ( ) const ;
2019-02-08 00:24:46 +08:00
/** \brief y-position of the last mouse-click (in screen pixels)
*
* \ see getMouseLastClickX ( ) , getMouseContextX ( ) , getMouseContextY ( )
*/
2019-01-26 03:16:04 +08:00
int getMouseLastClickY ( ) const ;
2015-10-10 18:42:55 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the coordinate axis object for the x-axis \see JKQTBasePlotter::getXAxis() */
2019-01-26 03:16:04 +08:00
inline JKQTPHorizontalAxis * getXAxis ( ) { return plotter - > getXAxis ( ) ; }
2019-02-08 00:24:46 +08:00
/** \brief returns the coordinate axis object for the y-axis \see JKQTBasePlotter::getYAxis() */
2019-01-26 03:16:04 +08:00
inline JKQTPVerticalAxis * getYAxis ( ) { return plotter - > getYAxis ( ) ; }
2019-02-08 00:24:46 +08:00
/** \brief returns the coordinate axis object for the x-axis as a const pointer \see JKQTBasePlotter::getXAxis() */
2019-01-26 03:16:04 +08:00
inline const JKQTPHorizontalAxis * getXAxis ( ) const { return plotter - > getXAxis ( ) ; }
2019-02-08 00:24:46 +08:00
/** \brief returns the coordinate axis object for the y-axis as a const pointer \see JKQTBasePlotter::getYAxis() */
2019-01-26 03:16:04 +08:00
inline const JKQTPVerticalAxis * getYAxis ( ) const { return plotter - > getYAxis ( ) ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the \a i -th graph (of type JKQTPPlotElement) in this plotter instance \see JKQTBasePlotter::getGraph() */
2019-01-20 17:49:29 +08:00
inline JKQTPPlotElement * getGraph ( size_t i ) { return plotter - > getGraph ( i ) ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the number of graphs \see JKQTBasePlotter::getGraphCount() */
2015-07-11 18:56:02 +08:00
inline size_t getGraphCount ( ) { return plotter - > getGraphCount ( ) ; }
2019-02-08 00:24:46 +08:00
/** \brief remove the i-th graph \see JKQTBasePlotter::deleteGraph() */
2015-07-11 18:56:02 +08:00
inline void deleteGraph ( size_t i , bool deletegraph = true ) { plotter - > deleteGraph ( i , deletegraph ) ; }
2019-02-08 00:24:46 +08:00
/** \brief returns \c true, if the given graph is present \see JKQTBasePlotter::containsGraph() */
2019-01-20 17:49:29 +08:00
inline bool containsGraph ( JKQTPPlotElement * gr ) { return plotter - > containsGraph ( gr ) ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief remove the given graph, if it is contained \see JKQTBasePlotter::deleteGraph() */
2019-01-25 05:49:10 +08:00
inline void deleteGraph ( JKQTPPlotElement * gr , bool deletegraph = true ) { plotter - > deleteGraph ( gr , deletegraph ) ; }
2015-07-11 18:56:02 +08:00
/** \brief remove all plots
*
* \ param deleteGraphs if set \ c true ( default ) the graph objects will also be deleted
2019-02-08 00:24:46 +08:00
*
* \ see JKQTBasePlotter : : clearGraphs ( )
2015-07-11 18:56:02 +08:00
*/
inline void clearGraphs ( bool deleteGraphs = true ) { plotter - > clearGraphs ( deleteGraphs ) ; }
2019-02-03 21:04:48 +08:00
/** \brief add a new graph, returns it's position in the graphs list
*
* \ param gr graph object ( of type JKQTPPlotElement ) to be added . \ b Note : The JKQTPlotter takes ownership of graph \ a gr .
* \ return ID of the added graph object \ a gr in the internal list of graphs
*
2019-02-08 00:24:46 +08:00
* \ see JKQTBasePlotter : : addGraph ( )
2019-02-03 21:04:48 +08:00
*/
2019-01-20 17:49:29 +08:00
inline size_t addGraph ( JKQTPPlotElement * gr ) { return plotter - > addGraph ( gr ) ; }
2015-07-11 18:56:02 +08:00
2019-02-03 21:04:48 +08:00
/** \brief move the given graph to the top, or add it, if it is not yet contained
*
* \ param gr graph object ( of type JKQTPPlotElement ) to be moved ( needs to be containing to the JKQTPlotter already ! )
* \ return ID of the added graph object \ a gr in the internal list of graphs
2019-02-08 00:24:46 +08:00
*
* \ see JKQTBasePlotter : : moveGraphTop ( )
2019-02-03 21:04:48 +08:00
*/
2019-01-20 17:49:29 +08:00
inline size_t moveGraphTop ( JKQTPPlotElement * gr ) { return plotter - > moveGraphTop ( gr ) ; }
2015-07-11 18:56:02 +08:00
2019-02-03 21:04:48 +08:00
/** \brief move the given graph to the top, or add it, if it is not yet contained
*
* \ param gr graph object ( of type JKQTPPlotElement ) to be moved ( needs to be containing to the JKQTPlotter already ! )
* \ return ID of the added graph object \ a gr in the internal list of graphs
2019-02-08 00:24:46 +08:00
*
* \ see JKQTBasePlotter : : moveGraphBottom ( )
2019-02-03 21:04:48 +08:00
*/
2019-01-20 17:49:29 +08:00
inline size_t moveGraphBottom ( JKQTPPlotElement * gr ) { return plotter - > moveGraphBottom ( gr ) ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief add a new graphs from a QVector<JKQTPPlotElement*>, QList<JKQTPPlotElement*>, std::vector<JKQTPPlotElement*> ... or any standard-iterateable container with JKQTPPlotElement*-items
*
* \ tparam TJKQTPGraphContainer a container type with default C + + - sytle iterator interface
* ( i . e . methods \ c begin ( ) and \ c end ( ) and an iterator , which may be
* moved to the next element with the operator \ c + + .
* \ param gr Container of type TJKQTPGraphContainer , which contains the graphs \ b Note : The JKQTPlotter takes ownership of graphs in \ a gr .
* \ param [ out ] graphIDsOut optional output parameter , the vector will contain the IDs of each graph added to theis plot
*
* \ see JKQTBasePlotter : : addGraphs ( )
*/
2019-01-20 17:49:29 +08:00
template < class TJKQTPGraphContainer >
2019-02-08 00:24:46 +08:00
inline void addGraphs ( const TJKQTPGraphContainer & gr , QVector < size_t > * graphIDsOut = nullptr ) { plotter - > addGraphs ( gr , graphIDsOut ) ; }
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief returns the current x-axis min \see JKQTBasePlotter::getYAxis() */
2015-07-11 18:56:02 +08:00
inline double getXMin ( ) const { return plotter - > getXMin ( ) ; }
2019-02-08 00:24:46 +08:00
/** \brief returns the current x-axis max \see JKQTBasePlotter::getYAxis() */
2015-07-11 18:56:02 +08:00
inline double getXMax ( ) const { return plotter - > getXMax ( ) ; }
2019-02-08 00:24:46 +08:00
/** \brief returns the current y-axis min \see JKQTBasePlotter::getYAxis() */
2015-07-11 18:56:02 +08:00
inline double getYMin ( ) const { return plotter - > getYMin ( ) ; }
2019-02-08 00:24:46 +08:00
/** \brief returns the current y-axis max \see JKQTBasePlotter::getYAxis() */
2015-07-11 18:56:02 +08:00
inline double getYMax ( ) const { return plotter - > getYMax ( ) ; }
/** \brief returns the absolute x-axis min */
inline double getAbsoluteXMin ( ) const { return plotter - > getAbsoluteXMin ( ) ; }
/** \brief returns the absolute x-axis max */
inline double getAbsoluteXMax ( ) const { return plotter - > getAbsoluteXMax ( ) ; }
/** \brief returns the absolute y-axis min */
inline double getAbsoluteYMin ( ) const { return plotter - > getAbsoluteYMin ( ) ; }
/** \brief returns the absolute y-axis max */
inline double getAbsoluteYMax ( ) const { return plotter - > getAbsoluteYMax ( ) ; }
2019-01-25 05:49:10 +08:00
/** \brief returns the current magnification factor */
2015-07-11 18:56:02 +08:00
inline double getMagnification ( ) const { return magnification ; }
2015-08-02 19:36:54 +08:00
/** \brief gets the next unused style id, i.e. the smalles number >=0 which is not contained in usedStyles */
inline int getNextStyle ( ) {
2019-01-26 03:16:04 +08:00
return getPlotter ( ) - > getNextStyle ( ) ;
2015-08-02 19:36:54 +08:00
}
/** \brief returns a QPen object for the i-th plot style */
2019-01-20 17:49:29 +08:00
inline JKQTBasePlotter : : JKQTPPen getPlotStyle ( int i ) const {
2019-01-26 20:00:40 +08:00
return getConstplotter ( ) - > getPlotStyle ( i ) ;
2015-08-02 19:36:54 +08:00
}
/** \brief font size for key labels [in points] */
2019-01-26 03:16:04 +08:00
inline double getKeyFontSize ( ) const {
2019-01-26 20:00:40 +08:00
return getConstplotter ( ) - > getKeyFontSize ( ) ;
2015-08-02 19:36:54 +08:00
}
2019-01-28 06:24:12 +08:00
2019-05-01 18:46:17 +08:00
/** \brief returns the currently set mode for the context menu \see JKQTPContextMenuModes, \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_SPECIALCONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2019-02-08 00:24:46 +08:00
JKQTPContextMenuModes getContextMenuMode ( ) const ;
2019-01-28 06:24:12 +08:00
2019-02-08 00:24:46 +08:00
/** \brief current style properties for this JKQTPlotter
*
* \ see JKQTPSetSystemDefaultStyle ( ) , JKQTPSetSystemDefaultStyle ( ) , \ ref jkqtpplotter_styling
*/
const JKQTPlotterStyle & getCurrentPlotterStyle ( ) const ;
/** \brief replace the current style properties for this JKQTBasePlotter
*
* \ see JKQTPSetSystemDefaultStyle ( ) , JKQTPSetSystemDefaultStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
*/
void setCurrentPlotterStyle ( const JKQTPlotterStyle & style ) ;
/** \brief replace the current style properties for this JKQTBasePlotter
*
* \ see JKQTPSetSystemDefaultStyle ( ) , JKQTPSetSystemDefaultStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
*/
void setCurrentPlotterStyle ( const JKQTPlotterStyle & style , const JKQTBasePlotterStyle & baseStyle ) ;
/** \brief replace the current style properties for this JKQTBasePlotter with properties loaded from \a settings
*
* \ param settings the QSettings object to read from
* \ param group group in \ a settings to read from
* \ param alsoLoadBaseStyle if \ c true , then also JKQTBasePlotter : : loadCurrentPlotterStyle ( ) of the internal JKQTBasePlotter is called
*
* \ see JKQTPSetSystemDefaultStyle ( ) , JKQTPSetSystemDefaultStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
*/
2022-04-21 19:51:50 +08:00
void loadCurrentPlotterStyle ( const QSettings & settings , const QString & group = " plots/ " , bool alsoLoadBaseStyle = true ) ;
2019-02-08 00:24:46 +08:00
/** \brief store the current style properties for this JKQTBasePlotter with properties loaded from \a settings
*
* \ param settings the QSettings object to write to
* \ param group group in \ a settings to write to
* \ param alsoSaveBaseStyle if \ c true , then also JKQTBasePlotter : : saveCurrentPlotterStyle ( ) of the internal JKQTBasePlotter is called
*
* \ see JKQTPSetSystemDefaultStyle ( ) , JKQTPSetSystemDefaultStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
*/
2022-04-21 19:51:50 +08:00
void saveCurrentPlotterStyle ( QSettings & settings , const QString & group = " plots/ " , bool alsoSaveBaseStyle = true ) const ;
2019-01-28 06:24:12 +08:00
2022-05-15 20:15:15 +08:00
/** \brief \copydoc actMouseMoveToolTip */
QAction * getActMouseMoveToolTip ( ) ;
2019-05-06 01:31:20 +08:00
/** \brief \copydoc actMouseLeftAsRuler */
2022-05-15 20:15:15 +08:00
QAction * getActMouseLeftAsRuler ( ) ;
2019-05-06 01:31:20 +08:00
/** \brief \copydoc actMouseLeftAsDefault */
2022-05-15 20:15:15 +08:00
QAction * getActMouseLeftAsDefault ( ) ;
2019-05-06 01:31:20 +08:00
/** \brief \copydoc actMouseLeftAsZoomRect */
2022-05-15 20:15:15 +08:00
QAction * getActMouseLeftAsZoomRect ( ) ;
2019-05-06 01:31:20 +08:00
/** \brief \copydoc actMouseLeftAsPanView */
2022-05-15 20:15:15 +08:00
QAction * getActMouseLeftAsPanView ( ) ;
/** \brief \copydoc actMouseMoveToolTip */
const QAction * getActMouseMoveToolTip ( ) const ;
/** \brief \copydoc actMouseLeftAsRuler */
const QAction * getActMouseLeftAsRuler ( ) const ;
/** \brief \copydoc actMouseLeftAsDefault */
const QAction * getActMouseLeftAsDefault ( ) const ;
/** \brief \copydoc actMouseLeftAsZoomRect */
const QAction * getActMouseLeftAsZoomRect ( ) const ;
/** \brief \copydoc actMouseLeftAsPanView */
const QAction * getActMouseLeftAsPanView ( ) const ;
2019-05-06 01:31:20 +08:00
2015-07-11 18:56:02 +08:00
public slots :
2019-01-25 05:49:10 +08:00
/** \brief set the current plot magnification */
2015-07-11 18:56:02 +08:00
void setMagnification ( double m ) ;
/** \brief sets x/ymin and x/ymax to the supplied values and replots the graph (zoom operation!) */
inline void zoom ( double nxmin , double nxmax , double nymin , double nymax ) {
plotter - > zoom ( nxmin , nxmax , nymin , nymax ) ;
}
2019-01-25 05:49:10 +08:00
/** \brief sets whether to plot grid lines or not
*
* \ image html jkqtplotter_gridvisible . png " Grid visible "
* \ image html jkqtplotter_gridinvisible . png " Grid invisible "
* */
2015-07-11 18:56:02 +08:00
inline void setGrid ( bool val ) {
plotter - > setGrid ( val ) ;
}
2019-06-16 19:27:02 +08:00
/** \brief sets the color of all Major grid lines
* */
inline void setGridColor ( QColor color ) {
plotter - > setGridColor ( color ) ;
}
/** \brief sets the color of all minor grid lines
* */
inline void setMinorGridColor ( QColor color ) {
plotter - > setMinorGridColor ( color ) ;
}
/** \brief sets the width of all Major grid lines
* */
inline void setGridWidth ( double __value ) {
plotter - > setGridWidth ( __value ) ;
}
/** \brief sets the width of all minor grid lines
* */
inline void setMinorGridWidth ( double __value ) {
plotter - > setMinorGridWidth ( __value ) ;
}
/** \brief sets the style of all Major grid lines
* */
inline void setGridStyle ( Qt : : PenStyle __value ) {
plotter - > setGridStyle ( __value ) ;
}
/** \brief sets the style of all minor grid lines
* */
inline void setMinorGridStyle ( Qt : : PenStyle __value ) {
plotter - > setMinorGridStyle ( __value ) ;
}
2019-06-12 19:00:28 +08:00
/** \brief switches the visibility of the zero-axes associated with the x- and y-axis
*
* \ param showX indicates whether to show the zero - axis associated with the x - axis ( i . e . x = = 0 or the vertical zero - axis )
* \ param showY indicates whether to show the zero - axis associated with the y - axis ( i . e . y = = 0 or the horizontal zero - axis )
* */
inline void setShowZeroAxes ( bool showX , bool showY ) {
plotter - > setShowZeroAxes ( showX , showY ) ;
}
/** \brief switches the visibility of the zero-axes associated with the x- and y-axis
*
* \ param showXY indicates whether to show the zero - axis associated with the x - and y - axis
* */
inline void setShowZeroAxes ( bool showXY ) {
plotter - > setShowZeroAxes ( showXY ) ;
}
2015-07-11 18:56:02 +08:00
/** \brief save the current plot as an image file, with the current widget aspect ratio, if filename is empty a file selection dialog is displayed.
* The image format is extracted from the file extension ( jpeg , tiff , png , pdf , . . . ) */
2019-01-26 19:28:44 +08:00
inline void saveImage ( const QString & filename = QString ( " " ) , bool displayPreview = true ) {
2015-07-11 18:56:02 +08:00
plotter - > saveImage ( filename , displayPreview ) ;
}
/** \brief save the data used for the current plot. The file format is extracted from the file extension (csv, ...)
*
* The parameter \ a format specifies the export format . if it is empty the format will be choosen according to the file extension , or
* if \ a filename is also empty the format will be choosen according to what is selected in the file selection dialog .
*
* If \ a format is \ c " slk " the output will be in SYLK format , if \ a format is \ c " csv " or \ a " dat " the output will be comma separated values
* and if \ a format is \ c " txt " the output will be tab separated values .
*/
2019-01-26 19:28:44 +08:00
inline void saveData ( const QString & filename = QString ( " " ) , const QString & format = QString ( " " ) ) {
2015-07-11 18:56:02 +08:00
plotter - > saveData ( filename , format ) ;
}
2022-07-19 05:33:20 +08:00
# ifndef JKQTPLOTTER_COMPILE_WITHOUT_PRINTSUPPORT
2018-11-18 18:59:30 +08:00
/** \brief print the current plot, if printer is \c nullptr a printer selection dialog is displayed */
inline void print ( QPrinter * printer = nullptr ) {
2015-07-11 18:56:02 +08:00
plotter - > print ( printer ) ;
}
2022-07-19 05:33:20 +08:00
# endif
2015-07-11 18:56:02 +08:00
/** \brief copy displayed data to cpliboard */
inline void copyData ( ) {
plotter - > copyData ( ) ;
}
/** \brief copy displayed data to cpliboard in Matlab syntax */
inline void copyDataMatlab ( ) {
plotter - > copyDataMatlab ( ) ;
}
/** \brief this method zooms the graph so that all plotted datapoints are visible.
*
* \ param zoomX if set \ c true ( default ) zooms the x axis
* \ param zoomY if set \ c true ( default ) zooms the y axis
* \ param includeX0 if this is \ c true zoomToFit ( ) will ensure that \ f $ x = 0 \ f $ is visible in the plot ( only for non - logx plots , default : false )
* \ param includeY0 if this is \ c true zoomToFit ( ) will ensure that \ f $ y = 0 \ f $ is visible in the plot ( only for non - logy plots , default : false )
* \ param scaleX the plot will have a width of \ f $ \ mbox { Xscale } \ cdot \ Delta x \ f $ where \ f $ \ Delta x \ f $ is the actual x - axis data range
* For logx plots we actually use this on the logarithmized data ! ( default : 1.05 )
* \ param scaleY the plot will have a height of \ f $ \ mbox { Yscale } \ cdot \ Delta < \ f $ where \ f $ \ Delta < \ f $ is the actual < - axis data range
* For log < plots we actually use this on the logarithmized data ! ( default : 1.05 )
*
*/
inline void zoomToFit ( bool zoomX = true , bool zoomY = true , bool includeX0 = false , bool includeY0 = false , double scaleX = 1.05 , double scaleY = 1.05 ) {
plotter - > zoomToFit ( zoomX , zoomY , includeX0 , includeY0 , scaleX , scaleY ) ;
}
/** \brief zooms into the graph (the same as turning the mouse wheel) by the given factor */
2019-01-25 05:49:10 +08:00
inline void zoomIn ( double factor = 2.0 ) { plotter - > zoomIn ( factor ) ; }
2015-07-11 18:56:02 +08:00
/** \brief zooms out of the graph (the same as turning the mouse wheel) by the given factor */
2019-01-25 05:49:10 +08:00
inline void zoomOut ( double factor = 2.0 ) { plotter - > zoomOut ( factor ) ; }
2015-07-11 18:56:02 +08:00
2019-01-26 03:16:04 +08:00
/** \brief update the plot and the overlays */
2019-01-26 19:28:44 +08:00
void redrawPlot ( ) ;
2015-07-11 18:56:02 +08:00
2019-05-06 01:31:20 +08:00
/** \brief allows to activate/deactivate toolbar buttons that can activate certain mouse drag actions
*
* \ see getActMouseLeftAsDefault ( ) , getActMouseLeftAsRuler ( ) , getActMouseLeftAsToolTip ( )
*/
void setMouseActionToolbarActionsActive ( bool __value ) ;
2019-02-08 00:24:46 +08:00
/** \brief returns whether the toolbar is enabled
*
* \ copydetails JKQTPlotterStyle : : toolbarEnabled
*
* \ see isToolbarEnabled ( ) , JKQTPlotterStyle : : toolbarEnabled
*/
void setToolbarEnabled ( bool __value ) ;
/** \brief returns whether the toolbar is always visible or only when the mouse moves to the upper left area
*
* \ copydetails JKQTPlotterStyle : : toolbarAlwaysOn
*
* \ see isToolbarAlwaysOn ( ) , JKQTPlotterStyle : : toolbarAlwaysOn
*/
2019-01-26 03:16:04 +08:00
void setToolbarAlwaysOn ( bool __value ) ;
2019-02-08 00:24:46 +08:00
/** \brief specifies whether to display the current position of the mouse in the top border of the plot (this may automatically extent the
* top border , so the position fits in . The default widget font is used for the output .
*
* \ copydetails JKQTPlotterStyle : : displayMousePosition
*
* \ see isMousePositionShown ( ) , JKQTPlotterStyle : : displayMousePosition , \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE */
2019-01-26 03:16:04 +08:00
void setMousePositionShown ( bool __value ) ;
2019-05-06 01:31:20 +08:00
/** \copydoc JKQTPlotterStyle::userActionOverlayPen
*
* \ see setUserActionOverlayPen ( ) , getUserActionOverlayPen ( ) , JKQTPlotterStyle : : userActionOverlayPen \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
void setUserActionOverlayPen ( const QPen & __value ) ;
/** \copydoc JKQTPlotterStyle::userActionOverlayPen
*
* \ see setUserActionOverlayBrush ( ) , getUserActionOverlayBrush ( ) , JKQTPlotterStyle : : userActionOverlayBrush \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
void setUserActionOverlayBrush ( const QBrush & __value ) ;
/** \copydoc JKQTPlotterStyle::userActionOpaquePen
*
* \ see setUserActionOpaquePen ( ) , getUserActionOpaquePen ( ) , JKQTPlotterStyle : : userActionOpaquePen \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
void setUserActionOpaquePen ( const QPen & __value ) ;
/** \copydoc JKQTPlotterStyle::userActionOpaquePen
*
* \ see setUserActionOpaqueBrush ( ) , getUserActionOpaqueBrush ( ) , JKQTPlotterStyle : : userActionOpaqueBrush \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
void setUserActionOpaqueBrush ( const QBrush & __value ) ;
/** \copydoc JKQTPlotterStyle::userActionMarkerPen
2019-02-08 00:24:46 +08:00
*
2019-05-06 01:31:20 +08:00
* \ see setUserActionMarkerPen ( ) , getUserActionMarkerPen ( ) , JKQTPlotterStyle : : userActionMarkerPen \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
void setUserActionMarkerPen ( const QPen & __value ) ;
/** \copydoc JKQTPlotterStyle::userActionMarkerPen
2019-02-08 00:24:46 +08:00
*
2019-05-06 01:31:20 +08:00
* \ see setUserActionMarkerBrush ( ) , getUserActionMarkerBrush ( ) , JKQTPlotterStyle : : userActionMarkerBrush \ ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
void setUserActionMarkerBrush ( const QBrush & __value ) ;
/** \copydoc JKQTPlotterStyle::maxTooltipDistance */
void setMaxTooltipDistance ( int v ) ;
/** \copydoc JKQTPlotterStyle::userActionCatchSensitivity */
void setUserActionCatchSensitivity ( int v ) ;
/** \copydoc JKQTPlotterStyle::userActionMarkerDiameter */
void setUserActionMarkerDiameter ( int v ) ;
/** \copydoc JKQTPlotterStyle::userActionMarkerType */
void setUserActionMarkerType ( JKQTPUserActionMarkerType v ) ;
2019-01-28 06:24:12 +08:00
2019-05-01 18:46:17 +08:00
/** \brief sets the mode if the standard context menu \see JKQTPContextMenuModes, \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_SPECIALCONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2019-02-08 00:24:46 +08:00
void setContextMenuMode ( JKQTPContextMenuModes mode ) ;
2015-07-11 18:56:02 +08:00
2019-02-03 21:04:48 +08:00
/** \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 */
2019-01-20 23:15:10 +08:00
void synchronizeXAxis ( double newxmin , double newxmax , double newymin , double newymax , JKQTPlotter * sender ) ;
2019-02-03 21:04:48 +08:00
/** \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 */
2019-01-20 23:15:10 +08:00
void synchronizeYAxis ( double newxmin , double newxmax , double newymin , double newymax , JKQTPlotter * sender ) ;
2019-02-03 21:04:48 +08:00
/** \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 */
2019-01-20 23:15:10 +08:00
void synchronizeXYAxis ( double newxmin , double newxmax , double newymin , double newymax , JKQTPlotter * sender ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief popuplate the given toolbar \a toolbar with all actions shown in a toolbar from this class ...
*
* This function can be used to populate an external toolbar with actions for this JKQTPlotter .
*/
2019-01-26 19:28:44 +08:00
void populateToolbar ( QToolBar * toolbar ) const ;
2015-07-11 18:56:02 +08:00
2019-05-01 18:46:17 +08:00
/** \brief open the context menu at the mouse position of the last click \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2015-10-12 23:05:15 +08:00
void openContextMenu ( ) ;
2019-05-01 18:46:17 +08:00
/** \brief open the context menu at the mouse position \a x and \a y \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2015-10-12 23:05:15 +08:00
void openContextMenu ( int x , int y ) ;
2019-01-28 17:46:38 +08:00
2019-05-01 18:46:17 +08:00
/** \brief open the standard context menu at the mouse position of the last click \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2019-01-28 17:46:38 +08:00
void openStandardContextMenu ( ) ;
2019-05-01 18:46:17 +08:00
/** \brief open the standard context menu at the mouse position \a x and \a y \see \ref JKQTPLOTTER_CONTEXTMENU , \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2019-01-28 17:46:38 +08:00
void openStandardContextMenu ( int x , int y ) ;
2019-05-01 18:46:17 +08:00
/** \brief open the special context menu at the mouse position of the last click \see \ref JKQTPLOTTER_SPECIALCONTEXTMENU, \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2015-10-12 23:05:15 +08:00
void openSpecialContextMenu ( ) ;
2019-05-01 18:46:17 +08:00
/** \brief open the special context menu at the mouse position \a x and \a y \see \ref JKQTPLOTTER_SPECIALCONTEXTMENU, \ref JKQTPLOTTER_USERMOUSEINTERACTION */
2015-10-12 23:05:15 +08:00
void openSpecialContextMenu ( int x , int y ) ;
2019-01-25 05:49:10 +08:00
2019-05-01 18:46:17 +08:00
/** \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 */
2019-01-28 17:46:38 +08:00
void openStandardAndSpecialContextMenu ( ) ;
2019-05-01 18:46:17 +08:00
/** \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 */
2019-01-28 17:46:38 +08:00
void openStandardAndSpecialContextMenu ( int x , int y ) ;
2019-01-25 05:49:10 +08:00
2019-02-08 00:24:46 +08:00
/** \brief sets absolutely limiting x-range of the plot
*
* \ param xminn absolute minimum of x - axis
* \ param xmaxx absolute maximum of x - axis
*
* \ note if the aspect ratio of this does not fit into the widget , it is possible that you don ' t see the complete contents !
*
* \ see setAbsoluteXY ( ) , setAbsoluteY ( ) , JKQTBasePlotter : : setAbsoluteX ( )
*/
2019-01-25 05:49:10 +08:00
inline void setAbsoluteX ( double xminn , double xmaxx ) { plotter - > setAbsoluteX ( xminn , xmaxx ) ; }
2019-02-08 00:24:46 +08:00
/** \brief sets absolute minimum and maximum y-value to plot
*
* \ param yminn absolute minimum of y - axis
* \ param ymaxx absolute maximum of y - axis
*
* \ note if the aspect ratio of this does not fit into the widget , it is possible that you don ' t see the complete contents !
*
* \ see setAbsoluteXY ( ) , setAbsoluteX ( ) , JKQTBasePlotter : : setAbsoluteY ( )
*/
2019-01-25 05:49:10 +08:00
inline void setAbsoluteY ( double yminn , double ymaxx ) { plotter - > setAbsoluteY ( yminn , ymaxx ) ; }
2019-02-08 00:24:46 +08:00
/** \brief sets absolutely limiting x- and y-range of the plot
*
* The user ( or programmer ) cannot zoom to a viewport that is larger than the range given to this function .
*
* \ param xminn absolute minimum of x - axis
* \ param xmaxx absolute maximum of x - axis
* \ param yminn absolute minimum of y - axis
* \ param ymaxx absolute maximum of y - axis
*
* \ note if the aspect ratio of this does not fit into the widget , it is possible that you don ' t see the complete contents !
*
* \ see setAbsoluteX ( ) , setAbsoluteY ( ) , zoomToFit ( ) , JKQTBasePlotter : : setAbsoluteXY ( )
*/
2019-01-25 05:49:10 +08:00
inline void setAbsoluteXY ( double xminn , double xmaxx , double yminn , double ymaxx ) { plotter - > setAbsoluteXY ( xminn , xmaxx , yminn , ymaxx ) ; }
2019-02-08 00:24:46 +08:00
/** \brief sets the x-range of the plot (minimum and maximum x-value on the x-axis)
*
* \ param xminn absolute minimum of x - axis
* \ param xmaxx absolute maximum of x - axis
*
* \ note You cannot expand the x - range outside the absolute x - range set e . g . by setAbsoluteX ( ) !
* Also the range will be limited to possible values ( e . g . to positive values if you use
* logarithmic axes ) .
*
* Uppon setting , this function emits the signal zoomChangedLocally ( ) , if emitting signals
* is activated at the moment ( e . g . using JKQTBasePlotter : : setEmittingSignalsEnabled ( ) ) .
*
* \ see setY ( ) , setXY ( ) , zoomToFit ( ) , setAbsoluteXY ( ) , JKQTBasePlotter : : setY ( )
*/
2019-01-25 05:49:10 +08:00
inline void setX ( double xminn , double xmaxx ) { plotter - > setX ( xminn , xmaxx ) ; }
2019-02-08 00:24:46 +08:00
/** \brief sets the y-range of the plot (minimum and maximum y-value on the y-axis)
*
* \ param yminn absolute minimum of y - axis
* \ param ymaxx absolute maximum of y - axis
*
* \ note You cannot expand the y - range outside the absolute y - range set e . g . by setAbsoluteY ( ) !
* Also the range will be limited to possible values ( e . g . to positive values if you use
* logarithmic axes ) .
*
* Uppon setting , this function emits the signal zoomChangedLocally ( ) , if emitting signals
* is activated at the moment ( e . g . using JKQTBasePlotter : : setEmittingSignalsEnabled ( ) ) .
*
* \ see setX ( ) , setXY ( ) , zoomToFit ( ) , setAbsoluteXY ( ) , JKQTBasePlotter : : setX ( )
*/
2019-01-25 05:49:10 +08:00
inline void setY ( double yminn , double ymaxx ) { plotter - > setY ( yminn , ymaxx ) ; }
2019-02-08 00:24:46 +08:00
/** \brief sets the x- and y-range of the plot (minimum and maximum values on the x-/y-axis)
*
* \ param xminn absolute minimum of x - axis
* \ param xmaxx absolute maximum of x - axis
* \ param yminn absolute minimum of y - axis
* \ param ymaxx absolute maximum of y - axis
*
* \ note You cannot expand the ranges outside the absolute ranges set e . g . by setAbsoluteXY ( ) !
* Also the range will be limited to possible values ( e . g . to positive values if you use
* logarithmic axes ) .
*
* Uppon setting , this function emits the signal zoomChangedLocally ( ) , if emitting signals
* is activated at the moment ( e . g . using JKQTBasePlotter : : setEmittingSignalsEnabled ( ) ) .
*
* \ see setX ( ) , setX ( ) , zoomToFit ( ) , setAbsoluteXY ( ) , JKQTBasePlotter : : setXY ( )
*/
inline void setXY ( double xminn , double xmaxx , double yminn , double ymaxx ) { plotter - > setXY ( xminn , xmaxx , yminn , ymaxx ) ; }
2015-07-11 18:56:02 +08:00
signals :
2019-01-27 03:12:54 +08:00
/** \brief emitted whenever the mouse moves
*
* \ param x x - position of the mouse ( in plot coordinates )
* \ param y y - position of the mouse ( in plot coordinates )
*/
2015-07-11 18:56:02 +08:00
void plotMouseMove ( double x , double y ) ;
2019-01-27 03:12:54 +08:00
/** \brief emitted when a single-click event from the mouse occurs inside the plot
*
* \ param x x - position of the mouse ( in plot coordinates )
* \ param y y - position of the mouse ( in plot coordinates )
* \ param modifiers key - modifiers when the click occured
* \ param button mouse - button that was used for the click
*/
2015-07-11 18:56:02 +08:00
void plotMouseClicked ( double x , double y , Qt : : KeyboardModifiers modifiers , Qt : : MouseButton button ) ;
2019-01-27 03:12:54 +08:00
/** \brief emitted when a double-click event from the mouse occurs inside the plot
*
* \ param x x - position of the mouse ( in plot coordinates )
* \ param y y - position of the mouse ( in plot coordinates )
* \ param modifiers key - modifiers when the click occured
* \ param button mouse - button that was used for the click
*/
2015-07-11 18:56:02 +08:00
void plotMouseDoubleClicked ( double x , double y , Qt : : KeyboardModifiers modifiers , Qt : : MouseButton button ) ;
2019-01-29 00:05:03 +08:00
/** \brief emitted when a single-click event from the mouse occurs inside the plot
*
* \ param x x - position of the mouse ( in plot coordinates )
* \ param y y - position of the mouse ( in plot coordinates )
* \ param modifiers key - modifiers when the click occured
* \ param deltaAngleX amount of rotation ( in eighths of a degree ) of the wheel in x - direction
* \ param deltaAngleY amount of rotation ( in eighths of a degree ) of the wheel in y - direction
*/
void plotMouseWheelOperated ( double x , double y , Qt : : KeyboardModifiers modifiers , int deltaAngleX , int deltaAngleY ) ;
2019-02-08 00:24:46 +08:00
/** \brief emitted when the mouse action jkqtpmdaZoomByRectangle and the drawing of the new zoom rectangle is finished (=mouse key released)
2019-01-27 03:12:54 +08:00
*
* \ param mouseDragRectXStart start of the selected x - range ( in plot coordinates )
* \ param mouseDragRectXEnd end of the selected x - range ( in plot coordinates )
* \ param mouseDragRectYStart start of the selected x - range ( in plot coordinates )
* \ param mouseDragRectYEnd end of the selected x - range ( in plot coordinates )
* \ param modifiers key - modifiers when the click occured
*/
void plotNewZoomRectangle ( double mouseDragRectXStart , double mouseDragRectXEnd , double mouseDragRectYStart , double mouseDragRectYEnd , Qt : : KeyboardModifiers modifiers ) ;
2015-07-11 18:56:02 +08:00
/** \brief emitted when the plot scaling has been recalculated */
void plotScalingRecalculated ( ) ;
/** \brief emitted before the plot scaling has been recalculated */
void beforePlotScalingRecalculate ( ) ;
2019-01-27 03:12:54 +08:00
/** \brief emitted whenever a context menu is opened. You can modify the menu via the parameter \a contextMenu!
*
* \ param x x - position of the context - menu ( in plot coordinates )
* \ param y y - position of the context - menu ( in plot coordinates )
* \ param contextMenu QMenu - object of the context menu . This object may be altered to display additional items . . . Here is an example :
* \ code
* contextMenu - > addSeparator ( ) ;
* QAction * act = contextMenu - > addMenu ( QString ( " contextMenuOpened(x=%1, y=%2) " ) . arg ( x ) . arg ( y ) ) - > addAction ( " user-added action " ) ;
* connect ( act , & QAction : : triggered , [ x , y ] ( ) { QMessageBox : : warning ( nullptr , tr ( " Plot Context Menu " ) ,
* tr ( " Context Menu was opened at x/y=%1/%2! " ) . arg ( x ) . arg ( y ) ,
* QMessageBox : : Ok ,
* QMessageBox : : Ok ) ; } ) ;
* \ endcode
2019-05-01 18:46:17 +08:00
* < b > Please read the warning below ! ! ! < / b >
*
* \ warning A note of care : This signal can be used to alter the context menu . It behaves differently , depending on
* whether you use the standard context menu , or the special context menu ( setSpecialContextMenu ( ) ) . If the
* standard menu is opened , your alterations are valid until it is shown the next time ( i . e . the internal
* context menu object is deleted in between ) . If you show the special context menu only , your alterations
* are < b > permanently stored < / b > in the menu object . I . e . if you use the code example above and open the menu
* several times , it will accumulate additional menu entries !
* If you must modify the special menu , just access actions and do not add or delete any in a slot bound to
* this signal ! You can recognize the special menu with code like this :
* \ code
* if ( contextMenu = = plot - > getSpecialContextMenu ( ) ) {
* //...
* // do something with the special menu, do not add/remove entries
* } else {
* //...
* // do something with the standard menu, you are free to do anything!
* }
* \ endcode
*
* \ see \ ref JKQTPLOTTER_CONTEXTMENU , \ ref JKQTPLOTTER_SPECIALCONTEXTMENU , \ ref JKQTPLOTTER_USERMOUSEINTERACTION
2019-01-27 03:12:54 +08:00
*/
2015-10-10 18:42:55 +08:00
void contextMenuOpened ( double x , double y , QMenu * contextMenu ) ;
2015-07-11 18:56:02 +08:00
2019-01-27 03:12:54 +08:00
/** \brief signal: emitted whenever the user selects a new x-y zoom range (by mouse)
*
* \ param newxmin start of the selected x - range ( in plot coordinates )
* \ param newxmax end of the selected x - range ( in plot coordinates )
* \ param newymin start of the selected x - range ( in plot coordinates )
* \ param newymax end of the selected x - range ( in plot coordinates )
* \ param sender JKQTPlotter sending this event
*
* This signal is designed to be connected to these slots : synchronizeXAxis ( ) , synchronizeYAxis ( ) , synchronizeXYAxis ( )
*/
2019-01-20 23:15:10 +08:00
void zoomChangedLocally ( double newxmin , double newxmax , double newymin , double newymax , JKQTPlotter * sender ) ;
2015-07-11 18:56:02 +08:00
2020-09-11 19:48:07 +08:00
/** \brief signal: emitted whenever the widget is resized
*
* \ param new_width new width of the widget ( in pixels )
* \ param new_height new height of the widget ( in pixels )
* \ param sender JKQTPlotter sending this event
*
* This signal is designed to be connected to these slots : synchronizeXAxis ( ) , synchronizeYAxis ( ) , synchronizeXYAxis ( )
*/
void widgetResized ( int new_width , int new_height , JKQTPlotter * sender ) ;
2019-01-28 06:24:12 +08:00
/** \brief emitted when the mouse action JKQTPlotter::ScribbleEvents and a click event from the mouse occurs inside the plot,
2019-01-27 03:12:54 +08:00
* or the mouse moved while the left button is pressed down
*
* \ param x x - position of the mouse ( in plot coordinates )
* \ param y y - position of the mouse ( in plot coordinates )
* \ param modifiers key - modifiers when the event was generated
* \ 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
* \ 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
*/
2015-07-11 18:56:02 +08:00
void userScribbleClick ( double x , double y , Qt : : KeyboardModifiers modifiers , bool first , bool last ) ;
2019-01-28 06:24:12 +08:00
/** \brief emitted when the mouse action JKQTPlotter::RectangleEvents and the drawing of the new rectangle is finished (=mouse key released)
2019-01-27 03:12:54 +08:00
*
* \ param x x - coordinate of the bottom left corner of the rectangle ( in plot coordinates )
* \ param y y - coordinate of the bottom left corner of the rectangle ( in plot coordinates )
* \ param width width of the rectangle ( in plot coordinates )
* \ param height height of the rectangle ( in plot coordinates )
* \ param modifiers key - modifiers when the rectangle was finished
*/
2015-07-11 18:56:02 +08:00
void userRectangleFinished ( double x , double y , double width , double height , Qt : : KeyboardModifiers modifiers ) ;
2019-01-28 06:24:12 +08:00
/** \brief emitted when the mouse action JKQTPlotter::LineEvents and the drawing of the new line is finished (=mouse key released)
2019-01-27 03:12:54 +08:00
*
* \ param x1 x - coordinate of the start of the line ( in plot coordinates )
* \ param y1 y - coordinate of the start of the line ( in plot coordinates )
* \ param x2 x - coordinate of the end of the line ( in plot coordinates )
* \ param y2 y - coordinate of the end of the line ( in plot coordinates )
* \ param modifiers key - modifiers when the rectangle was finished
*/
2015-07-11 18:56:02 +08:00
void userLineFinished ( double x1 , double y1 , double x2 , double y2 , Qt : : KeyboardModifiers modifiers ) ;
2019-01-28 06:24:12 +08:00
/** \brief emitted when the mouse action JKQTPlotter::CircleEvents and the drawing of the new circle is finished (=mouse key released)
2019-01-27 03:12:54 +08:00
*
* \ param x x - coordinate of the center of the circle ( in plot coordinates )
* \ param y y - coordinate of the center of the circle ( in plot coordinates )
* \ param radius radius of the circle ( in plot coordinates )
* \ param modifiers key - modifiers when the rectangle was finished
*/
2015-07-11 18:56:02 +08:00
void userCircleFinished ( double x , double y , double radius , Qt : : KeyboardModifiers modifiers ) ;
2019-01-28 06:24:12 +08:00
/** \brief emitted when the mouse action JKQTPlotter::EllipseEvents and the drawing of the new ellipse is finished (=mouse key released)
2019-01-27 03:12:54 +08:00
*
* \ param x x - coordinate of the center of the ellipse ( in plot coordinates )
* \ param y y - coordinate of the center of the ellipse ( in plot coordinates )
* \ param radiusX half - axis in x - direction of the ellipse ( in plot coordinates )
* \ param radiusY half - axis in y - direction of the ellipse ( in plot coordinates )
* \ param modifiers key - modifiers when the rectangle was finished
*/
2015-07-11 18:56:02 +08:00
void userEllipseFinished ( double x , double y , double radiusX , double radiusY , Qt : : KeyboardModifiers modifiers ) ;
2019-05-06 01:31:20 +08:00
/** \brief emitted when a tooltip for a datapoint is displayed
*
* \ param x x - coordinate of the center of the marked datapoint ( in plot coordinates )
* \ param y y - coordinate of the center of the marked datapoint ( in plot coordinates )
* \ param entries contents of the tooltip
* \ param graphs graph objects that created the entries
*/
void tooltipDisplayed ( double x , double y , const QStringList & entries , const QList < JKQTPPlotElement * > & graphs ) ;
/** \brief emitted when a new ruler between two points is displayed
*
* \ param x1 x - coordinate of the start of the line ( in plot coordinates )
* \ param y1 y - coordinate of the start of the line ( in plot coordinates )
* \ param x2 x - coordinate of the end of the line ( in plot coordinates )
* \ param y2 y - coordinate of the end of the line ( in plot coordinates )
* \ param modifiers key - modifiers when the rectangle was finished
*/
void rulerDisplayed ( double x1 , double y1 , double x2 , double y2 , Qt : : KeyboardModifiers modifiers ) ;
2015-07-11 18:56:02 +08:00
protected :
2019-01-28 06:24:12 +08:00
/** \brief ties a MouseActionMode to a mouse-button and a keyboard-modifier
* \ internal
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-01-28 06:24:12 +08:00
*/
2019-06-22 20:21:32 +08:00
struct JKQTPLOTTER_LIB_EXPORT MouseDragAction {
2019-01-28 06:24:12 +08:00
/** \brief constructs an invalid object */
MouseDragAction ( ) ;
2019-02-08 00:24:46 +08:00
MouseDragAction ( Qt : : MouseButton _mouseButton , Qt : : KeyboardModifiers _modifier , JKQTPMouseDragActions _mode ) ;
JKQTPMouseDragActions mode ;
Qt : : KeyboardModifiers modifier ;
2019-01-28 06:24:12 +08:00
Qt : : MouseButton mouseButton ;
bool isValid ( ) const ;
void clear ( ) ;
private :
bool valid ;
} ;
/** \brief the currently executed MouseDragAction */
MouseDragAction currentMouseDragAction ;
2022-05-15 20:15:15 +08:00
/** \brief the currently executed MouseMoveActions */
QSet < JKQTPMouseMoveActions > currentMouseMoveAction ;
2019-05-06 01:31:20 +08:00
/** \brief searches JKQTPlotterStyle::registeredMouseActionModes for a matching action, returns in \a found whether an action was found */
JKQTPMouseDragActionsHashMapIterator findMatchingMouseDragAction ( Qt : : MouseButton button , Qt : : KeyboardModifiers modifiers , bool * found = nullptr ) const ;
2019-01-28 06:24:12 +08:00
2022-05-15 20:15:15 +08:00
/** \brief searches JKQTPlotterStyle::registeredMouseMoveActions for a matching action */
JKQTPMouseMoveActionsHashMapIterator findMatchingMouseMoveAction ( Qt : : KeyboardModifiers modifiers , bool * found = nullptr ) const ;
2019-02-08 00:24:46 +08:00
/** \brief searches JKQTPlotterStyle::registeredMouseWheelActions for a matching action */
2022-04-21 19:33:22 +08:00
JKQTPMouseWheelActionsHashMapIterator findMatchingMouseWheelAction ( Qt : : KeyboardModifiers modifiers , bool * found = nullptr ) const ;
2019-01-29 00:05:03 +08:00
2019-02-08 00:24:46 +08:00
/** \brief searches JKQTPlotterStyle::registeredMouseDoubleClickActions for a matching action */
2022-04-21 19:33:22 +08:00
JKQTPMouseDoubleClickActionsHashMapIterator findMatchingMouseDoubleClickAction ( Qt : : MouseButton button , Qt : : KeyboardModifiers modifiers , bool * found = nullptr ) const ;
2019-01-29 00:05:03 +08:00
2019-05-01 18:46:17 +08:00
/** \brief you may overwrite this method to modify the given context menu before it is displayed.
2015-07-11 18:56:02 +08:00
*
* The plotter will fill the menu with the default items and then call this method . The default implementation does NOTHING .
2019-05-01 18:46:17 +08:00
*
* \ see \ ref JKQTPLOTTER_CONTEXTMENU , \ ref JKQTPLOTTER_USERMOUSEINTERACTION
2015-07-11 18:56:02 +08:00
*/
2019-01-26 19:28:44 +08:00
void modifyContextMenu ( QMenu * menu ) ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief indicates whether the plot is updated automatically at the moment
*
* \ see setPlotUpdateEnabled ( ) , isPlotUpdateEnabled ( )
*/
2015-07-11 18:56:02 +08:00
bool doDrawing ;
2019-01-26 03:16:04 +08:00
/** \brief JKQTBasePlotter used to plot */
2019-01-20 17:49:29 +08:00
JKQTBasePlotter * plotter ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief modifies the settings of \a plotter to match those of this object */
void fixBasePlotterSettings ( ) ;
2015-07-11 18:56:02 +08:00
/** \brief this is set \c true if we are drawing a zoom rectangle */
bool mouseDragingRectangle ;
2019-01-27 05:22:46 +08:00
/** \brief when draging the mouse this contains the x-coordinate the user clicked on (in plot coordinates) */
2015-07-11 18:56:02 +08:00
double mouseDragRectXStart ;
2019-01-27 05:22:46 +08:00
/** \brief when draging the mouse this contains the x-coordinate the user clicked on (in pixels) */
int mouseDragRectXStartPixel ;
/** \brief when draging the mouse this contains the x-coordinate the mouse is currently
* pointing to ( in pixels ) */
int mouseDragRectXEndPixel ;
/** \brief when draging the mouse this contains the y-coordinate the mouse is currently
* pointing to ( in pixels ) */
int mouseDragRectYEndPixel ;
/** \brief when draging the mouse this contains the x-coordinate the mouse is currently
2015-07-11 18:56:02 +08:00
* pointing to
*/
double mouseDragRectXEnd ;
2019-01-27 05:22:46 +08:00
/** \brief when draging the mouse this contains the y-coordinate the user clicked on (in plot coordinates) */
2015-07-11 18:56:02 +08:00
double mouseDragRectYStart ;
2019-01-27 05:22:46 +08:00
/** \brief when zooming by moving the mouse this contains the y-coordinate the user clicked on (in pixels) */
int mouseDragRectYStartPixel ;
2015-07-11 18:56:02 +08:00
/** \brief when zooming by moving the mouse this contains the y-coordinate the mouse is currently
* pointing to
*/
double mouseDragRectYEnd ;
2019-05-06 01:31:20 +08:00
/** \brief describes a marker to be drawn by paintUserAction() */
struct MouseDragMarker {
inline MouseDragMarker ( const QPoint & pos_ , const QString & label_ , const QString & title_ , const QColor & color_ , const QImage & keymarker_ = QImage ( ) , JKQTPPlotElement * _graph = nullptr ) :
pos ( pos_ ) , label ( label_ ) , title ( title_ ) , color ( color_ ) , keyMarker ( keymarker_ ) , graph ( _graph )
{ }
/** \brief position of the marker in screen pixels */
QPoint pos ;
/** \brief marker label */
QString label ;
/** \brief graph label */
QString title ;
/** \brief color for the marker */
QColor color ;
/** \brief key marker image */
QImage keyMarker ;
/** \brief graph that created that marker */
JKQTPPlotElement * graph ;
} ;
/** \brief internal list of markers to be drawn by paintUserAction() */
QList < MouseDragMarker > mouseDragMarkers ;
2015-07-11 18:56:02 +08:00
/** \brief this stores the currently displayed plot */
QImage image ;
/** \brief this can be used when drawing a zoom rectangle to store an unchanged
* copy of the currently displayed image .
*/
QImage oldImage ;
2019-01-25 05:49:10 +08:00
2019-05-01 18:46:17 +08:00
/** \brief use this QMenu instance instead of the standard context menu of this widget
* \ see \ ref JKQTPLOTTER_SPECIALCONTEXTMENU
*/
QMenu * menuSpecialContextMenu ;
2015-10-12 23:05:15 +08:00
2015-07-11 18:56:02 +08:00
/** \brief toolbar class used for user input */
JKVanishQToolBar * toolbar ;
/** \brief paint the user action (rectangle, ellipse, ... */
void paintUserAction ( ) ;
2019-02-08 00:24:46 +08:00
/** \brief event handler for a double click
*
* \ see registerMouseDoubleClickAction ( ) , deregisterMouseDoubleClickAction ( )
*/
2015-07-11 18:56:02 +08:00
void mouseDoubleClickEvent ( QMouseEvent * event ) ;
/*! \brief react on key presses.
These shortcuts are defined :
- ESC stops current zooming / drawing action
.
*/
void keyReleaseEvent ( QKeyEvent * event ) ;
/** \brief event handler for a mouse move
*
* This implements two behaviours :
2019-02-08 00:24:46 +08:00
* - if displayMousePosition is \ c true , stores the current mouse position in mousePosX , mousePosY
* - if necessary , contributes to user - actions started by mousePressEvent ( )
* - emits plotMouseMove ( ) if the mouse is inside the plot rectangle .
2022-05-15 20:15:15 +08:00
* - execute mouseMoveActions
2015-07-11 18:56:02 +08:00
* .
2019-02-08 00:24:46 +08:00
*
* \ see mousePosX , mousePosY
2022-05-15 20:15:15 +08:00
* \ see registerMouseWheelAction ( ) , deregisterMouseWheelAction ( ) , registeredMouseWheelActions
2015-07-11 18:56:02 +08:00
*/
void mouseMoveEvent ( QMouseEvent * event ) ;
/** \brief event handler for a mouse down event
*
2019-01-28 06:24:12 +08:00
* This event determines the action to be performed from registeredMouseActionModes
* and then sets currentMouseDragAction accordingly and starts the mouse action .
2019-02-08 00:24:46 +08:00
*
* \ see registerMouseDragAction ( ) , deregisterMouseDragAction ( ) , registeredJKQTPMouseDragActions
2015-07-11 18:56:02 +08:00
*/
void mousePressEvent ( QMouseEvent * event ) ;
/** \brief event handler for a mouse release event
*
2019-01-28 06:24:12 +08:00
* this finishes the action , started by mousePressEvent ( )
2015-07-11 18:56:02 +08:00
*/
void mouseReleaseEvent ( QMouseEvent * event ) ;
/** \brief event handler for a turn of the mouse wheel
2019-02-08 00:24:46 +08:00
*
* Executes the user action defined for the mouse wheel .
*
* \ see registerMouseWheelAction ( ) , deregisterMouseWheelAction ( ) , registeredMouseWheelActions
*/
2015-07-11 18:56:02 +08:00
void wheelEvent ( QWheelEvent * event ) ;
/** \brief this simply paints the stored image to the widget's surface */
void paintEvent ( QPaintEvent * event ) ;
/** \brief resizes the internal representation (image) of the graphs */
void resizeEvent ( QResizeEvent * event ) ;
2019-01-28 06:24:12 +08:00
/** \brief called, when the mouse leaves the widget, hides the toolbar (if visible) */
2015-07-11 18:56:02 +08:00
void leaveEvent ( QEvent * event ) ;
2019-02-08 00:24:46 +08:00
/** \brief update settings of the toolbar */
2015-07-11 18:56:02 +08:00
void updateToolbar ( ) ;
2019-02-03 21:04:48 +08:00
/** \brief the master plotter, this plotter is connected to in x-direction. */
QPointer < JKQTPlotter > masterPlotterX ;
/** \brief the master plotter, this plotter is connected to in y-direction. */
QPointer < JKQTPlotter > masterPlotterY ;
2015-07-11 18:56:02 +08:00
/** \brief calculate the y-axis shift of the plot, so there is space for the potentially displayed mouse position label */
int getPlotYOffset ( ) ;
2019-02-08 00:24:46 +08:00
/** \brief x-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates) */
2015-07-11 18:56:02 +08:00
double mousePosX ;
2019-02-08 00:24:46 +08:00
/** \brief y-position of the mouse during the last mouseMoveEvent() calls (in plot coordinates) */
2015-07-11 18:56:02 +08:00
double mousePosY ;
2019-01-28 17:46:38 +08:00
/** \brief magnification factor for the display of the plot */
2015-07-11 18:56:02 +08:00
double magnification ;
2019-02-08 00:24:46 +08:00
/** \brief current minimal size of the JKQTPlotter widget to properly display the plot */
2015-07-11 18:56:02 +08:00
QSize minSize ;
2019-05-01 18:46:17 +08:00
/** \brief the context menu object used by this JKQTPlotter
*
* \ note this might be \ c = = nullptr occasionally , therefore you need to check it , before accessing it !
*
* \ see \ ref JKQTPLOTTER_CONTEXTMENU , resetContextMenu ( ) , initContextMenu ( ) , contextMenuMode
*/
2015-07-11 18:56:02 +08:00
QMenu * contextMenu ;
2019-05-01 18:46:17 +08:00
/** \brief current mode for the default context menu (i.e. the right-click context menu) \see \ref JKQTPLOTTER_CONTEXTMENU */
2019-02-08 00:24:46 +08:00
JKQTPContextMenuModes contextMenuMode ;
2019-01-25 05:49:10 +08:00
/** \brief x-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle) */
2015-10-10 18:42:55 +08:00
double mouseContextX ;
2019-01-25 05:49:10 +08:00
/** \brief y-position of the mouse (in plot coordinates) when a user mouse-action was started (e.g. drawing a rectangle) */
2015-10-10 18:42:55 +08:00
double mouseContextY ;
2019-01-25 05:49:10 +08:00
/** \brief x-position of the last mouse-click (in screen pixels) */
2015-10-12 23:05:15 +08:00
int mouseLastClickX ;
2019-01-25 05:49:10 +08:00
/** \brief y-position of the last mouse-click (in screen pixels) */
2015-10-12 23:05:15 +08:00
int mouseLastClickY ;
2019-05-06 01:31:20 +08:00
/** \brief internal storage for sub-menu entries of the internal contextMenu object, based on the actions returned by JKQTBasePlotter::getLstAdditionalPlotterActions()
* \ internal
*/
2015-07-11 18:56:02 +08:00
QList < QMenu * > contextSubMenus ;
2019-05-01 18:46:17 +08:00
/** \brief fills the member contextMenu with all default and additionally registered actions, also calls modifyContextMenu()
*
* \ note This function calls resetContextMenu ( ) internally !
*
* \ see resetContextMenu ( ) , contextMenuMode
*/
2015-07-11 18:56:02 +08:00
void initContextMenu ( ) ;
2019-01-28 17:46:38 +08:00
/** \brief set the current mouse cursor shappe according to currentMouseDragAction */
2015-07-11 18:56:02 +08:00
void updateCursor ( ) ;
2019-02-08 00:24:46 +08:00
/** \brief current style properties for this JKQTPlotter
*
* \ see JKQTPSetSystemDefaultStyle ( ) , JKQTPSetSystemDefaultStyle ( ) , getCurrentPlotterStyle ( ) , \ ref jkqtpplotter_styling
*/
JKQTPlotterStyle plotterStyle ;
2015-07-11 18:56:02 +08:00
2019-02-08 00:24:46 +08:00
/** \brief timer used while the graph is resized to delay the redrawing with new size (in the meantime, an intermediate graphic is displayed)
* \ internal
* \ see delayedResizeEvent ( )
*
* \ image html jkqtplotter_fastresizing . gif
*/
2015-07-11 18:56:02 +08:00
QTimer resizeTimer ;
2019-02-08 00:24:46 +08:00
2019-05-01 18:46:17 +08:00
/** \brief destroys the internal contextMenu and optionally creates a new one
*
* \ param createnew if \ c = = true , contextMenu is reinitialized with a ( shiny ) new QMenu ,
* otherwise it is set to \ c nullptr after destroying the old menu .
*
* \ see initContextMenu ( ) , contextMenuMode
*/
void resetContextMenu ( bool createnew = true ) ;
2019-05-06 01:31:20 +08:00
/** \brief fills the inertnal mouseDragMarkers structure with data to display tooltips close to (x0, y0)
*
* if \ a emitEvent is \ c true , the signal is emitted before the function returns
*/
void fillInternalStructForToolTipOfClosestDataPoint ( double x0 , double y0 , bool emitEvent = true ) ;
/** \brief resets the currently activated mouse drag action, e.g. called by mouseReleaseEvent() */
void resetCurrentMouseDragAction ( ) ;
/** \brief list of override mouse drag action modes, that override the settings ing plotterStyle.registeredMouseDragActionModes \see setOverrideMouseDragAction(), resetOverrideMouseDragAction(), JKQTPlotterStyle::registeredMouseDragActionModes */
JKQTPMouseDragActionsHashMap registeredOverrideMouseDragActionModes ;
/** \brief sets an override mouse drag action for the given button/modifiers combination \see setOverrideMouseDragAction(), resetOverrideMouseDragAction(), registeredOverrideMouseDragActionModes */
void setOverrideMouseDragAction ( Qt : : MouseButton button , Qt : : KeyboardModifiers modifiers , JKQTPMouseDragActions action ) ;
/** \brief removes a previously set override mouse drag action for the given button/modifiers combination \see setOverrideMouseDragAction(), resetOverrideMouseDragAction(), registeredOverrideMouseDragActionModes */
void resetOverrideMouseDragAction ( Qt : : MouseButton button , Qt : : KeyboardModifiers modifiers ) ;
/** \brief action group, that groups the actMouseLeft... actions */
QActionGroup * actgrpMouseLeft ;
/** \brief action that activates the default action, set in plotterStyle! */
QAction * actMouseLeftAsDefault ;
/** \brief action that activates the ruler tool (override!) */
QAction * actMouseLeftAsRuler ;
/** \brief action that activates the tooltip tool (override!) */
2022-05-15 20:15:15 +08:00
QAction * actMouseMoveToolTip ;
2019-05-06 01:31:20 +08:00
/** \brief action that activates the zoom rectangle tool (override!) */
QAction * actMouseLeftAsZoomRect ;
/** \brief action that activates the pan view tool (override!) */
QAction * actMouseLeftAsPanView ;
2015-07-11 18:56:02 +08:00
protected slots :
2019-02-08 00:24:46 +08:00
/** \brief while the window is resized, the plot is only redrawn after a restartable delay, implemented by this function and resizeTimer
* \ internal
* \ see resizeTimer
*
* \ image html jkqtplotter_fastresizing . gif
*/
2015-07-11 18:56:02 +08:00
void delayedResizeEvent ( ) ;
/** \brief connected to plotScalingRecalculated() of the masterPlotter */
void masterPlotScalingRecalculated ( ) ;
/** \brief called whenever the zoom changes in plotter */
2019-01-20 17:49:29 +08:00
void pzoomChangedLocally ( double newxmin , double newxmax , double newymin , double newymax , JKQTBasePlotter * sender ) ;
2015-07-11 18:56:02 +08:00
/** \brief emitted before the plot scaling has been recalculated */
void intBeforePlotScalingRecalculate ( ) ;
2018-08-20 00:17:18 +08:00
/** \brief called from a menu entry that encodes the graph ID */
void reactGraphVisible ( bool visible ) ;
2015-07-11 18:56:02 +08:00
2019-05-06 01:31:20 +08:00
/** \brief action that activates the pan viewport tool \see resetMouseLeftAction(), setMouseLeftActionAsToolTip() */
void setMouseLeftActionAsPanView ( ) ;
/** \brief action that activates the zoom rectangle tool \see resetMouseLeftAction(), setMouseLeftActionAsToolTip() */
void setMouseLeftActionAsZoomRect ( ) ;
/** \brief action that activates the ruler tool \see resetMouseLeftAction(), setMouseLeftActionAsToolTip() */
void setMouseLeftActionAsRuler ( ) ;
2022-05-15 20:15:15 +08:00
/** \brief action that activates the tooltip tool, when dragging the mouse with the left button pressed \see resetMouseLeftAction() */
void setMouseLeftDragActionAsToolTip ( ) ;
2019-05-06 01:31:20 +08:00
/** \brief resets any previously set override action for the left mouse-button, un-modified \see setMouseLeftActionAsRuler(), setMouseLeftActionAsToolTip() */
void resetMouseLeftAction ( ) ;
2022-05-15 20:15:15 +08:00
/** \brief action that (de)activates the tooltip tool, when moving the mouse without any button pressed \see setMouseLeftActionAsRuler(), resetMouseLeftAction() */
void setMouseMoveActionAsToolTip ( bool enabled ) ;
2019-05-06 01:31:20 +08:00
2015-07-11 18:56:02 +08:00
} ;
2020-10-02 21:41:26 +08:00
QT_BEGIN_NAMESPACE
2019-01-28 06:24:12 +08:00
/** \brief qHash-variant used by JKQTPlotter
* \ internal
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-01-28 06:24:12 +08:00
*/
2022-04-22 19:27:31 +08:00
# if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
inline size_t qHash ( const QPair < Qt : : MouseButton , Qt : : KeyboardModifiers > & key , size_t seed = 0 ) {
# else
inline uint qHash ( const QPair < Qt : : MouseButton , Qt : : KeyboardModifiers > & key , uint seed = 0 ) {
# endif
2019-01-28 06:24:12 +08:00
return static_cast < uint > ( key . first ) + static_cast < uint > ( key . second ) ;
}
2015-07-11 18:56:02 +08:00
2019-01-29 00:05:03 +08:00
/** \brief qHash-variant used by JKQTPlotter
* \ internal
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-01-29 00:05:03 +08:00
*/
2022-04-22 19:27:31 +08:00
# if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
inline size_t qHash ( const Qt : : MouseButton & key , size_t /*seed=0*/ ) {
# else
inline uint qHash ( const Qt : : MouseButton & key , uint /*seed=0*/ ) {
# endif
2019-01-29 00:05:03 +08:00
return static_cast < uint > ( key ) ;
}
/** \brief qHash-variant used by JKQTPlotter
* \ internal
2019-05-23 04:20:00 +08:00
* \ ingroup jkqtpplottersupprt
2019-01-29 00:05:03 +08:00
*/
2022-04-22 19:27:31 +08:00
# if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
inline size_t qHash ( const Qt : : KeyboardModifiers & key , size_t /*seed=0*/ ) {
# else
inline uint qHash ( const Qt : : KeyboardModifiers & key , uint /*seed=0*/ ) {
# endif
2019-01-29 00:05:03 +08:00
return static_cast < uint > ( key ) ;
}
2020-10-02 21:41:26 +08:00
QT_END_NAMESPACE
2015-07-11 18:56:02 +08:00
# endif // JKQTPLOTTER_H