mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 18:15:52 +08:00
69ad2a0182
- improved documentation - changed: using static const variables instead of \c #define for fixed default values (e.g. JKQTPImageTools::LUTSIZE, JKQTPImageTools::PALETTE_ICON_WIDTH, JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, JKQTMathText::ABS_MIN_LINEWIDTH ...) - new: added debugging option, which surrounds different regions with visible rectangles (JKQTBasePlotter::enableDebugShowRegionBoxes() ) - fixed: colorbars at top were positioned over the plot label - new: frames (plot viewport, key/legend ...) may be rounded off at the corners - new: diverse new styling options (default font name/size ...) - speed improvements to JKQTMathText::useSTIX()
146 lines
6.0 KiB
C++
146 lines
6.0 KiB
C++
/*
|
|
Copyright (c) 2008-2019 Jan W. Krieger (<jan@jkrieger.de>, <j.krieger@dkfz.de>)
|
|
|
|
|
|
|
|
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/>.
|
|
*/
|
|
|
|
#ifndef JKQTPLOTTERSTYLE_H
|
|
#define JKQTPLOTTERSTYLE_H
|
|
|
|
#include "jkqtplottertools/jkqtptools.h"
|
|
#include "jkqtplottertools/jkqtp_imexport.h"
|
|
#include <QColor>
|
|
#include <QPainter>
|
|
#include <QString>
|
|
#include <QHash>
|
|
#include <QPair>
|
|
#include <QMouseEvent>
|
|
#include <QSettings>
|
|
|
|
|
|
/** \brief Support Class for JKQTPlotter, which summarizes all proeprties that define the visual styling of a JKQTPlotter
|
|
* \ingroup jkqtpplotter_styling
|
|
*
|
|
* \see JKQTPlotter, \ref jkqtpplotter_styling
|
|
*/
|
|
class JKQTP_LIB_EXPORT JKQTPlotterStyle {
|
|
Q_GADGET
|
|
public:
|
|
/** \brief initialize with default values */
|
|
JKQTPlotterStyle();
|
|
|
|
|
|
|
|
/** \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/"), const JKQTPlotterStyle &defaultStyle=JKQTPlotterStyle());
|
|
|
|
/** \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/")) const;
|
|
|
|
|
|
|
|
|
|
|
|
/** \brief width/height of the icons in the plotter toolbar in pixel */
|
|
int toolbarIconSize;
|
|
/** \brief fill color of the zoom rectangle \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
|
|
QColor userActionColor;
|
|
/** \brief the QPainter::CompositionMode used to draw the zoom rectangle etc. \see \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEDRAG */
|
|
QPainter::CompositionMode userActionCompositionMode;
|
|
/** \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)
|
|
*
|
|
* By default simply <code>"(%1, %2)</code> is used to format this display (e.g. <code>(1.35, -4.56)</code>).
|
|
*
|
|
* \image html jkqtplotter_mousepositiondisplay.png
|
|
*
|
|
* \see mousePositionTemplate, \ref JKQTPlotterUserInteraction */
|
|
QString mousePositionTemplate;
|
|
|
|
/** \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.
|
|
*
|
|
* \image html jkqtplotter_mousepositiondisplay.png
|
|
*
|
|
* \see mousePositionTemplate, \ref JKQTPlotterUserInteraction, \ref JKQTPLOTTER_USERMOUSEINTERACTION_MOUSEMOVE
|
|
*/
|
|
bool displayMousePosition;
|
|
|
|
/** \brief specifies whether to display a toolbar with buttons when the mouse is in the upper border of the plot
|
|
*
|
|
* \image html jkqtplotter_toolbar_alwayson.png
|
|
*
|
|
* \see toolbarAlwaysOn, \ref JKQTPlotterUserInteraction
|
|
*/
|
|
bool toolbarEnabled;
|
|
/** \brief specifies whether the toolbar is always visible or only when the mouse moves to the upper left area
|
|
*
|
|
* If toolbarAlwaysOn is set to \c true:
|
|
*
|
|
* \image html jkqtplotter_toolbar_alwayson.png
|
|
*
|
|
* If toolbarAlwaysOn is set to \c false, the toolbar only appears when the mouse is in the right location:
|
|
*
|
|
* \image html jkqtplotter_toolbar_hidden.png "Hidden Toolbar"
|
|
* \image html jkqtplotter_toolbar_shown.png "Shown Toolbar"
|
|
*
|
|
* \see toolbarEnabled, \ref JKQTPlotterUserInteraction
|
|
*/
|
|
bool toolbarAlwaysOn;
|
|
|
|
/** \brief if set (\c true ), JKQTPlotter uses QPalette::Window and other colors from QPalette as background color for the plot
|
|
*
|
|
* \note setting this (default: \c true ) will overwrite some settings from JKQTBasePlotterStyle! */
|
|
bool usePaletteColors;
|
|
|
|
/** \brief lists all availble mouse drag action modes */
|
|
JKQTPMouseDragActionsHashMap registeredMouseDragActionModes;
|
|
|
|
/** \brief lists all availble mouse wheel action modes */
|
|
JKQTPMouseWheelActionsHashMap registeredMouseWheelActions;
|
|
|
|
/** \brief action to perform on a double-click of the mouse buttons (depending on the button and the modifiers) */
|
|
JKQTPMouseDoubleClickActionsHashMap registeredMouseDoubleClickActions;
|
|
|
|
};
|
|
|
|
|
|
/** \brief returns the system-wide default JKQTPlotterStyle
|
|
* \ingroup jkqtpplotter_styling
|
|
*
|
|
* \see JKQTPSetSystemDefaultStyle(), JKQTPGetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), \ref jkqtpplotter_styling
|
|
*/
|
|
JKQTP_LIB_EXPORT JKQTPlotterStyle& JKQTPGetSystemDefaultStyle();
|
|
|
|
/** \brief replaces the system-wide default JKQTPlotterStyle with the given \a newStyle
|
|
* \ingroup jkqtpplotter_styling
|
|
*
|
|
* \see JKQTPGetSystemDefaultStyle(), JKQTPGetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), \ref jkqtpplotter_styling
|
|
*/
|
|
JKQTP_LIB_EXPORT void JKQTPSetSystemDefaultStyle(JKQTPlotterStyle& newStyle);
|
|
|
|
|
|
#endif // JKQTPLOTTERSTYLE_H
|