JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
jkqtplotterstyle.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3
4
5
6 This software is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef JKQTPLOTTERSTYLE_H
21#define JKQTPLOTTERSTYLE_H
22
23#include "jkqtplotter/jkqtptools.h"
24#include "jkqtplotter/jkqtplotter_imexport.h"
25#include "jkqtplotter/jkqtplotter_configmacros.h"
26#include <QColor>
27#include <QPainter>
28#include <QString>
29#include <QHash>
30#include <QPair>
31#include <QMouseEvent>
32#include <QSettings>
33
34
35/** \brief Support Class for JKQTPlotter, which summarizes all properties that define the visual styling of a JKQTPlotter
36 * \ingroup jkqtpplotter_styling_classes
37 *
38 * \see JKQTPlotter, \ref jkqtpplotter_styling
39 */
41 Q_GADGET
42public:
43 /** \brief initialize with default values */
45
46
47
48 /** \brief loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object
49 *
50 * \param settings QSettings-object to read from
51 * \param group Group in the QSettings-object to read from
52 * \param defaultStyle If a setting cannot be found in \a settings, default values are taken from this object
53 * By default, this is a default-constructed object
54 */
55 void loadSettings(const QSettings &settings, const QString& group=QString("plots/"), const JKQTPlotterStyle &defaultStyle=JKQTPlotterStyle());
56
57 /** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
58 *
59 * \param settings QSettings-object to save to
60 * \param group Group in the QSettings-object to save to
61 */
62 void saveSettings(QSettings& settings, const QString& group=QString("plots/")) const;
63
64
65
66
67
68 /** \brief maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaToolTipForClosestDataPoint is executed */
70 /** \brief sensitivity (i.e. max. distance to see as one point) for user actions */
72
73 /** \brief width/height of the icons in the plotter toolbar in pixel */
75 /** \brief pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles) \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
77 /** \brief brush for user actions (typically semi-transparent, like e.g. zoom-rectangles) \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
79
80 /** \brief pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips) \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
82 /** \brief brush for user actions that cover parts of the plot (typically opaque, like e.g. tooltips) \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
84
85 /** \brief pen for location markers of user actions on the plot \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
87 /** \brief brush for location markers of user actions on the plot \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
89 /** \brief type of the location markers of user actions on the plot \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
91
92 /** \brief font name to use for text of user actions \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
94 /** \brief font size [pt] to use for text of user actions \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
96
97 /** \brief size (diameter) of markers drawn by user actions */
99
100 /** \brief this string is used to generate the position output above the graph (\c %1 is replaced by the x-position, \c %2 by the y-position)
101 *
102 * By default simply <code>"(%1, %2)</code> is used to format this display (e.g. <code>(1.35, -4.56)</code>).
103 *
104 * \image html jkqtplotter_mousepositiondisplay.png
105 *
106 * \see mousePositionTemplate, \ref JKQTPlotterUserInteraction */
108
109 /** \brief specifies whether to display the current position of the mouse in the top border of the plot (this may automatically extent the
110 * top border, so the position fits in. The default widget font is used for the output.
111 *
112 * \image html jkqtplotter_mousepositiondisplay.png
113 *
114 * \see mousePositionTemplate, \ref JKQTPlotterUserInteraction, \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE
115 */
117
118 /** \brief specifies whether to display a toolbar with buttons when the mouse is in the upper border of the plot
119 *
120 * \image html jkqtplotter_toolbar_alwayson.png
121 *
122 * \see toolbarAlwaysOn, \ref JKQTPlotterUserInteraction
123 */
125 /** \brief specifies whether the toolbar is always visible or only when the mouse moves to the upper left area
126 *
127 * If toolbarAlwaysOn is set to \c true:
128 *
129 * \image html jkqtplotter_toolbar_alwayson.png
130 *
131 * If toolbarAlwaysOn is set to \c false, the toolbar only appears when the mouse is in the right location:
132 *
133 * \image html jkqtplotter_toolbar_hidden.png "Hidden Toolbar"
134 * \image html jkqtplotter_toolbar_shown.png "Shown Toolbar"
135 *
136 * \see toolbarEnabled, \ref JKQTPlotterUserInteraction
137 */
139
140 /** \brief if set (\c true ), JKQTPlotter uses QPalette::Window and other colors from QPalette as background color for the plot
141 *
142 * \note setting this (default: \c true ) will overwrite some settings from JKQTBasePlotterStyle! */
144
145 /** \brief lists all availble mouse drag action modes */
147
148 /** \brief lists all availble mouse wheel action modes */
150
151 /** \brief action to perform on a double-click of the mouse buttons (depending on the button and the modifiers) */
153
154 /** \brief the currently executed MouseMoveAction */
156
157};
158
159
160/** \brief returns the system-wide default JKQTPlotterStyle
161 * \ingroup jkqtpplotter_styling_classes
162 *
163 * \see JKQTPSetSystemDefaultStyle(), JKQTPGetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), \ref jkqtpplotter_styling
164 */
166
167/** \brief replaces the system-wide default JKQTPlotterStyle with the given \a newStyle
168 * \ingroup jkqtpplotter_styling_classes
169 *
170 * \see JKQTPGetSystemDefaultStyle(), JKQTPGetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), \ref jkqtpplotter_styling
171 */
173
174
175#endif // JKQTPLOTTERSTYLE_H
Support Class for JKQTPlotter, which summarizes all properties that define the visual styling of a JK...
Definition jkqtplotterstyle.h:40
bool displayMousePosition
specifies whether to display the current position of the mouse in the top border of the plot (this ma...
Definition jkqtplotterstyle.h:116
JKQTPlotterStyle()
initialize with default values
QBrush userActionOverlayBrush
brush for user actions (typically semi-transparent, like e.g. zoom-rectangles)
Definition jkqtplotterstyle.h:78
bool toolbarAlwaysOn
specifies whether the toolbar is always visible or only when the mouse moves to the upper left area
Definition jkqtplotterstyle.h:138
QPen userActionOpaquePen
pen for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
Definition jkqtplotterstyle.h:81
int userActionCatchSensitivity
sensitivity (i.e. max. distance to see as one point) for user actions
Definition jkqtplotterstyle.h:71
int userActionMarkerDiameter
size (diameter) of markers drawn by user actions
Definition jkqtplotterstyle.h:98
JKQTPMouseDoubleClickActionsHashMap registeredMouseDoubleClickActions
action to perform on a double-click of the mouse buttons (depending on the button and the modifiers)
Definition jkqtplotterstyle.h:152
QPen userActionOverlayPen
pen for user actions that overlay the plot (typically semi-transparent, like e.g. zoom-rectangles)
Definition jkqtplotterstyle.h:76
double userActionFontSize
font size [pt] to use for text of user actions
Definition jkqtplotterstyle.h:95
int toolbarIconSize
width/height of the icons in the plotter toolbar in pixel
Definition jkqtplotterstyle.h:74
void saveSettings(QSettings &settings, const QString &group=QString("plots/")) const
saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object.
QPen userActionMarkerPen
pen for location markers of user actions on the plot
Definition jkqtplotterstyle.h:86
int maxTooltipDistance
maximum distance at which a tooltip for a point is still displayed, when the user action jkqtpmdaTool...
Definition jkqtplotterstyle.h:69
bool toolbarEnabled
specifies whether to display a toolbar with buttons when the mouse is in the upper border of the plot
Definition jkqtplotterstyle.h:124
QBrush userActionMarkerBrush
brush for location markers of user actions on the plot
Definition jkqtplotterstyle.h:88
JKQTPUserActionMarkerType userActionMarkerType
type of the location markers of user actions on the plot
Definition jkqtplotterstyle.h:90
QString mousePositionTemplate
this string is used to generate the position output above the graph (%1 is replaced by the x-position...
Definition jkqtplotterstyle.h:107
JKQTPMouseDragActionsHashMap registeredMouseDragActionModes
lists all availble mouse drag action modes
Definition jkqtplotterstyle.h:146
JKQTPMouseMoveActionsHashMap registeredMouseMoveActions
the currently executed MouseMoveAction
Definition jkqtplotterstyle.h:155
JKQTPMouseWheelActionsHashMap registeredMouseWheelActions
lists all availble mouse wheel action modes
Definition jkqtplotterstyle.h:149
QBrush userActionOpaqueBrush
brush for user actions that cover parts of the plot (typically opaque, like e.g. tooltips)
Definition jkqtplotterstyle.h:83
QString userActionFontName
font name to use for text of user actions
Definition jkqtplotterstyle.h:93
void loadSettings(const QSettings &settings, const QString &group=QString("plots/"), const JKQTPlotterStyle &defaultStyle=JKQTPlotterStyle())
loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object
bool usePaletteColors
if set (true ), JKQTPlotter uses QPalette::Window and other colors from QPalette as background color ...
Definition jkqtplotterstyle.h:143
JKQTPLOTTER_LIB_EXPORT JKQTPlotterStyle & JKQTPGetSystemDefaultStyle()
returns the system-wide default JKQTPlotterStyle
JKQTPLOTTER_LIB_EXPORT void JKQTPSetSystemDefaultStyle(JKQTPlotterStyle &newStyle)
replaces the system-wide default JKQTPlotterStyle with the given newStyle
QHash< QPair< Qt::MouseButton, Qt::KeyboardModifiers >, JKQTPMouseDoubleClickActions > JKQTPMouseDoubleClickActionsHashMap
data structure for storage of assigned JKQTPMouseDoubleClickActions
Definition jkqtptools.h:245
JKQTPUserActionMarkerType
Styles in which to mark single positions during user actions in JKQTPlotter.
Definition jkqtptools.h:83
QHash< Qt::KeyboardModifiers, JKQTPMouseWheelActions > JKQTPMouseWheelActionsHashMap
data structure for storage of assigned JKQTPMouseWheelActions
Definition jkqtptools.h:238
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89
QHash< Qt::KeyboardModifiers, JKQTPMouseMoveActions > JKQTPMouseMoveActionsHashMap
data structure for storage of assigned JKQTPMouseMoveActions
Definition jkqtptools.h:253
QHash< QPair< Qt::MouseButton, Qt::KeyboardModifiers >, JKQTPMouseDragActions > JKQTPMouseDragActionsHashMap
data structure for storage of assigned JKQTPMouseDragActions
Definition jkqtptools.h:231