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
jkqtpkeystyle.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 JKQTPKEYSTYLE_H
21#define JKQTPKEYSTYLE_H
22
23#include "jkqtplotter/jkqtptools.h"
24#include "jkqtplotter/jkqtplotter_imexport.h"
25#include "jkqtplotter/jkqtplotter_configmacros.h"
26#include <QColor>
27#include <QString>
28#include <QSettings>
29#include <QPen>
30#include <QBrush>
31
32class JKQTBasePlotterStyle; // forward
33
34/** \brief Support Class for JKQTBasePlotter, which summarizes all properties that define the visual styling of the key in a JKQTBasePlotter
35 * \ingroup jkqtpplotter_styling_classes
36 *
37 * With JKQTPKeyStyle you can style the appearance of a key/legend:
38 *
39 * \image html plot_key.png
40 *
41 * In addition it is possible to set:
42 * - its visiblility with JKQTPKeyStyle::visible
43 * - its location within or besides the plot area, using JKQTPKeyStyle::position
44 * - its overall layout (i.e. how the entries are distributed over the available space), using JKQTPKeyStyle::layout
45 * .
46 *
47 * \see JKQTPBaseKey, JKQTBasePlotter, JKQTBasePlotterStyle, \ref jkqtpplotter_styling
48 */
50 Q_GADGET
51 public:
53 explicit JKQTPKeyStyle(const JKQTBasePlotterStyle& baseStyle);
54
55
56 /** \brief loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object
57 *
58 * \param settings QSettings-object to read from
59 * \param group Group in the QSettings-object to read from
60 * \param defaultStyle If a setting cannot be found in \a settings, default values are taken from this object
61 * By default, this is a default-constructed object
62 */
63 void loadSettings(const QSettings &settings, const QString& group=QString("plots/key/"), const JKQTPKeyStyle &defaultStyle=JKQTPKeyStyle());
64
65 /** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
66 *
67 * \param settings QSettings-object to save to
68 * \param group Group in the QSettings-object to save to
69 */
70 void saveSettings(QSettings& settings, const QString& group=QString("plots/key/")) const;
71
72
73 /** \brief indicates whether to plot a frame around the key */
75 /** \brief color of the key frame line */
76 QColor frameColor;
77 /** \brief linestyle for the frame */
78 Qt::PenStyle frameLineStyle;
79 /** \brief width of the key frame line [pt] */
80 double frameWidth;
81 /** \brief rounding radius of the key frame rectangle (<=0 -> no rounded rectangle) [pt] */
83 /** \brief color of the key background */
85 /** \brief indicates whether to plot a key */
86 bool visible;
87 /** \brief font size for key labels [in points] */
88 double fontSize;
89 /** \brief font name */
90 QString fontName;
91 /** \brief color of the key entries' text */
92 QColor textColor;
93 /** \brief length of the line samples in the key [in units of width of 'X' set in fontName, fontSize] */
95 /** \brief height of a line sample [in units of height of fontName, fontSize] */
97 /** \brief x-distance between key frame and key content [in units of width of 'X' set in fontName, fontSize] */
98 double xMargin;
99 /** \brief y-distance between key frame and key content [in units of width of 'X' set in fontName, fontSize] */
100 double yMargin;
101 /** \brief x-offset of the key from the border of the plot [in units of width of 'X' set in fontName, fontSize] */
102 double xOffset;
103 /** \brief y-offset of the key from the border of the plot [in units of width of 'X' set in fontName, fontSize] */
104 double yOffset;
105 /** \brief distance between key line example and key text [in units of width of 'X' set in fontName, fontSize] */
107 /** \brief distance between two key entries [in units of height of fontName, fontSize] */
109 /** \brief distance between two columns of key entries [in units of width of 'X' set in fontName, fontSize] */
111
112 /** \brief key position inside or besides the plot area, see JKQTPKeyPositions for details and examples */
114 /** \brief the key layout, i.e. how the entries are distributed over the available space, see JKQTPKeyLayout for details and examples */
116};
117
118#endif // JKQTPKEYSTYLE_H
Support Class for JKQTBasePlotter, which summarizes all properties that define the visual styling of ...
Definition jkqtpbaseplotterstyle.h:47
Support Class for JKQTBasePlotter, which summarizes all properties that define the visual styling of ...
Definition jkqtpkeystyle.h:49
void loadSettings(const QSettings &settings, const QString &group=QString("plots/key/"), const JKQTPKeyStyle &defaultStyle=JKQTPKeyStyle())
loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object
double frameRounding
rounding radius of the key frame rectangle (<=0 -> no rounded rectangle) [pt]
Definition jkqtpkeystyle.h:82
double frameWidth
width of the key frame line [pt]
Definition jkqtpkeystyle.h:80
QBrush backgroundBrush
color of the key background
Definition jkqtpkeystyle.h:84
double ySeparation
distance between two key entries [in units of height of fontName, fontSize]
Definition jkqtpkeystyle.h:108
double sampleHeight
height of a line sample [in units of height of fontName, fontSize]
Definition jkqtpkeystyle.h:96
QString fontName
font name
Definition jkqtpkeystyle.h:90
double columnSeparation
distance between two columns of key entries [in units of width of 'X' set in fontName,...
Definition jkqtpkeystyle.h:110
double xSeparation
distance between key line example and key text [in units of width of 'X' set in fontName,...
Definition jkqtpkeystyle.h:106
double xMargin
x-distance between key frame and key content [in units of width of 'X' set in fontName,...
Definition jkqtpkeystyle.h:98
JKQTPKeyPosition position
key position inside or besides the plot area, see JKQTPKeyPositions for details and examples
Definition jkqtpkeystyle.h:113
JKQTPKeyLayout layout
the key layout, i.e. how the entries are distributed over the available space, see JKQTPKeyLayout for...
Definition jkqtpkeystyle.h:115
QColor textColor
color of the key entries' text
Definition jkqtpkeystyle.h:92
bool frameVisible
indicates whether to plot a frame around the key
Definition jkqtpkeystyle.h:74
JKQTPKeyStyle(const JKQTBasePlotterStyle &baseStyle)
void saveSettings(QSettings &settings, const QString &group=QString("plots/key/")) const
saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings object.
double fontSize
font size for key labels [in points]
Definition jkqtpkeystyle.h:88
Qt::PenStyle frameLineStyle
linestyle for the frame
Definition jkqtpkeystyle.h:78
double yMargin
y-distance between key frame and key content [in units of width of 'X' set in fontName,...
Definition jkqtpkeystyle.h:100
bool visible
indicates whether to plot a key
Definition jkqtpkeystyle.h:86
double sampleLineLength
length of the line samples in the key [in units of width of 'X' set in fontName, fontSize]
Definition jkqtpkeystyle.h:94
QColor frameColor
color of the key frame line
Definition jkqtpkeystyle.h:76
double yOffset
y-offset of the key from the border of the plot [in units of width of 'X' set in fontName,...
Definition jkqtpkeystyle.h:104
double xOffset
x-offset of the key from the border of the plot [in units of width of 'X' set in fontName,...
Definition jkqtpkeystyle.h:102
JKQTPKeyLayout
layout of the key
Definition jkqtptools.h:632
QFlags< JKQTPKeyPositions > JKQTPKeyPosition
position of the key
Definition jkqtptools.h:607
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89