2019-02-08 00:24:46 +08:00
|
|
|
/*
|
2022-07-19 19:40:43 +08:00
|
|
|
Copyright (c) 2008-2022 Jan W. Krieger (<jan@jkrieger.de>)
|
2019-02-08 00:24:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This software is free software: you can redistribute it and/or modify
|
|
|
|
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
|
|
|
|
(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
|
|
|
|
GNU Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2023-12-19 05:24:59 +08:00
|
|
|
#ifndef JKQTPKEYSTYLE_H
|
|
|
|
#define JKQTPKEYSTYLE_H
|
2019-02-08 00:24:46 +08:00
|
|
|
|
2019-05-30 04:40:02 +08:00
|
|
|
#include "jkqtplotter/jkqtptools.h"
|
2019-06-22 20:21:32 +08:00
|
|
|
#include "jkqtplotter/jkqtplotter_imexport.h"
|
2022-07-19 16:24:52 +08:00
|
|
|
#include "jkqtplotter/jkqtplotter_configmacros.h"
|
2019-02-08 00:24:46 +08:00
|
|
|
#include <QColor>
|
|
|
|
#include <QString>
|
|
|
|
#include <QSettings>
|
2022-07-21 04:31:42 +08:00
|
|
|
#include <QPen>
|
|
|
|
#include <QBrush>
|
2019-02-08 00:24:46 +08:00
|
|
|
|
|
|
|
class JKQTBasePlotterStyle; // forward
|
|
|
|
|
2020-09-26 21:58:58 +08:00
|
|
|
/** \brief Support Class for JKQTBasePlotter, which summarizes all properties that define the visual styling of the key in a JKQTBasePlotter
|
2022-09-25 02:18:08 +08:00
|
|
|
* \ingroup jkqtpplotter_styling_classes
|
2019-02-08 00:24:46 +08:00
|
|
|
*
|
2023-12-19 05:24:59 +08:00
|
|
|
* \image html plot_key.png
|
|
|
|
*
|
|
|
|
* \see JKQTPKey, JKQTBasePlotter, JKQTBasePlotterStyle, \ref jkqtpplotter_styling
|
2019-02-08 00:24:46 +08:00
|
|
|
*/
|
2019-06-22 20:21:32 +08:00
|
|
|
class JKQTPLOTTER_LIB_EXPORT JKQTPKeyStyle {
|
2019-02-08 00:24:46 +08:00
|
|
|
Q_GADGET
|
|
|
|
public:
|
|
|
|
JKQTPKeyStyle();
|
2022-11-03 22:48:48 +08:00
|
|
|
explicit JKQTPKeyStyle(const JKQTBasePlotterStyle& baseStyle);
|
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
|
|
|
|
*
|
|
|
|
* \param settings QSettings-object to read from
|
|
|
|
* \param group Group in the QSettings-object to read from
|
|
|
|
* \param defaultStyle If a setting cannot be found in \a settings, default values are taken from this object
|
|
|
|
* By default, this is a default-constructed object
|
|
|
|
*/
|
|
|
|
void loadSettings(const QSettings &settings, const QString& group=QString("plots/key/"), const JKQTPKeyStyle &defaultStyle=JKQTPKeyStyle());
|
|
|
|
|
|
|
|
/** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
|
|
|
|
*
|
|
|
|
* \param settings QSettings-object to save to
|
|
|
|
* \param group Group in the QSettings-object to save to
|
|
|
|
*/
|
|
|
|
void saveSettings(QSettings& settings, const QString& group=QString("plots/key/")) const;
|
|
|
|
|
|
|
|
|
|
|
|
/** \brief indicates whether to plot a frame around the key */
|
|
|
|
bool frameVisible;
|
|
|
|
/** \brief color of the key frame line */
|
|
|
|
QColor frameColor;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief linestyle for the frame */
|
|
|
|
Qt::PenStyle frameLineStyle;
|
2019-02-08 00:24:46 +08:00
|
|
|
/** \brief width of the key frame line [pt] */
|
|
|
|
double frameWidth;
|
|
|
|
/** \brief rounding radius of the key frame rectangle (<=0 -> no rounded rectangle) [pt] */
|
|
|
|
double frameRounding;
|
|
|
|
/** \brief color of the key background */
|
2019-04-25 01:33:51 +08:00
|
|
|
QBrush backgroundBrush;
|
2019-02-08 00:24:46 +08:00
|
|
|
/** \brief indicates whether to plot a key */
|
|
|
|
bool visible;
|
|
|
|
/** \brief font size for key labels [in points] */
|
|
|
|
double fontSize;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief font name */
|
|
|
|
QString fontName;
|
2019-02-08 00:24:46 +08:00
|
|
|
/** \brief color of the key entries' text */
|
|
|
|
QColor textColor;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief length of the line samples in the key [in units of width of 'X' set in fontName, fontSize] */
|
2019-02-08 00:24:46 +08:00
|
|
|
double sampleLineLength;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief height of a line sample [in units of height of fontName, fontSize] */
|
|
|
|
double sampleHeight;
|
|
|
|
/** \brief x-distance between key frame and key content [in units of width of 'X' set in fontName, fontSize] */
|
2019-02-08 00:24:46 +08:00
|
|
|
double xMargin;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief y-distance between key frame and key content [in units of width of 'X' set in fontName, fontSize] */
|
2019-02-08 00:24:46 +08:00
|
|
|
double yMargin;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief x-offset of the key from the border of the plot [in units of width of 'X' set in fontName, fontSize] */
|
2019-02-08 00:24:46 +08:00
|
|
|
double xOffset;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief y-offset of the key from the border of the plot [in units of width of 'X' set in fontName, fontSize] */
|
2019-02-08 00:24:46 +08:00
|
|
|
double yOffset;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief distance between key line example and key text [in units of width of 'X' set in fontName, fontSize] */
|
2019-02-08 00:24:46 +08:00
|
|
|
double xSeparation;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief distance between two key entries [in units of height of fontName, fontSize] */
|
2019-02-08 00:24:46 +08:00
|
|
|
double ySeparation;
|
2023-12-19 05:24:59 +08:00
|
|
|
/** \brief distance between two columns of key entries [in units of width of 'X' set in fontName, fontSize] */
|
|
|
|
double columnSeparation;
|
|
|
|
|
2019-02-08 00:24:46 +08:00
|
|
|
/** \brief key position */
|
|
|
|
JKQTPKeyPosition position;
|
|
|
|
/** \brief the key layout */
|
|
|
|
JKQTPKeyLayout layout;
|
|
|
|
};
|
|
|
|
|
2023-12-19 05:24:59 +08:00
|
|
|
#endif // JKQTPKEYSTYLE_H
|