JKQtPlotter/doc/dox/jkqtplotter_styling.dox

107 lines
6.3 KiB
Plaintext
Raw Normal View History

2022-09-20 03:53:53 +08:00
/*!
\defgroup jkqtpplotter_styling Styling System
\ingroup jkqtplotter_general
2022-09-20 03:53:53 +08:00
\image html stylesbanner.png
JKQTPlotter (and JKQTBasePlotter) offer a styling system, which allows to easily define and transfer plot styling from one object to another.
The system is based on a hirarchy of structs, which summarize properties, describing how a plot looks in general. The classes contained in this system are:
- JKQTPlotterStyle for JKQTPlotter: Defines e.g. basic user-interactions, the display options of the toolbar
- JKQTBasePlotterStyle for JKQTBasePlotter defines the appearance of the plot itself (colors, axis properties, key properties, default graph colors/styles, ...), contains JKQTPCoordinateAxisStyle instances to configrue the plot's coordinate axes
- JKQTPCoordinateAxisStyle for JKQTPCoordinateAxis defines the appearance of a coordinate axis (colors, axis properties, ...)
- JKQTPKeyStyle for the style of the key/legend in a JKQTBasePlotterStyle
.
In addition there are static methods that allow to manage a system-wide (actually program-instance wide) style that is applied to any new instance of JKQTPlotter and JKQTBasePlotter on construction:
- JKQTPGetSystemDefaultStyle() / JKQTPSetSystemDefaultStyle() allows to access the central instace of JKQTPlotterStyle (mainly properties/style of the GUI-parts and user-action bindings)
- JKQTPGetSystemDefaultBaseStyle() / JKQTPSetSystemDefaultBaseStyle() accesses the central instance of JKQTBasePlotterStyle (styles the actual plot/graphs with colors, axes styles, ...)
.
You can e.g. use these general methods to alter the styles for all JKQTPlotter instances, created in the future:
\code{.cpp}
// load the system-wide default settings from an INI-file:
QSettings plotSettings("JKQTPlotterSettings.ini", QSettings::IniFormat);;
JKQTPGetSystemDefaultStyle().loadSettings(plotSettings);
JKQTPGetSystemDefaultBaseStyle().loadSettings(plotSettings);
// alter a system-wide default setting by hand (here: set color of zooming rect to red)
JKQTPGetSystemDefaultStyle().userActionColor=QColor("red");
\endcode
Several pre-made styles are available in the JKQTPlotter repository (<a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/">https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/</a>).
These are also linked into the JKQTPlotter library as Qt ressource into the subdirectory \c :/JKQTPlotter/styles/ . You can use them as follows:
\code{.cpp}
QSettings plotSettings(":/JKQTPlotter/styles/blackandwhite.ini", QSettings::IniFormat);;
JKQTPGetSystemDefaultStyle().loadSettings(plotSettings);
JKQTPGetSystemDefaultBaseStyle().loadSettings(plotSettings);
\endcode
Here is a table with all available ready-made styles:
<!--include:styles.dox-->
<table>
<tr>
<th>Style-file
<th>Screenshot
<th>Symbols
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/default.ini"><code>:/JKQTPlotter/styles/default.ini</code></a>
<td>\image html default.ini.png
<td>\image html default.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blueprint.ini"><code>:/JKQTPlotter/styles/blueprint.ini</code></a>
<td>\image html blueprint.ini.png
<td>\image html blueprint.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/cyberpunk.ini"><code>:/JKQTPlotter/styles/cyberpunk.ini</code></a>
<td>\image html cyberpunk.ini.png
<td>\image html cyberpunk.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/dark.ini"><code>:/JKQTPlotter/styles/dark.ini</code></a>
<td>\image html dark.ini.png
<td>\image html dark.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blackandwhite.ini"><code>:/JKQTPlotter/styles/blackandwhite.ini</code></a>
<td>\image html blackandwhite.ini.png
<td>\image html blackandwhite.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/legacy_default_style.ini"><code>:/JKQTPlotter/styles/legacy_default_style.ini</code></a>
<td>\image html legacy_default_style.ini.png
<td>\image html legacy_default_style.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/seaborn.ini"><code>:/JKQTPlotter/styles/seaborn.ini</code></a>
<td>\image html seaborn.ini.png
<td>\image html seaborn.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_arrowsaxes.ini"><code>:/JKQTPlotter/styles/simple_arrowsaxes.ini</code></a>
<td>\image html simple_arrowsaxes.ini.png
<td>\image html simple_arrowsaxes.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset.ini"><code>:/JKQTPlotter/styles/simple_axesoffset.ini</code></a>
<td>\image html simple_axesoffset.ini.png
<td>\image html simple_axesoffset.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset_plotbox.ini"><code>:/JKQTPlotter/styles/simple_axesoffset_plotbox.ini</code></a>
<td>\image html simple_axesoffset_plotbox.ini.png
<td>\image html simple_axesoffset_plotbox.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_gridandticks.ini"><code>:/JKQTPlotter/styles/simple_gridandticks.ini</code></a>
<td>\image html simple_gridandticks.ini.png
<td>\image html simple_gridandticks.ini.symbols.png
<tr>
<td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_noaxes.ini"><code>:/JKQTPlotter/styles/simple_noaxes.ini</code></a>
<td>\image html simple_noaxes.ini.png
<td>\image html simple_noaxes.ini.symbols.png
</table>
<!--/include:styles.dox-->
2022-09-20 03:53:53 +08:00
\see Classes are documented in \ref jkqtpplotter_styling_classes .
<br>See \ref JKQTPlotterStyling for a detailed example.
2022-09-20 03:53:53 +08:00
*/