reorganized folder structure in root directory (there are now distinct folders for INCLUDE, STATIC, DYNAMIC libs and examples moved to the folder examples)

This commit is contained in:
Jan W. Krieger 2018-12-28 17:46:47 +01:00
parent 9d43cd67cf
commit 5beed78563
269 changed files with 37951 additions and 37768 deletions

View File

@ -1,6 +1,7 @@
TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib \
jkqtplotterlib_sharedlib \
jkqtmathtext_simpletest \
jkqtplot_test \
jkqtplotter_simpletest \
@ -8,31 +9,33 @@ SUBDIRS += jkqtplotterlib \
jkqtfastplotter_test
jkqtplotterlib.file = lib/jkqtplotterlib.pro
jkqtplotterlib.file = staticlib/jkqtplotterlib.pro
jkqtmathtext_simpletest.subdir = test/jkqtmathtext_simpletest
jkqtplotterlib_sharedlib.file = sharedlib/jkqtplotterlib_sharedlib.pro
jkqtmathtext_simpletest.subdir = examples/jkqtmathtext_simpletest
jkqtmathtext_simpletest.depends = jkqtplotterlib
jkqtmathtext_test.subdir = test/jkqtmathtext_test
jkqtmathtext_test.subdir = examples/jkqtmathtext_test
jkqtmathtext_test.depends = jkqtplotterlib
jkqtplot_test.subdir = test/jkqtplot_test
jkqtplot_test.subdir = examples/jkqtplot_test
jkqtplot_test.depends = jkqtplotterlib
jkqtplotter_simpletest.file = test/simpletest/jkqtplotter_simpletest.pro
jkqtplotter_simpletest.file = examples/simpletest/jkqtplotter_simpletest.pro
jkqtplotter_simpletest.depends = jkqtplotterlib
test_multiplot.file = test/test_multiplot/test_multiplot.pro
test_multiplot.file = examples/test_multiplot/test_multiplot.pro
test_multiplot.depends = jkqtplotterlib
jkqtfastplotter_test.file = $$PWD/test/jkqtfastplotter_test/jkqtfastplotter_test.pro
jkqtfastplotter_test.file = $$PWD/examples/jkqtfastplotter_test/jkqtfastplotter_test.pro
jkqtfastplotter_test.depends = jkqtplotterlib
defineTest(addSimpleTest) {
test_name = $$1
SUBDIRS += jkqtplotter_simpletest_$${test_name}
jkqtplotter_simpletest_$${test_name}.file = test/simpletest_$${test_name}/jkqtplotter_simpletest_$${test_name}.pro
jkqtplotter_simpletest_$${test_name}.file = examples/simpletest_$${test_name}/jkqtplotter_simpletest_$${test_name}.pro
jkqtplotter_simpletest_$${test_name}.depends = jkqtplotterlib
export (jkqtplotter_simpletest_$${test_name}.file)

View File

@ -1,8 +1,8 @@
# JKQtPlotter
This is an extensive library of function/data plotter classes for Qt (>= 4.7, tested with Qt up to 5.11).
This software is licensed under the term of the GNU Lesser General Public License 2.1
(LGPL 2.1) or above.
This software is licensed under the term of the [GNU Lesser General Public License 2.1
(LGPL 2.1)](https://github.com/jkriege2/JKQtPlotter/blob/master/LICENSE) or above.
## Continuous Integration Status
[![Build status](https://ci.appveyor.com/api/projects/status/vq2o9pfi97isxm2a/branch/master?svg=true)](https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master)
@ -11,6 +11,11 @@ This software is licensed under the term of the GNU Lesser General Public Licens
## Screenshots
[Screenshots directory](https://github.com/jkriege2/JKQtPlotter/tree/master/screenshots)
## Building
Building instructions can be found here:
- include necessary files into QMake project: [`./lib/*.pri`](https://github.com/jkriege2/JKQtPlotter/tree/master/lib)
- build a static library: [`./staticlib/*.pro`](https://github.com/jkriege2/JKQtPlotter/tree/master/staticlib)
- build a shared library (DLL): [`./sharedlib/*.pro`](https://github.com/jkriege2/JKQtPlotter/tree/master/sharedlib)
## Examples
This section assembles some simple examples of usage.
@ -21,49 +26,49 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest1_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest) | [Very Basic Example (Line Graph)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest) | `JKQTPxyLineGraph`<br/>C++-style QVector arrays of data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_speed_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_speed) | [Line Graph with Live Data / Speed Test](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_speed) | `JKQTPxyLineGraph`<br/>external `std::array<double,N>` data, not owned by datastore<br/>live-data, measure plotting speed<br/>tipps to increas plotting speed |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_symbols_and_styles_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_symbols_and_styles) | [Line Graph with Different Symbols and Line Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_symbols_and_styles) | `JKQTPxyLineGraph`<br/>C++ vector of data<br/>setting line styles and symbol styles<br/>automatic graph coloring |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_stepplots_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_stepplots) | [Step Line Plots in Different Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_stepplots) | `JKQTPstepHorizontalGraph` (and `JKQTPxyLineGraph`)<br/>C++ vector of data<br/>different step modes, filled and line-only |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_symbols_and_errors_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_symbols_and_errors) | [Simple Line/Symbol Graph With Errorbars](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_symbols_and_errors) | `JKQTPxyLineErrorGraph`<br/>C-style arrays of data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_errorbarstyles_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_errorbarstyles) | [Different Types of Error Indicators](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_errorbarstyles) | `JKQTPxyLineErrorGraph`<br/>different styles of error indicators for x- and y-errors<br>C++-style QVector for data<br/>styling error indicators<br/>moving key and formatting plotter grid |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_barchart_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_barchart) | [Simple Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_barchart) | `JKQTPbarVerticalGraph`<br/>C-style arrays of data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/JKQTPbarVerticalGraphStacked_small.png)<br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/JKQTPbarHorizontalGraphStacked_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_stackedbars) | [Stacked Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_stackedbars) | `JKQTPbarVerticalStackableGraph`, `JKQTPbarHorizontalStackableGraph`<br/>C++-style vectors of data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_filledgraphs_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_filledgraphs) | [Filled Curve Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_filledgraphs) | `JKQTPbarVerticalGraph`<br/>setting/altering data in `JKQTPdatstore` directly<br/> transparent plots<br/>calculating histograms |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_impulsesplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_impulsesplot) | [Impulse Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_impulsesplot) | `JKQTPimpulsesVerticalGraph` and `JKQTPimpulsesHorizontalGraph`<br/>C++-style QVector as plot data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_paramscatterplot) | [Scatter Graph with Parametrized Symbols/Colors](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_paramscatterplot) | `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>modify scatter/points/line-graph properties by data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_paramscatterplot_image) | [Draw an Artistic Image with a Parametrized Scatter Graph](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_paramscatterplot_image) | `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>rectangular arrangement of scatters<br/>generative computer graphics |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parametriccurve_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_parametriccurve) | [Plotting Parametric Curves](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_parametriccurve) | `JKQTPxyLineGraph` and `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>parametric curve plotting |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_functionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_functionplot) | [Plotting Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_functionplot) | `JKQTPxFunctionLineGraph` <br/>diretly plotting C/C++-functions |
[![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_parsedfunctionplot) | [Plotting Parsed Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_parsedfunctionplot) | `JKQTPxParsedFunctionLineGraph` <br/>plotting functions with the internal math equation parser/evaluator |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest1_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest) | [Very Basic Example (Line Graph)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest) | `JKQTPxyLineGraph`<br/>C++-style QVector arrays of data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_speed_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_speed) | [Line Graph with Live Data / Speed Test](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_speed) | `JKQTPxyLineGraph`<br/>external `std::array<double,N>` data, not owned by datastore<br/>live-data, measure plotting speed<br/>tipps to increas plotting speed |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_symbols_and_styles_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_styles) | [Line Graph with Different Symbols and Line Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_styles) | `JKQTPxyLineGraph`<br/>C++ vector of data<br/>setting line styles and symbol styles<br/>automatic graph coloring |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_stepplots_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stepplots) | [Step Line Plots in Different Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stepplots) | `JKQTPstepHorizontalGraph` (and `JKQTPxyLineGraph`)<br/>C++ vector of data<br/>different step modes, filled and line-only |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_symbols_and_errors_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_errors) | [Simple Line/Symbol Graph With Errorbars](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_errors) | `JKQTPxyLineErrorGraph`<br/>C-style arrays of data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_errorbarstyles_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_errorbarstyles) | [Different Types of Error Indicators](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_errorbarstyles) | `JKQTPxyLineErrorGraph`<br/>different styles of error indicators for x- and y-errors<br>C++-style QVector for data<br/>styling error indicators<br/>moving key and formatting plotter grid |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_barchart_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_barchart) | [Simple Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_barchart) | `JKQTPbarVerticalGraph`<br/>C-style arrays of data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/JKQTPbarVerticalGraphStacked_small.png)<br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/JKQTPbarHorizontalGraphStacked_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stackedbars) | [Stacked Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stackedbars) | `JKQTPbarVerticalStackableGraph`, `JKQTPbarHorizontalStackableGraph`<br/>C++-style vectors of data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_filledgraphs_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_filledgraphs) | [Filled Curve Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_filledgraphs) | `JKQTPbarVerticalGraph`<br/>setting/altering data in `JKQTPdatstore` directly<br/> transparent plots<br/>calculating histograms |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_impulsesplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_impulsesplot) | [Impulse Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_impulsesplot) | `JKQTPimpulsesVerticalGraph` and `JKQTPimpulsesHorizontalGraph`<br/>C++-style QVector as plot data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_paramscatterplot) | [Scatter Graph with Parametrized Symbols/Colors](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_paramscatterplot) | `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>modify scatter/points/line-graph properties by data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_paramscatterplot_image) | [Draw an Artistic Image with a Parametrized Scatter Graph](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_paramscatterplot_image) | `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>rectangular arrangement of scatters<br/>generative computer graphics |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parametriccurve_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parametriccurve) | [Plotting Parametric Curves](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parametriccurve) | `JKQTPxyLineGraph` and `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>parametric curve plotting |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_functionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) | [Plotting Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) | `JKQTPxFunctionLineGraph` <br/>diretly plotting C/C++-functions |
[![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parsedfunctionplot) | [Plotting Parsed Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parsedfunctionplot) | `JKQTPxParsedFunctionLineGraph` <br/>plotting functions with the internal math equation parser/evaluator |
### Styling the Plot, Keys, Axes, ...
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_logaxes_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_logaxes) | [logarithmic axes](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_logaxes) | `JKQTPxyLineGraph` and `JKQTPgeoText`<br/>C++ vector of data<br/>logarithmic axes and styling<br/>plot line styles<br/>internal LaTeX parser<br/>add commenting text to a graph |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_dateaxes_small.png)<br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_dateaxes_dates_small.png)<br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_dateaxes_timeaxis_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_dateaxes) | [date/time axes](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_dateaxes) | `JKQTPxyLineGraph` and `JKQTPfilledVerticalRangeGraph`<br/>C++ vector of data<br/>date/time axes<br/>plot min/max range graph<br/>internal LaTeX parser<br/>data from CSV files |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_logaxes_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_logaxes) | [logarithmic axes](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_logaxes) | `JKQTPxyLineGraph` and `JKQTPgeoText`<br/>C++ vector of data<br/>logarithmic axes and styling<br/>plot line styles<br/>internal LaTeX parser<br/>add commenting text to a graph |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_dateaxes_small.png)<br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_dateaxes_dates_small.png)<br>![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_dateaxes_timeaxis_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_dateaxes) | [date/time axes](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_dateaxes) | `JKQTPxyLineGraph` and `JKQTPfilledVerticalRangeGraph`<br/>C++ vector of data<br/>date/time axes<br/>plot min/max range graph<br/>internal LaTeX parser<br/>data from CSV files |
### Image data Plots
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_qt_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_rgbimageplot_qt) | [`QImage` as a Graph](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_rgbimageplot_qt) | `JKQTPImage`<br/>`QImage` drawn onto a plot with arbitrary scaling) |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_imageplot) | [Basic 1-channel Raw C Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_imageplot) | `JKQTPColumnMathImage`<br/>image data copied from C-style row-major array into a single column of the internal datastore<br>Describes several options of the image plotting classes (different ways of color coding, what to do with data above/below the limits etc.) |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_modifier_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_imageplot_modifier) | [Modifier-Feature of Image Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_imageplot_modifier) | `JKQTPColumnMathImage`<br/>image data copied from C-style row-major array into a single column of the internal datastore<br>Image is modified by a second image to display two data dimensions at the same time |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_nodatastore_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_imageplot_nodatastore) | [Basic 1-channel Raw C Image Plot<br>without the internal datastore](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_imageplot_nodatastore) | `JKQTPMathImage`<br/>image data in a C-style row-major array, not using internal datastore |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_imageplot_opencv) | [1-channel OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_imageplot_opencv) | `JKQTPColumnMathImage`<br/>image data copied from OpenCV cv::Mat-structure into a single column of the internal datastore |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_rgbimageplot_opencv) | [RGB OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_rgbimageplot_opencv) | `JKQTPColumnRGBMathImage`<br/>image data copied from OpenCV cv::Mat-structure into three columns of the internal datastore |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_qt_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_rgbimageplot_qt) | [`QImage` as a Graph](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_rgbimageplot_qt) | `JKQTPImage`<br/>`QImage` drawn onto a plot with arbitrary scaling) |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot) | [Basic 1-channel Raw C Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot) | `JKQTPColumnMathImage`<br/>image data copied from C-style row-major array into a single column of the internal datastore<br>Describes several options of the image plotting classes (different ways of color coding, what to do with data above/below the limits etc.) |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_modifier_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_modifier) | [Modifier-Feature of Image Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_modifier) | `JKQTPColumnMathImage`<br/>image data copied from C-style row-major array into a single column of the internal datastore<br>Image is modified by a second image to display two data dimensions at the same time |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_nodatastore_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_nodatastore) | [Basic 1-channel Raw C Image Plot<br>without the internal datastore](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_nodatastore) | `JKQTPMathImage`<br/>image data in a C-style row-major array, not using internal datastore |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_imageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_opencv) | [1-channel OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_imageplot_opencv) | `JKQTPColumnMathImage`<br/>image data copied from OpenCV cv::Mat-structure into a single column of the internal datastore |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_rgbimageplot_opencv_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_rgbimageplot_opencv) | [RGB OpenCV cv::Mat Image Plot](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_rgbimageplot_opencv) | `JKQTPColumnRGBMathImage`<br/>image data copied from OpenCV cv::Mat-structure into three columns of the internal datastore |
### GUI Tools and Plot Layout
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_multiplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/test_multiplot) | [Layouting Several Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/test/test_multiplot) | Combining plots in Qt Layouts<br/>linking plot axes<br>copy data from a `std::map` int the datastore<br>print plots/print preview |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_multiplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_multiplot) | [Layouting Several Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_multiplot) | Combining plots in Qt Layouts<br/>linking plot axes<br>copy data from a `std::map` int the datastore<br>print plots/print preview |
### Tools and Special Features
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtmathtext_simpletest_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtmathtext_simpletest) | [JKQTMathText: LaTeX Renderer](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtmathtext_simpletest) | |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtmathtext_simpletest_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/jkqtmathtext_simpletest) | [JKQTMathText: LaTeX Renderer](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/jkqtmathtext_simpletest) | |

View File

@ -31,7 +31,7 @@ build:
configuration:
- release
# - debug
- debug
install:
- IF %VSVER% GTR 14 (

View File

@ -1,9 +1,9 @@
#include <QApplication>
#include "testmain.h"
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
TestMain w;
w.show();
return a.exec();
}
#include <QApplication>
#include "testmain.h"
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
TestMain w;
w.show();
return a.exec();
}

View File

@ -1,35 +1,39 @@
# -------------------------------------------------
# Project created by QtCreator 2010-06-13T12:40:50
# -------------------------------------------------
TARGET = JKQTFastPlotter_test
TEMPLATE = app
SOURCES += jkqtfastplotter_test.cpp \
testmain.cpp
HEADERS += testmain.h
RCC_DIR = .rccs
CONFIG += qt windows
QT += core gui opengl
UI_DIR = .uics
OBJECTS_DIR = .objs
MOC_DIR = .mocs
DESTDIR = ./
DEFINES += DEBUG_TIMING
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# include JKQtPlotter library
DEPENDPATH += . ../../lib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib
CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib
# -------------------------------------------------
# Project created by QtCreator 2010-06-13T12:40:50
# -------------------------------------------------
TARGET = JKQTFastPlotter_test
TEMPLATE = app
SOURCES += jkqtfastplotter_test.cpp \
testmain.cpp
HEADERS += testmain.h
RCC_DIR = .rccs
CONFIG += qt windows
QT += core gui opengl
UI_DIR = .uics
OBJECTS_DIR = .objs
MOC_DIR = .mocs
DESTDIR = ./
DEFINES += DEBUG_TIMING
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# include JKQtPlotter library
DEPENDPATH += . ../../lib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
} else {
LIBS += -L../../staticlib/release -ljkqtplotterlib
}
message("LIBS = $$LIBS")

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 457 KiB

After

Width:  |  Height:  |  Size: 457 KiB

View File

@ -1,186 +1,186 @@
#include "testmain.h"
#include <QCheckBox>
#include <QtGui>
TestMain::TestMain(QWidget *parent) :
QWidget(parent)
{
imageRed=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
imageGreen=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
imageBlue=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
image=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
ovrl=(bool*)calloc(IMAGE_N*IMAGE_N, sizeof(bool));
x=(double*)calloc(N1, sizeof(double));
y1=(double*)calloc(N1, sizeof(double));
y2=(double*)calloc(N1, sizeof(double));
y3=(double*)calloc(N1, sizeof(double));
QGridLayout* gl=new QGridLayout(this);
setLayout(gl);
QTabWidget* t=new QTabWidget(this);
gl->addWidget(t,0,0);
QWidget* w=new QWidget(this);
gl=new QGridLayout(w);
w->setLayout(gl);
JKQTFastPlotter* pl1=new JKQTFastPlotter(w);
pl1->set_maintainAspectRatio(true);
gl->addWidget(pl1, 0, 0);
JKQTFastPlotter* pl2=new JKQTFastPlotter(w);
pl2->setMaximumWidth(100);
pl2->set_synchronizeY(pl1);
pl2->set_yAxisLabelVisible(false);
pl2->set_plotBorderLeft(10);
pl2->set_plotBorderRight(2);
w->connect(pl1, SIGNAL(replotting()), pl2, SLOT(update_plot()));
gl->addWidget(pl2, 0, 1);
JKQTFastPlotter* pl3=new JKQTFastPlotter(w);
pl3->set_synchronizeX(pl1);
w->connect(pl1, SIGNAL(replotting()), pl3, SLOT(update_plot()));
gl->addWidget(pl3, 1, 0);
xx.clear();
yy.clear();
for (int i=0; i<N1; i++) {
x[i]=(i+1)*XMAX/(double)N1;
xx.push_back(x[i]);
yy.push_back(sin(0.5*M_PI*x[i])+2.0);
std::cout<<xx[i]<<", "<<yy[i]<<std::endl;
y1[i]=i*XMAX/(double)N1;
y2[i]=log(x[i]);
y3[i]=log10(x[i]);
}
JKQTFPVBarPlot* p1=new JKQTFPVBarPlot(pl1, N1, x, y1);
JKQTFPLinePlot* p2=new JKQTFPLinePlot(pl1, N1, x, y2, QColor("blue"));
JKQTFPLinePlot* p3=new JKQTFPLinePlot(pl1, N1, x, y3, QColor("darkgreen"));
JKQTFPLinePlot* pv=new JKQTFPLinePlot(pl1, &xx, &yy, QColor("black"), Qt::SolidLine, 3);
img=QImage("lena.png");
JKQTFPQImagePlot* p4=new JKQTFPQImagePlot(pl2, &img, 0, 10, 0, 10);
for (int x=0; x<IMAGE_N; x++) {
for (int y=0; y<IMAGE_N; y++) {
image[y*IMAGE_N+x]=IMAGE_N*(1.1+sin(sqrt((x-50)*(x-50)+(y-50)*(y-50))));
if (x>50 && y>50) image[y*IMAGE_N+x]=0;
if (x<50 && y<50) image[y*IMAGE_N+x]=50;
if (abs(x-(IMAGE_N-y))<4) ovrl[y*IMAGE_N+x]=true; else ovrl[y*IMAGE_N+x]=false;
}
}
JKQTFPimagePlot* p5=new JKQTFPimagePlot(pl3, image, JKQTFP_double, IMAGE_N, IMAGE_N, 0, 10, 0, 10, JKQTFP_GRAY);
QColor col=QColor("red");
col.setAlpha(127);
JKQTFPimageOverlayPlot* p5o=new JKQTFPimageOverlayPlot(pl3, ovrl, IMAGE_N, IMAGE_N, 0, 10, 0, 10, col);
JKQTFPXRangePlot* p6=new JKQTFPXRangePlot(pl1, 2.25, 7.75);
p6->set_fillStyle(Qt::SolidPattern);
JKQTFPQScaleBarXPlot* sb=new JKQTFPQScaleBarXPlot(pl1, 1, QString("%1 mm"));
pl1->addPlot(p6);
pl1->addPlot(p1);
pl1->addPlot(p2);
pl1->addPlot(p3);
pl1->addPlot(pv);
pl1->addPlot(sb);
pl2->addPlot(p4);
pl3->addPlot(p5);
pl3->addPlot(p5o);
pl3->setObjectName("pl3");
QComboBox* spin=new QComboBox(w);
spin->addItems(JKQTFPimagePlot_getPalettes());
gl->addWidget(spin, 2,0);
connect(spin, SIGNAL(currentIndexChanged(int)), p5, SLOT(set_palette(int)));
QComboBox* scale=new QComboBox(w);
scale->addItem("TopLeft");
scale->addItem("TopRight");
scale->addItem("BottomLeft");
scale->addItem("BottomRight");
gl->addWidget(scale, 3,0);
connect(scale, SIGNAL(currentIndexChanged(int)), sb, SLOT(set_position(int)));
t->addTab(w, tr("Basic Test"));
w=new QWidget(this);
gl=new QGridLayout(w);
w->setLayout(gl);
JKQTFastPlotter* p21=new JKQTFastPlotter(w);
gl->addWidget(p21, 0, 0, 1, 3);
for (int x=0; x<IMAGE_N; x++) {
for (int y=0; y<IMAGE_N; y++) {
imageRed[y*IMAGE_N+x]=(fabs(x)+fabs(y))/2.0;
imageGreen[y*IMAGE_N+x]=(fabs(double(IMAGE_N)-x)+fabs(y))/2.0;
imageBlue[y*IMAGE_N+x]=sqrt(x*x+y*y);
}
}
prgb=new JKQTFPRGBImageOverlayPlot(p21);
prgb->set_image(imageRed, JKQTFP_double, imageGreen, JKQTFP_double, imageBlue, JKQTFP_double, IMAGE_N, IMAGE_N,0,10,0,10);
p21->addPlot(prgb);
QCheckBox* c=new QCheckBox(tr("red channel"), w);
c->setChecked(true);
connect(c, SIGNAL(toggled(bool)), this, SLOT(enableRed(bool)));
gl->addWidget(c, 1,0);
c=new QCheckBox(tr("green channel"), w);
c->setChecked(true);
connect(c, SIGNAL(toggled(bool)), this, SLOT(enableGreen(bool)));
gl->addWidget(c, 1,1);
c=new QCheckBox(tr("blue channel"), w);
c->setChecked(true);
connect(c, SIGNAL(toggled(bool)), this, SLOT(enableBlue(bool)));
gl->addWidget(c, 1,2);
t->addTab(w, tr("Overlay Test"));
t->setCurrentIndex(1);
resize(500,400);
}
TestMain::~TestMain() {
free(imageRed);
free(imageGreen);
free(imageBlue);
free(image);
free(ovrl);
free(x);
free(y1);
free(y2);
free(y3);
}
void TestMain::enableRed(bool enabled) {
if (enabled) {
prgb->set_imageRed(imageRed, JKQTFP_double);
} else {
prgb->set_imageRed(NULL, JKQTFP_double);
}
}
void TestMain::enableGreen(bool enabled) {
if (enabled) {
prgb->set_imageGreen(imageGreen, JKQTFP_double);
} else {
prgb->set_imageGreen(NULL, JKQTFP_double);
}
}
void TestMain::enableBlue(bool enabled) {
if (enabled) {
prgb->set_imageBlue(imageBlue, JKQTFP_double);
} else {
prgb->set_imageBlue(NULL, JKQTFP_double);
}
}
#include "testmain.h"
#include <QCheckBox>
#include <QtGui>
TestMain::TestMain(QWidget *parent) :
QWidget(parent)
{
imageRed=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
imageGreen=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
imageBlue=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
image=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
ovrl=(bool*)calloc(IMAGE_N*IMAGE_N, sizeof(bool));
x=(double*)calloc(N1, sizeof(double));
y1=(double*)calloc(N1, sizeof(double));
y2=(double*)calloc(N1, sizeof(double));
y3=(double*)calloc(N1, sizeof(double));
QGridLayout* gl=new QGridLayout(this);
setLayout(gl);
QTabWidget* t=new QTabWidget(this);
gl->addWidget(t,0,0);
QWidget* w=new QWidget(this);
gl=new QGridLayout(w);
w->setLayout(gl);
JKQTFastPlotter* pl1=new JKQTFastPlotter(w);
pl1->set_maintainAspectRatio(true);
gl->addWidget(pl1, 0, 0);
JKQTFastPlotter* pl2=new JKQTFastPlotter(w);
pl2->setMaximumWidth(100);
pl2->set_synchronizeY(pl1);
pl2->set_yAxisLabelVisible(false);
pl2->set_plotBorderLeft(10);
pl2->set_plotBorderRight(2);
w->connect(pl1, SIGNAL(replotting()), pl2, SLOT(update_plot()));
gl->addWidget(pl2, 0, 1);
JKQTFastPlotter* pl3=new JKQTFastPlotter(w);
pl3->set_synchronizeX(pl1);
w->connect(pl1, SIGNAL(replotting()), pl3, SLOT(update_plot()));
gl->addWidget(pl3, 1, 0);
xx.clear();
yy.clear();
for (int i=0; i<N1; i++) {
x[i]=(i+1)*XMAX/(double)N1;
xx.push_back(x[i]);
yy.push_back(sin(0.5*M_PI*x[i])+2.0);
std::cout<<xx[i]<<", "<<yy[i]<<std::endl;
y1[i]=i*XMAX/(double)N1;
y2[i]=log(x[i]);
y3[i]=log10(x[i]);
}
JKQTFPVBarPlot* p1=new JKQTFPVBarPlot(pl1, N1, x, y1);
JKQTFPLinePlot* p2=new JKQTFPLinePlot(pl1, N1, x, y2, QColor("blue"));
JKQTFPLinePlot* p3=new JKQTFPLinePlot(pl1, N1, x, y3, QColor("darkgreen"));
JKQTFPLinePlot* pv=new JKQTFPLinePlot(pl1, &xx, &yy, QColor("black"), Qt::SolidLine, 3);
img=QImage("lena.png");
JKQTFPQImagePlot* p4=new JKQTFPQImagePlot(pl2, &img, 0, 10, 0, 10);
for (int x=0; x<IMAGE_N; x++) {
for (int y=0; y<IMAGE_N; y++) {
image[y*IMAGE_N+x]=IMAGE_N*(1.1+sin(sqrt((x-50)*(x-50)+(y-50)*(y-50))));
if (x>50 && y>50) image[y*IMAGE_N+x]=0;
if (x<50 && y<50) image[y*IMAGE_N+x]=50;
if (abs(x-(IMAGE_N-y))<4) ovrl[y*IMAGE_N+x]=true; else ovrl[y*IMAGE_N+x]=false;
}
}
JKQTFPimagePlot* p5=new JKQTFPimagePlot(pl3, image, JKQTFP_double, IMAGE_N, IMAGE_N, 0, 10, 0, 10, JKQTFP_GRAY);
QColor col=QColor("red");
col.setAlpha(127);
JKQTFPimageOverlayPlot* p5o=new JKQTFPimageOverlayPlot(pl3, ovrl, IMAGE_N, IMAGE_N, 0, 10, 0, 10, col);
JKQTFPXRangePlot* p6=new JKQTFPXRangePlot(pl1, 2.25, 7.75);
p6->set_fillStyle(Qt::SolidPattern);
JKQTFPQScaleBarXPlot* sb=new JKQTFPQScaleBarXPlot(pl1, 1, QString("%1 mm"));
pl1->addPlot(p6);
pl1->addPlot(p1);
pl1->addPlot(p2);
pl1->addPlot(p3);
pl1->addPlot(pv);
pl1->addPlot(sb);
pl2->addPlot(p4);
pl3->addPlot(p5);
pl3->addPlot(p5o);
pl3->setObjectName("pl3");
QComboBox* spin=new QComboBox(w);
spin->addItems(JKQTFPimagePlot_getPalettes());
gl->addWidget(spin, 2,0);
connect(spin, SIGNAL(currentIndexChanged(int)), p5, SLOT(set_palette(int)));
QComboBox* scale=new QComboBox(w);
scale->addItem("TopLeft");
scale->addItem("TopRight");
scale->addItem("BottomLeft");
scale->addItem("BottomRight");
gl->addWidget(scale, 3,0);
connect(scale, SIGNAL(currentIndexChanged(int)), sb, SLOT(set_position(int)));
t->addTab(w, tr("Basic Test"));
w=new QWidget(this);
gl=new QGridLayout(w);
w->setLayout(gl);
JKQTFastPlotter* p21=new JKQTFastPlotter(w);
gl->addWidget(p21, 0, 0, 1, 3);
for (int x=0; x<IMAGE_N; x++) {
for (int y=0; y<IMAGE_N; y++) {
imageRed[y*IMAGE_N+x]=(fabs(x)+fabs(y))/2.0;
imageGreen[y*IMAGE_N+x]=(fabs(double(IMAGE_N)-x)+fabs(y))/2.0;
imageBlue[y*IMAGE_N+x]=sqrt(x*x+y*y);
}
}
prgb=new JKQTFPRGBImageOverlayPlot(p21);
prgb->set_image(imageRed, JKQTFP_double, imageGreen, JKQTFP_double, imageBlue, JKQTFP_double, IMAGE_N, IMAGE_N,0,10,0,10);
p21->addPlot(prgb);
QCheckBox* c=new QCheckBox(tr("red channel"), w);
c->setChecked(true);
connect(c, SIGNAL(toggled(bool)), this, SLOT(enableRed(bool)));
gl->addWidget(c, 1,0);
c=new QCheckBox(tr("green channel"), w);
c->setChecked(true);
connect(c, SIGNAL(toggled(bool)), this, SLOT(enableGreen(bool)));
gl->addWidget(c, 1,1);
c=new QCheckBox(tr("blue channel"), w);
c->setChecked(true);
connect(c, SIGNAL(toggled(bool)), this, SLOT(enableBlue(bool)));
gl->addWidget(c, 1,2);
t->addTab(w, tr("Overlay Test"));
t->setCurrentIndex(1);
resize(500,400);
}
TestMain::~TestMain() {
free(imageRed);
free(imageGreen);
free(imageBlue);
free(image);
free(ovrl);
free(x);
free(y1);
free(y2);
free(y3);
}
void TestMain::enableRed(bool enabled) {
if (enabled) {
prgb->set_imageRed(imageRed, JKQTFP_double);
} else {
prgb->set_imageRed(NULL, JKQTFP_double);
}
}
void TestMain::enableGreen(bool enabled) {
if (enabled) {
prgb->set_imageGreen(imageGreen, JKQTFP_double);
} else {
prgb->set_imageGreen(NULL, JKQTFP_double);
}
}
void TestMain::enableBlue(bool enabled) {
if (enabled) {
prgb->set_imageBlue(imageBlue, JKQTFP_double);
} else {
prgb->set_imageBlue(NULL, JKQTFP_double);
}
}

View File

@ -1,44 +1,44 @@
#ifndef TESTMAIN_H
#define TESTMAIN_H
#include <QTabWidget>
#include <QGridLayout>
#include "jkqtfastplotter/jkqtfastplotter.h"
#include <QComboBox>
#define N1 20
#define XMAX 10.0
#define IMAGE_N 300
class TestMain : public QWidget {
Q_OBJECT
public:
explicit TestMain(QWidget *parent = 0);
virtual ~TestMain();
signals:
public slots:
void enableRed(bool enabled);
void enableGreen(bool enabled);
void enableBlue(bool enabled);
protected:
double* x;
double* y1;
double* y2;
double* y3;
QVector<double> xx;
QVector<double> yy;
QImage img;
double* image;
bool* ovrl;
double* imageRed;
double* imageGreen;
double* imageBlue;
JKQTFPRGBImageOverlayPlot* prgb;
};
#endif // TESTMAIN_H
#ifndef TESTMAIN_H
#define TESTMAIN_H
#include <QTabWidget>
#include <QGridLayout>
#include "jkqtfastplotter/jkqtfastplotter.h"
#include <QComboBox>
#define N1 20
#define XMAX 10.0
#define IMAGE_N 300
class TestMain : public QWidget {
Q_OBJECT
public:
explicit TestMain(QWidget *parent = 0);
virtual ~TestMain();
signals:
public slots:
void enableRed(bool enabled);
void enableGreen(bool enabled);
void enableBlue(bool enabled);
protected:
double* x;
double* y1;
double* y2;
double* y3;
QVector<double> xx;
QVector<double> yy;
QImage img;
double* image;
bool* ovrl;
double* imageRed;
double* imageGreen;
double* imageBlue;
JKQTFPRGBImageOverlayPlot* prgb;
};
#endif // TESTMAIN_H

View File

@ -1,72 +1,72 @@
[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)
# JKQtPlotter
## JKQTmathText
JKQTmathText is a hand-written LaTeX-renderer for Qt (implemented in native C++, using Qt). It supports a large set of standard LaTeX markup and can render it to a QPainter.
## A simple usage example
This project (see `./test/jkqtmathtext_simpletest/`) simply creates a QLabel (as a new window) that displays a rendered LaTeX equation (here the time-dependent Schrödinger equation).
The QMake project looks like this (see [`jkqtmathtext_simpletest.pro`](https://github.com/jkriege2/JKQtPlotter/blob/master/test/jkqtmathtext_simpletest/jkqtmathtext_simpletest.pro):
```qmake
# include JKQTmathText source-code, including the open-source XITS fonts
include(../../lib/jkqtmathtext_with_xits.pri)
SOURCES += jkqtmathtext_simpletest.cpp
# if you don't want to use the XITS fonts, use this line (and uncomment the
# last two line!):
#include(../../lib/jkqtmathtext.pri)
CONFIG += qt
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtmathtext_simpletest
```
And the soruce code of the main application is (see [`jkqtmathtext_simpletest.cpp`](https://github.com/jkriege2/JKQtPlotter/blob/master/test/jkqtmathtext_simpletest/jkqtmathtext_simpletest.cpp):
```c++
#include <QApplication>
#include <QLabel>
#include <QPixmap>
#include "jkqtmathtext/jkqtmathtext.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// we use a simple label to display the math text
QLabel lab;
// 1. we will paint into a QPixmap
QPixmap pix(600,400);
pix.fill(QColor("white"));
QPainter painter;
// 2. now we create a JKQTmathText object.
// Also we configure the JKQTmathText to use the XITS fonts that
// were included in the *.pro-file
JKQTmathText mathText;
mathText.useXITS();
mathText.set_fontSize(20);
// 3. now we parse some LaTeX code (the Schroedinger's equation), so
// we can draw it onto the QPixmap in the next step
mathText.parse("$\\left[-\\frac{\\hbar^2}{2m}\\frac{\\partial^2}{\\partial x^2}+V(x)\\right]\\Psi(x)=\\mathrm{i}\\hbar\\frac{\\partial}{\\partial t}\\Psi(x)$");
// 3. here we do the painting
painter.begin(&pix);
mathText.draw(painter, Qt::AlignCenter, QRectF(0,0,pix.width(), pix.height()), false);
painter.end();
// now we display and resize the label as a window
lab.setPixmap(pix);
lab.show();
lab.resize(600,400);
return app.exec();
}
```
The result looks like this:
![jkqtmathtext_simpletest](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtmathtext_simpletest.png)
[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)
# JKQtPlotter
## JKQTmathText
JKQTmathText is a hand-written LaTeX-renderer for Qt (implemented in native C++, using Qt). It supports a large set of standard LaTeX markup and can render it to a QPainter.
## A simple usage example
This project (see `./examples/jkqtmathtext_simpletest/`) simply creates a QLabel (as a new window) that displays a rendered LaTeX equation (here the time-dependent Schrödinger equation).
The QMake project looks like this (see [`jkqtmathtext_simpletest.pro`](https://github.com/jkriege2/JKQtPlotter/blob/master/examples/jkqtmathtext_simpletest/jkqtmathtext_simpletest.pro):
```qmake
# include JKQTmathText source-code, including the open-source XITS fonts
include(../../lib/jkqtmathtext_with_xits.pri)
SOURCES += jkqtmathtext_simpletest.cpp
# if you don't want to use the XITS fonts, use this line (and uncomment the
# last two line!):
#include(../../lib/jkqtmathtext.pri)
CONFIG += qt
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtmathtext_simpletest
```
And the soruce code of the main application is (see [`jkqtmathtext_simpletest.cpp`](https://github.com/jkriege2/JKQtPlotter/blob/master/examples/jkqtmathtext_simpletest/jkqtmathtext_simpletest.cpp):
```c++
#include <QApplication>
#include <QLabel>
#include <QPixmap>
#include "jkqtmathtext/jkqtmathtext.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// we use a simple label to display the math text
QLabel lab;
// 1. we will paint into a QPixmap
QPixmap pix(600,400);
pix.fill(QColor("white"));
QPainter painter;
// 2. now we create a JKQTmathText object.
// Also we configure the JKQTmathText to use the XITS fonts that
// were included in the *.pro-file
JKQTmathText mathText;
mathText.useXITS();
mathText.set_fontSize(20);
// 3. now we parse some LaTeX code (the Schroedinger's equation), so
// we can draw it onto the QPixmap in the next step
mathText.parse("$\\left[-\\frac{\\hbar^2}{2m}\\frac{\\partial^2}{\\partial x^2}+V(x)\\right]\\Psi(x)=\\mathrm{i}\\hbar\\frac{\\partial}{\\partial t}\\Psi(x)$");
// 3. here we do the painting
painter.begin(&pix);
mathText.draw(painter, Qt::AlignCenter, QRectF(0,0,pix.width(), pix.height()), false);
painter.end();
// now we display and resize the label as a window
lab.setPixmap(pix);
lab.show();
lab.resize(600,400);
return app.exec();
}
```
The result looks like this:
![jkqtmathtext_simpletest](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtmathtext_simpletest.png)
[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)

View File

@ -1,40 +1,40 @@
#include <QApplication>
#include <QLabel>
#include <QPixmap>
#include "jkqtmathtext/jkqtmathtext.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// we use a simple label to display the math text
QLabel lab;
// 1. we will paint into a QPixmap
QPixmap pix(600,400);
pix.fill(QColor("white"));
QPainter painter;
// 2. now we create a JKQTmathText object.
// Also we configure the JKQTmathText to use the XITS fonts that
// were included in the *.pro-file
JKQTmathText mathText;
mathText.useXITS();
mathText.set_fontSize(20);
// 3. now we parse some LaTeX code (the Schroedinger's equation), so
// we can draw it onto the QPixmap in the next step
mathText.parse("$\\left[-\\frac{\\hbar^2}{2m}\\frac{\\partial^2}{\\partial x^2}+V(x)\\right]\\Psi(x)=\\mathrm{i}\\hbar\\frac{\\partial}{\\partial t}\\Psi(x)$");
// 3. here we do the painting
painter.begin(&pix);
mathText.draw(painter, Qt::AlignCenter, QRectF(0,0,pix.width(), pix.height()), false);
painter.end();
// now we display and resize the label as a window
lab.setPixmap(pix);
lab.show();
lab.resize(600,400);
return app.exec();
}
#include <QApplication>
#include <QLabel>
#include <QPixmap>
#include "jkqtmathtext/jkqtmathtext.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// we use a simple label to display the math text
QLabel lab;
// 1. we will paint into a QPixmap
QPixmap pix(600,400);
pix.fill(QColor("white"));
QPainter painter;
// 2. now we create a JKQTmathText object.
// Also we configure the JKQTmathText to use the XITS fonts that
// were included in the *.pro-file
JKQTmathText mathText;
mathText.useXITS();
mathText.set_fontSize(20);
// 3. now we parse some LaTeX code (the Schroedinger's equation), so
// we can draw it onto the QPixmap in the next step
mathText.parse("$\\left[-\\frac{\\hbar^2}{2m}\\frac{\\partial^2}{\\partial x^2}+V(x)\\right]\\Psi(x)=\\mathrm{i}\\hbar\\frac{\\partial}{\\partial t}\\Psi(x)$");
// 3. here we do the painting
painter.begin(&pix);
mathText.draw(painter, Qt::AlignCenter, QRectF(0,0,pix.width(), pix.height()), false);
painter.end();
// now we display and resize the label as a window
lab.setPixmap(pix);
lab.show();
lab.resize(600,400);
return app.exec();
}

View File

@ -1,14 +1,18 @@
TARGET = jkqtmathtext_simpletest
TEMPLATE = app
SOURCES += jkqtmathtext_simpletest.cpp
CONFIG += qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
DEPENDPATH += . ../../lib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib
CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib
TARGET = jkqtmathtext_simpletest
TEMPLATE = app
SOURCES += jkqtmathtext_simpletest.cpp
CONFIG += qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
DEPENDPATH += . ../../lib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
} else {
LIBS += -L../../staticlib/release -ljkqtplotterlib
}
message("LIBS = $$LIBS")

View File

@ -1,8 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtmathtext_simpletest
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro
jkqtmathtext_simpletest.file=$$PWD/jkqtmathtext_simpletest.pro
jkqtmathtext_simpletest.depends = jkqtplotterlib
TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtmathtext_simpletest
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro
jkqtmathtext_simpletest.file=$$PWD/jkqtmathtext_simpletest.pro
jkqtmathtext_simpletest.depends = jkqtplotterlib

View File

@ -1 +1 @@
RESOURCES += asana.qrc
RESOURCES += asana.qrc

View File

@ -1,275 +1,275 @@
#include <QApplication>
#include <QLabel>
#include <QPainter>
#include <QPixmap>
#include <QScrollArea>
#include <QDebug>
#include <QHBoxLayout>
#include <QTextBrowser>
#include "jkqtmathtext/jkqtmathtext.h"
#include "jkqtplottertools/jkqtphighrestimer.h"
#include "testform.h"
#define W 2000
#define H 3000
#define X1 15
#define Y1 50
/*
HighResTimer ht;
double draw(QPainter& painter, double X, double YY, JKQTmathText& mt, QString name) {
double Y=YY;
painter.save();
ht.start();
QSizeF s=mt.getSize(painter);
Y=Y+mt.getAscent(painter);
std::cout<<" sizing in "<<ht.get_time()/1000.0<<" ms\n";
QPen p=painter.pen();
p.setColor("lightcoral");
p.setStyle(Qt::DashLine);
p.setWidth(2);
painter.setPen(p);
QRectF r(X, Y-mt.getAscent(painter),s.width(), s.height());
painter.drawRect(r);
p.setColor("lightblue");
painter.setPen(p);
painter.drawLine(X, Y, X+s.width(), Y);
ht.start();
p.setStyle(Qt::SolidLine);
p.setWidth(1);
p.setColor("black");
painter.setPen(p);
mt.draw(painter, X, Y);
std::cout<<" drawing in "<<ht.get_time()/1000.0<<" ms\n";
p.setColor("blue");
painter.setPen(p);
QFont f;
f.setFamily("sans serif");
f.setUnderline(true);
f.setPointSize(10);
painter.setFont(f);
painter.drawText(X, Y-mt.getAscent(painter)-6, name+":");
painter.restore();
std::cout<<name.toStdString()<<": width="<<s.width()<<" height="<<s.height()<<" ascent="<<mt.getAscent(painter)<<" descent="<<mt.getDescent(painter)<<std::endl;
return mt.getDescent(painter)+mt.getAscent(painter)+40;
}
void timingTest(QPainter& painter, QString text, QString name, double fontSize) {
double sum_parse=0;
double sum_size=0;
double sum_draw=0;
double sqrsum_parse=0, sqrsum_size=0, sqrsum_draw=0;
int N=20;
std::cout<<"testing '"<<name.toStdString()<<"':\nparse [ms],\tsize [ms],\tdraw [ms]\n---------------------------------------------\n";
for (int i=0; i<N; i++) {
double t;
JKQTmathText mt;
mt.set_fontSize(fontSize);
ht.start(); mt.parse(text); t=ht.get_time()/1000.0;
sum_parse+=t;
sqrsum_parse+=t*t;
//std::cout<<t<<",\t";
ht.start(); mt.getSize(painter); t=ht.get_time()/1000.0;
sum_size+=t;
sqrsum_size+=t*t;
//std::cout<<t<<",\t";
ht.start(); mt.draw(painter, 0,0); t=ht.get_time()/1000.0;
sum_draw+=t;
sqrsum_draw+=t*t;
//std::cout<<t<<"\n";
}
//std::cout<<"---------------------------------------------\n";
std::cout<<sum_parse/(double)N<<",\t"<<sum_size/(double)N<<",\t"<<sum_draw/(double)N<<"\t: average\n";
std::cout<<sqrt(sqrsum_parse-sum_parse*sum_parse/(double)N)/(double)N<<",\t"<<sqrt(sqrsum_size-sum_size*sum_size/(double)N)/(double)N<<",\t"<<sqrt(sqrsum_draw-sum_draw*sum_draw/(double)N)/(double)N<<"\t: std dev\n";
std::cout<<"\n\n";
}
int main(int argc, char* argv[])
{
std::cout<<sizeof(unsigned char)<<" "<<sizeof(unsigned short)<<" "<<sizeof(unsigned int)<<" "<<sizeof(unsigned long)<<" "<<sizeof(unsigned long long)<<"\n\n";
QString mathTest="This is normal text: $this is math:\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle\\ \\ \\ g(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1} \\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\left\\{\\va\\left|\\|\\va\\|_2\\geq2\\right.\\right\\} \\vr\\vR\\frac{\\sqrt{\\sqrt{\\sqrt{\\sum_{i=0}^\\infty \\hat{i}^2}+y^\\alpha}+1}}{\\dot{v}\\equiv\\ddot{r}}\\argmin_{\\vec{k}}\\sum_{\\sqrt{i}=0}^{N}\\int_{x_0}^{x_1}\\left(\\left(\\left(x\\right)\\right)\\right)\\underbrace{\\left[\\left\\{\\frac{\\partial f}{\\partial x}\\right\\}\\cdot\\frac{1}{2}\\right]}{\\text{underbraced text \\hbar}}\\cdots\\frac{\\sqrt{\\sum_{i=0}^2 \\hat{i}^2}+y^\\alpha}{\\dot{v}\\equiv\\ddot{r}}, \\hat{t}\\hat{T} \\overbrace{\\left|\\sqrt{x\\cdot Y}\\right|}{\\propto\\bbN\\circ\\bbZ} \\left<\\arrow{x(\\tau)}\\cdot\\vec{R}(t+\\bar{\\tau})\\right> \\alpha\\beta\\gamma\\delta\\epsilon\\Gamma\\Delta\\Theta\\Omega \\left\\_\\left~\\cbrt{\\hbar\\omega}\\right~\\right\\_$";
QString symbolTest="\\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\sum\\int \\iint \\oint \\prod \\leftrightarrow \\leftarrow\\Leftarrow\\rightarrow\\Rightarrow\\pm\\mp\\leq\\geq\\ll\\gg\\hbar\\euro\\bbC\\bbH\\bbN\\bbP\\bbQ\\bbZ\\bbR\\Angstrom\\Alef\\Bet\\Gimel\\Dalet\\nexists\\ni\\notni\\circ\\tilde\\oiint\\oiiint\\emptyset\\odot\\ominus\\subsetnot\\DC\\bot\\cdots\\perthousand\\leftharpoonup\\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\coprod \\leftharpoondown \\rightharpoondown \\nwarrow \\nearrow \\mapsto \\cent \\pound \\yen \\div \\multimap \\maporiginal \\mapimage \\bigcap \\bigcup \\benzene \\times \\cdot \\propto \\equiv \\Im \\Re \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ ";
//QString mathTest="$\\left\\|\\stackrel{1}{2}\\right\\|\\cdot\\left|\\begin{Bmatrix}1123&2^2&\\frac{3}{4}\\\\4&5_5&6\\\\72_8&8_{\\text{längerer Index}}&9&10&11\\end{Bmatrix}\\right|\\cdots f(x)$";
//QString mathTest="0";
//QString text="x_0 \\sqrt{a^2+b^2}\\underbrace{underbrace}{x_0} (\\bf{Test})\\_\\it{Text} ... ! Äquator\\alpha\\beta $f(x)=\\sin(x{\\cdot}y)$ \\ul{Text\\ol{\\gamma}} \\script{Script}, \\tt{Typewriter}, \\sf{sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^{n^{m^{123456789}}}\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^2\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
QString text="x_0My Text$\\sqrt{a^2+b^2 } \\underbrace{underbrace}{x_0}$";
QApplication app(argc, argv);
QWidget w;
QHBoxLayout lay(&w);
w.setLayout(&lay);
QScrollArea area;
QTextBrowser browser;
lay.addWidget(&area);
lay.addWidget(&browser);
QLabel win;
area.setBackgroundRole(QPalette::Dark);
area.setWidget(&win);
QPixmap pix(W, H), pix2(W,H);
pix.fill();
QPainter painter;
JKQTmathText mt(&win);
double Y=Y1;
painter.begin(&pix);
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::HighQualityAntialiasing);
painter.setRenderHint(QPainter::TextAntialiasing);
ht.start();
mt.set_fontRoman("Times New Roman");
mt.set_fontMathRoman("Times New Roman");
mt.set_fontSans("Arial");
mt.set_fontMathSans("Arial");
mt.set_fontTypewriter("Courier");
mt.parse(mathTest);
bool okh=true;
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML1: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML1: --------------------------------------------- ok="<<okh;
if (mt.get_error_list().size()>0) {
std::cout<<mt.get_error_list().join("\n").toStdString()<<std::endl<<std::endl;
}
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "math, symbol, 10pt");
mt.set_fontSize(20);
Y+=draw(painter, X1, Y, mt, "math, symbol, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
mt.set_fontSize(12);
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "text, symbol, 10pt");
mt.set_fontSize(16);
Y+=draw(painter, X1, Y, mt, "text, symbol, 16pt");
Y+=30;
mt.useXITS();
ht.start();
mt.parse(mathTest);
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "math, XITS, 10pt");
mt.set_fontSize(20);
Y+=draw(painter, X1, Y, mt, "math, XITS, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(12);
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "text, XITS, 10pt");
mt.set_fontSize(16);
Y+=draw(painter, X1, Y, mt, "text, XITS, 16pt");
Y+=30;
mt.useAnyUnicode("Arial", "Times New Roman");
ht.start();
mt.parse(mathTest);
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 10pt");
mt.set_fontSize(20);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(12);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "text, Arial Unicode, 10pt");
mt.set_fontSize(16);
Y+=draw(painter, X1, Y, mt, "text, Arial Unicode, 16pt");
Y+=30;
mt.useSTIX();
ht.start();
mt.parse(mathTest);
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "math, STIX, 10pt");
mt.set_fontSize(20);
Y+=draw(painter, X1, Y, mt, "math, STIX, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(12);
Y+=draw(painter, X1, Y, mt, "math, STIX, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "text, STIX, 10pt");
mt.set_fontSize(16);
Y+=draw(painter, X1, Y, mt, "text, STIX, 16pt");
painter.end();
// timing test
painter.begin(&pix2);
std::cout<<"timing test, font size 10pt:\n";
timingTest(painter, mathTest, "mathTest", 10);
timingTest(painter, text, "text", 10);
std::cout<<"timing test, font size 20pt:\n";
timingTest(painter, mathTest, "mathTest", 20);
timingTest(painter, text, "text", 20);
std::cout<<"timing test, font size 30pt:\n";
timingTest(painter, mathTest, "mathTest", 30);
timingTest(painter, text, "text", 30);
win.setPixmap(pix);
win.resize(W, H);
w.show();
w.showMaximized();
return app.exec();
}
*/
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
TestForm w;
w.show();
w.updateMath();
w.showMaximized();
return app.exec();
}
#include <QApplication>
#include <QLabel>
#include <QPainter>
#include <QPixmap>
#include <QScrollArea>
#include <QDebug>
#include <QHBoxLayout>
#include <QTextBrowser>
#include "jkqtmathtext/jkqtmathtext.h"
#include "jkqtplottertools/jkqtphighrestimer.h"
#include "testform.h"
#define W 2000
#define H 3000
#define X1 15
#define Y1 50
/*
HighResTimer ht;
double draw(QPainter& painter, double X, double YY, JKQTmathText& mt, QString name) {
double Y=YY;
painter.save();
ht.start();
QSizeF s=mt.getSize(painter);
Y=Y+mt.getAscent(painter);
std::cout<<" sizing in "<<ht.get_time()/1000.0<<" ms\n";
QPen p=painter.pen();
p.setColor("lightcoral");
p.setStyle(Qt::DashLine);
p.setWidth(2);
painter.setPen(p);
QRectF r(X, Y-mt.getAscent(painter),s.width(), s.height());
painter.drawRect(r);
p.setColor("lightblue");
painter.setPen(p);
painter.drawLine(X, Y, X+s.width(), Y);
ht.start();
p.setStyle(Qt::SolidLine);
p.setWidth(1);
p.setColor("black");
painter.setPen(p);
mt.draw(painter, X, Y);
std::cout<<" drawing in "<<ht.get_time()/1000.0<<" ms\n";
p.setColor("blue");
painter.setPen(p);
QFont f;
f.setFamily("sans serif");
f.setUnderline(true);
f.setPointSize(10);
painter.setFont(f);
painter.drawText(X, Y-mt.getAscent(painter)-6, name+":");
painter.restore();
std::cout<<name.toStdString()<<": width="<<s.width()<<" height="<<s.height()<<" ascent="<<mt.getAscent(painter)<<" descent="<<mt.getDescent(painter)<<std::endl;
return mt.getDescent(painter)+mt.getAscent(painter)+40;
}
void timingTest(QPainter& painter, QString text, QString name, double fontSize) {
double sum_parse=0;
double sum_size=0;
double sum_draw=0;
double sqrsum_parse=0, sqrsum_size=0, sqrsum_draw=0;
int N=20;
std::cout<<"testing '"<<name.toStdString()<<"':\nparse [ms],\tsize [ms],\tdraw [ms]\n---------------------------------------------\n";
for (int i=0; i<N; i++) {
double t;
JKQTmathText mt;
mt.set_fontSize(fontSize);
ht.start(); mt.parse(text); t=ht.get_time()/1000.0;
sum_parse+=t;
sqrsum_parse+=t*t;
//std::cout<<t<<",\t";
ht.start(); mt.getSize(painter); t=ht.get_time()/1000.0;
sum_size+=t;
sqrsum_size+=t*t;
//std::cout<<t<<",\t";
ht.start(); mt.draw(painter, 0,0); t=ht.get_time()/1000.0;
sum_draw+=t;
sqrsum_draw+=t*t;
//std::cout<<t<<"\n";
}
//std::cout<<"---------------------------------------------\n";
std::cout<<sum_parse/(double)N<<",\t"<<sum_size/(double)N<<",\t"<<sum_draw/(double)N<<"\t: average\n";
std::cout<<sqrt(sqrsum_parse-sum_parse*sum_parse/(double)N)/(double)N<<",\t"<<sqrt(sqrsum_size-sum_size*sum_size/(double)N)/(double)N<<",\t"<<sqrt(sqrsum_draw-sum_draw*sum_draw/(double)N)/(double)N<<"\t: std dev\n";
std::cout<<"\n\n";
}
int main(int argc, char* argv[])
{
std::cout<<sizeof(unsigned char)<<" "<<sizeof(unsigned short)<<" "<<sizeof(unsigned int)<<" "<<sizeof(unsigned long)<<" "<<sizeof(unsigned long long)<<"\n\n";
QString mathTest="This is normal text: $this is math:\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle\\ \\ \\ g(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1} \\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\left\\{\\va\\left|\\|\\va\\|_2\\geq2\\right.\\right\\} \\vr\\vR\\frac{\\sqrt{\\sqrt{\\sqrt{\\sum_{i=0}^\\infty \\hat{i}^2}+y^\\alpha}+1}}{\\dot{v}\\equiv\\ddot{r}}\\argmin_{\\vec{k}}\\sum_{\\sqrt{i}=0}^{N}\\int_{x_0}^{x_1}\\left(\\left(\\left(x\\right)\\right)\\right)\\underbrace{\\left[\\left\\{\\frac{\\partial f}{\\partial x}\\right\\}\\cdot\\frac{1}{2}\\right]}{\\text{underbraced text \\hbar}}\\cdots\\frac{\\sqrt{\\sum_{i=0}^2 \\hat{i}^2}+y^\\alpha}{\\dot{v}\\equiv\\ddot{r}}, \\hat{t}\\hat{T} \\overbrace{\\left|\\sqrt{x\\cdot Y}\\right|}{\\propto\\bbN\\circ\\bbZ} \\left<\\arrow{x(\\tau)}\\cdot\\vec{R}(t+\\bar{\\tau})\\right> \\alpha\\beta\\gamma\\delta\\epsilon\\Gamma\\Delta\\Theta\\Omega \\left\\_\\left~\\cbrt{\\hbar\\omega}\\right~\\right\\_$";
QString symbolTest="\\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\sum\\int \\iint \\oint \\prod \\leftrightarrow \\leftarrow\\Leftarrow\\rightarrow\\Rightarrow\\pm\\mp\\leq\\geq\\ll\\gg\\hbar\\euro\\bbC\\bbH\\bbN\\bbP\\bbQ\\bbZ\\bbR\\Angstrom\\Alef\\Bet\\Gimel\\Dalet\\nexists\\ni\\notni\\circ\\tilde\\oiint\\oiiint\\emptyset\\odot\\ominus\\subsetnot\\DC\\bot\\cdots\\perthousand\\leftharpoonup\\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\coprod \\leftharpoondown \\rightharpoondown \\nwarrow \\nearrow \\mapsto \\cent \\pound \\yen \\div \\multimap \\maporiginal \\mapimage \\bigcap \\bigcup \\benzene \\times \\cdot \\propto \\equiv \\Im \\Re \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ ";
//QString mathTest="$\\left\\|\\stackrel{1}{2}\\right\\|\\cdot\\left|\\begin{Bmatrix}1123&2^2&\\frac{3}{4}\\\\4&5_5&6\\\\72_8&8_{\\text{längerer Index}}&9&10&11\\end{Bmatrix}\\right|\\cdots f(x)$";
//QString mathTest="0";
//QString text="x_0 \\sqrt{a^2+b^2}\\underbrace{underbrace}{x_0} (\\bf{Test})\\_\\it{Text} ... ! Äquator\\alpha\\beta $f(x)=\\sin(x{\\cdot}y)$ \\ul{Text\\ol{\\gamma}} \\script{Script}, \\tt{Typewriter}, \\sf{sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^{n^{m^{123456789}}}\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^2\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
QString text="x_0My Text$\\sqrt{a^2+b^2 } \\underbrace{underbrace}{x_0}$";
QApplication app(argc, argv);
QWidget w;
QHBoxLayout lay(&w);
w.setLayout(&lay);
QScrollArea area;
QTextBrowser browser;
lay.addWidget(&area);
lay.addWidget(&browser);
QLabel win;
area.setBackgroundRole(QPalette::Dark);
area.setWidget(&win);
QPixmap pix(W, H), pix2(W,H);
pix.fill();
QPainter painter;
JKQTmathText mt(&win);
double Y=Y1;
painter.begin(&pix);
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::HighQualityAntialiasing);
painter.setRenderHint(QPainter::TextAntialiasing);
ht.start();
mt.set_fontRoman("Times New Roman");
mt.set_fontMathRoman("Times New Roman");
mt.set_fontSans("Arial");
mt.set_fontMathSans("Arial");
mt.set_fontTypewriter("Courier");
mt.parse(mathTest);
bool okh=true;
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML1: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML1: --------------------------------------------- ok="<<okh;
if (mt.get_error_list().size()>0) {
std::cout<<mt.get_error_list().join("\n").toStdString()<<std::endl<<std::endl;
}
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "math, symbol, 10pt");
mt.set_fontSize(20);
Y+=draw(painter, X1, Y, mt, "math, symbol, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
mt.set_fontSize(12);
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "text, symbol, 10pt");
mt.set_fontSize(16);
Y+=draw(painter, X1, Y, mt, "text, symbol, 16pt");
Y+=30;
mt.useXITS();
ht.start();
mt.parse(mathTest);
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "math, XITS, 10pt");
mt.set_fontSize(20);
Y+=draw(painter, X1, Y, mt, "math, XITS, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(12);
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "text, XITS, 10pt");
mt.set_fontSize(16);
Y+=draw(painter, X1, Y, mt, "text, XITS, 16pt");
Y+=30;
mt.useAnyUnicode("Arial", "Times New Roman");
ht.start();
mt.parse(mathTest);
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 10pt");
mt.set_fontSize(20);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(12);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "text, Arial Unicode, 10pt");
mt.set_fontSize(16);
Y+=draw(painter, X1, Y, mt, "text, Arial Unicode, 16pt");
Y+=30;
mt.useSTIX();
ht.start();
mt.parse(mathTest);
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "math, STIX, 10pt");
mt.set_fontSize(20);
Y+=draw(painter, X1, Y, mt, "math, STIX, 20pt");
ht.start();
mt.parse(symbolTest);
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(12);
Y+=draw(painter, X1, Y, mt, "math, STIX, 12pt");
ht.start();
mt.parse(text);
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
mt.set_fontSize(10);
Y+=draw(painter, X1, Y, mt, "text, STIX, 10pt");
mt.set_fontSize(16);
Y+=draw(painter, X1, Y, mt, "text, STIX, 16pt");
painter.end();
// timing test
painter.begin(&pix2);
std::cout<<"timing test, font size 10pt:\n";
timingTest(painter, mathTest, "mathTest", 10);
timingTest(painter, text, "text", 10);
std::cout<<"timing test, font size 20pt:\n";
timingTest(painter, mathTest, "mathTest", 20);
timingTest(painter, text, "text", 20);
std::cout<<"timing test, font size 30pt:\n";
timingTest(painter, mathTest, "mathTest", 30);
timingTest(painter, text, "text", 30);
win.setPixmap(pix);
win.resize(W, H);
w.show();
w.showMaximized();
return app.exec();
}
*/
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
TestForm w;
w.show();
w.updateMath();
w.showMaximized();
return app.exec();
}

View File

@ -1,41 +1,45 @@
include($$PWD/asana.pri)
LIBS +=
SOURCES += jkqtmathtext_test.cpp \
testform.cpp
RCC_DIR = rccs
CONFIG += qt windows
TARGET = jkqtmathtext_test
QT += core gui svg xml
UI_DIR = .uics
HEADERS += testform.h
OBJECTS_DIR = .objs
INCLUDEPATH +=
MOC_DIR = .mocs
FORMS += \
testform.ui
DESTDIR = ./
DEFINES += AUTOLOAD_XITS_FONTS AUTOLOAD_Asana_FONTS
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
DEPENDPATH += . ../../lib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib
CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib
include($$PWD/asana.pri)
LIBS +=
SOURCES += jkqtmathtext_test.cpp \
testform.cpp
RCC_DIR = rccs
CONFIG += qt windows
TARGET = jkqtmathtext_test
QT += core gui svg xml
UI_DIR = .uics
HEADERS += testform.h
OBJECTS_DIR = .objs
INCLUDEPATH +=
MOC_DIR = .mocs
FORMS += \
testform.ui
DESTDIR = ./
DEFINES += AUTOLOAD_XITS_FONTS AUTOLOAD_Asana_FONTS
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
DEPENDPATH += . ../../lib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
} else {
LIBS += -L../../staticlib/release -ljkqtplotterlib
}
message("LIBS = $$LIBS")

View File

@ -1,8 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtmathtext_test
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro
jkqtmathtext_test.file=$$PWD/jkqtmathtext_test.pro
jkqtmathtext_test.depends = jkqtplotterlib
TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtmathtext_test
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro
jkqtmathtext_test.file=$$PWD/jkqtmathtext_test.pro
jkqtmathtext_test.depends = jkqtplotterlib

View File

@ -1,12 +1,12 @@
[FormatInfo]
Type=TeXnicCenterProjectInformation
Version=4
[ProjectInfo]
MainFile=mathtest.tex
UseBibTeX=0
UseMakeIndex=0
ActiveProfile=LaTeX ⇨ PDF
ProjectLanguage=en
ProjectDialect=US
[FormatInfo]
Type=TeXnicCenterProjectInformation
Version=4
[ProjectInfo]
MainFile=mathtest.tex
UseBibTeX=0
UseMakeIndex=0
ActiveProfile=LaTeX ⇨ PDF
ProjectLanguage=en
ProjectDialect=US

View File

@ -1,127 +1,127 @@
\documentclass[a4paper]{scrartcl}
%% Deutsche Anpassungen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[ngerman]{babel}
\usepackage[ansinew]{inputenc}
\usepackage{ulem}
\usepackage{mathtools}
\usepackage{esint}
%\usepackage{txfonts}
\usepackage[landscape]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\newcommand{\cbrt}[1]{\sqrt[3]{#1}}
\newcommand{\bbC}{\mathbb{C}}
\newcommand{\bbH}{\mathbb{H}}
\newcommand{\bbN}{\mathbb{N}}
\newcommand{\bbP}{\mathbb{P}}
\newcommand{\bbQ}{\mathbb{Q}}
\newcommand{\bbZ}{\mathbb{Z}}
\newcommand{\bbR}{\mathbb{R}}
\newcommand{\Angstrom}{\r{A}}
\newcommand{\lefrighttharpoons}{\rightleftharpoons}
\newcommand{\subsetnot}{\not\subset}
\newcommand{\argmax}{\operatorname*{arg\,max}}
\newcommand{\va}{\vec{a}}
\newcommand{\vr}{\vec{r}}
\newcommand{\vR}{\vec{R}}
\newcommand{\argmin}{\mbox{arg\:min}}
\newcommand{\uul}[1]{\uuline{#1}}
\newcommand{\ool}[1]{\overline{\overline{#1}}}
\newcommand{\arrow}[1]{\overrightarrow{#1}}
\begin{document}
\begin{itemize}
\item\textbf{std dev:} \[\sigma_x=\sqrt{\langle (x-\langle x\rangle)^2\rangle}=\sqrt{\frac{1}{N-1}\cdot\left( \sum_{i=1}^N{x_i}^2-\frac{1}{N}\cdot\left(\sum_{i=1}^Nx_i\right)^2\right)} \]
\item\textbf{std dev 2:} \[\sigma_x=\sqrt{\langle (x-\langle x\rangle)^2\rangle}=\sqrt{\frac{1}{N-1}\cdot\left( \sum_{i=1}^Nx_i^2-\frac{1}{N}\cdot\left(\sum_{i=1}^Nx_i\right)^2\right)} \]
\item\textbf{rotation matrix:} \[\mathrm{\mathbf{M}}(\alpha) = \left(\begin{matrix}\cos(\alpha)+n_x^2\cdot (1-\cos(\alpha)) & n_x\cdot n_y\cdot (1-\cos(\alpha))-n_z\cdot \sin(\alpha) & n_x\cdot n_z\cdot (1-\cos(\alpha))+n_y\cdot \sin(\alpha)\\n_x\cdot n_y\cdot (1-\cos(\alpha))+n_z\cdot \sin(\alpha) & \cos(\alpha)+n_y^2\cdot (1-\cos(\alpha)) & n_y\cdot n_z\cdot (1-\cos(\alpha))-n_x\cdot \sin(\alpha)\\n_z\cdot n_x\cdot (1-\cos(\alpha))-n_y\cdot \sin(\alpha) & n_z\cdot n_y\cdot (1-\cos(\alpha))+n_x\cdot \sin(\alpha) & \cos(\alpha)+n_z^2\cdot (1-\cos(\alpha))\end{matrix}\right) \]
\item\textbf{like in label at bottom (no MM):} \[\left(\left[\sqrt{2\pi\cdot\int_{-\infty}^\infty f(x)\;\mathrm{d}x}\right]\right) \]
\item\textbf{like in label at bottom (MM):} \[\left(\left[\sqrt{2\pi\cdot\int_{-\infty}^\infty f(x)\;\mathrm{d}x}\right]\right) \]
\item\textbf{decoration:} \[\vec{x}\vec{X}\vec{\psi} -- \dot{x}\dot{X}\dot{\psi} -- \ddot{x}\ddot{X}\ddot{\psi} -- \overline{x}\overline{X}\overline{\psi} -- \underline{x}\underline{X}\underline{\psi} -- \hat{x}\hat{X}\hat{\psi} -- \tilde{x}\tilde{X}\tilde{\psi} -- \uul{x}\uul{X}\uul{\psi} -- \ool{x}\ool{X}\ool{\psi} -- \bar{x}\bar{X}\bar{\psi} -- \arrow{x}\arrow{X}\arrow{\psi} \]
\item\textbf{mathtest:}\\ This is normal text: $this is math:\langle r^2(\tau)\rangle=\left\langle (\vec{r}(t)-\vec{r}(t+\tau) )^2\right\rangle\ \ \ g(\tau)=\frac{1}{N}\cdot\left(1+\frac{2}{3}\frac{\langle r^2(\tau)\rangle}{w_{xy}^2}\right)^{-1} \lfloor\rfloor\lceil\rceil\langle\rangle\left\{\va\left|\|\va\|_2\geq2\right.\right\} \vr\vR$\\$\frac{\sqrt{\sqrt{\sqrt{\sum_{i=0}^\infty \hat{i}^2}+y^\alpha}+1}}{\dot{v}\equiv\ddot{r}}\argmin_{\vec{k}}\sum_{\sqrt{i}=0}^{N}\int_{x_0}^{x_1}\left(\left(\left(x\right)\right)\right)\underbrace{\left[\left\{\frac{\partial f}{\partial x}\right\}\cdot\frac{1}{2}\right]}{\text{underbraced text $\hbar$}}\cdots\frac{\sqrt{\sum_{i=0}^2 \hat{i}^2}+y^\alpha}{\dot{v}\equiv\ddot{r}}, \hat{t}\hat{T} \overbrace{\left|\sqrt{x\cdot Y}\right|}{\propto\bbN\circ\bbZ}$\\$\left<\arrow{x(\tau)}\cdot\vec{R}(t+\bar{\tau})\right> \alpha\beta\gamma\delta\epsilon\Gamma\Delta\Theta\Omega \left\lfloor \left\lceil \cbrt{\hbar\omega}\right\rceil\right\rfloor $
\item\textbf{chi2 test:} \[\vec{p}^\ast=\argmax\limits_{\vec{p}}\chi^2=\argmax\limits_{\vec{p}}\sum\limits_{i=1}^N\left|\frac{\hat{f}_i-f(x_i;\vec{p})}{\sigma_i}\right|^2\]
\item\textbf{upper/lower parantheses test:} \[ \text{bblabla} \frac{1}{2}\cdot\left(\frac{1}{\mathrm{e}^x+\mathrm{e}^{-x}}\right)\cdot\left(\frac{1}{\frac{1+2}{5+x}}\right)\cdot\left(\frac{1}{\exp\left[-\frac{y^2}{\sqrt{x}}\right]\cdot\exp\left[-\frac{1}{\frac{1}{2}}\right]}\right) \]
\item\textbf{ACF test:} \[g_{rg}^{ab}(\tau)=\frac{1}{N}\cdot\left(1+\frac{2}{3}\frac{\langle r^2(\tau)\rangle}{w_{xy}^2}\right)^{-1}\cdot\left(1+\frac{2}{3}\frac{\langle r^2(\tau)\rangle}{w_{xy}^2}\right)^{-\frac{1}{2}} \]
\item\textbf{MSD test:} \[\mathrm{MSD}(\tau)\equiv\langle r^2(\tau)\rangle=\left\langle (\vec{r}(t)-\vec{r}(t+\tau) )^2\right\rangle=2n\cdot\frac{K_\alpha}{\Gamma(1+\alpha)}\cdot\tau^\alpha \]
\item\textbf{math: blackboard:} \[\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ120} \]
\item\textbf{math: bf:} \[\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ120} \]
\item\textbf{math: rm:} \[\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ120} \]
\item\textbf{math: cal:} \[\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ120} \]
\item\textbf{subscript test:} \[r_{123}\ \ r_{\frac{1}{2}} \]
\item\textbf{subscript0 test:} \[r_{123} \]
\item\textbf{subscript1 test:} \[r_{123}\ \]
\item\textbf{subscript2 test:} \[r_{123}\ \ \]
\item\textbf{subscript3 test:} \[r_{123}r_{\frac{1}{2}} \]
\item\textbf{superscript test:} \[r^{123}\ \ r^{\frac{1}{2}} \]
\item\textbf{superscript0 test:} \[r^{123} \]
\item\textbf{superscript1 test:} \[r^{123}\ \]
\item\textbf{superscript2 test:} \[r^{123}\ \ \]
\item\textbf{superscript3 test:} \[r^{123}r^{\frac{1}{2}} \]
\item\textbf{asuperscript test:} \[a^{123}\ \ a^{\frac{1}{2}} \]
\item\textbf{asuperscript0 test:} \[a^{123} \]
\item\textbf{gsuperscript1 test:} \[g^{123}\ \]
\item\textbf{gsuperscript2 test:} \[g^{123}\ \ \]
\item\textbf{gsuperscript3 test:} \[g^{123}g^{\frac{1}{2}} \]
\item\textbf{frac test:} \[\frac{a}{b}+\frac{g}{a}-\frac{a^2}{b^2}\cdot\frac{a^2}{b^{\frac{1}{2}}} \]
\item\textbf{tfrac test:} \[\tfrac{a}{b}+\tfrac{g}{a}-\tfrac{a^2}{b^2}\cdot\tfrac{a^2}{b^{\tfrac{1}{2}}} \]
\item\textbf{dfrac test:} \[\dfrac{a}{b}+\dfrac{g}{a}-\dfrac{a^2}{b^2}\cdot\dfrac{a^2}{b^{\dfrac{1}{2}}} \]
\item\textbf{stackrel test:} \[\stackrel{a}{b}+\stackrel{g}{a}-\stackrel{a^2}{b^2}\cdot\stackrel{a^2}{b^{\stackrel{1}{2}}} \]
\item\textbf{brace5 test: ( )} \[\left(\left(\left( r^{123}\right)\right)\right) -- \left(\left(\left( r^{123}\right)\right)\right) \]
\item\textbf{brace6 test: [ ]} \[\left[\left[\left[ r^{123}\right]\right]\right] -- \left[\left[\left[ r^{123}\right]\right]\right] \]
\item\textbf{brace7 test: { }} \[\left\{\left\{\left\{ r^{123}\right\}\right\}\right\} -- \left\{\left\{\left\{ r^{123}\right\}\right\}\right\} \]
\item\textbf{brace8 test: || ||} \[\left\|\left\|\left\| r^{123}\right\|\right\|\right\| -- \left\|\left\|\left\| r^{123}\right\|\right\|\right\| \]
\item\textbf{brace9 test: | |} \[\left|\left|\left| r^{123}\right|\right|\right| -- \left|\left|\left| r^{123}\right|\right|\right| \]
\item\textbf{brace10 test} \[\left\{\left[\left( r^{123}\right)\right]\right\} -- \left\{\left[\left( r^{123}\right)\right]\right\} \]
\item\textbf{brace11 test: floor} \[\left\lfloor\left\lfloor\left\lfloor r^{123}\right\rfloor\right\rfloor\right\rfloor -- \left\lfloor\left\lfloor\left\lfloor r^{123}\right\rfloor\right\rfloor\right\rfloor \]
\item\textbf{brace12 test: ceil} \[\left\lceil\left\lceil\left\lceil r^{123}\right\rceil\right\rceil\right\rceil -- \left\lceil\left\lceil\left\lceil r^{123}\right\rceil\right\rceil\right\rceil \]
\item\textbf{sub-, superscript test} \[r^{1234}_{321} r_{321}^{1234} -- r^{1234}_{321} r_{321}^{1234} -- \kappa^2 -- \kappa_2 -- \kappa_2^2 \]
\item\textbf{super-, subscript test} \[r^{123}_{4321} r_{4321}^{123} -- r^{123}_{4321} r_{4321}^{123} -- \kappa^2 -- \kappa_2 -- \kappa_2^2 \]
\item\textbf{math 1:} \[f(x)=\int_{-\infty}^xe^{-t^2}\;\mathrm{d}t \]
\item\textbf{math 2:} \[\sum_{i=1}^\infty\frac{-e^{i\pi}}{2^n} \]
\item\textbf{math 3:} \[\mbox{det} \begin{pmatrix} 1 & x_1 & \ldots & x_1^{n-1} \\ 1 & x_2 & \ldots & x_2^{n-1} \\ \vdots & \vdots & \ddots & \vdots \\ 1 & x_n & \ldots & x_n^{n-1} \end{pmatrix} = \prod_{1 \leq i < j \leq n} (x_j - x_i) \]
\item\textbf{math 4:} \[\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}}} \]
\item\textbf{math 5:} \[\left(\stackrel{p}{2}\right)=x^2y^{p-2}-\frac{1}{1-x}\frac{1}{1-x^2} \]
\item\textbf{math 6:} \[a_0+\frac{1}{a_1+\frac{1}{a_2+\frac{1}{a_3+\frac{1}{a_4}}}} \]
\item\textbf{math 7:} \[\left(\frac{\partial^2}{\partial x^2}+\frac{\partial^2}{\partial y^2}\right)\left|\varphi(x+\mathrm{i}y)\right|^2=0 \]
\item\textbf{math 8:} \[2^{2^{2^{x}}} \]
\item\textbf{math 9:} \[\iint_Df(x,y)\;\mathrm{d}x\;\mathrm{d}y \]
\item\textbf{math 10 (overbrace):} \[\overbrace{x+x+...+x}{k\ \mathrm{times}} \]
\item\textbf{math 11 (underbrace):} \[\underbrace{x+x+...+x}{k\ \mathrm{times}} \]
\item\textbf{math 12 (under/overbrace):} \[\underbrace{\overbrace{x+x+...+x}{k\ \mathrm{times}} \overbrace{x+x+...+x}{k\ \mathrm{times}}}{2k\ \mathrm{times}} \]
\item\textbf{math 13:} \[y_1''\ \ \ y_2''' \]
\item\textbf{math 14:} \[f(x)=\begin{cases} 1/3 & \mathrm{if}\ 0\leq x\leq1 \\ 2/3 & \mathrm{if}\ 3\leq x\leq4 \\0 & \mathrm{elsewhere} \end{cases} \]
\item\textbf{math 15:} \[\Re{z} =\frac{n\pi \dfrac{\theta +\psi}{2}}{\left(\dfrac{\theta +\psi}{2}\right)^2 + \left( \dfrac{1}{2}\log \left\lvert\dfrac{B}{A}\right\rvert\right)^2}. \]
\item\textbf{math 16:} \[\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}{3^m\left(m\,3^n+n\,3^m\right)} \]
\item\textbf{math 17:} \[\phi_n(\kappa) =\frac{1}{4\pi^2\kappa^2} \int_0^\infty\frac{\sin(\kappa R)}{\kappa R}\frac{\partial}{\partial R}\left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR \]
\item\textbf{math 18:} \[{}_pF_q(a_1,\dots,a_p;c_1,\dots,c_q;z)= \sum_{n=0}^\infty\frac{(a_1)_n\cdots(a_p)_n}{(c_1)_n\cdots(c_q)_n}\frac{z^n}{n!} \]
\item\textbf{math 19 (overset):} \[X \overset{=}{def} Y\ \ \ \ \ X \overset{=}{!} Y\ \ \ \ \ X \overset{\rightarrow}{f} Y\ \ \ \ \ \frac{f(x+\Delta x)-f(x)}{\Delta x}\overset{\longrightarrow}{\Delta x\to 0}f'(x) \]
\item\textbf{math 20 (underset):} \[X \underset{=}{\text{def (5)}} Y\ \ \ \ \ X \underset{\rightarrow}{f} Y\ \ \ \ \ \frac{f(x+\Delta x)-f(x)}{\Delta x}\underset{\longrightarrow}{\Delta x\to 0}f'(x) \]
\item\textbf{axiom of power test:} \[\forall A \, \exists P \, \forall B \, [B \in P \iff \forall C \, (C \in B \Rightarrow C \in A)] \]
\item\textbf{De Morgan's law:} $\neg(P\land Q)\iff(\neg P)\lor(\neg Q)$ or $\overline{\bigcap_{i \in I} A_{i}}\equiv\bigcup_{i \in I} \overline{A_{i}}$ or $\overline{A \cup B}\equiv\overline{A} \cap \overline{B} $
\item\textbf{quadratic formula:} \[x=\frac{-b \pm \sqrt{b^2-4ac}}{2a} \]
\item\textbf{combination:} \[\binom{n}{k} = \frac{n(n-1)...(n-k+1)}{k(k-1)\dots1}=\frac{n!}{k!(n-k)!} \]
\item\textbf{Sophomore's dream 1:} \[\int_0^1 x^{-x}\,dx = \sum_{n=1}^\infty n^{-n}(\scriptstyle{= 1.29128599706266354040728259059560054149861936827\dots)} \]
\item\textbf{Sophomore's dream 2:} \[\int_0^1 x^x \,dx = \sum_{n=1}^\infty (-1)^{n+1}n^{-n} = - \sum_{n=1}^\infty (-n)^{-n} (\scriptstyle{= 0.78343051071213440705926438652697546940768199014\dots}) \]
\item\textbf{divergence 1:} \[\operatorname{div}\vec{F} = \nabla\cdot\vec{F}=\frac{\partial U}{\partial x}+\frac{\partial V}{\partial y}+\frac{\partial W}{\partial z} \]
\item\textbf{divergence 2:} \[\overrightarrow{\operatorname{div}}\,(\mathbf{\underline{\underline{\epsilon}}}) =
\begin{bmatrix}
\frac{\partial \epsilon_{xx}}{\partial x} +\frac{\partial \epsilon_{yx}}{\partial y} +\frac{\partial \epsilon_{zx}}{\partial z} \\
\frac{\partial \epsilon_{xy}}{\partial x} +\frac{\partial \epsilon_{yy}}{\partial y} +\frac{\partial \epsilon_{zy}}{\partial z} \\
\frac{\partial \epsilon_{xz}}{\partial x} +\frac{\partial \epsilon_{yz}}{\partial y} +\frac{\partial \epsilon_{zz}}{\partial z}
\end{bmatrix} \]
\item\textbf{lim, sum ...:} \[\lim_{x\to\infty} f(x) = \binom{k}{r} + \frac{a}{b} \sum_{n=1}^\infty a_n + \displaystyle{ \left\{ \frac{1}{13} \sum_{n=1}^\infty b_n \right\} }. \]
%\item\textbf{array test:} \[ f(x) := \left\{\begin{array}[ll] x^2\sin\frac{1}{x} & \text{if} x \ne 0, \\ 0 & \text{if } x = 0 . \end{array}\right. \]
\item\textbf{Schwinger-Dyson:} \[\left\langle\psi\left|\mathcal{T}\{F \phi^j\}\right|\psi\right\rangle=\left\langle\psi\left|\mathcal{T}\{iF_{,i}D^{ij}-FS_{int,i}D^{ij}\}\right|\psi\right\rangle. \]
\item\textbf{Schrödinger's equation:} \[\left[-\frac{\hbar^2}{-2m}\frac{\partial^2}{\partial x^2}+V\right]\Psi(x)=i\hbar\frac{\partial}{\partial t}\Psi(x) \]
\item\textbf{Cauchy-Schwarz inequality:} \[\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) \]
\item\textbf{Maxwell's equations:} \[\begin{aligned}\nabla \times \vec{\mathbf{B}} -\, \frac{1}{c}\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\\nabla \times \vec{\mathbf{E}}\, +\, \frac{1}{c}\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\\nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned} \]
\end{itemize}
\documentclass[a4paper]{scrartcl}
%% Deutsche Anpassungen %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[ngerman]{babel}
\usepackage[ansinew]{inputenc}
\usepackage{ulem}
\usepackage{mathtools}
\usepackage{esint}
%\usepackage{txfonts}
\usepackage[landscape]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\newcommand{\cbrt}[1]{\sqrt[3]{#1}}
\newcommand{\bbC}{\mathbb{C}}
\newcommand{\bbH}{\mathbb{H}}
\newcommand{\bbN}{\mathbb{N}}
\newcommand{\bbP}{\mathbb{P}}
\newcommand{\bbQ}{\mathbb{Q}}
\newcommand{\bbZ}{\mathbb{Z}}
\newcommand{\bbR}{\mathbb{R}}
\newcommand{\Angstrom}{\r{A}}
\newcommand{\lefrighttharpoons}{\rightleftharpoons}
\newcommand{\subsetnot}{\not\subset}
\newcommand{\argmax}{\operatorname*{arg\,max}}
\newcommand{\va}{\vec{a}}
\newcommand{\vr}{\vec{r}}
\newcommand{\vR}{\vec{R}}
\newcommand{\argmin}{\mbox{arg\:min}}
\newcommand{\uul}[1]{\uuline{#1}}
\newcommand{\ool}[1]{\overline{\overline{#1}}}
\newcommand{\arrow}[1]{\overrightarrow{#1}}
\begin{document}
\begin{itemize}
\item\textbf{std dev:} \[\sigma_x=\sqrt{\langle (x-\langle x\rangle)^2\rangle}=\sqrt{\frac{1}{N-1}\cdot\left( \sum_{i=1}^N{x_i}^2-\frac{1}{N}\cdot\left(\sum_{i=1}^Nx_i\right)^2\right)} \]
\item\textbf{std dev 2:} \[\sigma_x=\sqrt{\langle (x-\langle x\rangle)^2\rangle}=\sqrt{\frac{1}{N-1}\cdot\left( \sum_{i=1}^Nx_i^2-\frac{1}{N}\cdot\left(\sum_{i=1}^Nx_i\right)^2\right)} \]
\item\textbf{rotation matrix:} \[\mathrm{\mathbf{M}}(\alpha) = \left(\begin{matrix}\cos(\alpha)+n_x^2\cdot (1-\cos(\alpha)) & n_x\cdot n_y\cdot (1-\cos(\alpha))-n_z\cdot \sin(\alpha) & n_x\cdot n_z\cdot (1-\cos(\alpha))+n_y\cdot \sin(\alpha)\\n_x\cdot n_y\cdot (1-\cos(\alpha))+n_z\cdot \sin(\alpha) & \cos(\alpha)+n_y^2\cdot (1-\cos(\alpha)) & n_y\cdot n_z\cdot (1-\cos(\alpha))-n_x\cdot \sin(\alpha)\\n_z\cdot n_x\cdot (1-\cos(\alpha))-n_y\cdot \sin(\alpha) & n_z\cdot n_y\cdot (1-\cos(\alpha))+n_x\cdot \sin(\alpha) & \cos(\alpha)+n_z^2\cdot (1-\cos(\alpha))\end{matrix}\right) \]
\item\textbf{like in label at bottom (no MM):} \[\left(\left[\sqrt{2\pi\cdot\int_{-\infty}^\infty f(x)\;\mathrm{d}x}\right]\right) \]
\item\textbf{like in label at bottom (MM):} \[\left(\left[\sqrt{2\pi\cdot\int_{-\infty}^\infty f(x)\;\mathrm{d}x}\right]\right) \]
\item\textbf{decoration:} \[\vec{x}\vec{X}\vec{\psi} -- \dot{x}\dot{X}\dot{\psi} -- \ddot{x}\ddot{X}\ddot{\psi} -- \overline{x}\overline{X}\overline{\psi} -- \underline{x}\underline{X}\underline{\psi} -- \hat{x}\hat{X}\hat{\psi} -- \tilde{x}\tilde{X}\tilde{\psi} -- \uul{x}\uul{X}\uul{\psi} -- \ool{x}\ool{X}\ool{\psi} -- \bar{x}\bar{X}\bar{\psi} -- \arrow{x}\arrow{X}\arrow{\psi} \]
\item\textbf{mathtest:}\\ This is normal text: $this is math:\langle r^2(\tau)\rangle=\left\langle (\vec{r}(t)-\vec{r}(t+\tau) )^2\right\rangle\ \ \ g(\tau)=\frac{1}{N}\cdot\left(1+\frac{2}{3}\frac{\langle r^2(\tau)\rangle}{w_{xy}^2}\right)^{-1} \lfloor\rfloor\lceil\rceil\langle\rangle\left\{\va\left|\|\va\|_2\geq2\right.\right\} \vr\vR$\\$\frac{\sqrt{\sqrt{\sqrt{\sum_{i=0}^\infty \hat{i}^2}+y^\alpha}+1}}{\dot{v}\equiv\ddot{r}}\argmin_{\vec{k}}\sum_{\sqrt{i}=0}^{N}\int_{x_0}^{x_1}\left(\left(\left(x\right)\right)\right)\underbrace{\left[\left\{\frac{\partial f}{\partial x}\right\}\cdot\frac{1}{2}\right]}{\text{underbraced text $\hbar$}}\cdots\frac{\sqrt{\sum_{i=0}^2 \hat{i}^2}+y^\alpha}{\dot{v}\equiv\ddot{r}}, \hat{t}\hat{T} \overbrace{\left|\sqrt{x\cdot Y}\right|}{\propto\bbN\circ\bbZ}$\\$\left<\arrow{x(\tau)}\cdot\vec{R}(t+\bar{\tau})\right> \alpha\beta\gamma\delta\epsilon\Gamma\Delta\Theta\Omega \left\lfloor \left\lceil \cbrt{\hbar\omega}\right\rceil\right\rfloor $
\item\textbf{chi2 test:} \[\vec{p}^\ast=\argmax\limits_{\vec{p}}\chi^2=\argmax\limits_{\vec{p}}\sum\limits_{i=1}^N\left|\frac{\hat{f}_i-f(x_i;\vec{p})}{\sigma_i}\right|^2\]
\item\textbf{upper/lower parantheses test:} \[ \text{bblabla} \frac{1}{2}\cdot\left(\frac{1}{\mathrm{e}^x+\mathrm{e}^{-x}}\right)\cdot\left(\frac{1}{\frac{1+2}{5+x}}\right)\cdot\left(\frac{1}{\exp\left[-\frac{y^2}{\sqrt{x}}\right]\cdot\exp\left[-\frac{1}{\frac{1}{2}}\right]}\right) \]
\item\textbf{ACF test:} \[g_{rg}^{ab}(\tau)=\frac{1}{N}\cdot\left(1+\frac{2}{3}\frac{\langle r^2(\tau)\rangle}{w_{xy}^2}\right)^{-1}\cdot\left(1+\frac{2}{3}\frac{\langle r^2(\tau)\rangle}{w_{xy}^2}\right)^{-\frac{1}{2}} \]
\item\textbf{MSD test:} \[\mathrm{MSD}(\tau)\equiv\langle r^2(\tau)\rangle=\left\langle (\vec{r}(t)-\vec{r}(t+\tau) )^2\right\rangle=2n\cdot\frac{K_\alpha}{\Gamma(1+\alpha)}\cdot\tau^\alpha \]
\item\textbf{math: blackboard:} \[\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ120} \]
\item\textbf{math: bf:} \[\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ120} \]
\item\textbf{math: rm:} \[\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ120} \]
\item\textbf{math: cal:} \[\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ120} \]
\item\textbf{subscript test:} \[r_{123}\ \ r_{\frac{1}{2}} \]
\item\textbf{subscript0 test:} \[r_{123} \]
\item\textbf{subscript1 test:} \[r_{123}\ \]
\item\textbf{subscript2 test:} \[r_{123}\ \ \]
\item\textbf{subscript3 test:} \[r_{123}r_{\frac{1}{2}} \]
\item\textbf{superscript test:} \[r^{123}\ \ r^{\frac{1}{2}} \]
\item\textbf{superscript0 test:} \[r^{123} \]
\item\textbf{superscript1 test:} \[r^{123}\ \]
\item\textbf{superscript2 test:} \[r^{123}\ \ \]
\item\textbf{superscript3 test:} \[r^{123}r^{\frac{1}{2}} \]
\item\textbf{asuperscript test:} \[a^{123}\ \ a^{\frac{1}{2}} \]
\item\textbf{asuperscript0 test:} \[a^{123} \]
\item\textbf{gsuperscript1 test:} \[g^{123}\ \]
\item\textbf{gsuperscript2 test:} \[g^{123}\ \ \]
\item\textbf{gsuperscript3 test:} \[g^{123}g^{\frac{1}{2}} \]
\item\textbf{frac test:} \[\frac{a}{b}+\frac{g}{a}-\frac{a^2}{b^2}\cdot\frac{a^2}{b^{\frac{1}{2}}} \]
\item\textbf{tfrac test:} \[\tfrac{a}{b}+\tfrac{g}{a}-\tfrac{a^2}{b^2}\cdot\tfrac{a^2}{b^{\tfrac{1}{2}}} \]
\item\textbf{dfrac test:} \[\dfrac{a}{b}+\dfrac{g}{a}-\dfrac{a^2}{b^2}\cdot\dfrac{a^2}{b^{\dfrac{1}{2}}} \]
\item\textbf{stackrel test:} \[\stackrel{a}{b}+\stackrel{g}{a}-\stackrel{a^2}{b^2}\cdot\stackrel{a^2}{b^{\stackrel{1}{2}}} \]
\item\textbf{brace5 test: ( )} \[\left(\left(\left( r^{123}\right)\right)\right) -- \left(\left(\left( r^{123}\right)\right)\right) \]
\item\textbf{brace6 test: [ ]} \[\left[\left[\left[ r^{123}\right]\right]\right] -- \left[\left[\left[ r^{123}\right]\right]\right] \]
\item\textbf{brace7 test: { }} \[\left\{\left\{\left\{ r^{123}\right\}\right\}\right\} -- \left\{\left\{\left\{ r^{123}\right\}\right\}\right\} \]
\item\textbf{brace8 test: || ||} \[\left\|\left\|\left\| r^{123}\right\|\right\|\right\| -- \left\|\left\|\left\| r^{123}\right\|\right\|\right\| \]
\item\textbf{brace9 test: | |} \[\left|\left|\left| r^{123}\right|\right|\right| -- \left|\left|\left| r^{123}\right|\right|\right| \]
\item\textbf{brace10 test} \[\left\{\left[\left( r^{123}\right)\right]\right\} -- \left\{\left[\left( r^{123}\right)\right]\right\} \]
\item\textbf{brace11 test: floor} \[\left\lfloor\left\lfloor\left\lfloor r^{123}\right\rfloor\right\rfloor\right\rfloor -- \left\lfloor\left\lfloor\left\lfloor r^{123}\right\rfloor\right\rfloor\right\rfloor \]
\item\textbf{brace12 test: ceil} \[\left\lceil\left\lceil\left\lceil r^{123}\right\rceil\right\rceil\right\rceil -- \left\lceil\left\lceil\left\lceil r^{123}\right\rceil\right\rceil\right\rceil \]
\item\textbf{sub-, superscript test} \[r^{1234}_{321} r_{321}^{1234} -- r^{1234}_{321} r_{321}^{1234} -- \kappa^2 -- \kappa_2 -- \kappa_2^2 \]
\item\textbf{super-, subscript test} \[r^{123}_{4321} r_{4321}^{123} -- r^{123}_{4321} r_{4321}^{123} -- \kappa^2 -- \kappa_2 -- \kappa_2^2 \]
\item\textbf{math 1:} \[f(x)=\int_{-\infty}^xe^{-t^2}\;\mathrm{d}t \]
\item\textbf{math 2:} \[\sum_{i=1}^\infty\frac{-e^{i\pi}}{2^n} \]
\item\textbf{math 3:} \[\mbox{det} \begin{pmatrix} 1 & x_1 & \ldots & x_1^{n-1} \\ 1 & x_2 & \ldots & x_2^{n-1} \\ \vdots & \vdots & \ddots & \vdots \\ 1 & x_n & \ldots & x_n^{n-1} \end{pmatrix} = \prod_{1 \leq i < j \leq n} (x_j - x_i) \]
\item\textbf{math 4:} \[\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}}} \]
\item\textbf{math 5:} \[\left(\stackrel{p}{2}\right)=x^2y^{p-2}-\frac{1}{1-x}\frac{1}{1-x^2} \]
\item\textbf{math 6:} \[a_0+\frac{1}{a_1+\frac{1}{a_2+\frac{1}{a_3+\frac{1}{a_4}}}} \]
\item\textbf{math 7:} \[\left(\frac{\partial^2}{\partial x^2}+\frac{\partial^2}{\partial y^2}\right)\left|\varphi(x+\mathrm{i}y)\right|^2=0 \]
\item\textbf{math 8:} \[2^{2^{2^{x}}} \]
\item\textbf{math 9:} \[\iint_Df(x,y)\;\mathrm{d}x\;\mathrm{d}y \]
\item\textbf{math 10 (overbrace):} \[\overbrace{x+x+...+x}{k\ \mathrm{times}} \]
\item\textbf{math 11 (underbrace):} \[\underbrace{x+x+...+x}{k\ \mathrm{times}} \]
\item\textbf{math 12 (under/overbrace):} \[\underbrace{\overbrace{x+x+...+x}{k\ \mathrm{times}} \overbrace{x+x+...+x}{k\ \mathrm{times}}}{2k\ \mathrm{times}} \]
\item\textbf{math 13:} \[y_1''\ \ \ y_2''' \]
\item\textbf{math 14:} \[f(x)=\begin{cases} 1/3 & \mathrm{if}\ 0\leq x\leq1 \\ 2/3 & \mathrm{if}\ 3\leq x\leq4 \\0 & \mathrm{elsewhere} \end{cases} \]
\item\textbf{math 15:} \[\Re{z} =\frac{n\pi \dfrac{\theta +\psi}{2}}{\left(\dfrac{\theta +\psi}{2}\right)^2 + \left( \dfrac{1}{2}\log \left\lvert\dfrac{B}{A}\right\rvert\right)^2}. \]
\item\textbf{math 16:} \[\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}{3^m\left(m\,3^n+n\,3^m\right)} \]
\item\textbf{math 17:} \[\phi_n(\kappa) =\frac{1}{4\pi^2\kappa^2} \int_0^\infty\frac{\sin(\kappa R)}{\kappa R}\frac{\partial}{\partial R}\left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR \]
\item\textbf{math 18:} \[{}_pF_q(a_1,\dots,a_p;c_1,\dots,c_q;z)= \sum_{n=0}^\infty\frac{(a_1)_n\cdots(a_p)_n}{(c_1)_n\cdots(c_q)_n}\frac{z^n}{n!} \]
\item\textbf{math 19 (overset):} \[X \overset{=}{def} Y\ \ \ \ \ X \overset{=}{!} Y\ \ \ \ \ X \overset{\rightarrow}{f} Y\ \ \ \ \ \frac{f(x+\Delta x)-f(x)}{\Delta x}\overset{\longrightarrow}{\Delta x\to 0}f'(x) \]
\item\textbf{math 20 (underset):} \[X \underset{=}{\text{def (5)}} Y\ \ \ \ \ X \underset{\rightarrow}{f} Y\ \ \ \ \ \frac{f(x+\Delta x)-f(x)}{\Delta x}\underset{\longrightarrow}{\Delta x\to 0}f'(x) \]
\item\textbf{axiom of power test:} \[\forall A \, \exists P \, \forall B \, [B \in P \iff \forall C \, (C \in B \Rightarrow C \in A)] \]
\item\textbf{De Morgan's law:} $\neg(P\land Q)\iff(\neg P)\lor(\neg Q)$ or $\overline{\bigcap_{i \in I} A_{i}}\equiv\bigcup_{i \in I} \overline{A_{i}}$ or $\overline{A \cup B}\equiv\overline{A} \cap \overline{B} $
\item\textbf{quadratic formula:} \[x=\frac{-b \pm \sqrt{b^2-4ac}}{2a} \]
\item\textbf{combination:} \[\binom{n}{k} = \frac{n(n-1)...(n-k+1)}{k(k-1)\dots1}=\frac{n!}{k!(n-k)!} \]
\item\textbf{Sophomore's dream 1:} \[\int_0^1 x^{-x}\,dx = \sum_{n=1}^\infty n^{-n}(\scriptstyle{= 1.29128599706266354040728259059560054149861936827\dots)} \]
\item\textbf{Sophomore's dream 2:} \[\int_0^1 x^x \,dx = \sum_{n=1}^\infty (-1)^{n+1}n^{-n} = - \sum_{n=1}^\infty (-n)^{-n} (\scriptstyle{= 0.78343051071213440705926438652697546940768199014\dots}) \]
\item\textbf{divergence 1:} \[\operatorname{div}\vec{F} = \nabla\cdot\vec{F}=\frac{\partial U}{\partial x}+\frac{\partial V}{\partial y}+\frac{\partial W}{\partial z} \]
\item\textbf{divergence 2:} \[\overrightarrow{\operatorname{div}}\,(\mathbf{\underline{\underline{\epsilon}}}) =
\begin{bmatrix}
\frac{\partial \epsilon_{xx}}{\partial x} +\frac{\partial \epsilon_{yx}}{\partial y} +\frac{\partial \epsilon_{zx}}{\partial z} \\
\frac{\partial \epsilon_{xy}}{\partial x} +\frac{\partial \epsilon_{yy}}{\partial y} +\frac{\partial \epsilon_{zy}}{\partial z} \\
\frac{\partial \epsilon_{xz}}{\partial x} +\frac{\partial \epsilon_{yz}}{\partial y} +\frac{\partial \epsilon_{zz}}{\partial z}
\end{bmatrix} \]
\item\textbf{lim, sum ...:} \[\lim_{x\to\infty} f(x) = \binom{k}{r} + \frac{a}{b} \sum_{n=1}^\infty a_n + \displaystyle{ \left\{ \frac{1}{13} \sum_{n=1}^\infty b_n \right\} }. \]
%\item\textbf{array test:} \[ f(x) := \left\{\begin{array}[ll] x^2\sin\frac{1}{x} & \text{if} x \ne 0, \\ 0 & \text{if } x = 0 . \end{array}\right. \]
\item\textbf{Schwinger-Dyson:} \[\left\langle\psi\left|\mathcal{T}\{F \phi^j\}\right|\psi\right\rangle=\left\langle\psi\left|\mathcal{T}\{iF_{,i}D^{ij}-FS_{int,i}D^{ij}\}\right|\psi\right\rangle. \]
\item\textbf{Schrödinger's equation:} \[\left[-\frac{\hbar^2}{-2m}\frac{\partial^2}{\partial x^2}+V\right]\Psi(x)=i\hbar\frac{\partial}{\partial t}\Psi(x) \]
\item\textbf{Cauchy-Schwarz inequality:} \[\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) \]
\item\textbf{Maxwell's equations:} \[\begin{aligned}\nabla \times \vec{\mathbf{B}} -\, \frac{1}{c}\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\\nabla \times \vec{\mathbf{E}}\, +\, \frac{1}{c}\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\\nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned} \]
\end{itemize}
\end{document}

View File

@ -1,387 +1,387 @@
#include "testform.h"
#include "ui_testform.h"
#include <QDebug>
TestForm::TestForm(QWidget *parent) :
QWidget(parent),
ui(new Ui::TestForm)
{
ui->setupUi(this);
ui->cmbTestset->addItem("simple relations", "$a{\\leq}b$, $a{\\geq}b$, $a{\\equiv}b$, $a=b$, $a{\\neq}b$, $a<b$, $a>b$");
ui->cmbTestset->addItem("simple relations in different modes", "math: $a{\\leq}b$, math/no braces: $a\\leq b$, no math: a{\\leq}b, no math/no braces: a\\leq b");
ui->cmbTestset->addItem("named symbols 1", "ll: $\\ll$\\ gg: $\\gg$\\ leq: $\\leq$\\ geq: $\\geq$\\ pm: $\\pm$\\ mp: $\\mp$\\ ");
ui->cmbTestset->addItem("named symbols 2", "nexists: $\\nexists$\\ ni: $\\ni$\\ notni: $\\notni$\\ circ: $\\circ$\\ sim: $\\sim$\\ emptyset: $\\emptyset$\\ odot: $\\odot$\\ ominus: $\\ominus$\\ subsetnot: $\\subsetnot$\\ bot: $\\bot$");
ui->cmbTestset->addItem("named symbols 3", "leftharpoonup: $\\leftharpoonup$\\ rightharpoonup: $\\rightharpoonup$\\ upharpoonleft: $\\upharpoonleft$\\ downharpoonleft: $\\downharpoonleft$\\ leftrightharpoon: $\\leftrightharpoon$\\ rightleftharpoon: $\\rightleftharpoon$");
ui->cmbTestset->addItem("named symbols 4", "coprod: $\\coprod$\\ leftharpoondown: $\\leftharpoondown$\\ rightharpoondown: $\\rightharpoondown$\\ upharpoonright: $\\upharpoonright$\\ downharpoonright: $\\downharpoonright$\\ nwarrow: $\\nwarrow$\\ nearrow: $\\nearrow$\\ ");
ui->cmbTestset->addItem("named symbols 5", "searrow: $\\searrow$\\ swarrow: $\\swarrow$\\ mapsto: $\\mapsto$\\ div: $\\div$\\ multimap: $\\multimap$\\ maporiginal: $\\maporiginal$\\ mapimage: $\\mapimage$\\ ");
ui->cmbTestset->addItem("named symbols 6", "times: $\\times$\\ propto: $\\propto$\\ bullet: $\\bullet$\\ neq: $\\neq$\\ ne: $\\ne$\\ equiv: $\\equiv$\\ approx: $\\approx$\\ otimes: $\\otimes$\\ oplus: $\\oplus$");
ui->cmbTestset->addItem("named symbols 7", "oslash: $\\oslash$\\ cap: $\\cap$\\ land: $\\land$\\ cup: $\\cup$\\ lor: $\\lor$\\ supset: $\\supset$\\ supseteq: $\\supseteq$\\ supsetnot: $\\supsetnot$\\ subset: $\\subset$");
ui->cmbTestset->addItem("named symbols 8", "subseteq: $\\subseteq$\\ in: $\\in$\\ notin: $\\notin$\\ cdot: $\\cdot$\\ wedge: $\\wedge$\\ vee: $\\vee$\\ cong: $\\cong$\\ bot: $\\bot$");
ui->cmbTestset->addItem("symbols", "$\\ll\\gg\\leq\\geq\\leftrightarrow\\leftarrow\\rightarrow\\to\\uparrow\\downarrow\\updownarrow\\Leftrightarrow\\iff\\Leftarrow\\Rightarrow\\Uparrow\\Downarrow\\Updownarrow\\pm\\mp\\nexists\\ni\\notni\\circ\\sim\\emptyset\\odot\\ominus\\subsetnot\\bot\\leftharpoonup\\rightharpoonup\\upharpoonleft\\downharpoonleft\\leftrightharpoon\\rightleftharpoon\\coprod\\leftharpoondown\\rightharpoondown\\upharpoonright\\downharpoonright\\nwarrow\\nearrow\\searrow\\swarrow\\mapsto\\div\\multimap\\maporiginal\\mapimage\\times\\propto\\bullet\\neq\\ne\\equiv\\approx\\otimes\\oplus\\oslash\\cap\\land\\cup\\lor\\supset\\supseteq\\supsetnot\\subset\\subseteq\\in\\notin\\cdot\\wedge\\vee\\cong\\bot$");
ui->cmbTestset->addItem("std dev", "$\\sigma_x=\\sqrt{\\langle (x-\\langle x\\rangle)^2\\rangle}=\\sqrt{\\frac{1}{N-1}\\cdot\\left( \\sum_{i=1}^N{x_i}^2-\\frac{1}{N}\\cdot\\left(\\sum_{i=1}^Nx_i\\right)^2\\right)}$");
ui->cmbTestset->addItem("std dev 2", "$\\sigma_x=\\sqrt{\\langle (x-\\langle x\\rangle)^2\\rangle}=\\sqrt{\\frac{1}{N-1}\\cdot\\left( \\sum_{i=1}^Nx_i^2-\\frac{1}{N}\\cdot\\left(\\sum_{i=1}^Nx_i\\right)^2\\right)}$");
ui->cmbTestset->addItem("rotation matrix", "$\\mathrm{\\mathbf{M}}(\\alpha) = \\left(\\begin{matrix}\\cos(\\alpha)+n_x^2\\cdot (1-\\cos(\\alpha)) & n_x\\cdot n_y\\cdot (1-\\cos(\\alpha))-n_z\\cdot \\sin(\\alpha) & n_x\\cdot n_z\\cdot (1-\\cos(\\alpha))+n_y\\cdot \\sin(\\alpha)\\\\n_x\\cdot n_y\\cdot (1-\\cos(\\alpha))+n_z\\cdot \\sin(\\alpha) & \\cos(\\alpha)+n_y^2\\cdot (1-\\cos(\\alpha)) & n_y\\cdot n_z\\cdot (1-\\cos(\\alpha))-n_x\\cdot \\sin(\\alpha)\\\\n_z\\cdot n_x\\cdot (1-\\cos(\\alpha))-n_y\\cdot \\sin(\\alpha) & n_z\\cdot n_y\\cdot (1-\\cos(\\alpha))+n_x\\cdot \\sin(\\alpha) & \\cos(\\alpha)+n_z^2\\cdot (1-\\cos(\\alpha))\\end{matrix}\\right)$");
ui->cmbTestset->addItem("like in label at bottom (no MM)", "\\left(\\left[\\sqrt{2\\pi\\cdot\\int_{-\\infty}^\\infty f(x)\\;\\mathrm{d}x}\\right]\\right)");
ui->cmbTestset->addItem("like in label at bottom (MM)", "$\\left(\\left[\\sqrt{2\\pi\\cdot\\int_{-\\infty}^\\infty f(x)\\;\\mathrm{d}x}\\right]\\right)$");
ui->cmbTestset->addItem("text 0", "text");
ui->cmbTestset->addItem("text 1", "text \\mathbf{bold}");
ui->cmbTestset->addItem("text 2", "text \\mathbf{bold}\\textcolor{red}{RED}");
ui->cmbTestset->addItem("decoration", "$\\vec{x}\\vec{X}\\vec{\\psi} -- \\dot{x}\\dot{X}\\dot{\\psi} -- \\ddot{x}\\ddot{X}\\ddot{\\psi} -- \\overline{x}\\overline{X}\\overline{\\psi} -- \\underline{x}\\underline{X}\\underline{\\psi} -- \\hat{x}\\hat{X}\\hat{\\psi} -- \\tilde{x}\\tilde{X}\\tilde{\\psi} -- \\uul{x}\\uul{X}\\uul{\\psi} -- \\ool{x}\\ool{X}\\ool{\\psi} -- \\bar{x}\\bar{X}\\bar{\\psi} -- \\arrow{x}\\arrow{X}\\arrow{\\psi}$");
ui->cmbTestset->addItem("mathtest", "This is normal text: $this is math:\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle\\ \\ \\ g(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1} \\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\left\\{\\va\\left|\\|\\va\\|_2\\geq2\\right.\\right\\} \\vr\\vR\\frac{\\sqrt{\\sqrt{\\sqrt{\\sum_{i=0}^\\infty \\hat{i}^2}+y^\\alpha}+1}}{\\dot{v}\\equiv\\ddot{r}}\\argmin_{\\vec{k}}\\sum_{\\sqrt{i}=0}^{N}\\int_{x_0}^{x_1}\\left(\\left(\\left(x\\right)\\right)\\right)\\underbrace{\\left[\\left\\{\\frac{\\partial f}{\\partial x}\\right\\}\\cdot\\frac{1}{2}\\right]}{\\text{underbraced text \\hbar}}\\cdots\\frac{\\sqrt{\\sum_{i=0}^2 \\hat{i}^2}+y^\\alpha}{\\dot{v}\\equiv\\ddot{r}}, \\hat{t}\\hat{T} \\overbrace{\\left|\\sqrt{x\\cdot Y}\\right|}{\\propto\\bbN\\circ\\bbZ} \\left<\\arrow{x(\\tau)}\\cdot\\vec{R}(t+\\bar{\\tau})\\right> \\alpha\\beta\\gamma\\delta\\epsilon\\Gamma\\Delta\\Theta\\Omega \\left\\_\\left~\\cbrt{\\hbar\\omega}\\right~\\right\\_$");
ui->cmbTestset->addItem("upper/lower parantheses test:", "$\\text{bblabla} \\frac{1}{2}\\cdot\\left(\\frac{1}{\\mathrm{e}^x+\\mathrm{e}^{-x}}\\right)\\cdot\\left(\\frac{1}{\\frac{1+2}{5+x}}\\right)\\cdot\\left(\\frac{1}{\\exp\\left[-\\frac{y^2}{\\sqrt{x}}\\right]\\cdot\\exp\\left[-\\frac{1}{\\frac{1}{2}}\\right]}\\right) $");
ui->cmbTestset->addItem("ACF test", "$g_{rg}^{ab}(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-\\frac{1}{2}}$");
ui->cmbTestset->addItem("MSD test", "$\\mathrm{MSD}(\\tau)\\equiv\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle=2n\\cdot\\frac{K_\\alpha}{\\Gamma(1+\\alpha)}\\cdot\\tau^\\alpha$");
ui->cmbTestset->addItem("f() test", "$f(\\vec{x})=\\frac{1}{\\sqrt{2\\pi\\cdot\\sigma^2}}\\exp\\left(-\\frac{(\\vec{x}-\\vec{x}_0)^2}{\\sigma^2}\\right)$");
ui->cmbTestset->addItem("chi^2 test", "$\\vec{p}^\\ast=\\argmax\\limits_{\\vec{p}}\\chi^2=\\argmax\\limits_{\\vec{p}}\\sum\\limits_{i=1}^N\\left|\\frac{\\hat{f}_i-f(x_i;\\vec{p})}{\\sigma_i}\\right|^2$");
ui->cmbTestset->addItem("symbol test", "\\vdots\\cdots\\ddots\\iddots\\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\sum\\int \\iint \\oint \\prod \\leftrightarrow \\leftarrow\\Leftarrow\\rightarrow\\Rightarrow\\pm\\mp\\leq\\geq\\ll\\gg\\hbar\\euro\\bbC\\bbH\\bbN\\bbP\\bbQ\\bbZ\\bbR\\Angstrom\\Alef\\Bet\\Gimel\\Dalet\\nexists\\ni\\notni\\circ\\tilde\\oiint\\oiiint\\emptyset\\odot\\ominus\\subsetnot\\DC\\bot\\cdots\\perthousand\\leftharpoonup\\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\coprod \\leftharpoondown \\rightharpoondown \\nwarrow \\nearrow \\mapsto \\cent \\pound \\yen \\div \\multimap \\maporiginal \\mapimage \\bigcap \\bigcup \\benzene \\times \\cdot \\propto \\equiv \\Im \\Re \\ ");
ui->cmbTestset->addItem("arrowtest 1", "$\\leftarrow \\longleftarrow \\Leftarrow \\Longleftarrow \\rightarrow \\longrightarrow \\Rightarrow \\Longrightarrow \\uparrow \\Uparrow \\downarrow \\Downarrow \\leftrightarrow \\Leftrightarrow \\longleftrightarrow \\Longleftrightarrow$");
ui->cmbTestset->addItem("arrowtest 2", "$\\nwarrow \\nearrow \\searrow \\swarrow \\mapsto \\leftharpoonup \\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\leftharpoondown \\rightharpoondown \\upharpoonright \\downharpoonright $");
ui->cmbTestset->addItem("math: blackboard", "$\\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: bf", "$\\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: rm", "$\\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: cal", "$\\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("subscript test", "$r_{123}\\ \\ r_{\\frac{1}{2}}$");
ui->cmbTestset->addItem("subscript0 test", "$r_{123}$");
ui->cmbTestset->addItem("subscript1 test", "$r_{123}\\ $");
ui->cmbTestset->addItem("subscript2 test", "$r_{123}\\ \\ $");
ui->cmbTestset->addItem("subscript3 test", "$r_{123}r_{\\frac{1}{2}}$");
ui->cmbTestset->addItem("superscript test", "$r^{123}\\ \\ r^{\\frac{1}{2}}$");
ui->cmbTestset->addItem("superscript0 test", "$r^{123}$");
ui->cmbTestset->addItem("superscript1 test", "$r^{123}\\ $");
ui->cmbTestset->addItem("superscript2 test", "$r^{123}\\ \\ $");
ui->cmbTestset->addItem("superscript3 test", "$r^{123}r^{\\frac{1}{2}}$");
ui->cmbTestset->addItem("asuperscript test", "$a^{123}\\ \\ a^{\\frac{1}{2}}$");
ui->cmbTestset->addItem("asuperscript0 test", "$a^{123}$");
ui->cmbTestset->addItem("gsuperscript1 test", "$g^{123}\\ $");
ui->cmbTestset->addItem("gsuperscript2 test", "$g^{123}\\ \\ $");
ui->cmbTestset->addItem("gsuperscript3 test", "$g^{123}g^{\\frac{1}{2}}$");
ui->cmbTestset->addItem("frac test", "$\\frac{a}{b}+\\frac{g}{a}-\\frac{a^2}{b^2}\\cdot\\frac{a^2}{b^{\\frac{1}{2}}}$");
ui->cmbTestset->addItem("tfrac test", "$\\tfrac{a}{b}+\\tfrac{g}{a}-\\tfrac{a^2}{b^2}\\cdot\\tfrac{a^2}{b^{\\tfrac{1}{2}}}$");
ui->cmbTestset->addItem("dfrac test", "$\\dfrac{a}{b}+\\dfrac{g}{a}-\\dfrac{a^2}{b^2}\\cdot\\dfrac{a^2}{b^{\\dfrac{1}{2}}}$");
ui->cmbTestset->addItem("stackrel test", "$\\stackrel{a}{b}+\\stackrel{g}{a}-\\stackrel{a^2}{b^2}\\cdot\\stackrel{a^2}{b^{\\stackrel{1}{2}}}$");
ui->cmbTestset->addItem("brace0 test", "\\langle\\langle -- $\\langle\\langle$");
ui->cmbTestset->addItem("brace1 test", "\\langle\\langle r^{123} -- $\\langle\\langle r^{123}$");
ui->cmbTestset->addItem("brace2 test", "\\langle\\langle r^{123}\\rangle\\rangle -- $\\langle\\langle r^{123}\\rangle\\rangle$");
ui->cmbTestset->addItem("brace3 test", "\\left\\langle r^{123}\\right\\rangle -- $\\left\\langle r^{123}\\right\\rangle$");
ui->cmbTestset->addItem("brace4 test", "\\left\\langle\\left\\langle\\left\\langle r^{123}\\right\\rangle\\right\\rangle\\right\\rangle -- $\\left\\langle\\left\\langle\\left\\langle r^{123}\\right\\rangle\\right\\rangle\\right\\rangle$");
ui->cmbTestset->addItem("brace5 test: ( )", "\\left(\\left(\\left( r^{123}\\right)\\right)\\right) -- $\\left(\\left(\\left( r^{123}\\right)\\right)\\right)$");
ui->cmbTestset->addItem("brace6 test: [ ]", "\\left[\\left[\\left[ r^{123}\\right]\\right]\\right] -- $\\left[\\left[\\left[ r^{123}\\right]\\right]\\right]$");
ui->cmbTestset->addItem("brace7 test: { }", "\\left\\{\\left\\{\\left\\{ r^{123}\\right\\}\\right\\}\\right\\} -- $\\left\\{\\left\\{\\left\\{ r^{123}\\right\\}\\right\\}\\right\\}$");
ui->cmbTestset->addItem("brace8 test: || ||", "\\left\\|\\left\\|\\left\\| r^{123}\\right\\|\\right\\|\\right\\| -- $\\left\\|\\left\\|\\left\\| r^{123}\\right\\|\\right\\|\\right\\|$");
ui->cmbTestset->addItem("brace9 test: | |", "\\left|\\left|\\left| r^{123}\\right|\\right|\\right| -- $\\left|\\left|\\left| r^{123}\\right|\\right|\\right|$");
ui->cmbTestset->addItem("brace10 test", "\\left\\{\\left[\\left( r^{123}\\right)\\right]\\right\\} -- $\\left\\{\\left[\\left( r^{123}\\right)\\right]\\right\\}$");
ui->cmbTestset->addItem("brace11 test: floor", "\\left\\lfloor\\left\\lfloor\\left\\lfloor r^{123}\\right\\rfloor\\right\\rfloor\\right\\rfloor -- $\\left\\lfloor\\left\\lfloor\\left\\lfloor r^{123}\\right\\rfloor\\right\\rfloor\\right\\rfloor$");
ui->cmbTestset->addItem("brace12 test: ceil", "\\left\\lceil\\left\\lceil\\left\\lceil r^{123}\\right\\rceil\\right\\rceil\\right\\rceil -- $\\left\\lceil\\left\\lceil\\left\\lceil r^{123}\\right\\rceil\\right\\rceil\\right\\rceil$");
ui->cmbTestset->addItem("sub-, superscript test", "r^{1234}_{321} r_{321}^{1234} -- $r^{1234}_{321} r_{321}^{1234} -- \\kappa^2 -- \\kappa_2 -- \\kappa_2^2$");
ui->cmbTestset->addItem("super-, subscript test", "r^{123}_{4321} r_{4321}^{123} -- $r^{123}_{4321} r_{4321}^{123} -- \\kappa^2 -- \\kappa_2 -- \\kappa_2^2$");
//ui->cmbTestset->addItem("", "");
ui->cmbTestset->addItem("math 1", "$f(x)=\\int_{-\\infty}^xe^{-t^2}\\;\\mathrm{d}t$");
ui->cmbTestset->addItem("math 2", "$\\sum_{i=1}^\\infty\\frac{-e^{i\\pi}}{2^n}$");
ui->cmbTestset->addItem("math 3", "$\\mbox{det} \\begin{pmatrix} 1 & x_1 & \\ldots & x_1^{n-1} \\\\ 1 & x_2 & \\ldots & x_2^{n-1} \\\\ \\vdots & \\vdots & \\ddots & \\vdots \\\\ 1 & x_n & \\ldots & x_n^{n-1} \\end{pmatrix} = \\prod_{1 \\leq i < j \\leq n} (x_j - x_i) $");
ui->cmbTestset->addItem("math 4", "$\\sqrt{1+\\sqrt{1+\\sqrt{1+\\sqrt{1+\\sqrt{1+\\sqrt{1+x}}}}}}$");
ui->cmbTestset->addItem("math 5", "$\\left(\\stackrel{p}{2}\\right)=x^2y^{p-2}-\\frac{1}{1-x}\\frac{1}{1-x^2}$");
ui->cmbTestset->addItem("math 6", "$a_0+\\frac{1}{a_1+\\frac{1}{a_2+\\frac{1}{a_3+\\frac{1}{a_4}}}}$");
ui->cmbTestset->addItem("math 7", "$\\left(\\frac{\\partial^2}{\\partial x^2}+\\frac{\\partial^2}{\\partial y^2}\\right)\\left|\\varphi(x+\\mathrm{i}y)\\right|^2=0$");
ui->cmbTestset->addItem("math 8", "$2^{2^{2^{x}}}$");
ui->cmbTestset->addItem("math 9", "$\\iint_Df(x,y)\\;\\mathrm{d}x\\;\\mathrm{d}y$");
ui->cmbTestset->addItem("math 10 (overbrace)", "$\\overbrace{x+x+...+x}{k\\ \\mathrm{times}}$");
ui->cmbTestset->addItem("math 11 (underbrace)", "$\\underbrace{x+x+...+x}{k\\ \\mathrm{times}}$");
ui->cmbTestset->addItem("math 12 (under/overbrace)", "$\\underbrace{\\overbrace{x+x+...+x}{k\\ \\mathrm{times}} \\overbrace{x+x+...+x}{k\\ \\mathrm{times}}}{2k\\ \\mathrm{times}}$");
ui->cmbTestset->addItem("math 13", "$y_1''\\ \\ \\ y_2'''$");
ui->cmbTestset->addItem("math 14", "$f(x)=\\begin{cases} 1/3 & \\mathrm{if}\\ 0\\leq x\\leq1 \\\\ 2/3 & \\mathrm{if}\\ 3\\leq x\\leq4 \\\\0 & \\mathrm{elsewhere} \\end{cases}$");
ui->cmbTestset->addItem("math 15", "$\\Re{z} =\\frac{n\\pi \\dfrac{\\theta +\\psi}{2}}{\\left(\\dfrac{\\theta +\\psi}{2}\\right)^2 + \\left( \\dfrac{1}{2}\\log \\left\\lvert\\dfrac{B}{A}\\right\\rvert\\right)^2}.$");
ui->cmbTestset->addItem("math 16", "$\\sum_{m=1}^\\infty\\sum_{n=1}^\\infty\\frac{m^2\\,n}{3^m\\left(m\\,3^n+n\\,3^m\\right)}$");
ui->cmbTestset->addItem("math 17", "$\\phi_n(\\kappa) =\\frac{1}{4\\pi^2\\kappa^2} \\int_0^\\infty\\frac{\\sin(\\kappa R)}{\\kappa R}\\frac{\\partial}{\\partial R}\\left[R^2\\frac{\\partial D_n(R)}{\\partial R}\\right]\\,dR$");
ui->cmbTestset->addItem("math 18", "${}_pF_q(a_1,\\dots,a_p;c_1,\\dots,c_q;z)= \\sum_{n=0}^\\infty\\frac{(a_1)_n\\cdots(a_p)_n}{(c_1)_n\\cdots(c_q)_n}\\frac{z^n}{n!}$");
ui->cmbTestset->addItem("math 19 (overset)", "$X \\overset{=}{def} Y$\\ \\ \\ \\ \\ $X \\overset{=}{!} Y$\\ \\ \\ \\ \\ $X \\overset{\\rightarrow}{f} Y$\\ \\ \\ \\ \\ $\\frac{f(x+\\Delta x)-f(x)}{\\Delta x}\\overset{\\longrightarrow}{\\Delta x\\to 0}f'(x)$");
ui->cmbTestset->addItem("math 20 (underset)", "$X \\underset{=}{\\text{def (5)}} Y$\\ \\ \\ \\ \\ $X \\underset{\\rightarrow}{f} Y$\\ \\ \\ \\ \\ $\\frac{f(x+\\Delta x)-f(x)}{\\Delta x}\\underset{\\longrightarrow}{\\Delta x\\to 0}f'(x)$");
ui->cmbTestset->addItem("Jacobi Matrix and VarCov matrix", "$J_{ij}= \\left.\\frac{\\partial f(x,\\vec{p})}{\\partial p_i}\\right|_{\\vec{p},x=x_j}\\ \\ \\ \\ \\ \\mat{C}=\\left(\\mat{J}^\\mathrm{T}\\ J\\right)^{-1}\\ \\ \\ \\ \\ test: \\left|\\frac{\\partial f(x,\\vec{p})}{\\partial p_i}\\right|_{\\vec{p},x=x_j}^2$");
ui->cmbTestset->addItem("operator test (textmode)", "x=0\\ \\ y>0\\ \\ x+y\\ \\ -1\\ \\ x-2\\ \\ x\\cdot y\\ \\ x\\geq 4\\ \\ x~4");
ui->cmbTestset->addItem("operator test (mathmode)", "$x=0\\ \\ y>0\\ \\ x+y\\ \\ -1\\ \\ x-2\\ \\ x\\cdot y\\ \\ x\\geq 4\\ \\ x~4$");
ui->cmbTestset->addItem("color test", "\\textcolor{red}{RED}\\textcolor{blue}{BLUE}");
ui->cmbTestset->addItem("boxed test", "test: \\boxed{boxed text} in the middle");
ui->cmbTestset->addItem("mathboxed test", "\\fbox{2^{2^{\\colorbox{red}{2^{x}}}}}");
ui->cmbTestset->addItem("axiom of power test", "$\\forall A \\, \\exists P \\, \\forall B \\, [B \\in P \\iff \\forall C \\, (C \\in B \\Rightarrow C \\in A)]$");
ui->cmbTestset->addItem("De Morgan's law", "$\\neg(P\\land Q)\\iff(\\neg P)\\lor(\\neg Q)$ or $\\overline{\\bigcap_{i \\in I} A_{i}}\\equiv\\bigcup_{i \\in I} \\overline{A_{i}}$ or $\\overline{A \\cup B}\\equiv\\overline{A} \\cap \\overline{B}$");
ui->cmbTestset->addItem("quadratic formula", "$x=\\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}$");
ui->cmbTestset->addItem("combination", "$\\binom{n}{k} = \\frac{n(n-1)...(n-k+1)}{k(k-1)\\dots1}=\\frac{n!}{k!(n-k)!}$");
ui->cmbTestset->addItem("Sophomore's dream 1", "$\\int_0^1 x^{-x}\\,dx = \\sum_{n=1}^\\infty n^{-n}(\\scriptstyle{= 1.29128599706266354040728259059560054149861936827\\dots)}$");
ui->cmbTestset->addItem("Sophomore's dream 2", "$\\int_0^1 x^x \\,dx = \\sum_{n=1}^\\infty (-1)^{n+1}n^{-n} = - \\sum_{n=1}^\\infty (-n)^{-n} (\\scriptstyle{= 0.78343051071213440705926438652697546940768199014\\dots})$");
ui->cmbTestset->addItem("divergence 1", "$\\operatorname{div}\\vec{F} = \\nabla\\cdot\\vec{F}=\\frac{\\partial U}{\\partial x}+\\frac{\\partial V}{\\partial y}+\\frac{\\partial W}{\\partial z}$");
ui->cmbTestset->addItem("divergence 2", "$\\overrightarrow{\\operatorname{div}}\\,(\\mathbf{\\underline{\\underline{\\epsilon}}}) = "
"\\begin{bmatrix}"
"\\frac{\\partial \\epsilon_{xx}}{\\partial x} +\\frac{\\partial \\epsilon_{yx}}{\\partial y} +\\frac{\\partial \\epsilon_{zx}}{\\partial z} \\\\"
"\\frac{\\partial \\epsilon_{xy}}{\\partial x} +\\frac{\\partial \\epsilon_{yy}}{\\partial y} +\\frac{\\partial \\epsilon_{zy}}{\\partial z} \\\\"
"\\frac{\\partial \\epsilon_{xz}}{\\partial x} +\\frac{\\partial \\epsilon_{yz}}{\\partial y} +\\frac{\\partial \\epsilon_{zz}}{\\partial z}"
"\\end{bmatrix}$");
ui->cmbTestset->addItem("lim, sum ...", "$\\lim_{x\\to\\infty} f(x) = \\binom{k}{r} + \\frac{a}{b} \\sum_{n=1}^\\infty a_n + \\displaystyle{ \\left\\{ \\frac{1}{13} \\sum_{n=1}^\\infty b_n \\right\\} }.$");
ui->cmbTestset->addItem("array test", "$f(x) := \\left\\{\\begin{array} x^2 \\sin \\frac{1}{x} & \\textrm{if } x \\ne 0, \\\\ 0 & \\textrm{if } x = 0 . \\end{array}\\right.$");
ui->cmbTestset->addItem("Schwinger-Dyson", "$\\left\\langle\\psi\\left|\\mathcal{T}\\{F \\phi^j\\}\\right|\\psi\\right\\rangle=\\left\\langle\\psi\\left|\\mathcal{T}\\{iF_{,i}D^{ij}-FS_{int,i}D^{ij}\\}\\right|\\psi\\right\\rangle.$");
ui->cmbTestset->addItem(QLatin1String("Schrödinger's equation"), "$\\left[-\\frac{\\hbar^2}{2m}\\frac{\\partial^2}{\\partial x^2}+V\\right]\\Psi(x)=\\mathrm{i}\\hbar\\frac{\\partial}{\\partial t}\\Psi(x)$");
ui->cmbTestset->addItem("Cauchy-Schwarz inequality", "$\\left( \\sum_{k=1}^n a_k b_k \\right)^2 \\leq \\left( \\sum_{k=1}^n a_k^2 \\right) \\left( \\sum_{k=1}^n b_k^2 \\right)$");
ui->cmbTestset->addItem("Maxwell's equations", "$\\begin{aligned}\\nabla \\times \\vec{\\mathbf{B}} -\\, \\frac{1}{c}\\, \\frac{\\partial\\vec{\\mathbf{E}}}{\\partial t} & = \\frac{4\\pi}{c}\\vec{\\mathbf{j}} \\\\ \\nabla \\cdot \\vec{\\mathbf{E}} & = 4 \\pi \\rho \\\\\\nabla \\times \\vec{\\mathbf{E}}\\, +\\, \\frac{1}{c}\\, \\frac{\\partial\\vec{\\mathbf{B}}}{\\partial t} & = \\vec{\\mathbf{0}} \\\\\\nabla \\cdot \\vec{\\mathbf{B}} & = 0 \\end{aligned}$");
ui->cmbTestset->addItem("Langevin Equation", "$m \\dot{v}(t) = -\\gamma v(t) + F(x,t)+ f(t)$");
ui->cmbTestset->addItem("Fokker-Planck Equation", "$\\frac{\\partial}{\\partial t}P(y,t)=-\\frac{\\partial}{\\partial y}\\left[ A(y,t)P(y,t)\\right] +\\frac{\\Gamma}{2}\\frac{\\partial^2}{\\partial y^2}\\left[ P(y,t)\\right]$");
ui->cmbTestset->addItem("Hamilton Equations of motion", "$\\mathcal{H}(\\mathbf{q},\\mathbf{p})=\\frac{\\mathbf{p}^2}{2\\,m}+V(\\mathbf{q})\\ \\ \\ \\text{and}\\ \\ \\ \\dot{q}_k =\\frac{p_k}{m}\\ ,\\ \\dot{p}_k = - \\frac{\\partial V}{\\partial q_k}$");
ui->cmbTestset->addItem("Gaussian Distrubution", "$f(x | \\mu,\\sigma^2)=\\frac{1}{\\sqrt{2\\pi\\sigma^2}}\\operatorname{exp}\\left(-\\frac{(x-\\mu)^2}{2\\sigma^2}\\right)=\\frac{1}{\\sqrt{2\\pi\\sigma^2}} e^{-\\frac{(x-\\mu)^2}{2\\sigma^2}}\\quad -\\infty<x<\\infty$");
ui->cmbTestset->addItem("User-Editable Text");
//
//ui->cmbTestset->addItem("", "$$");
//ui->cmbTestset->addItem("", "$$");
//ui->cmbTestset->addItem("", "");
ui->cmbTestset->setCurrentIndex(0);
ui->labMath->setMath("\\left(\\left[\\sqrt{2\\pi\\cdot\\int_{-\\infty}^\\infty f(x)\\;\\mathrm{d}x}\\right]\\right)");
ui->cmbFont->setCurrentIndex(1);
}
TestForm::~TestForm()
{
delete ui;
}
#define W 2000
#define H 2000
#define X1 15
#define Y1 50
double TestForm::draw(QPainter& painter, double X, double YY, JKQTmathText& mt, QString name, double& durationSizingMS, double&durationTimingMS) {
double Y=YY;
painter.save();
ht.start();
QSizeF s=mt.getSize(painter);
Y=Y+mt.getAscent(painter);
durationSizingMS=ht.get_time()/1000.0;
qDebug()<<" sizing in "<<durationSizingMS<<" ms\n";
QPen p=painter.pen();
p.setColor("lightcoral");
p.setStyle(Qt::DashLine);
p.setWidth(2);
painter.setPen(p);
QRectF r(X, Y-mt.getAscent(painter),s.width(), s.height());
painter.drawRect(r);
p.setColor("lightblue");
painter.setPen(p);
painter.drawLine(X, Y, X+s.width(), Y);
ht.start();
p.setStyle(Qt::SolidLine);
p.setWidth(1);
p.setColor("black");
painter.setPen(p);
mt.draw(painter, X, Y, ui->chkBoxes->isChecked());
durationTimingMS=ht.get_time()/1000.0;
qDebug()<<" drawing in "<<durationTimingMS<<" ms";
p.setColor("blue");
painter.setPen(p);
QFont f;
f.setFamily("sans serif");
f.setUnderline(true);
f.setPointSize(10);
painter.setFont(f);
painter.drawText(X, Y-mt.getAscent(painter)-6, name+":");
painter.restore();
qDebug()<<name<<": width="<<s.width()<<" height="<<s.height()<<" ascent="<<mt.getAscent(painter)<<" descent="<<mt.getDescent(painter);
return mt.getDescent(painter)+mt.getAscent(painter)+40;
}
QTreeWidgetItem *TestForm::createTree(JKQTmathText::MTnode *node, QTreeWidgetItem* parent)
{
QString name;
JKQTmathText::MTtextNode* txtN=dynamic_cast<JKQTmathText::MTtextNode*>(node);
JKQTmathText::MTwhitespaceNode* spN=dynamic_cast<JKQTmathText::MTwhitespaceNode*>(node);
JKQTmathText::MTsymbolNode* symN=dynamic_cast<JKQTmathText::MTsymbolNode*>(node);
JKQTmathText::MTlistNode* lstN=dynamic_cast<JKQTmathText::MTlistNode*>(node);
JKQTmathText::MTinstruction1Node* inst1N=dynamic_cast<JKQTmathText::MTinstruction1Node*>(node);
JKQTmathText::MTsubscriptNode* subN=dynamic_cast<JKQTmathText::MTsubscriptNode*>(node);
JKQTmathText::MTsuperscriptNode* superN=dynamic_cast<JKQTmathText::MTsuperscriptNode*>(node);
JKQTmathText::MTbraceNode* braceN=dynamic_cast<JKQTmathText::MTbraceNode*>(node);
JKQTmathText::MTsqrtNode* sqrtN=dynamic_cast<JKQTmathText::MTsqrtNode*>(node);
JKQTmathText::MTfracNode* fracN=dynamic_cast<JKQTmathText::MTfracNode*>(node);
JKQTmathText::MTmatrixNode* matrixN=dynamic_cast<JKQTmathText::MTmatrixNode*>(node);
JKQTmathText::MTdecoratedNode* decoN=dynamic_cast<JKQTmathText::MTdecoratedNode*>(node);
QTreeWidgetItem* ti=nullptr;
if (parent) ti=new QTreeWidgetItem(parent);
else ti=new QTreeWidgetItem(ui->tree);
if (decoN) {
name=QString("MTdecoratedNode: mode='%1'").arg(JKQTmathText::decorationToString(decoN->get_decoration()));
if (decoN->get_child()) ti->addChild(createTree(decoN->get_child(), ti));
} else if (matrixN) {
int l=matrixN->get_lines();
int c=matrixN->get_columns();
name=QString("MTmatrixNode: l*c=%1*%2").arg(l).arg(c);
QVector<QVector<JKQTmathText::MTnode*> > children=matrixN->get_children();
for (int y=0; y<l; y++) {
for (int x=0; x<c; x++) {
if (children[y].at(x)!=nullptr) {
QTreeWidgetItem* it=createTree(children[y].at(x), ti);
it->setText(0, QString("(%1,%2):").arg(y).arg(x)+it->text(0));
ti->addChild(it);
}
}
}
} else if (fracN) {
name=QString("MTfracNode: mode='%1'").arg(JKQTmathText::fracModeToString(fracN->get_mode()));
if (fracN->get_child1()) ti->addChild(createTree(fracN->get_child1(), ti));
if (fracN->get_child2()) ti->addChild(createTree(fracN->get_child2(), ti));
} else if (sqrtN) {
name=QString("MTsqrtNode: deg=%1").arg(sqrtN->get_degree());
if (sqrtN->get_child()) ti->addChild(createTree(sqrtN->get_child(), ti));
} else if (braceN) {
name=QString("MTbraceNode: l='%1', r='%2', showR=%3").arg(braceN->get_openbrace()).arg(braceN->get_closebrace()).arg(braceN->get_showRightBrace());
if (braceN->get_child()) ti->addChild(createTree(braceN->get_child(), ti));
} else if (superN) {
name=QString("MTsuperscriptNode");
if (superN->get_child()) ti->addChild(createTree(superN->get_child(), ti));
} else if (subN) {
name=QString("MTsubscriptNode");
if (subN->get_child()) ti->addChild(createTree(subN->get_child(), ti));
} else if (inst1N) {
name=QString("MTinstruction1Node: \'%1\'").arg(inst1N->get_name());
if (inst1N->get_child()) ti->addChild(createTree(inst1N->get_child(), ti));
} else if (lstN) {
name=QString("MTlistNode");
QList<JKQTmathText::MTnode*> list=lstN->get_nodes();
for (int i=0; i<list.size(); i++) {
ti->addChild(createTree(list[i], ti));
}
} else if (symN) {
name=QString("MTsymbolNode: \'%1\'").arg(symN->get_symbolName());
} else if (spN) {
name=QString("MTwhitespaceNode :\'%1\'").arg(txtN->get_text());
} else if (txtN) {
name=QString("MTtextNode: \'%1\'").arg(txtN->get_text());
} else {
name=QString("unknown");
}
ti->setText(0,name);
/*
QString space="";
QTreeWidgetItem* p=ti->parent();
while (p) {
space+=" ";
p=p->parent();
}
qDebug()<<space<<"createTree()";
*/
return ti;
}
void TestForm::updateMath()
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString mathTest="";
//QString symbolTest="\\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\sum\\int \\iint \\oint \\prod \\leftrightarrow \\leftarrow\\Leftarrow\\rightarrow\\Rightarrow\\pm\\mp\\leq\\geq\\ll\\gg\\hbar\\euro\\bbC\\bbH\\bbN\\bbP\\bbQ\\bbZ\\bbR\\Angstrom\\Alef\\Bet\\Gimel\\Dalet\\nexists\\ni\\notni\\circ\\tilde\\oiint\\oiiint\\emptyset\\odot\\ominus\\subsetnot\\DC\\bot\\cdots\\perthousand\\leftharpoonup\\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\coprod \\leftharpoondown \\rightharpoondown \\nwarrow \\nearrow \\mapsto \\cent \\pound \\yen \\div \\multimap \\maporiginal \\mapimage \\bigcap \\bigcup \\benzene \\times \\cdot \\propto \\equiv \\Im \\Re \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ ";
//QString mathTest="$\\left\\|\\stackrel{1}{2}\\right\\|\\cdot\\left|\\begin{Bmatrix}1123&2^2&\\frac{3}{4}\\\\4&5_5&6\\\\72_8&8_{\\text{längerer Index}}&9&10&11\\end{Bmatrix}\\right|\\cdots f(x)$";
//QString mathTest="0";
//QString text="x_0 \\sqrt{a^2+b^2}\\underbrace{underbrace}{x_0} (\\bf{Test})\\_\\it{Text} ... ! Äquator\\alpha\\beta $f(x)=\\sin(x{\\cdot}y)$ \\ul{Text\\ol{\\gamma}} \\script{Script}, \\tt{Typewriter}, \\sf{sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^{n^{m^{123456789}}}\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^2\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
//QString text="x_0My Text$\\sqrt{a^2+b^2 } \\underbrace{underbrace}{x_0}$";
if (ui->cmbTestset->currentIndex()==ui->cmbTestset->count()-1) {
mathTest=ui->textBrowserSource->toPlainText();
ui->textBrowserSource->setReadOnly(false);
ui->btnRender->setEnabled(true);
} else {
mathTest=ui->cmbTestset->itemData(ui->cmbTestset->currentIndex()).toString();
ui->textBrowserSource->setPlainText(mathTest);
ui->textBrowserSource->setReadOnly(true);
ui->btnRender->setEnabled(false);
}
ui->scrollArea->setBackgroundRole(QPalette::Dark);
QPixmap pix(W, H);
pix.fill();
QPainter painter;
JKQTmathText mt(this);
double Y=Y1;
painter.begin(&pix);
if (ui->chkAntiAlias->isChecked()) painter.setRenderHint(QPainter::Antialiasing);
if (ui->chkAntiAliasHQ->isChecked()) painter.setRenderHint(QPainter::HighQualityAntialiasing);
if (ui->chkAntiAliasText->isChecked()) painter.setRenderHint(QPainter::TextAntialiasing);
if (ui->chkSmoothTransform->isChecked()) painter.setRenderHint(QPainter::QPainter::SmoothPixmapTransform);
ht.start();
mt.set_fontRoman(ui->cmbUnicodeSerif->currentFont().family());
mt.set_fontMathRoman(ui->cmbUnicodeSerif->currentFont().family());
mt.set_fontSans(ui->cmbUnicodeSans->currentFont().family());
mt.set_fontMathSans(ui->cmbUnicodeSans->currentFont().family());
mt.set_fontTypewriter(ui->cmbUnicodeFixed->currentFont().family());
mt.set_fontSymbol(ui->cmbUnicodeSymbol->currentFont().family());
switch (ui->cmbFont->currentIndex()) {
case 1: mt.useXITS(); break;
case 2: mt.useSTIX(); break;
case 3: mt.useAnyUnicode(ui->cmbUnicodeSans->currentFont().family(),ui->cmbUnicodeSerif->currentFont().family()); break;
case 4: mt.useLatexFonts(ui->edtLatexPrefix->text(), ui->edtLatexPostfix->text()); break;
case 5: mt.useASANA(); break;
}
ui->tree->clear();
ht.start();
double durationParse=0;
if (mt.parse(mathTest)) {
durationParse=ht.get_time()/1000.0;
ui->tree->addTopLevelItem(createTree(mt.get_parsedNode()));
} else {
durationParse=ht.get_time()/1000.0;
}
ui->labParsingTimes->setText(QString(" %1ms").arg(durationParse, 0, 'f', 3));
ui->tree->expandAll();
bool okh=true;
ui->textBrowser->clear();
qDebug()<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
QStringList sl=ui->edtSizes->text().split(",");
ui->labRenderTimes->setText("");
for (int i=0; i<sl.size(); i++) {
bool ok=true;
int size=sl[i].trimmed().toUInt(&ok);
if (!ok) size=10+i*5;
mt.set_fontSize(size);
double durationSizingMS=0, durationTimingMS=0;
Y+=draw(painter, X1, Y, mt, QString("%1, %2, %3pt").arg(ui->cmbTestset->currentText()).arg(ui->cmbFont->currentText()).arg(size), durationSizingMS, durationTimingMS);
if (i==0) {
if (mt.get_error_list().size()>0) {
ui->labError->setText("<span color=\"red\">"+mt.get_error_list().join("<br>")+"</span>");
} else {
ui->labError->setText("<span color=\"green\">OK</span>");
}
}
ui->labRenderTimes->setText(ui->labRenderTimes->text()+QString(" %1pt: %2ms/%3ms").arg(size).arg(durationSizingMS, 0, 'F', 1).arg(durationTimingMS, 0, 'F', 1));
ui->textBrowser->textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML: --------------------------------------------- ok="<<okh;
if (mt.get_error_list().size()>0) {
qDebug()<<mt.get_error_list().join("\n")<<"\n";
}
}
painter.end();
ui->label->setPixmap(pix);
QApplication::restoreOverrideCursor();
}
#include "testform.h"
#include "ui_testform.h"
#include <QDebug>
TestForm::TestForm(QWidget *parent) :
QWidget(parent),
ui(new Ui::TestForm)
{
ui->setupUi(this);
ui->cmbTestset->addItem("simple relations", "$a{\\leq}b$, $a{\\geq}b$, $a{\\equiv}b$, $a=b$, $a{\\neq}b$, $a<b$, $a>b$");
ui->cmbTestset->addItem("simple relations in different modes", "math: $a{\\leq}b$, math/no braces: $a\\leq b$, no math: a{\\leq}b, no math/no braces: a\\leq b");
ui->cmbTestset->addItem("named symbols 1", "ll: $\\ll$\\ gg: $\\gg$\\ leq: $\\leq$\\ geq: $\\geq$\\ pm: $\\pm$\\ mp: $\\mp$\\ ");
ui->cmbTestset->addItem("named symbols 2", "nexists: $\\nexists$\\ ni: $\\ni$\\ notni: $\\notni$\\ circ: $\\circ$\\ sim: $\\sim$\\ emptyset: $\\emptyset$\\ odot: $\\odot$\\ ominus: $\\ominus$\\ subsetnot: $\\subsetnot$\\ bot: $\\bot$");
ui->cmbTestset->addItem("named symbols 3", "leftharpoonup: $\\leftharpoonup$\\ rightharpoonup: $\\rightharpoonup$\\ upharpoonleft: $\\upharpoonleft$\\ downharpoonleft: $\\downharpoonleft$\\ leftrightharpoon: $\\leftrightharpoon$\\ rightleftharpoon: $\\rightleftharpoon$");
ui->cmbTestset->addItem("named symbols 4", "coprod: $\\coprod$\\ leftharpoondown: $\\leftharpoondown$\\ rightharpoondown: $\\rightharpoondown$\\ upharpoonright: $\\upharpoonright$\\ downharpoonright: $\\downharpoonright$\\ nwarrow: $\\nwarrow$\\ nearrow: $\\nearrow$\\ ");
ui->cmbTestset->addItem("named symbols 5", "searrow: $\\searrow$\\ swarrow: $\\swarrow$\\ mapsto: $\\mapsto$\\ div: $\\div$\\ multimap: $\\multimap$\\ maporiginal: $\\maporiginal$\\ mapimage: $\\mapimage$\\ ");
ui->cmbTestset->addItem("named symbols 6", "times: $\\times$\\ propto: $\\propto$\\ bullet: $\\bullet$\\ neq: $\\neq$\\ ne: $\\ne$\\ equiv: $\\equiv$\\ approx: $\\approx$\\ otimes: $\\otimes$\\ oplus: $\\oplus$");
ui->cmbTestset->addItem("named symbols 7", "oslash: $\\oslash$\\ cap: $\\cap$\\ land: $\\land$\\ cup: $\\cup$\\ lor: $\\lor$\\ supset: $\\supset$\\ supseteq: $\\supseteq$\\ supsetnot: $\\supsetnot$\\ subset: $\\subset$");
ui->cmbTestset->addItem("named symbols 8", "subseteq: $\\subseteq$\\ in: $\\in$\\ notin: $\\notin$\\ cdot: $\\cdot$\\ wedge: $\\wedge$\\ vee: $\\vee$\\ cong: $\\cong$\\ bot: $\\bot$");
ui->cmbTestset->addItem("symbols", "$\\ll\\gg\\leq\\geq\\leftrightarrow\\leftarrow\\rightarrow\\to\\uparrow\\downarrow\\updownarrow\\Leftrightarrow\\iff\\Leftarrow\\Rightarrow\\Uparrow\\Downarrow\\Updownarrow\\pm\\mp\\nexists\\ni\\notni\\circ\\sim\\emptyset\\odot\\ominus\\subsetnot\\bot\\leftharpoonup\\rightharpoonup\\upharpoonleft\\downharpoonleft\\leftrightharpoon\\rightleftharpoon\\coprod\\leftharpoondown\\rightharpoondown\\upharpoonright\\downharpoonright\\nwarrow\\nearrow\\searrow\\swarrow\\mapsto\\div\\multimap\\maporiginal\\mapimage\\times\\propto\\bullet\\neq\\ne\\equiv\\approx\\otimes\\oplus\\oslash\\cap\\land\\cup\\lor\\supset\\supseteq\\supsetnot\\subset\\subseteq\\in\\notin\\cdot\\wedge\\vee\\cong\\bot$");
ui->cmbTestset->addItem("std dev", "$\\sigma_x=\\sqrt{\\langle (x-\\langle x\\rangle)^2\\rangle}=\\sqrt{\\frac{1}{N-1}\\cdot\\left( \\sum_{i=1}^N{x_i}^2-\\frac{1}{N}\\cdot\\left(\\sum_{i=1}^Nx_i\\right)^2\\right)}$");
ui->cmbTestset->addItem("std dev 2", "$\\sigma_x=\\sqrt{\\langle (x-\\langle x\\rangle)^2\\rangle}=\\sqrt{\\frac{1}{N-1}\\cdot\\left( \\sum_{i=1}^Nx_i^2-\\frac{1}{N}\\cdot\\left(\\sum_{i=1}^Nx_i\\right)^2\\right)}$");
ui->cmbTestset->addItem("rotation matrix", "$\\mathrm{\\mathbf{M}}(\\alpha) = \\left(\\begin{matrix}\\cos(\\alpha)+n_x^2\\cdot (1-\\cos(\\alpha)) & n_x\\cdot n_y\\cdot (1-\\cos(\\alpha))-n_z\\cdot \\sin(\\alpha) & n_x\\cdot n_z\\cdot (1-\\cos(\\alpha))+n_y\\cdot \\sin(\\alpha)\\\\n_x\\cdot n_y\\cdot (1-\\cos(\\alpha))+n_z\\cdot \\sin(\\alpha) & \\cos(\\alpha)+n_y^2\\cdot (1-\\cos(\\alpha)) & n_y\\cdot n_z\\cdot (1-\\cos(\\alpha))-n_x\\cdot \\sin(\\alpha)\\\\n_z\\cdot n_x\\cdot (1-\\cos(\\alpha))-n_y\\cdot \\sin(\\alpha) & n_z\\cdot n_y\\cdot (1-\\cos(\\alpha))+n_x\\cdot \\sin(\\alpha) & \\cos(\\alpha)+n_z^2\\cdot (1-\\cos(\\alpha))\\end{matrix}\\right)$");
ui->cmbTestset->addItem("like in label at bottom (no MM)", "\\left(\\left[\\sqrt{2\\pi\\cdot\\int_{-\\infty}^\\infty f(x)\\;\\mathrm{d}x}\\right]\\right)");
ui->cmbTestset->addItem("like in label at bottom (MM)", "$\\left(\\left[\\sqrt{2\\pi\\cdot\\int_{-\\infty}^\\infty f(x)\\;\\mathrm{d}x}\\right]\\right)$");
ui->cmbTestset->addItem("text 0", "text");
ui->cmbTestset->addItem("text 1", "text \\mathbf{bold}");
ui->cmbTestset->addItem("text 2", "text \\mathbf{bold}\\textcolor{red}{RED}");
ui->cmbTestset->addItem("decoration", "$\\vec{x}\\vec{X}\\vec{\\psi} -- \\dot{x}\\dot{X}\\dot{\\psi} -- \\ddot{x}\\ddot{X}\\ddot{\\psi} -- \\overline{x}\\overline{X}\\overline{\\psi} -- \\underline{x}\\underline{X}\\underline{\\psi} -- \\hat{x}\\hat{X}\\hat{\\psi} -- \\tilde{x}\\tilde{X}\\tilde{\\psi} -- \\uul{x}\\uul{X}\\uul{\\psi} -- \\ool{x}\\ool{X}\\ool{\\psi} -- \\bar{x}\\bar{X}\\bar{\\psi} -- \\arrow{x}\\arrow{X}\\arrow{\\psi}$");
ui->cmbTestset->addItem("mathtest", "This is normal text: $this is math:\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle\\ \\ \\ g(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1} \\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\left\\{\\va\\left|\\|\\va\\|_2\\geq2\\right.\\right\\} \\vr\\vR\\frac{\\sqrt{\\sqrt{\\sqrt{\\sum_{i=0}^\\infty \\hat{i}^2}+y^\\alpha}+1}}{\\dot{v}\\equiv\\ddot{r}}\\argmin_{\\vec{k}}\\sum_{\\sqrt{i}=0}^{N}\\int_{x_0}^{x_1}\\left(\\left(\\left(x\\right)\\right)\\right)\\underbrace{\\left[\\left\\{\\frac{\\partial f}{\\partial x}\\right\\}\\cdot\\frac{1}{2}\\right]}{\\text{underbraced text \\hbar}}\\cdots\\frac{\\sqrt{\\sum_{i=0}^2 \\hat{i}^2}+y^\\alpha}{\\dot{v}\\equiv\\ddot{r}}, \\hat{t}\\hat{T} \\overbrace{\\left|\\sqrt{x\\cdot Y}\\right|}{\\propto\\bbN\\circ\\bbZ} \\left<\\arrow{x(\\tau)}\\cdot\\vec{R}(t+\\bar{\\tau})\\right> \\alpha\\beta\\gamma\\delta\\epsilon\\Gamma\\Delta\\Theta\\Omega \\left\\_\\left~\\cbrt{\\hbar\\omega}\\right~\\right\\_$");
ui->cmbTestset->addItem("upper/lower parantheses test:", "$\\text{bblabla} \\frac{1}{2}\\cdot\\left(\\frac{1}{\\mathrm{e}^x+\\mathrm{e}^{-x}}\\right)\\cdot\\left(\\frac{1}{\\frac{1+2}{5+x}}\\right)\\cdot\\left(\\frac{1}{\\exp\\left[-\\frac{y^2}{\\sqrt{x}}\\right]\\cdot\\exp\\left[-\\frac{1}{\\frac{1}{2}}\\right]}\\right) $");
ui->cmbTestset->addItem("ACF test", "$g_{rg}^{ab}(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-\\frac{1}{2}}$");
ui->cmbTestset->addItem("MSD test", "$\\mathrm{MSD}(\\tau)\\equiv\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle=2n\\cdot\\frac{K_\\alpha}{\\Gamma(1+\\alpha)}\\cdot\\tau^\\alpha$");
ui->cmbTestset->addItem("f() test", "$f(\\vec{x})=\\frac{1}{\\sqrt{2\\pi\\cdot\\sigma^2}}\\exp\\left(-\\frac{(\\vec{x}-\\vec{x}_0)^2}{\\sigma^2}\\right)$");
ui->cmbTestset->addItem("chi^2 test", "$\\vec{p}^\\ast=\\argmax\\limits_{\\vec{p}}\\chi^2=\\argmax\\limits_{\\vec{p}}\\sum\\limits_{i=1}^N\\left|\\frac{\\hat{f}_i-f(x_i;\\vec{p})}{\\sigma_i}\\right|^2$");
ui->cmbTestset->addItem("symbol test", "\\vdots\\cdots\\ddots\\iddots\\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\sum\\int \\iint \\oint \\prod \\leftrightarrow \\leftarrow\\Leftarrow\\rightarrow\\Rightarrow\\pm\\mp\\leq\\geq\\ll\\gg\\hbar\\euro\\bbC\\bbH\\bbN\\bbP\\bbQ\\bbZ\\bbR\\Angstrom\\Alef\\Bet\\Gimel\\Dalet\\nexists\\ni\\notni\\circ\\tilde\\oiint\\oiiint\\emptyset\\odot\\ominus\\subsetnot\\DC\\bot\\cdots\\perthousand\\leftharpoonup\\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\coprod \\leftharpoondown \\rightharpoondown \\nwarrow \\nearrow \\mapsto \\cent \\pound \\yen \\div \\multimap \\maporiginal \\mapimage \\bigcap \\bigcup \\benzene \\times \\cdot \\propto \\equiv \\Im \\Re \\ ");
ui->cmbTestset->addItem("arrowtest 1", "$\\leftarrow \\longleftarrow \\Leftarrow \\Longleftarrow \\rightarrow \\longrightarrow \\Rightarrow \\Longrightarrow \\uparrow \\Uparrow \\downarrow \\Downarrow \\leftrightarrow \\Leftrightarrow \\longleftrightarrow \\Longleftrightarrow$");
ui->cmbTestset->addItem("arrowtest 2", "$\\nwarrow \\nearrow \\searrow \\swarrow \\mapsto \\leftharpoonup \\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\leftharpoondown \\rightharpoondown \\upharpoonright \\downharpoonright $");
ui->cmbTestset->addItem("math: blackboard", "$\\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: bf", "$\\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: rm", "$\\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: cal", "$\\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("subscript test", "$r_{123}\\ \\ r_{\\frac{1}{2}}$");
ui->cmbTestset->addItem("subscript0 test", "$r_{123}$");
ui->cmbTestset->addItem("subscript1 test", "$r_{123}\\ $");
ui->cmbTestset->addItem("subscript2 test", "$r_{123}\\ \\ $");
ui->cmbTestset->addItem("subscript3 test", "$r_{123}r_{\\frac{1}{2}}$");
ui->cmbTestset->addItem("superscript test", "$r^{123}\\ \\ r^{\\frac{1}{2}}$");
ui->cmbTestset->addItem("superscript0 test", "$r^{123}$");
ui->cmbTestset->addItem("superscript1 test", "$r^{123}\\ $");
ui->cmbTestset->addItem("superscript2 test", "$r^{123}\\ \\ $");
ui->cmbTestset->addItem("superscript3 test", "$r^{123}r^{\\frac{1}{2}}$");
ui->cmbTestset->addItem("asuperscript test", "$a^{123}\\ \\ a^{\\frac{1}{2}}$");
ui->cmbTestset->addItem("asuperscript0 test", "$a^{123}$");
ui->cmbTestset->addItem("gsuperscript1 test", "$g^{123}\\ $");
ui->cmbTestset->addItem("gsuperscript2 test", "$g^{123}\\ \\ $");
ui->cmbTestset->addItem("gsuperscript3 test", "$g^{123}g^{\\frac{1}{2}}$");
ui->cmbTestset->addItem("frac test", "$\\frac{a}{b}+\\frac{g}{a}-\\frac{a^2}{b^2}\\cdot\\frac{a^2}{b^{\\frac{1}{2}}}$");
ui->cmbTestset->addItem("tfrac test", "$\\tfrac{a}{b}+\\tfrac{g}{a}-\\tfrac{a^2}{b^2}\\cdot\\tfrac{a^2}{b^{\\tfrac{1}{2}}}$");
ui->cmbTestset->addItem("dfrac test", "$\\dfrac{a}{b}+\\dfrac{g}{a}-\\dfrac{a^2}{b^2}\\cdot\\dfrac{a^2}{b^{\\dfrac{1}{2}}}$");
ui->cmbTestset->addItem("stackrel test", "$\\stackrel{a}{b}+\\stackrel{g}{a}-\\stackrel{a^2}{b^2}\\cdot\\stackrel{a^2}{b^{\\stackrel{1}{2}}}$");
ui->cmbTestset->addItem("brace0 test", "\\langle\\langle -- $\\langle\\langle$");
ui->cmbTestset->addItem("brace1 test", "\\langle\\langle r^{123} -- $\\langle\\langle r^{123}$");
ui->cmbTestset->addItem("brace2 test", "\\langle\\langle r^{123}\\rangle\\rangle -- $\\langle\\langle r^{123}\\rangle\\rangle$");
ui->cmbTestset->addItem("brace3 test", "\\left\\langle r^{123}\\right\\rangle -- $\\left\\langle r^{123}\\right\\rangle$");
ui->cmbTestset->addItem("brace4 test", "\\left\\langle\\left\\langle\\left\\langle r^{123}\\right\\rangle\\right\\rangle\\right\\rangle -- $\\left\\langle\\left\\langle\\left\\langle r^{123}\\right\\rangle\\right\\rangle\\right\\rangle$");
ui->cmbTestset->addItem("brace5 test: ( )", "\\left(\\left(\\left( r^{123}\\right)\\right)\\right) -- $\\left(\\left(\\left( r^{123}\\right)\\right)\\right)$");
ui->cmbTestset->addItem("brace6 test: [ ]", "\\left[\\left[\\left[ r^{123}\\right]\\right]\\right] -- $\\left[\\left[\\left[ r^{123}\\right]\\right]\\right]$");
ui->cmbTestset->addItem("brace7 test: { }", "\\left\\{\\left\\{\\left\\{ r^{123}\\right\\}\\right\\}\\right\\} -- $\\left\\{\\left\\{\\left\\{ r^{123}\\right\\}\\right\\}\\right\\}$");
ui->cmbTestset->addItem("brace8 test: || ||", "\\left\\|\\left\\|\\left\\| r^{123}\\right\\|\\right\\|\\right\\| -- $\\left\\|\\left\\|\\left\\| r^{123}\\right\\|\\right\\|\\right\\|$");
ui->cmbTestset->addItem("brace9 test: | |", "\\left|\\left|\\left| r^{123}\\right|\\right|\\right| -- $\\left|\\left|\\left| r^{123}\\right|\\right|\\right|$");
ui->cmbTestset->addItem("brace10 test", "\\left\\{\\left[\\left( r^{123}\\right)\\right]\\right\\} -- $\\left\\{\\left[\\left( r^{123}\\right)\\right]\\right\\}$");
ui->cmbTestset->addItem("brace11 test: floor", "\\left\\lfloor\\left\\lfloor\\left\\lfloor r^{123}\\right\\rfloor\\right\\rfloor\\right\\rfloor -- $\\left\\lfloor\\left\\lfloor\\left\\lfloor r^{123}\\right\\rfloor\\right\\rfloor\\right\\rfloor$");
ui->cmbTestset->addItem("brace12 test: ceil", "\\left\\lceil\\left\\lceil\\left\\lceil r^{123}\\right\\rceil\\right\\rceil\\right\\rceil -- $\\left\\lceil\\left\\lceil\\left\\lceil r^{123}\\right\\rceil\\right\\rceil\\right\\rceil$");
ui->cmbTestset->addItem("sub-, superscript test", "r^{1234}_{321} r_{321}^{1234} -- $r^{1234}_{321} r_{321}^{1234} -- \\kappa^2 -- \\kappa_2 -- \\kappa_2^2$");
ui->cmbTestset->addItem("super-, subscript test", "r^{123}_{4321} r_{4321}^{123} -- $r^{123}_{4321} r_{4321}^{123} -- \\kappa^2 -- \\kappa_2 -- \\kappa_2^2$");
//ui->cmbTestset->addItem("", "");
ui->cmbTestset->addItem("math 1", "$f(x)=\\int_{-\\infty}^xe^{-t^2}\\;\\mathrm{d}t$");
ui->cmbTestset->addItem("math 2", "$\\sum_{i=1}^\\infty\\frac{-e^{i\\pi}}{2^n}$");
ui->cmbTestset->addItem("math 3", "$\\mbox{det} \\begin{pmatrix} 1 & x_1 & \\ldots & x_1^{n-1} \\\\ 1 & x_2 & \\ldots & x_2^{n-1} \\\\ \\vdots & \\vdots & \\ddots & \\vdots \\\\ 1 & x_n & \\ldots & x_n^{n-1} \\end{pmatrix} = \\prod_{1 \\leq i < j \\leq n} (x_j - x_i) $");
ui->cmbTestset->addItem("math 4", "$\\sqrt{1+\\sqrt{1+\\sqrt{1+\\sqrt{1+\\sqrt{1+\\sqrt{1+x}}}}}}$");
ui->cmbTestset->addItem("math 5", "$\\left(\\stackrel{p}{2}\\right)=x^2y^{p-2}-\\frac{1}{1-x}\\frac{1}{1-x^2}$");
ui->cmbTestset->addItem("math 6", "$a_0+\\frac{1}{a_1+\\frac{1}{a_2+\\frac{1}{a_3+\\frac{1}{a_4}}}}$");
ui->cmbTestset->addItem("math 7", "$\\left(\\frac{\\partial^2}{\\partial x^2}+\\frac{\\partial^2}{\\partial y^2}\\right)\\left|\\varphi(x+\\mathrm{i}y)\\right|^2=0$");
ui->cmbTestset->addItem("math 8", "$2^{2^{2^{x}}}$");
ui->cmbTestset->addItem("math 9", "$\\iint_Df(x,y)\\;\\mathrm{d}x\\;\\mathrm{d}y$");
ui->cmbTestset->addItem("math 10 (overbrace)", "$\\overbrace{x+x+...+x}{k\\ \\mathrm{times}}$");
ui->cmbTestset->addItem("math 11 (underbrace)", "$\\underbrace{x+x+...+x}{k\\ \\mathrm{times}}$");
ui->cmbTestset->addItem("math 12 (under/overbrace)", "$\\underbrace{\\overbrace{x+x+...+x}{k\\ \\mathrm{times}} \\overbrace{x+x+...+x}{k\\ \\mathrm{times}}}{2k\\ \\mathrm{times}}$");
ui->cmbTestset->addItem("math 13", "$y_1''\\ \\ \\ y_2'''$");
ui->cmbTestset->addItem("math 14", "$f(x)=\\begin{cases} 1/3 & \\mathrm{if}\\ 0\\leq x\\leq1 \\\\ 2/3 & \\mathrm{if}\\ 3\\leq x\\leq4 \\\\0 & \\mathrm{elsewhere} \\end{cases}$");
ui->cmbTestset->addItem("math 15", "$\\Re{z} =\\frac{n\\pi \\dfrac{\\theta +\\psi}{2}}{\\left(\\dfrac{\\theta +\\psi}{2}\\right)^2 + \\left( \\dfrac{1}{2}\\log \\left\\lvert\\dfrac{B}{A}\\right\\rvert\\right)^2}.$");
ui->cmbTestset->addItem("math 16", "$\\sum_{m=1}^\\infty\\sum_{n=1}^\\infty\\frac{m^2\\,n}{3^m\\left(m\\,3^n+n\\,3^m\\right)}$");
ui->cmbTestset->addItem("math 17", "$\\phi_n(\\kappa) =\\frac{1}{4\\pi^2\\kappa^2} \\int_0^\\infty\\frac{\\sin(\\kappa R)}{\\kappa R}\\frac{\\partial}{\\partial R}\\left[R^2\\frac{\\partial D_n(R)}{\\partial R}\\right]\\,dR$");
ui->cmbTestset->addItem("math 18", "${}_pF_q(a_1,\\dots,a_p;c_1,\\dots,c_q;z)= \\sum_{n=0}^\\infty\\frac{(a_1)_n\\cdots(a_p)_n}{(c_1)_n\\cdots(c_q)_n}\\frac{z^n}{n!}$");
ui->cmbTestset->addItem("math 19 (overset)", "$X \\overset{=}{def} Y$\\ \\ \\ \\ \\ $X \\overset{=}{!} Y$\\ \\ \\ \\ \\ $X \\overset{\\rightarrow}{f} Y$\\ \\ \\ \\ \\ $\\frac{f(x+\\Delta x)-f(x)}{\\Delta x}\\overset{\\longrightarrow}{\\Delta x\\to 0}f'(x)$");
ui->cmbTestset->addItem("math 20 (underset)", "$X \\underset{=}{\\text{def (5)}} Y$\\ \\ \\ \\ \\ $X \\underset{\\rightarrow}{f} Y$\\ \\ \\ \\ \\ $\\frac{f(x+\\Delta x)-f(x)}{\\Delta x}\\underset{\\longrightarrow}{\\Delta x\\to 0}f'(x)$");
ui->cmbTestset->addItem("Jacobi Matrix and VarCov matrix", "$J_{ij}= \\left.\\frac{\\partial f(x,\\vec{p})}{\\partial p_i}\\right|_{\\vec{p},x=x_j}\\ \\ \\ \\ \\ \\mat{C}=\\left(\\mat{J}^\\mathrm{T}\\ J\\right)^{-1}\\ \\ \\ \\ \\ test: \\left|\\frac{\\partial f(x,\\vec{p})}{\\partial p_i}\\right|_{\\vec{p},x=x_j}^2$");
ui->cmbTestset->addItem("operator test (textmode)", "x=0\\ \\ y>0\\ \\ x+y\\ \\ -1\\ \\ x-2\\ \\ x\\cdot y\\ \\ x\\geq 4\\ \\ x~4");
ui->cmbTestset->addItem("operator test (mathmode)", "$x=0\\ \\ y>0\\ \\ x+y\\ \\ -1\\ \\ x-2\\ \\ x\\cdot y\\ \\ x\\geq 4\\ \\ x~4$");
ui->cmbTestset->addItem("color test", "\\textcolor{red}{RED}\\textcolor{blue}{BLUE}");
ui->cmbTestset->addItem("boxed test", "test: \\boxed{boxed text} in the middle");
ui->cmbTestset->addItem("mathboxed test", "\\fbox{2^{2^{\\colorbox{red}{2^{x}}}}}");
ui->cmbTestset->addItem("axiom of power test", "$\\forall A \\, \\exists P \\, \\forall B \\, [B \\in P \\iff \\forall C \\, (C \\in B \\Rightarrow C \\in A)]$");
ui->cmbTestset->addItem("De Morgan's law", "$\\neg(P\\land Q)\\iff(\\neg P)\\lor(\\neg Q)$ or $\\overline{\\bigcap_{i \\in I} A_{i}}\\equiv\\bigcup_{i \\in I} \\overline{A_{i}}$ or $\\overline{A \\cup B}\\equiv\\overline{A} \\cap \\overline{B}$");
ui->cmbTestset->addItem("quadratic formula", "$x=\\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}$");
ui->cmbTestset->addItem("combination", "$\\binom{n}{k} = \\frac{n(n-1)...(n-k+1)}{k(k-1)\\dots1}=\\frac{n!}{k!(n-k)!}$");
ui->cmbTestset->addItem("Sophomore's dream 1", "$\\int_0^1 x^{-x}\\,dx = \\sum_{n=1}^\\infty n^{-n}(\\scriptstyle{= 1.29128599706266354040728259059560054149861936827\\dots)}$");
ui->cmbTestset->addItem("Sophomore's dream 2", "$\\int_0^1 x^x \\,dx = \\sum_{n=1}^\\infty (-1)^{n+1}n^{-n} = - \\sum_{n=1}^\\infty (-n)^{-n} (\\scriptstyle{= 0.78343051071213440705926438652697546940768199014\\dots})$");
ui->cmbTestset->addItem("divergence 1", "$\\operatorname{div}\\vec{F} = \\nabla\\cdot\\vec{F}=\\frac{\\partial U}{\\partial x}+\\frac{\\partial V}{\\partial y}+\\frac{\\partial W}{\\partial z}$");
ui->cmbTestset->addItem("divergence 2", "$\\overrightarrow{\\operatorname{div}}\\,(\\mathbf{\\underline{\\underline{\\epsilon}}}) = "
"\\begin{bmatrix}"
"\\frac{\\partial \\epsilon_{xx}}{\\partial x} +\\frac{\\partial \\epsilon_{yx}}{\\partial y} +\\frac{\\partial \\epsilon_{zx}}{\\partial z} \\\\"
"\\frac{\\partial \\epsilon_{xy}}{\\partial x} +\\frac{\\partial \\epsilon_{yy}}{\\partial y} +\\frac{\\partial \\epsilon_{zy}}{\\partial z} \\\\"
"\\frac{\\partial \\epsilon_{xz}}{\\partial x} +\\frac{\\partial \\epsilon_{yz}}{\\partial y} +\\frac{\\partial \\epsilon_{zz}}{\\partial z}"
"\\end{bmatrix}$");
ui->cmbTestset->addItem("lim, sum ...", "$\\lim_{x\\to\\infty} f(x) = \\binom{k}{r} + \\frac{a}{b} \\sum_{n=1}^\\infty a_n + \\displaystyle{ \\left\\{ \\frac{1}{13} \\sum_{n=1}^\\infty b_n \\right\\} }.$");
ui->cmbTestset->addItem("array test", "$f(x) := \\left\\{\\begin{array} x^2 \\sin \\frac{1}{x} & \\textrm{if } x \\ne 0, \\\\ 0 & \\textrm{if } x = 0 . \\end{array}\\right.$");
ui->cmbTestset->addItem("Schwinger-Dyson", "$\\left\\langle\\psi\\left|\\mathcal{T}\\{F \\phi^j\\}\\right|\\psi\\right\\rangle=\\left\\langle\\psi\\left|\\mathcal{T}\\{iF_{,i}D^{ij}-FS_{int,i}D^{ij}\\}\\right|\\psi\\right\\rangle.$");
ui->cmbTestset->addItem(QLatin1String("Schrödinger's equation"), "$\\left[-\\frac{\\hbar^2}{2m}\\frac{\\partial^2}{\\partial x^2}+V\\right]\\Psi(x)=\\mathrm{i}\\hbar\\frac{\\partial}{\\partial t}\\Psi(x)$");
ui->cmbTestset->addItem("Cauchy-Schwarz inequality", "$\\left( \\sum_{k=1}^n a_k b_k \\right)^2 \\leq \\left( \\sum_{k=1}^n a_k^2 \\right) \\left( \\sum_{k=1}^n b_k^2 \\right)$");
ui->cmbTestset->addItem("Maxwell's equations", "$\\begin{aligned}\\nabla \\times \\vec{\\mathbf{B}} -\\, \\frac{1}{c}\\, \\frac{\\partial\\vec{\\mathbf{E}}}{\\partial t} & = \\frac{4\\pi}{c}\\vec{\\mathbf{j}} \\\\ \\nabla \\cdot \\vec{\\mathbf{E}} & = 4 \\pi \\rho \\\\\\nabla \\times \\vec{\\mathbf{E}}\\, +\\, \\frac{1}{c}\\, \\frac{\\partial\\vec{\\mathbf{B}}}{\\partial t} & = \\vec{\\mathbf{0}} \\\\\\nabla \\cdot \\vec{\\mathbf{B}} & = 0 \\end{aligned}$");
ui->cmbTestset->addItem("Langevin Equation", "$m \\dot{v}(t) = -\\gamma v(t) + F(x,t)+ f(t)$");
ui->cmbTestset->addItem("Fokker-Planck Equation", "$\\frac{\\partial}{\\partial t}P(y,t)=-\\frac{\\partial}{\\partial y}\\left[ A(y,t)P(y,t)\\right] +\\frac{\\Gamma}{2}\\frac{\\partial^2}{\\partial y^2}\\left[ P(y,t)\\right]$");
ui->cmbTestset->addItem("Hamilton Equations of motion", "$\\mathcal{H}(\\mathbf{q},\\mathbf{p})=\\frac{\\mathbf{p}^2}{2\\,m}+V(\\mathbf{q})\\ \\ \\ \\text{and}\\ \\ \\ \\dot{q}_k =\\frac{p_k}{m}\\ ,\\ \\dot{p}_k = - \\frac{\\partial V}{\\partial q_k}$");
ui->cmbTestset->addItem("Gaussian Distrubution", "$f(x | \\mu,\\sigma^2)=\\frac{1}{\\sqrt{2\\pi\\sigma^2}}\\operatorname{exp}\\left(-\\frac{(x-\\mu)^2}{2\\sigma^2}\\right)=\\frac{1}{\\sqrt{2\\pi\\sigma^2}} e^{-\\frac{(x-\\mu)^2}{2\\sigma^2}}\\quad -\\infty<x<\\infty$");
ui->cmbTestset->addItem("User-Editable Text");
//
//ui->cmbTestset->addItem("", "$$");
//ui->cmbTestset->addItem("", "$$");
//ui->cmbTestset->addItem("", "");
ui->cmbTestset->setCurrentIndex(0);
ui->labMath->setMath("\\left(\\left[\\sqrt{2\\pi\\cdot\\int_{-\\infty}^\\infty f(x)\\;\\mathrm{d}x}\\right]\\right)");
ui->cmbFont->setCurrentIndex(1);
}
TestForm::~TestForm()
{
delete ui;
}
#define W 2000
#define H 2000
#define X1 15
#define Y1 50
double TestForm::draw(QPainter& painter, double X, double YY, JKQTmathText& mt, QString name, double& durationSizingMS, double&durationTimingMS) {
double Y=YY;
painter.save();
ht.start();
QSizeF s=mt.getSize(painter);
Y=Y+mt.getAscent(painter);
durationSizingMS=ht.get_time()/1000.0;
qDebug()<<" sizing in "<<durationSizingMS<<" ms\n";
QPen p=painter.pen();
p.setColor("lightcoral");
p.setStyle(Qt::DashLine);
p.setWidth(2);
painter.setPen(p);
QRectF r(X, Y-mt.getAscent(painter),s.width(), s.height());
painter.drawRect(r);
p.setColor("lightblue");
painter.setPen(p);
painter.drawLine(X, Y, X+s.width(), Y);
ht.start();
p.setStyle(Qt::SolidLine);
p.setWidth(1);
p.setColor("black");
painter.setPen(p);
mt.draw(painter, X, Y, ui->chkBoxes->isChecked());
durationTimingMS=ht.get_time()/1000.0;
qDebug()<<" drawing in "<<durationTimingMS<<" ms";
p.setColor("blue");
painter.setPen(p);
QFont f;
f.setFamily("sans serif");
f.setUnderline(true);
f.setPointSize(10);
painter.setFont(f);
painter.drawText(X, Y-mt.getAscent(painter)-6, name+":");
painter.restore();
qDebug()<<name<<": width="<<s.width()<<" height="<<s.height()<<" ascent="<<mt.getAscent(painter)<<" descent="<<mt.getDescent(painter);
return mt.getDescent(painter)+mt.getAscent(painter)+40;
}
QTreeWidgetItem *TestForm::createTree(JKQTmathText::MTnode *node, QTreeWidgetItem* parent)
{
QString name;
JKQTmathText::MTtextNode* txtN=dynamic_cast<JKQTmathText::MTtextNode*>(node);
JKQTmathText::MTwhitespaceNode* spN=dynamic_cast<JKQTmathText::MTwhitespaceNode*>(node);
JKQTmathText::MTsymbolNode* symN=dynamic_cast<JKQTmathText::MTsymbolNode*>(node);
JKQTmathText::MTlistNode* lstN=dynamic_cast<JKQTmathText::MTlistNode*>(node);
JKQTmathText::MTinstruction1Node* inst1N=dynamic_cast<JKQTmathText::MTinstruction1Node*>(node);
JKQTmathText::MTsubscriptNode* subN=dynamic_cast<JKQTmathText::MTsubscriptNode*>(node);
JKQTmathText::MTsuperscriptNode* superN=dynamic_cast<JKQTmathText::MTsuperscriptNode*>(node);
JKQTmathText::MTbraceNode* braceN=dynamic_cast<JKQTmathText::MTbraceNode*>(node);
JKQTmathText::MTsqrtNode* sqrtN=dynamic_cast<JKQTmathText::MTsqrtNode*>(node);
JKQTmathText::MTfracNode* fracN=dynamic_cast<JKQTmathText::MTfracNode*>(node);
JKQTmathText::MTmatrixNode* matrixN=dynamic_cast<JKQTmathText::MTmatrixNode*>(node);
JKQTmathText::MTdecoratedNode* decoN=dynamic_cast<JKQTmathText::MTdecoratedNode*>(node);
QTreeWidgetItem* ti=nullptr;
if (parent) ti=new QTreeWidgetItem(parent);
else ti=new QTreeWidgetItem(ui->tree);
if (decoN) {
name=QString("MTdecoratedNode: mode='%1'").arg(JKQTmathText::decorationToString(decoN->get_decoration()));
if (decoN->get_child()) ti->addChild(createTree(decoN->get_child(), ti));
} else if (matrixN) {
int l=matrixN->get_lines();
int c=matrixN->get_columns();
name=QString("MTmatrixNode: l*c=%1*%2").arg(l).arg(c);
QVector<QVector<JKQTmathText::MTnode*> > children=matrixN->get_children();
for (int y=0; y<l; y++) {
for (int x=0; x<c; x++) {
if (children[y].at(x)!=nullptr) {
QTreeWidgetItem* it=createTree(children[y].at(x), ti);
it->setText(0, QString("(%1,%2):").arg(y).arg(x)+it->text(0));
ti->addChild(it);
}
}
}
} else if (fracN) {
name=QString("MTfracNode: mode='%1'").arg(JKQTmathText::fracModeToString(fracN->get_mode()));
if (fracN->get_child1()) ti->addChild(createTree(fracN->get_child1(), ti));
if (fracN->get_child2()) ti->addChild(createTree(fracN->get_child2(), ti));
} else if (sqrtN) {
name=QString("MTsqrtNode: deg=%1").arg(sqrtN->get_degree());
if (sqrtN->get_child()) ti->addChild(createTree(sqrtN->get_child(), ti));
} else if (braceN) {
name=QString("MTbraceNode: l='%1', r='%2', showR=%3").arg(braceN->get_openbrace()).arg(braceN->get_closebrace()).arg(braceN->get_showRightBrace());
if (braceN->get_child()) ti->addChild(createTree(braceN->get_child(), ti));
} else if (superN) {
name=QString("MTsuperscriptNode");
if (superN->get_child()) ti->addChild(createTree(superN->get_child(), ti));
} else if (subN) {
name=QString("MTsubscriptNode");
if (subN->get_child()) ti->addChild(createTree(subN->get_child(), ti));
} else if (inst1N) {
name=QString("MTinstruction1Node: \'%1\'").arg(inst1N->get_name());
if (inst1N->get_child()) ti->addChild(createTree(inst1N->get_child(), ti));
} else if (lstN) {
name=QString("MTlistNode");
QList<JKQTmathText::MTnode*> list=lstN->get_nodes();
for (int i=0; i<list.size(); i++) {
ti->addChild(createTree(list[i], ti));
}
} else if (symN) {
name=QString("MTsymbolNode: \'%1\'").arg(symN->get_symbolName());
} else if (spN) {
name=QString("MTwhitespaceNode :\'%1\'").arg(txtN->get_text());
} else if (txtN) {
name=QString("MTtextNode: \'%1\'").arg(txtN->get_text());
} else {
name=QString("unknown");
}
ti->setText(0,name);
/*
QString space="";
QTreeWidgetItem* p=ti->parent();
while (p) {
space+=" ";
p=p->parent();
}
qDebug()<<space<<"createTree()";
*/
return ti;
}
void TestForm::updateMath()
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString mathTest="";
//QString symbolTest="\\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\sum\\int \\iint \\oint \\prod \\leftrightarrow \\leftarrow\\Leftarrow\\rightarrow\\Rightarrow\\pm\\mp\\leq\\geq\\ll\\gg\\hbar\\euro\\bbC\\bbH\\bbN\\bbP\\bbQ\\bbZ\\bbR\\Angstrom\\Alef\\Bet\\Gimel\\Dalet\\nexists\\ni\\notni\\circ\\tilde\\oiint\\oiiint\\emptyset\\odot\\ominus\\subsetnot\\DC\\bot\\cdots\\perthousand\\leftharpoonup\\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\coprod \\leftharpoondown \\rightharpoondown \\nwarrow \\nearrow \\mapsto \\cent \\pound \\yen \\div \\multimap \\maporiginal \\mapimage \\bigcap \\bigcup \\benzene \\times \\cdot \\propto \\equiv \\Im \\Re \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ ";
//QString mathTest="$\\left\\|\\stackrel{1}{2}\\right\\|\\cdot\\left|\\begin{Bmatrix}1123&2^2&\\frac{3}{4}\\\\4&5_5&6\\\\72_8&8_{\\text{längerer Index}}&9&10&11\\end{Bmatrix}\\right|\\cdots f(x)$";
//QString mathTest="0";
//QString text="x_0 \\sqrt{a^2+b^2}\\underbrace{underbrace}{x_0} (\\bf{Test})\\_\\it{Text} ... ! Äquator\\alpha\\beta $f(x)=\\sin(x{\\cdot}y)$ \\ul{Text\\ol{\\gamma}} \\script{Script}, \\tt{Typewriter}, \\sf{sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^{n^{m^{123456789}}}\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
//QString text="$\\sum_{i=0_{j=-1_{k=-45}}}^2\\left(\\left(\\left(\\int_0^\\inf\\left[r+i^{\\left\\{2^2\\right\\}}\\right]{\\dd}r\\right)\\right)\\right)$ \\bf{Test}\\_\\it{Text} ... ! \\sc{&Äquator \\&}\\alpha\\beta $f(x)=\\sin(x\\cdot\\cos(a+{\\ii}b))$ \\ul{Text\\gamma} \\script{Script-Text}\\tt{ and Typewriter} \\sf{also sans serif}";
//QString text="x_0My Text$\\sqrt{a^2+b^2 } \\underbrace{underbrace}{x_0}$";
if (ui->cmbTestset->currentIndex()==ui->cmbTestset->count()-1) {
mathTest=ui->textBrowserSource->toPlainText();
ui->textBrowserSource->setReadOnly(false);
ui->btnRender->setEnabled(true);
} else {
mathTest=ui->cmbTestset->itemData(ui->cmbTestset->currentIndex()).toString();
ui->textBrowserSource->setPlainText(mathTest);
ui->textBrowserSource->setReadOnly(true);
ui->btnRender->setEnabled(false);
}
ui->scrollArea->setBackgroundRole(QPalette::Dark);
QPixmap pix(W, H);
pix.fill();
QPainter painter;
JKQTmathText mt(this);
double Y=Y1;
painter.begin(&pix);
if (ui->chkAntiAlias->isChecked()) painter.setRenderHint(QPainter::Antialiasing);
if (ui->chkAntiAliasHQ->isChecked()) painter.setRenderHint(QPainter::HighQualityAntialiasing);
if (ui->chkAntiAliasText->isChecked()) painter.setRenderHint(QPainter::TextAntialiasing);
if (ui->chkSmoothTransform->isChecked()) painter.setRenderHint(QPainter::QPainter::SmoothPixmapTransform);
ht.start();
mt.set_fontRoman(ui->cmbUnicodeSerif->currentFont().family());
mt.set_fontMathRoman(ui->cmbUnicodeSerif->currentFont().family());
mt.set_fontSans(ui->cmbUnicodeSans->currentFont().family());
mt.set_fontMathSans(ui->cmbUnicodeSans->currentFont().family());
mt.set_fontTypewriter(ui->cmbUnicodeFixed->currentFont().family());
mt.set_fontSymbol(ui->cmbUnicodeSymbol->currentFont().family());
switch (ui->cmbFont->currentIndex()) {
case 1: mt.useXITS(); break;
case 2: mt.useSTIX(); break;
case 3: mt.useAnyUnicode(ui->cmbUnicodeSans->currentFont().family(),ui->cmbUnicodeSerif->currentFont().family()); break;
case 4: mt.useLatexFonts(ui->edtLatexPrefix->text(), ui->edtLatexPostfix->text()); break;
case 5: mt.useASANA(); break;
}
ui->tree->clear();
ht.start();
double durationParse=0;
if (mt.parse(mathTest)) {
durationParse=ht.get_time()/1000.0;
ui->tree->addTopLevelItem(createTree(mt.get_parsedNode()));
} else {
durationParse=ht.get_time()/1000.0;
}
ui->labParsingTimes->setText(QString(" %1ms").arg(durationParse, 0, 'f', 3));
ui->tree->expandAll();
bool okh=true;
ui->textBrowser->clear();
qDebug()<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
QStringList sl=ui->edtSizes->text().split(",");
ui->labRenderTimes->setText("");
for (int i=0; i<sl.size(); i++) {
bool ok=true;
int size=sl[i].trimmed().toUInt(&ok);
if (!ok) size=10+i*5;
mt.set_fontSize(size);
double durationSizingMS=0, durationTimingMS=0;
Y+=draw(painter, X1, Y, mt, QString("%1, %2, %3pt").arg(ui->cmbTestset->currentText()).arg(ui->cmbFont->currentText()).arg(size), durationSizingMS, durationTimingMS);
if (i==0) {
if (mt.get_error_list().size()>0) {
ui->labError->setText("<span color=\"red\">"+mt.get_error_list().join("<br>")+"</span>");
} else {
ui->labError->setText("<span color=\"green\">OK</span>");
}
}
ui->labRenderTimes->setText(ui->labRenderTimes->text()+QString(" %1pt: %2ms/%3ms").arg(size).arg(durationSizingMS, 0, 'F', 1).arg(durationTimingMS, 0, 'F', 1));
ui->textBrowser->textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML: --------------------------------------------- ok="<<okh;
if (mt.get_error_list().size()>0) {
qDebug()<<mt.get_error_list().join("\n")<<"\n";
}
}
painter.end();
ui->label->setPixmap(pix);
QApplication::restoreOverrideCursor();
}

View File

@ -1,34 +1,34 @@
#ifndef TESTFORM_H
#define TESTFORM_H
#include <QWidget>
#include <QStringList>
#include "jkqtmathtext/jkqtmathtext.h"
#include "jkqtplottertools/jkqtphighrestimer.h"
#include <QPainter>
#include <QTreeWidget>
namespace Ui {
class TestForm;
}
class TestForm : public QWidget
{
Q_OBJECT
public:
explicit TestForm(QWidget *parent = 0);
~TestForm();
public slots:
void updateMath();
private:
Ui::TestForm *ui;
JKQTPHighResTimer ht;
double draw(QPainter& painter, double X, double YY, JKQTmathText& mt, QString name, double &durationSizingMS, double &durationTimingMS);
QTreeWidgetItem* createTree(JKQTmathText::MTnode* node, QTreeWidgetItem *parent=NULL);
};
#endif // TESTFORM_H
#ifndef TESTFORM_H
#define TESTFORM_H
#include <QWidget>
#include <QStringList>
#include "jkqtmathtext/jkqtmathtext.h"
#include "jkqtplottertools/jkqtphighrestimer.h"
#include <QPainter>
#include <QTreeWidget>
namespace Ui {
class TestForm;
}
class TestForm : public QWidget
{
Q_OBJECT
public:
explicit TestForm(QWidget *parent = 0);
~TestForm();
public slots:
void updateMath();
private:
Ui::TestForm *ui;
JKQTPHighResTimer ht;
double draw(QPainter& painter, double X, double YY, JKQTmathText& mt, QString name, double &durationSizingMS, double &durationTimingMS);
QTreeWidgetItem* createTree(JKQTmathText::MTnode* node, QTreeWidgetItem *parent=NULL);
};
#endif // TESTFORM_H

View File

@ -1,66 +1,66 @@
EmfEngine GNU GPL v. 3.0
------------------------
EmfEngine GNU GPL v. 3.0
------------------------
26/07/2010 - Release 0.8
This release improves the support for Unix-like systems, using the GDI API provided by libEMF:
- Fixes compilation issues.
- Fixes compilation issues.
- Fixed crash when exporting rotated text strings.
- Fixed drawing of paths.
- Fixed drawing of paths.
- Added support for drawing images and tiled pixmaps.
------------------------
30/08/2009 - Release 0.7:
- Fixed crash when exporting text strings having a non available font family using the GDI+ backend.
- Improved exporting of texts containing superscripts/subscripts.
------------------------
16/07/2009 - Release 0.6. Improvements for the GDI+ backend:
- Implemented support for pens with custom dash patterns.
- Fixed drawing of polygons.
- Fixed drawing of pixmaps/images.
------------------------
25/05/2009 - Release 0.5:
- Implemented drawPoints().
- Improved GDI+ backend:
- Fixed clipping.
- Improved drawRects().
------------------------
07/05/2009 - Release 0.4:
- Fixed compile errors with Visual Studio 2008.
- Removed clipping in drawTextItem().
- Improved the build system.
- Added the "EMFENGINE_DLL" and "EMFENGINE_DLL_BUILD" preprocessor flags in order to be able to build using Visual Studio (thanks to David Stranz).
------------------------
22/04/2009 - Release 0.3:
EmfEngine was completely rewritten using the Windows GDI+ API. The old implementation using Windows GDI (also provided by libEMF on Unix-like systems) is still available if you disable the HAVE_GDI_PLUS option in EmfEngine.pro.
This new implementation adds the following features:
- Antialiasing
- Antialiased texts (if the option HAVE_ANTIALIASED_TEXT is enabled in EmfEngine.pro)
- Transparent brushes
- Support for Qt::LinearGradientPattern and Qt::RadialGradientPattern
------------------------
13/04/2009 - Release 0.2:
- Implemented drawImage().
- Implemented drawTiledPixmap().
- Improved drawPixmap().
- Implemented rendering of QBrush with style set to Qt::TexturePattern.
- Improved paths handling in drawPath().
- Fixed polyline drawing in drawPolygon().
- Modified the example to make use of the new features.
------------------------
10/04/2009 - Release 0.1: Initial release.
30/08/2009 - Release 0.7:
- Fixed crash when exporting text strings having a non available font family using the GDI+ backend.
- Improved exporting of texts containing superscripts/subscripts.
------------------------
16/07/2009 - Release 0.6. Improvements for the GDI+ backend:
- Implemented support for pens with custom dash patterns.
- Fixed drawing of polygons.
- Fixed drawing of pixmaps/images.
------------------------
25/05/2009 - Release 0.5:
- Implemented drawPoints().
- Improved GDI+ backend:
- Fixed clipping.
- Improved drawRects().
------------------------
07/05/2009 - Release 0.4:
- Fixed compile errors with Visual Studio 2008.
- Removed clipping in drawTextItem().
- Improved the build system.
- Added the "EMFENGINE_DLL" and "EMFENGINE_DLL_BUILD" preprocessor flags in order to be able to build using Visual Studio (thanks to David Stranz).
------------------------
22/04/2009 - Release 0.3:
EmfEngine was completely rewritten using the Windows GDI+ API. The old implementation using Windows GDI (also provided by libEMF on Unix-like systems) is still available if you disable the HAVE_GDI_PLUS option in EmfEngine.pro.
This new implementation adds the following features:
- Antialiasing
- Antialiased texts (if the option HAVE_ANTIALIASED_TEXT is enabled in EmfEngine.pro)
- Transparent brushes
- Support for Qt::LinearGradientPattern and Qt::RadialGradientPattern
------------------------
13/04/2009 - Release 0.2:
- Implemented drawImage().
- Implemented drawTiledPixmap().
- Improved drawPixmap().
- Implemented rendering of QBrush with style set to Qt::TexturePattern.
- Improved paths handling in drawPath().
- Fixed polyline drawing in drawPolygon().
- Modified the example to make use of the new features.
------------------------
10/04/2009 - Release 0.1: Initial release.

View File

@ -1,7 +1,7 @@
include( config.pri )
TEMPLATE = subdirs
SUBDIRS = \
src \
include( config.pri )
TEMPLATE = subdirs
SUBDIRS = \
src \
example

View File

@ -1,28 +1,28 @@
EmfEngine GNU GPL v. 3.0
------------------------
AUTHOR: Ion Vasilief
------------------------
FEATURES: EmfEngine enables Qt based applications to easily export graphics created using the
QPainter class to the Enhanced MetaFile format (EMF).
---------------------------------------------------------------------------
DEPENDENCIES: You need Qt (http://www.qtsoftware.com) installed on your system in order to build EmfEngine.
On Unix-like systems you also need libEMF (http://libemf.sourceforge.net/).
---------------------------------------------------------------------------
COMPILING: EmfEngine uses qmake for the building process.
qmake is part of a Qt distribution:
qmake reads project files, that contain the options and rules how to build a certain project.
A project file ends with the suffix "*.pro". Please read the qmake documentation for more details.
After installing Qt on your system, type the following command lines:
$ qmake
$ make
if you use MinGW, or:
$ qmake -tp vc -r
if you use Microsoft Visual Studio (this will generate Visual Studio .vcproj project files in the "src" and "example" folders).
---------------------------------------------------------------------------
USE: a short demo application is provided in the "example" folder of the source archive.
---------------------------------------------------------------------------
EmfEngine GNU GPL v. 3.0
------------------------
AUTHOR: Ion Vasilief
------------------------
FEATURES: EmfEngine enables Qt based applications to easily export graphics created using the
QPainter class to the Enhanced MetaFile format (EMF).
---------------------------------------------------------------------------
DEPENDENCIES: You need Qt (http://www.qtsoftware.com) installed on your system in order to build EmfEngine.
On Unix-like systems you also need libEMF (http://libemf.sourceforge.net/).
---------------------------------------------------------------------------
COMPILING: EmfEngine uses qmake for the building process.
qmake is part of a Qt distribution:
qmake reads project files, that contain the options and rules how to build a certain project.
A project file ends with the suffix "*.pro". Please read the qmake documentation for more details.
After installing Qt on your system, type the following command lines:
$ qmake
$ make
if you use MinGW, or:
$ qmake -tp vc -r
if you use Microsoft Visual Studio (this will generate Visual Studio .vcproj project files in the "src" and "example" folders).
---------------------------------------------------------------------------
USE: a short demo application is provided in the "example" folder of the source archive.
---------------------------------------------------------------------------

View File

@ -1,15 +1,15 @@
CONFIG += qt warn_on thread
CONFIG += release
# Comment the following line if you want to build using the GDI backend
win32:CONFIG += HAVE_GDI_PLUS
# Uncomment the following line if you want to enable text antialiasing (works only with the GDI+ backend enabled)
#DEFINES += HAVE_ANTIALIASED_TEXT
# Comment the following line if you want to build EmfEngine statically
#CONFIG += EmfEngineDll
CONFIG += qt warn_on thread
CONFIG += release
# Comment the following line if you want to build using the GDI backend
win32:CONFIG += HAVE_GDI_PLUS
# Uncomment the following line if you want to enable text antialiasing (works only with the GDI+ backend enabled)
#DEFINES += HAVE_ANTIALIASED_TEXT
# Comment the following line if you want to build EmfEngine statically
#CONFIG += EmfEngineDll

View File

@ -1,23 +1,23 @@
include( ../config.pri )
TARGET = example
TEMPLATE = app
CONFIG += warn_on release thread
win32: CONFIG += console
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ./
INCLUDEPATH += ../src
unix: INCLUDEPATH += /usr/local/include/libEMF
LIBS += ../libEmfEngine.a
win32: LIBS += -lgdi32
unix: LIBS += /usr/local/lib/libEMF.a
HEADERS = renderarea.h \
pixmaps.h
SOURCES = main.cpp \
renderarea.cpp
include( ../config.pri )
TARGET = example
TEMPLATE = app
CONFIG += warn_on release thread
win32: CONFIG += console
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ./
INCLUDEPATH += ../src
unix: INCLUDEPATH += /usr/local/include/libEMF
LIBS += ../libEmfEngine.a
win32: LIBS += -lgdi32
unix: LIBS += /usr/local/lib/libEMF.a
HEADERS = renderarea.h \
pixmaps.h
SOURCES = main.cpp \
renderarea.cpp

View File

@ -1,20 +1,20 @@
#include <QApplication>
#include "renderarea.h"
#include <EmfEngine.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
RenderArea area;
area.setGeometry(100, 100, 600, 500);
area.show();
EmfPaintDevice emf(QSize(600, 500), QString("example.emf"));
QPainter paint;
paint.begin(&emf);
area.draw(&paint);
paint.end();
return app.exec();
}
#include <QApplication>
#include "renderarea.h"
#include <EmfEngine.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
RenderArea area;
area.setGeometry(100, 100, 600, 500);
area.show();
EmfPaintDevice emf(QSize(600, 500), QString("example.emf"));
QPainter paint;
paint.begin(&emf);
area.draw(&paint);
paint.end();
return app.exec();
}

View File

@ -1,135 +1,135 @@
#include <QtGui>
#include "renderarea.h"
#include "pixmaps.h"
RenderArea::RenderArea(QWidget *parent)
: QWidget(parent)
{
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
setFixedWidth(600);
setFixedHeight(500);
}
void RenderArea::draw(QPainter *painter)
{
static const QPoint points[4] = {
QPoint(10, 80),
QPoint(20, 10),
QPoint(80, 30),
QPoint(90, 70)
};
QRect rect(10, 20, 80, 60);
QPainterPath path;
path.moveTo(20, 80);
path.lineTo(20, 30);
path.cubicTo(80, 0, 50, 50, 80, 80);
int startAngle = 20 * 16;
int arcLength = 120 * 16;
QLinearGradient linearGrad(QPointF(0, 0), QPointF(100, 100));
linearGrad.setColorAt(0, Qt::black);
linearGrad.setColorAt(1, Qt::red);
QRadialGradient radialGrad(QPointF(50, 50), 40, QPointF(75, 50));
radialGrad.setColorAt(0, Qt::white);
radialGrad.setColorAt(0.5, Qt::black);
radialGrad.setColorAt(1, Qt::red);
/*QConicalGradient conGrad(QPointF(50, 50), 90);
conGrad.setColorAt(0, Qt::blue);
conGrad.setColorAt(0.5, Qt::red);
conGrad.setColorAt(1, Qt::green);
QBrush brush = QBrush(conGrad);*/
QBrush brush = QBrush(Qt::gray);
int brushStyle = Qt::NoBrush;
int penStyle = Qt::NoPen;
int shape = Rect;
int drawnRects = 0;
for (int x = 0; x < width(); x += 100){
for (int y = 0; y < height(); y += 100){
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
shape = (shape + 1)%14;
penStyle = (penStyle + 1)%4;
if(!penStyle)
penStyle = 1;
if (shape == RoundedRect && drawnRects < 2){
if (drawnRects == 0)
painter->setBrush(QBrush(linearGrad));
else if (drawnRects == 1)
painter->setBrush(QBrush(radialGrad));
drawnRects++;
} else {
brushStyle = (brushStyle + 1)%14;
if(!brushStyle)
brushStyle = 1;
brush.setStyle((Qt::BrushStyle)brushStyle);
painter->setBrush(brush);
}
painter->setPen(QPen(Qt::black, 2, (Qt::PenStyle)penStyle, Qt::FlatCap, Qt::MiterJoin));
painter->translate(x, y);
switch (shape) {
case Line:
painter->drawLine(rect.bottomLeft(), rect.topRight());
break;
case Polyline:
painter->drawPolyline(points, 4);
break;
case Polygon:
painter->drawPolygon(points, 4);
break;
case Rect:
painter->drawRect(rect);
break;
case RoundedRect:
painter->drawRoundedRect(rect, 25, 25, Qt::RelativeSize);
break;
case Ellipse:
painter->drawEllipse(rect);
break;
case Arc:
painter->drawArc(rect, startAngle, arcLength);
break;
case Chord:
painter->drawChord(rect, startAngle, arcLength);
break;
case Pie:
painter->drawPie(rect, startAngle, arcLength);
break;
case Path:
painter->drawPath(path);
break;
case Text:
painter->drawText(rect, Qt::AlignCenter, "EmfEngine demo");
break;
case Pixmap:
painter->drawPixmap(10, 10, QPixmap(qt_logo_xpm));
break;
case TiledPixmap:
painter->drawTiledPixmap (QRect(10, 10, 64, 64), QPixmap(brick_xpm));
break;
}
painter->restore();
}
}
painter->setPen(Qt::darkGray);
painter->setBrush(Qt::NoBrush);
painter->drawRect(QRect(9, 9, width() - 18, height() - 18));
}
void RenderArea::paintEvent(QPaintEvent * /* event */)
{
QPainter painter(this);
draw(&painter);
}
#include <QtGui>
#include "renderarea.h"
#include "pixmaps.h"
RenderArea::RenderArea(QWidget *parent)
: QWidget(parent)
{
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
setFixedWidth(600);
setFixedHeight(500);
}
void RenderArea::draw(QPainter *painter)
{
static const QPoint points[4] = {
QPoint(10, 80),
QPoint(20, 10),
QPoint(80, 30),
QPoint(90, 70)
};
QRect rect(10, 20, 80, 60);
QPainterPath path;
path.moveTo(20, 80);
path.lineTo(20, 30);
path.cubicTo(80, 0, 50, 50, 80, 80);
int startAngle = 20 * 16;
int arcLength = 120 * 16;
QLinearGradient linearGrad(QPointF(0, 0), QPointF(100, 100));
linearGrad.setColorAt(0, Qt::black);
linearGrad.setColorAt(1, Qt::red);
QRadialGradient radialGrad(QPointF(50, 50), 40, QPointF(75, 50));
radialGrad.setColorAt(0, Qt::white);
radialGrad.setColorAt(0.5, Qt::black);
radialGrad.setColorAt(1, Qt::red);
/*QConicalGradient conGrad(QPointF(50, 50), 90);
conGrad.setColorAt(0, Qt::blue);
conGrad.setColorAt(0.5, Qt::red);
conGrad.setColorAt(1, Qt::green);
QBrush brush = QBrush(conGrad);*/
QBrush brush = QBrush(Qt::gray);
int brushStyle = Qt::NoBrush;
int penStyle = Qt::NoPen;
int shape = Rect;
int drawnRects = 0;
for (int x = 0; x < width(); x += 100){
for (int y = 0; y < height(); y += 100){
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
shape = (shape + 1)%14;
penStyle = (penStyle + 1)%4;
if(!penStyle)
penStyle = 1;
if (shape == RoundedRect && drawnRects < 2){
if (drawnRects == 0)
painter->setBrush(QBrush(linearGrad));
else if (drawnRects == 1)
painter->setBrush(QBrush(radialGrad));
drawnRects++;
} else {
brushStyle = (brushStyle + 1)%14;
if(!brushStyle)
brushStyle = 1;
brush.setStyle((Qt::BrushStyle)brushStyle);
painter->setBrush(brush);
}
painter->setPen(QPen(Qt::black, 2, (Qt::PenStyle)penStyle, Qt::FlatCap, Qt::MiterJoin));
painter->translate(x, y);
switch (shape) {
case Line:
painter->drawLine(rect.bottomLeft(), rect.topRight());
break;
case Polyline:
painter->drawPolyline(points, 4);
break;
case Polygon:
painter->drawPolygon(points, 4);
break;
case Rect:
painter->drawRect(rect);
break;
case RoundedRect:
painter->drawRoundedRect(rect, 25, 25, Qt::RelativeSize);
break;
case Ellipse:
painter->drawEllipse(rect);
break;
case Arc:
painter->drawArc(rect, startAngle, arcLength);
break;
case Chord:
painter->drawChord(rect, startAngle, arcLength);
break;
case Pie:
painter->drawPie(rect, startAngle, arcLength);
break;
case Path:
painter->drawPath(path);
break;
case Text:
painter->drawText(rect, Qt::AlignCenter, "EmfEngine demo");
break;
case Pixmap:
painter->drawPixmap(10, 10, QPixmap(qt_logo_xpm));
break;
case TiledPixmap:
painter->drawTiledPixmap (QRect(10, 10, 64, 64), QPixmap(brick_xpm));
break;
}
painter->restore();
}
}
painter->setPen(Qt::darkGray);
painter->setBrush(Qt::NoBrush);
painter->drawRect(QRect(9, 9, width() - 18, height() - 18));
}
void RenderArea::paintEvent(QPaintEvent * /* event */)
{
QPainter painter(this);
draw(&painter);
}

View File

@ -1,19 +1,19 @@
#ifndef RENDERAREA_H
#define RENDERAREA_H
#include <QWidget>
class RenderArea : public QWidget
{
public:
enum Shape { Line, Polyline, Polygon, Rect, RoundedRect, Ellipse, Arc,
Chord, Pie, Path, Text, Pixmap, TiledPixmap };
RenderArea(QWidget *parent = 0);
void draw(QPainter *painter);
protected:
void paintEvent(QPaintEvent *event);
};
#endif
#ifndef RENDERAREA_H
#define RENDERAREA_H
#include <QWidget>
class RenderArea : public QWidget
{
public:
enum Shape { Line, Polyline, Polygon, Rect, RoundedRect, Ellipse, Arc,
Chord, Pie, Path, Text, Pixmap, TiledPixmap };
RenderArea(QWidget *parent = 0);
void draw(QPainter *painter);
protected:
void paintEvent(QPaintEvent *event);
};
#endif

View File

@ -1,138 +1,138 @@
/***************************************************************************
File : EmfEngine.h
Project : EmfEngine
--------------------------------------------------------------------
Copyright : (C) 2009 - 2010 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Enables the export of QPainter grafics to
Windows Enhanced Metafiles (.emf)
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef EMFENGINE_H
#define EMFENGINE_H
#include <QPaintDevice>
#include <QPaintEngine>
#ifdef Q_WS_WIN
#include <windows.h>
#endif
#ifdef EMFENGINE_DLL
# ifdef EMFENGINE_DLL_BUILD
# define EMFENGINELIB_EXPORT Q_DECL_EXPORT
# else
# define EMFENGINELIB_EXPORT Q_DECL_IMPORT
# endif
#else
# define EMFENGINELIB_EXPORT
#endif
#ifdef HAVE_GDIPLUS
#include <gdiplus.h>
using namespace Gdiplus;
#else
#ifdef Q_WS_X11
#include <emf.h>
#endif
#ifdef Q_WS_MAC
#include <emf.h>
#endif
#undef min
#undef max
#endif
class EmfPaintEngine : public QPaintEngine
{
public:
EmfPaintEngine(const QString&);
~EmfPaintEngine(){};
virtual bool begin(QPaintDevice*);
virtual bool end();
virtual void updateState( const QPaintEngineState & ) {};
virtual void drawEllipse(const QRectF &);
virtual void drawImage(const QRectF& r, const QImage& im, const QRectF& sr) {drawPixmap(r,QPixmap::fromImage(im),sr);};
virtual QPaintEngine::Type type() const {return QPaintEngine::User;};
virtual void drawPoints ( const QPointF * points, int pointCount );
virtual void drawLines ( const QLineF * , int );
virtual void drawPath ( const QPainterPath & path );
virtual void drawPolygon ( const QPointF * , int , PolygonDrawMode );
virtual void drawTextItem ( const QPointF & , const QTextItem & );
virtual void drawRects ( const QRectF * , int );
virtual void drawPixmap ( const QRectF &, const QPixmap &, const QRectF &);
virtual void drawTiledPixmap(const QRectF &, const QPixmap &, const QPointF &);
virtual void drawImage(const QRectF &, const QImage &, const QRectF &, Qt::ImageConversionFlags);
#ifdef HAVE_GDIPLUS
Graphics *graphicsObject(){return d_grx;};
GraphicsPath *convertPath (const QPainterPath & path);
#endif
private:
#ifdef HAVE_GDIPLUS
Metafile *metafile;
Graphics *d_grx;
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
//! Converts a QPen to a GDI+ Pen structure
Pen *convertPen(const QPen& pen);
//! Converts a QBrush to a GDI+ Brush structure
Brush *convertBrush(const QBrush& brush, GraphicsPath *origPath = nullptr);
//! Draws pixmap pix in a given rectangle
void drawPixmap(const QPixmap &pix, const RectF &p);
//! Constructs a texture brush based on pixmap pix
TextureBrush *textureBrush(const QPixmap & pix);
#else
//! Converts a QPen to a HPEN structure
HPEN convertPen(const QPen&);
//! Converts a QBrush to a HBRUSH structure
HBRUSH convertBrush(const QBrush&);
//! Pointer to the metafile device context
HDC metaDC;
RECT d_rect;
#endif
//! Name of the output metafile
QString fname;
void setClipping();
void resetClipping();
};
class EMFENGINELIB_EXPORT EmfPaintDevice : public QPaintDevice
{
public:
EmfPaintDevice(const QSize& s, const QString& fileName);
~EmfPaintDevice();
virtual QPaintEngine * paintEngine () const;
protected:
virtual int metric ( PaintDeviceMetric ) const;
private:
//! Size in pixels
QSize d_size;
EmfPaintEngine* engine;
};
#endif
/***************************************************************************
File : EmfEngine.h
Project : EmfEngine
--------------------------------------------------------------------
Copyright : (C) 2009 - 2010 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Enables the export of QPainter grafics to
Windows Enhanced Metafiles (.emf)
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef EMFENGINE_H
#define EMFENGINE_H
#include <QPaintDevice>
#include <QPaintEngine>
#ifdef Q_WS_WIN
#include <windows.h>
#endif
#ifdef EMFENGINE_DLL
# ifdef EMFENGINE_DLL_BUILD
# define EMFENGINELIB_EXPORT Q_DECL_EXPORT
# else
# define EMFENGINELIB_EXPORT Q_DECL_IMPORT
# endif
#else
# define EMFENGINELIB_EXPORT
#endif
#ifdef HAVE_GDIPLUS
#include <gdiplus.h>
using namespace Gdiplus;
#else
#ifdef Q_WS_X11
#include <emf.h>
#endif
#ifdef Q_WS_MAC
#include <emf.h>
#endif
#undef min
#undef max
#endif
class EmfPaintEngine : public QPaintEngine
{
public:
EmfPaintEngine(const QString&);
~EmfPaintEngine(){};
virtual bool begin(QPaintDevice*);
virtual bool end();
virtual void updateState( const QPaintEngineState & ) {};
virtual void drawEllipse(const QRectF &);
virtual void drawImage(const QRectF& r, const QImage& im, const QRectF& sr) {drawPixmap(r,QPixmap::fromImage(im),sr);};
virtual QPaintEngine::Type type() const {return QPaintEngine::User;};
virtual void drawPoints ( const QPointF * points, int pointCount );
virtual void drawLines ( const QLineF * , int );
virtual void drawPath ( const QPainterPath & path );
virtual void drawPolygon ( const QPointF * , int , PolygonDrawMode );
virtual void drawTextItem ( const QPointF & , const QTextItem & );
virtual void drawRects ( const QRectF * , int );
virtual void drawPixmap ( const QRectF &, const QPixmap &, const QRectF &);
virtual void drawTiledPixmap(const QRectF &, const QPixmap &, const QPointF &);
virtual void drawImage(const QRectF &, const QImage &, const QRectF &, Qt::ImageConversionFlags);
#ifdef HAVE_GDIPLUS
Graphics *graphicsObject(){return d_grx;};
GraphicsPath *convertPath (const QPainterPath & path);
#endif
private:
#ifdef HAVE_GDIPLUS
Metafile *metafile;
Graphics *d_grx;
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
//! Converts a QPen to a GDI+ Pen structure
Pen *convertPen(const QPen& pen);
//! Converts a QBrush to a GDI+ Brush structure
Brush *convertBrush(const QBrush& brush, GraphicsPath *origPath = nullptr);
//! Draws pixmap pix in a given rectangle
void drawPixmap(const QPixmap &pix, const RectF &p);
//! Constructs a texture brush based on pixmap pix
TextureBrush *textureBrush(const QPixmap & pix);
#else
//! Converts a QPen to a HPEN structure
HPEN convertPen(const QPen&);
//! Converts a QBrush to a HBRUSH structure
HBRUSH convertBrush(const QBrush&);
//! Pointer to the metafile device context
HDC metaDC;
RECT d_rect;
#endif
//! Name of the output metafile
QString fname;
void setClipping();
void resetClipping();
};
class EMFENGINELIB_EXPORT EmfPaintDevice : public QPaintDevice
{
public:
EmfPaintDevice(const QSize& s, const QString& fileName);
~EmfPaintDevice();
virtual QPaintEngine * paintEngine () const;
protected:
virtual int metric ( PaintDeviceMetric ) const;
private:
//! Size in pixels
QSize d_size;
EmfPaintEngine* engine;
};
#endif

View File

@ -1,78 +1,78 @@
/***************************************************************************
File : EmfPaintDevice.cpp
Project : EmfEngine
--------------------------------------------------------------------
Copyright : (C) 2009 -2010 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Enables the export of QPainter grafics to
Windows Enhanced Metafiles (.emf) by using GDI calls
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#include "EmfEngine.h"
#include <QApplication>
#include <QDesktopWidget>
EmfPaintDevice::EmfPaintDevice(const QSize& s, const QString& fileName) : QPaintDevice(),
d_size(s)
{
engine = new EmfPaintEngine(fileName);
}
EmfPaintDevice::~EmfPaintDevice()
{
delete engine;
}
QPaintEngine * EmfPaintDevice::paintEngine () const
{
return engine;
}
int EmfPaintDevice::metric ( PaintDeviceMetric metric ) const
{
int xdpi = QApplication::desktop()->logicalDpiX();
int ydpi = QApplication::desktop()->logicalDpiY();
switch (metric){
case QPaintDevice::PdmWidth:
return d_size.width();
case QPaintDevice::PdmHeight:
return d_size.height();
case QPaintDevice::PdmWidthMM:
return int(25.4*d_size.width()/(double)xdpi);
case QPaintDevice::PdmHeightMM:
return int(25.4*d_size.height()/(double)ydpi);
case QPaintDevice::PdmNumColors:
return 65536;//should it be millions?
case QPaintDevice::PdmDepth:
return 32;
case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmPhysicalDpiX:
return xdpi;
case QPaintDevice::PdmDpiY:
case QPaintDevice::PdmPhysicalDpiY:
return ydpi;
default:
qWarning ("EmfPaintDevice::Strange metric asked");
return 0;
}
}
/***************************************************************************
File : EmfPaintDevice.cpp
Project : EmfEngine
--------------------------------------------------------------------
Copyright : (C) 2009 -2010 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Enables the export of QPainter grafics to
Windows Enhanced Metafiles (.emf) by using GDI calls
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#include "EmfEngine.h"
#include <QApplication>
#include <QDesktopWidget>
EmfPaintDevice::EmfPaintDevice(const QSize& s, const QString& fileName) : QPaintDevice(),
d_size(s)
{
engine = new EmfPaintEngine(fileName);
}
EmfPaintDevice::~EmfPaintDevice()
{
delete engine;
}
QPaintEngine * EmfPaintDevice::paintEngine () const
{
return engine;
}
int EmfPaintDevice::metric ( PaintDeviceMetric metric ) const
{
int xdpi = QApplication::desktop()->logicalDpiX();
int ydpi = QApplication::desktop()->logicalDpiY();
switch (metric){
case QPaintDevice::PdmWidth:
return d_size.width();
case QPaintDevice::PdmHeight:
return d_size.height();
case QPaintDevice::PdmWidthMM:
return int(25.4*d_size.width()/(double)xdpi);
case QPaintDevice::PdmHeightMM:
return int(25.4*d_size.height()/(double)ydpi);
case QPaintDevice::PdmNumColors:
return 65536;//should it be millions?
case QPaintDevice::PdmDepth:
return 32;
case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmPhysicalDpiX:
return xdpi;
case QPaintDevice::PdmDpiY:
case QPaintDevice::PdmPhysicalDpiY:
return ydpi;
default:
qWarning ("EmfPaintDevice::Strange metric asked");
return 0;
}
}

View File

@ -1,26 +1,26 @@
# qmake project file for building the EmfEngine libraries
include( ../config.pri )
TARGET = EmfEngine
TEMPLATE = lib
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ../
contains(CONFIG, EmfEngineDll) {
CONFIG += dll
DEFINES += EMFENGINE_DLL EMFENGINE_DLL_BUILD
} else {
CONFIG += staticlib
}
HEADERS = EmfEngine.h
SOURCES += EmfEngine.cpp
SOURCES += EmfPaintDevice.cpp
win32: LIBS += -lgdi32
unix: LIBS += /usr/local/lib/libEMF.a
unix: INCLUDEPATH += /usr/local/include/libEMF
# qmake project file for building the EmfEngine libraries
include( ../config.pri )
TARGET = EmfEngine
TEMPLATE = lib
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ../
contains(CONFIG, EmfEngineDll) {
CONFIG += dll
DEFINES += EMFENGINE_DLL EMFENGINE_DLL_BUILD
} else {
CONFIG += staticlib
}
HEADERS = EmfEngine.h
SOURCES += EmfEngine.cpp
SOURCES += EmfPaintDevice.cpp
win32: LIBS += -lgdi32
unix: LIBS += /usr/local/lib/libEMF.a
unix: INCLUDEPATH += /usr/local/include/libEMF

View File

@ -1,16 +1,16 @@
QTeXEngine GNU GPL v. 3.0
------------------------
09/11/2010 - Release 0.3:
Fixed a bug leading to the creation of empty drawing paths.
------------------------
17/08/2009 - Release 0.2:
- Improved handling of text strings.
- Added several useful output options.
- Added Doxygen configuration files.
------------------------
QTeXEngine GNU GPL v. 3.0
------------------------
09/11/2010 - Release 0.3:
Fixed a bug leading to the creation of empty drawing paths.
------------------------
17/08/2009 - Release 0.2:
- Improved handling of text strings.
- Added several useful output options.
- Added Doxygen configuration files.
------------------------
05/08/2009 - Release 0.1: Initial release.

View File

@ -1,8 +1,8 @@
include( config.pri )
TEMPLATE = subdirs
SUBDIRS = \
src \
example \
include( config.pri )
TEMPLATE = subdirs
SUBDIRS = \
src \
example \
test

View File

@ -1,28 +1,28 @@
QTeXEngine GNU GPL v. 3.0
------------------------
AUTHOR: Ion Vasilief
------------------------
FEATURES: QTeXEngine enables Qt based applications to easily export graphics created using the
QPainter class to the .tex format using Pgf/TikZ packages (http://sourceforge.net/projects/pgf/).
---------------------------------------------------------------------------
DEPENDENCIES: You need Qt (http://www.qtsoftware.com) installed on your system in order to build QTeXEngine.
---------------------------------------------------------------------------
COMPILING: QTeXEngine uses qmake for the building process.
qmake is part of a Qt distribution:
qmake reads project files, that contain the options and rules how to build a certain project.
A project file ends with the suffix "*.pro". Please read the qmake documentation for more details.
After installing Qt on your system, type the following command lines:
$ qmake
$ make
if you use MinGW, or:
$ qmake -tp vc -r
if you use Microsoft Visual Studio (this will generate Visual Studio .vcproj project files in the "src" and "example" folders).
---------------------------------------------------------------------------
USE: a short demo application is provided in the "example" folder of the source archive.
---------------------------------------------------------------------------
QTeXEngine GNU GPL v. 3.0
------------------------
AUTHOR: Ion Vasilief
------------------------
FEATURES: QTeXEngine enables Qt based applications to easily export graphics created using the
QPainter class to the .tex format using Pgf/TikZ packages (http://sourceforge.net/projects/pgf/).
---------------------------------------------------------------------------
DEPENDENCIES: You need Qt (http://www.qtsoftware.com) installed on your system in order to build QTeXEngine.
---------------------------------------------------------------------------
COMPILING: QTeXEngine uses qmake for the building process.
qmake is part of a Qt distribution:
qmake reads project files, that contain the options and rules how to build a certain project.
A project file ends with the suffix "*.pro". Please read the qmake documentation for more details.
After installing Qt on your system, type the following command lines:
$ qmake
$ make
if you use MinGW, or:
$ qmake -tp vc -r
if you use Microsoft Visual Studio (this will generate Visual Studio .vcproj project files in the "src" and "example" folders).
---------------------------------------------------------------------------
USE: a short demo application is provided in the "example" folder of the source archive.
---------------------------------------------------------------------------

View File

@ -1,9 +1,9 @@
CONFIG += qt warn_on thread
CONFIG += release
# Comment the lines bellow if you want to build QTeXEngine statically
#CONFIG += QTeXEngineDll
CONFIG += qt warn_on thread
CONFIG += release
# Comment the lines bellow if you want to build QTeXEngine statically
#CONFIG += QTeXEngineDll

View File

@ -1,222 +1,222 @@
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = QTeXEngine
PROJECT_NUMBER = 0.2
OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = YES
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = YES
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src .
FILE_PATTERNS = *.cpp \
*.h \
*.txt \
*.dox
RECURSIVE = yes
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = *moc_*
EXAMPLE_PATH = ../README.txt ../COPYING.txt
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
# recommendation: install graphviz and use HAVE_DOT = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = QTeXEngine
PROJECT_NUMBER = 0.2
OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = YES
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = YES
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src .
FILE_PATTERNS = *.cpp \
*.h \
*.txt \
*.dox
RECURSIVE = yes
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = *moc_*
EXAMPLE_PATH = ../README.txt ../COPYING.txt
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
# recommendation: install graphviz and use HAVE_DOT = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 35 B

After

Width:  |  Height:  |  Size: 35 B

View File

Before

Width:  |  Height:  |  Size: 706 B

After

Width:  |  Height:  |  Size: 706 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,15 +1,15 @@
TARGET = example
TEMPLATE = app
CONFIG += warn_on release thread
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ./
INCLUDEPATH += ../src
LIBS += ../libQTeXEngine.a
HEADERS = renderarea.h \
pixmaps.h
SOURCES = main.cpp \
renderarea.cpp
TARGET = example
TEMPLATE = app
CONFIG += warn_on release thread
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ./
INCLUDEPATH += ../src
LIBS += ../libQTeXEngine.a
HEADERS = renderarea.h \
pixmaps.h
SOURCES = main.cpp \
renderarea.cpp

View File

@ -1,21 +1,21 @@
#include <QApplication>
#include "renderarea.h"
#include <QTeXEngine.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
RenderArea area;
area.setGeometry(100, 100, 600, 500);
area.show();
QTeXPaintDevice tex(QString("example.tex"), QSize(600, 500));
tex.setDocumentMode();
QPainter paint;
paint.begin(&tex);
area.draw(&paint);
paint.end();
return app.exec();
}
#include <QApplication>
#include "renderarea.h"
#include <QTeXEngine.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
RenderArea area;
area.setGeometry(100, 100, 600, 500);
area.show();
QTeXPaintDevice tex(QString("example.tex"), QSize(600, 500));
tex.setDocumentMode();
QPainter paint;
paint.begin(&tex);
area.draw(&paint);
paint.end();
return app.exec();
}

View File

@ -1,134 +1,134 @@
#include <QtGui>
#include "renderarea.h"
#include "pixmaps.h"
RenderArea::RenderArea(QWidget *parent)
: QWidget(parent)
{
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
setFixedWidth(600);
setFixedHeight(500);
}
void RenderArea::draw(QPainter *painter)
{
static const QPoint points[4] = {
QPoint(10, 80),
QPoint(20, 10),
QPoint(80, 30),
QPoint(90, 70)
};
QRect rect(10, 20, 80, 60);
QPainterPath path;
path.moveTo(20, 80);
path.lineTo(20, 30);
path.cubicTo(80, 0, 50, 50, 80, 80);
int startAngle = 20 * 16;
int arcLength = 120 * 16;
QLinearGradient linearGrad(QPointF(0, 0), QPointF(100, 100));
linearGrad.setColorAt(0, Qt::black);
linearGrad.setColorAt(1, Qt::red);
QRadialGradient radialGrad(QPointF(50, 50), 50, QPointF(50, 50));
radialGrad.setColorAt(0, Qt::red);
radialGrad.setColorAt(1, Qt::green);
/*QConicalGradient conGrad(QPointF(50, 50), 90);
conGrad.setColorAt(0, Qt::blue);
conGrad.setColorAt(0.5, Qt::red);
conGrad.setColorAt(1, Qt::green);
QBrush brush = QBrush(conGrad);*/
QBrush brush = QBrush(Qt::gray);
int brushStyle = Qt::NoBrush;
int penStyle = Qt::NoPen;
int shape = Rect;
int drawnRects = 0;
for (int x = 0; x < width(); x += 100){
for (int y = 0; y < height(); y += 100){
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
shape = (shape + 1)%14;
penStyle = (penStyle + 1)%4;
if(!penStyle)
penStyle = 1;
if (shape == RoundedRect && drawnRects < 2){
if (drawnRects == 0)
painter->setBrush(QBrush(linearGrad));
else if (drawnRects == 1)
painter->setBrush(QBrush(radialGrad));
drawnRects++;
} else {
brushStyle = (brushStyle + 1)%14;
if(!brushStyle)
brushStyle = 1;
brush.setStyle((Qt::BrushStyle)brushStyle);
painter->setBrush(brush);
}
painter->setPen(QPen(Qt::black, 2, (Qt::PenStyle)penStyle, Qt::FlatCap, Qt::MiterJoin));
painter->translate(x, y);
switch (shape) {
case Line:
painter->drawLine(rect.bottomLeft(), rect.topRight());
break;
case Polyline:
painter->drawPolyline(points, 4);
break;
case Polygon:
painter->drawPolygon(points, 4);
break;
case Rect:
painter->drawRect(rect);
break;
case RoundedRect:
painter->drawRoundedRect(rect, 25, 25, Qt::RelativeSize);
break;
case Ellipse:
painter->drawEllipse(rect);
break;
case Arc:
painter->drawArc(rect, startAngle, arcLength);
break;
case Chord:
painter->drawChord(rect, startAngle, arcLength);
break;
case Pie:
painter->drawPie(rect, startAngle, arcLength);
break;
case Path:
painter->drawPath(path);
break;
case Text:
painter->drawText(rect, Qt::AlignCenter, "QTeXEngine");
break;
case Pixmap:
painter->drawPixmap(10, 10, QPixmap(qt_logo_xpm));
break;
case TiledPixmap:
painter->drawTiledPixmap (QRect(10, 10, 64, 64), QPixmap(brick_xpm));
break;
}
painter->restore();
}
}
painter->setPen(Qt::darkGray);
painter->setBrush(Qt::NoBrush);
painter->drawRect(QRect(9, 9, width() - 18, height() - 18));
}
void RenderArea::paintEvent(QPaintEvent * /* event */)
{
QPainter painter(this);
draw(&painter);
}
#include <QtGui>
#include "renderarea.h"
#include "pixmaps.h"
RenderArea::RenderArea(QWidget *parent)
: QWidget(parent)
{
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
setFixedWidth(600);
setFixedHeight(500);
}
void RenderArea::draw(QPainter *painter)
{
static const QPoint points[4] = {
QPoint(10, 80),
QPoint(20, 10),
QPoint(80, 30),
QPoint(90, 70)
};
QRect rect(10, 20, 80, 60);
QPainterPath path;
path.moveTo(20, 80);
path.lineTo(20, 30);
path.cubicTo(80, 0, 50, 50, 80, 80);
int startAngle = 20 * 16;
int arcLength = 120 * 16;
QLinearGradient linearGrad(QPointF(0, 0), QPointF(100, 100));
linearGrad.setColorAt(0, Qt::black);
linearGrad.setColorAt(1, Qt::red);
QRadialGradient radialGrad(QPointF(50, 50), 50, QPointF(50, 50));
radialGrad.setColorAt(0, Qt::red);
radialGrad.setColorAt(1, Qt::green);
/*QConicalGradient conGrad(QPointF(50, 50), 90);
conGrad.setColorAt(0, Qt::blue);
conGrad.setColorAt(0.5, Qt::red);
conGrad.setColorAt(1, Qt::green);
QBrush brush = QBrush(conGrad);*/
QBrush brush = QBrush(Qt::gray);
int brushStyle = Qt::NoBrush;
int penStyle = Qt::NoPen;
int shape = Rect;
int drawnRects = 0;
for (int x = 0; x < width(); x += 100){
for (int y = 0; y < height(); y += 100){
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
shape = (shape + 1)%14;
penStyle = (penStyle + 1)%4;
if(!penStyle)
penStyle = 1;
if (shape == RoundedRect && drawnRects < 2){
if (drawnRects == 0)
painter->setBrush(QBrush(linearGrad));
else if (drawnRects == 1)
painter->setBrush(QBrush(radialGrad));
drawnRects++;
} else {
brushStyle = (brushStyle + 1)%14;
if(!brushStyle)
brushStyle = 1;
brush.setStyle((Qt::BrushStyle)brushStyle);
painter->setBrush(brush);
}
painter->setPen(QPen(Qt::black, 2, (Qt::PenStyle)penStyle, Qt::FlatCap, Qt::MiterJoin));
painter->translate(x, y);
switch (shape) {
case Line:
painter->drawLine(rect.bottomLeft(), rect.topRight());
break;
case Polyline:
painter->drawPolyline(points, 4);
break;
case Polygon:
painter->drawPolygon(points, 4);
break;
case Rect:
painter->drawRect(rect);
break;
case RoundedRect:
painter->drawRoundedRect(rect, 25, 25, Qt::RelativeSize);
break;
case Ellipse:
painter->drawEllipse(rect);
break;
case Arc:
painter->drawArc(rect, startAngle, arcLength);
break;
case Chord:
painter->drawChord(rect, startAngle, arcLength);
break;
case Pie:
painter->drawPie(rect, startAngle, arcLength);
break;
case Path:
painter->drawPath(path);
break;
case Text:
painter->drawText(rect, Qt::AlignCenter, "QTeXEngine");
break;
case Pixmap:
painter->drawPixmap(10, 10, QPixmap(qt_logo_xpm));
break;
case TiledPixmap:
painter->drawTiledPixmap (QRect(10, 10, 64, 64), QPixmap(brick_xpm));
break;
}
painter->restore();
}
}
painter->setPen(Qt::darkGray);
painter->setBrush(Qt::NoBrush);
painter->drawRect(QRect(9, 9, width() - 18, height() - 18));
}
void RenderArea::paintEvent(QPaintEvent * /* event */)
{
QPainter painter(this);
draw(&painter);
}

View File

@ -1,19 +1,19 @@
#ifndef RENDERAREA_H
#define RENDERAREA_H
#include <QWidget>
class RenderArea : public QWidget
{
public:
enum Shape { Line, Polyline, Polygon, Rect, RoundedRect, Ellipse, Arc,
Chord, Pie, Path, Text, Pixmap, TiledPixmap };
RenderArea(QWidget *parent = 0);
void draw(QPainter *painter);
protected:
void paintEvent(QPaintEvent *event);
};
#endif
#ifndef RENDERAREA_H
#define RENDERAREA_H
#include <QWidget>
class RenderArea : public QWidget
{
public:
enum Shape { Line, Polyline, Polygon, Rect, RoundedRect, Ellipse, Arc,
Chord, Pie, Path, Text, Pixmap, TiledPixmap };
RenderArea(QWidget *parent = 0);
void draw(QPainter *painter);
protected:
void paintEvent(QPaintEvent *event);
};
#endif

View File

@ -1,166 +1,166 @@
/***************************************************************************
File : QTeXEngine.h
Project : QTeXEngine GNU GPL v. 3.0
--------------------------------------------------------------------
Copyright : (C) 2009 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Enables the export of QPainter grafics to .tex files
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef Q_TEX_ENGINE_H
#define Q_TEX_ENGINE_H
#include <QPaintDevice>
#include <QPaintEngine>
#include <QPrinter>
class QFile;
class QTeXPaintEngine;
class QTeXPaintDevice : public QPaintDevice
{
public:
enum Unit{pt, bp, mm, cm, in, ex, em};
enum OutputMode{Tikz, Pgf};
QTeXPaintDevice(const QString& fileName, const QSize& s = QSize(), Unit u = pt);
~QTeXPaintDevice();
virtual QPaintEngine * paintEngine () const;
//! Set color mode (Color or GrayScale)
void setColorMode(QPrinter::ColorMode mode);
//! Set output mode (Tikz or Pgf)
void setOutputMode(OutputMode mode);
//! Set length unit
void setUnit(Unit u);
//! Set size
void setSize(const QSize& s){d_size = s;};
//! Enables/Disables document tags
void setDocumentMode(bool on = true);
//! Enables/Disables escaping of special characters in texts
void setEscapeTextMode(bool on = true);
//! Enables/Disables exporting of font sizes
void exportFontSizes(bool on = true);
//! Set horizontal alignment
void setTextHorizontalAlignment(Qt::Alignment alignment);
protected:
virtual int metric ( PaintDeviceMetric ) const;
private:
//! Size in pixels
QSize d_size;
QTeXPaintEngine* engine;
};
class QTeXPaintEngine : public QPaintEngine
{
public:
QTeXPaintEngine(const QString&, QTeXPaintDevice::Unit u = QTeXPaintDevice::pt);
~QTeXPaintEngine(){};
virtual bool begin(QPaintDevice*);
virtual bool end();
virtual void updateState( const QPaintEngineState & ) {};
virtual void drawEllipse(const QRectF &);
virtual QPaintEngine::Type type() const {return QPaintEngine::User;};
virtual void drawPoints ( const QPointF * points, int pointCount );
virtual void drawLines ( const QLineF * , int );
virtual void drawPath ( const QPainterPath & path );
virtual void drawPolygon ( const QPointF * , int , PolygonDrawMode );
virtual void drawTextItem ( const QPointF & , const QTextItem & );
virtual void drawRects ( const QRectF * , int );
virtual void drawPixmap ( const QRectF &, const QPixmap &, const QRectF &);
virtual void drawImage(const QRectF &, const QImage &, const QRectF &, Qt::ImageConversionFlags);
//! Set length unit
void setUnit(QTeXPaintDevice::Unit u){d_unit = u;};
//! Enables/Disables gray scale output
void setGrayScale(bool on = true){d_gray_scale = on;};
//! Set output syntax
void setOutputMode(QTeXPaintDevice::OutputMode mode){d_pgf_mode = (mode == QTeXPaintDevice::Pgf) ? true : false;};
void setDocumentMode(bool on = true){d_document_mode = on;};
//! Enables/Disables escaping of special characters in texts
void setEscapeTextMode(bool on = true){d_escape_text = on;};
void exportFontSizes(bool on = true){d_font_size = on;};
void setTextHorizontalAlignment(Qt::Alignment alignment){d_horizontal_alignment = alignment;};
private:
enum Shape{Line, Polygon, Polyline, Rect, Ellipse, Path, Points};
//! Returns true if draw operation has NoBrush and NoPen
bool emptyStringOperation();
QString unit();
double unitFactor();
double resFactorX();
double resFactorY();
QString pgfPoint(const QPointF& p);
QString tikzPoint(const QPointF& p);
QPointF convertPoint(const QPointF& p);
QString color(const QColor& col);
QString defineColor(const QColor& c, const QString& name);
QString pgfPen(const QPen& pen);
QString tikzPen(const QPen& pen);
QString pgfBrush(const QBrush& brush);
QString tikzBrush(const QBrush& brush);
QString beginScope();
QString endScope();
QString clipPath();
bool changedClipping();
QString path(const QPainterPath & path);
QString pgfPath(const QPainterPath & path);
QString tikzPath(const QPainterPath & path);
QString drawShape(Shape shape, const QString & path);
QString drawPgfShape(Shape shape, const QString & path);
QString drawTikzShape(Shape shape, const QString & path);
//! Draws pixmap pix in a given rectangle
void drawPixmap(const QPixmap &pix, const QRectF &p);
void writeToFile(const QString& s);
QString indentString(const QString& s);
//! Returns true if a new color command should be added
bool addNewBrushColor();
bool addNewPatternColor();
bool addNewPenColor();
QFile *file;
//! Name of the output file
QString fname;
int d_pixmap_index;
bool d_pgf_mode;
bool d_open_scope;
bool d_gray_scale;
bool d_document_mode;
bool d_escape_text;
bool d_font_size;
QPainterPath d_clip_path;
QColor d_current_color, d_pattern_color;
QTeXPaintDevice::Unit d_unit;
Qt::Alignment d_horizontal_alignment;
};
#endif
/***************************************************************************
File : QTeXEngine.h
Project : QTeXEngine GNU GPL v. 3.0
--------------------------------------------------------------------
Copyright : (C) 2009 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Enables the export of QPainter grafics to .tex files
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef Q_TEX_ENGINE_H
#define Q_TEX_ENGINE_H
#include <QPaintDevice>
#include <QPaintEngine>
#include <QPrinter>
class QFile;
class QTeXPaintEngine;
class QTeXPaintDevice : public QPaintDevice
{
public:
enum Unit{pt, bp, mm, cm, in, ex, em};
enum OutputMode{Tikz, Pgf};
QTeXPaintDevice(const QString& fileName, const QSize& s = QSize(), Unit u = pt);
~QTeXPaintDevice();
virtual QPaintEngine * paintEngine () const;
//! Set color mode (Color or GrayScale)
void setColorMode(QPrinter::ColorMode mode);
//! Set output mode (Tikz or Pgf)
void setOutputMode(OutputMode mode);
//! Set length unit
void setUnit(Unit u);
//! Set size
void setSize(const QSize& s){d_size = s;};
//! Enables/Disables document tags
void setDocumentMode(bool on = true);
//! Enables/Disables escaping of special characters in texts
void setEscapeTextMode(bool on = true);
//! Enables/Disables exporting of font sizes
void exportFontSizes(bool on = true);
//! Set horizontal alignment
void setTextHorizontalAlignment(Qt::Alignment alignment);
protected:
virtual int metric ( PaintDeviceMetric ) const;
private:
//! Size in pixels
QSize d_size;
QTeXPaintEngine* engine;
};
class QTeXPaintEngine : public QPaintEngine
{
public:
QTeXPaintEngine(const QString&, QTeXPaintDevice::Unit u = QTeXPaintDevice::pt);
~QTeXPaintEngine(){};
virtual bool begin(QPaintDevice*);
virtual bool end();
virtual void updateState( const QPaintEngineState & ) {};
virtual void drawEllipse(const QRectF &);
virtual QPaintEngine::Type type() const {return QPaintEngine::User;};
virtual void drawPoints ( const QPointF * points, int pointCount );
virtual void drawLines ( const QLineF * , int );
virtual void drawPath ( const QPainterPath & path );
virtual void drawPolygon ( const QPointF * , int , PolygonDrawMode );
virtual void drawTextItem ( const QPointF & , const QTextItem & );
virtual void drawRects ( const QRectF * , int );
virtual void drawPixmap ( const QRectF &, const QPixmap &, const QRectF &);
virtual void drawImage(const QRectF &, const QImage &, const QRectF &, Qt::ImageConversionFlags);
//! Set length unit
void setUnit(QTeXPaintDevice::Unit u){d_unit = u;};
//! Enables/Disables gray scale output
void setGrayScale(bool on = true){d_gray_scale = on;};
//! Set output syntax
void setOutputMode(QTeXPaintDevice::OutputMode mode){d_pgf_mode = (mode == QTeXPaintDevice::Pgf) ? true : false;};
void setDocumentMode(bool on = true){d_document_mode = on;};
//! Enables/Disables escaping of special characters in texts
void setEscapeTextMode(bool on = true){d_escape_text = on;};
void exportFontSizes(bool on = true){d_font_size = on;};
void setTextHorizontalAlignment(Qt::Alignment alignment){d_horizontal_alignment = alignment;};
private:
enum Shape{Line, Polygon, Polyline, Rect, Ellipse, Path, Points};
//! Returns true if draw operation has NoBrush and NoPen
bool emptyStringOperation();
QString unit();
double unitFactor();
double resFactorX();
double resFactorY();
QString pgfPoint(const QPointF& p);
QString tikzPoint(const QPointF& p);
QPointF convertPoint(const QPointF& p);
QString color(const QColor& col);
QString defineColor(const QColor& c, const QString& name);
QString pgfPen(const QPen& pen);
QString tikzPen(const QPen& pen);
QString pgfBrush(const QBrush& brush);
QString tikzBrush(const QBrush& brush);
QString beginScope();
QString endScope();
QString clipPath();
bool changedClipping();
QString path(const QPainterPath & path);
QString pgfPath(const QPainterPath & path);
QString tikzPath(const QPainterPath & path);
QString drawShape(Shape shape, const QString & path);
QString drawPgfShape(Shape shape, const QString & path);
QString drawTikzShape(Shape shape, const QString & path);
//! Draws pixmap pix in a given rectangle
void drawPixmap(const QPixmap &pix, const QRectF &p);
void writeToFile(const QString& s);
QString indentString(const QString& s);
//! Returns true if a new color command should be added
bool addNewBrushColor();
bool addNewPatternColor();
bool addNewPenColor();
QFile *file;
//! Name of the output file
QString fname;
int d_pixmap_index;
bool d_pgf_mode;
bool d_open_scope;
bool d_gray_scale;
bool d_document_mode;
bool d_escape_text;
bool d_font_size;
QPainterPath d_clip_path;
QColor d_current_color, d_pattern_color;
QTeXPaintDevice::Unit d_unit;
Qt::Alignment d_horizontal_alignment;
};
#endif

View File

@ -1,118 +1,118 @@
/***************************************************************************
File : QTeXPaintDevice.cpp
Project : QTeXEngine GNU GPL v. 3.0
--------------------------------------------------------------------
Copyright : (C) 2009 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Enables the export of QPainter grafics to .tex files
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#include "QTeXEngine.h"
#include <QApplication>
#include <QDesktopWidget>
QTeXPaintDevice::QTeXPaintDevice(const QString& fileName, const QSize& s, Unit u)
: QPaintDevice()
{
d_size = s;
if (!d_size.isValid())
d_size = QSize(500, 400);
engine = new QTeXPaintEngine(fileName, u);
}
QTeXPaintDevice::~QTeXPaintDevice()
{
delete engine;
}
QPaintEngine * QTeXPaintDevice::paintEngine () const
{
return engine;
}
void QTeXPaintDevice::setColorMode(QPrinter::ColorMode mode)
{
engine->setGrayScale(mode == QPrinter::GrayScale);
}
void QTeXPaintDevice::setOutputMode(OutputMode mode)
{
engine->setOutputMode(mode);
}
void QTeXPaintDevice::setUnit(Unit u)
{
engine->setUnit(u);
}
void QTeXPaintDevice::setDocumentMode(bool on)
{
engine->setDocumentMode(on);
}
void QTeXPaintDevice::setEscapeTextMode(bool on)
{
engine->setEscapeTextMode(on);
}
void QTeXPaintDevice::exportFontSizes(bool on)
{
engine->exportFontSizes(on);
}
void QTeXPaintDevice::setTextHorizontalAlignment(Qt::Alignment alignment)
{
engine->setTextHorizontalAlignment(alignment);
}
int QTeXPaintDevice::metric ( PaintDeviceMetric metric ) const
{
QDesktopWidget *desktop = QApplication::desktop();
int dpi_x = desktop->logicalDpiX();
int dpi_y = desktop->logicalDpiY();
switch (metric){
case QPaintDevice::PdmWidth:
return d_size.width();
case QPaintDevice::PdmHeight:
return d_size.height();
case QPaintDevice::PdmWidthMM:
return int(25.4*d_size.width()/(double)dpi_x);
case QPaintDevice::PdmHeightMM:
return int(25.4*d_size.height()/(double)dpi_y);
case QPaintDevice::PdmNumColors:
return 65536;//should it be millions?
case QPaintDevice::PdmDepth:
return 32;
case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmPhysicalDpiX:
return dpi_x;
case QPaintDevice::PdmDpiY:
case QPaintDevice::PdmPhysicalDpiY:
return dpi_y;
default:
qWarning ("QTeXPaintDevice::Unknown metric asked");
return 0;
}
}
/***************************************************************************
File : QTeXPaintDevice.cpp
Project : QTeXEngine GNU GPL v. 3.0
--------------------------------------------------------------------
Copyright : (C) 2009 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Enables the export of QPainter grafics to .tex files
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#include "QTeXEngine.h"
#include <QApplication>
#include <QDesktopWidget>
QTeXPaintDevice::QTeXPaintDevice(const QString& fileName, const QSize& s, Unit u)
: QPaintDevice()
{
d_size = s;
if (!d_size.isValid())
d_size = QSize(500, 400);
engine = new QTeXPaintEngine(fileName, u);
}
QTeXPaintDevice::~QTeXPaintDevice()
{
delete engine;
}
QPaintEngine * QTeXPaintDevice::paintEngine () const
{
return engine;
}
void QTeXPaintDevice::setColorMode(QPrinter::ColorMode mode)
{
engine->setGrayScale(mode == QPrinter::GrayScale);
}
void QTeXPaintDevice::setOutputMode(OutputMode mode)
{
engine->setOutputMode(mode);
}
void QTeXPaintDevice::setUnit(Unit u)
{
engine->setUnit(u);
}
void QTeXPaintDevice::setDocumentMode(bool on)
{
engine->setDocumentMode(on);
}
void QTeXPaintDevice::setEscapeTextMode(bool on)
{
engine->setEscapeTextMode(on);
}
void QTeXPaintDevice::exportFontSizes(bool on)
{
engine->exportFontSizes(on);
}
void QTeXPaintDevice::setTextHorizontalAlignment(Qt::Alignment alignment)
{
engine->setTextHorizontalAlignment(alignment);
}
int QTeXPaintDevice::metric ( PaintDeviceMetric metric ) const
{
QDesktopWidget *desktop = QApplication::desktop();
int dpi_x = desktop->logicalDpiX();
int dpi_y = desktop->logicalDpiY();
switch (metric){
case QPaintDevice::PdmWidth:
return d_size.width();
case QPaintDevice::PdmHeight:
return d_size.height();
case QPaintDevice::PdmWidthMM:
return int(25.4*d_size.width()/(double)dpi_x);
case QPaintDevice::PdmHeightMM:
return int(25.4*d_size.height()/(double)dpi_y);
case QPaintDevice::PdmNumColors:
return 65536;//should it be millions?
case QPaintDevice::PdmDepth:
return 32;
case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmPhysicalDpiX:
return dpi_x;
case QPaintDevice::PdmDpiY:
case QPaintDevice::PdmPhysicalDpiY:
return dpi_y;
default:
qWarning ("QTeXPaintDevice::Unknown metric asked");
return 0;
}
}

View File

@ -1,21 +1,21 @@
# qmake project file for building the QTeXEngine libraries
include( ../config.pri )
TARGET = QTeXEngine
TEMPLATE = lib
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ../
contains(CONFIG, QTeXEngineDll) {
CONFIG += dll
DEFINES += QTEXENGINE_DLL QTEXENGINE_DLL_BUILD
} else {
CONFIG += staticlib
}
HEADERS = QTeXEngine.h
SOURCES += QTeXPaintEngine.cpp
SOURCES += QTeXPaintDevice.cpp
# qmake project file for building the QTeXEngine libraries
include( ../config.pri )
TARGET = QTeXEngine
TEMPLATE = lib
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ../
contains(CONFIG, QTeXEngineDll) {
CONFIG += dll
DEFINES += QTEXENGINE_DLL QTEXENGINE_DLL_BUILD
} else {
CONFIG += staticlib
}
HEADERS = QTeXEngine.h
SOURCES += QTeXPaintEngine.cpp
SOURCES += QTeXPaintDevice.cpp

View File

@ -46,14 +46,14 @@ public:
int main(int argc, char **argv) {
QApplication app(argc, argv);
GraphicsView view;
view.show();
view.show();
QTeXPaintDevice tex("test.tex", view.scene()->sceneRect().size().toSize());
tex.setOutputMode(QTeXPaintDevice::Pgf);
tex.setDocumentMode();
QTeXPaintDevice tex("test.tex", view.scene()->sceneRect().size().toSize());
tex.setOutputMode(QTeXPaintDevice::Pgf);
tex.setDocumentMode();
QPainter painter(&tex);
view.scene()->render(&painter);
painter.end();
return app.exec();
}
}

View File

@ -1,12 +1,12 @@
TARGET = test
TEMPLATE = app
CONFIG += warn_on release thread
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ./
INCLUDEPATH += ../src
LIBS += ../libQTeXEngine.a
SOURCES += test.cpp
TARGET = test
TEMPLATE = app
CONFIG += warn_on release thread
MOC_DIR = ../tmp
OBJECTS_DIR = ../tmp
DESTDIR = ./
INCLUDEPATH += ../src
LIBS += ../libQTeXEngine.a
SOURCES += test.cpp

View File

@ -1,155 +1,155 @@
#include "TestWidgetBarcharts.h"
#include <QDebug>
#include <QDate>
#include <QDateTime>
#include <QApplication>
#include "jkqtplotter/jkqtpgraphsbarchart.h"
TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
QWidget(parent)
{
QVBoxLayout* barchartLayout=new QVBoxLayout(this);
setLayout(barchartLayout);
resize(1000, 800);
plotBarchart=new JKQtPlotter(true, this);
plotBarchart->set_doDrawing(false);
plotBarchart->get_plotter()->set_plotLabel(tr("\\textbf{bar charts}"));
plotBarchart->setObjectName("plotBarchart");
plotBarchart->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plot_peaks/");
plotBarchart->get_plotter()->get_xAxis()->set_labelType(JKQTPCALTdate);
plotBarchart->get_plotter()->get_xAxis()->set_tickDateFormat("dd. MMM yyyy");
barchartLayout->addWidget(plotBarchart);
QVector<double> dataBCX, dataBCXD, dataBCY1, dataBCY2, dataBCYE1, dataBCYE2;
for (int i=0; i<8; i++) {
double x=double(i);
dataBCX<<x;
QDateTime dt;
dt.setDate(QDate(2012,1+i,1));
//qDebug()<<dt<<dt.toMSecsSinceEpoch();
dataBCXD<<double(dt.toMSecsSinceEpoch());
dataBCY1<<1.0+sin(x*M_PI/6.0);
dataBCY2<<2.0+cos(x*M_PI/3.0);
dataBCYE1<<dataBCY1.last()*0.1;
dataBCYE2<<dataBCY2.last()*0.05;
}
size_t bcpx=plotBarchart->getDatastore()->addCopiedColumn(dataBCX, "x");
size_t bcpxd=plotBarchart->getDatastore()->addCopiedColumn(dataBCXD, "x_date");
size_t bcpy1=plotBarchart->getDatastore()->addCopiedColumn(dataBCY1, "y1");
size_t bcpye1=plotBarchart->getDatastore()->addCopiedColumn(dataBCYE1, "ye1");
size_t bcpy2=plotBarchart->getDatastore()->addCopiedColumn(dataBCY2, "y2");
size_t bcpye2=plotBarchart->getDatastore()->addCopiedColumn(dataBCYE2, "ye2");
JKQTPbarVerticalErrorGraph* plteBar1=new JKQTPbarVerticalErrorGraph(plotBarchart->get_plotter());
plteBar1->set_title(tr("bars 1"));
plteBar1->set_xColumn(bcpxd);
plteBar1->set_yColumn(bcpy1);
plteBar1->set_yErrorColumn(bcpye1);
plteBar1->set_width(0.45);
plteBar1->set_shift(-0.25);
plotBarchart->get_plotter()->addGraph(plteBar1);
JKQTPbarVerticalErrorGraph* plteBar2=new JKQTPbarVerticalErrorGraph(plotBarchart->get_plotter());
plteBar2->set_xColumn(bcpxd);
plteBar2->set_yColumn(bcpy2);
plteBar2->set_yErrorColumn(bcpye2);
plteBar2->set_title(tr("bars 2"));
plteBar2->set_width(0.45);
plteBar2->set_shift(0.25);
plteBar2->set_baseline(0.5);
plteBar2->set_yErrorSymmetric(false);
plotBarchart->get_plotter()->addGraph(plteBar2);
plteBar2->autoscaleBarWidthAndShift();
plotBarchart->set_doDrawing(true);
plotBarchart->zoomToFit();
plotBarchart2=new JKQtPlotter(false, this, plotBarchart->getDatastore());
plotBarchart2->set_doDrawing(false);
plotBarchart2->get_plotter()->set_plotLabel(tr("\\textbf{bar charts}"));
plotBarchart2->setObjectName("plotBarchart2");
plotBarchart2->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plot_peaks/");
barchartLayout->addWidget(plotBarchart2);
JKQTPbarHorizontalErrorGraph* plteBar3=new JKQTPbarHorizontalErrorGraph(plotBarchart2->get_plotter());
plteBar3->set_title(tr("bars 1"));
plteBar3->set_yColumn(bcpx);
plteBar3->set_xColumn(bcpy1);
plteBar3->set_xErrorColumn(bcpye1);
plteBar3->set_width(0.45);
plteBar3->set_shift(-0.25);
plotBarchart2->get_plotter()->addGraph(plteBar3);
JKQTPbarHorizontalErrorGraph* plteBar4=new JKQTPbarHorizontalErrorGraph(plotBarchart2->get_plotter());
plteBar4->set_yColumn(bcpx);
plteBar4->set_xColumn(bcpy2);
plteBar4->set_xErrorColumn(bcpye2);
plteBar4->set_title(tr("bars 2"));
plteBar4->set_width(0.45);
plteBar4->set_shift(0.25);
plteBar4->set_xErrorSymmetric(false);
plotBarchart2->get_plotter()->addGraph(plteBar4);
plteBar4->autoscaleBarWidthAndShift(0.9, 1);
plotBarchart2->set_doDrawing(true);
plotBarchart2->zoomToFit();
chkBarLog=new QCheckBox(tr("log-log plots"), this);
chkBarLog->setChecked(false);
barchartLayout->addWidget(chkBarLog);
connect(chkBarLog, SIGNAL(toggled(bool)), this, SLOT(setBarchartLogLog(bool)));
spinBarLabelAngel=new QSpinBox(this);
spinBarLabelAngel->setPrefix(tr("rotation angel: "));
spinBarLabelAngel->setSuffix(QLatin1String("°"));
spinBarLabelAngel->setRange(-180,180);
spinBarLabelAngel->setValue(0);
spinBarLabelAngel->setSingleStep(15);
barchartLayout->addWidget(spinBarLabelAngel);
connect(spinBarLabelAngel, SIGNAL(valueChanged(int)), this, SLOT(setBarchartAngele(int)));
spinBarLabelAngel2=new QSpinBox(this);
spinBarLabelAngel2->setPrefix(tr("rotation angel: "));
spinBarLabelAngel2->setSuffix(QLatin1String("°"));
spinBarLabelAngel2->setRange(-180,180);
spinBarLabelAngel2->setValue(0);
spinBarLabelAngel2->setSingleStep(15);
barchartLayout->addWidget(spinBarLabelAngel2);
connect(spinBarLabelAngel2, SIGNAL(valueChanged(int)), this, SLOT(setBarchartAngele2(int)));
}
void TestWidgetBarcharts::setBarchartLogLog(bool checked)
{
plotBarchart->get_xAxis()->set_logAxis(checked);
plotBarchart->get_yAxis()->set_logAxis(checked);
plotBarchart->zoomToFit();
plotBarchart2->get_xAxis()->set_logAxis(checked);
plotBarchart2->get_yAxis()->set_logAxis(checked);
plotBarchart2->zoomToFit();
}
void TestWidgetBarcharts::setBarchartAngele(int angle)
{
plotBarchart->get_xAxis()->set_tickLabelAngle(angle);
plotBarchart->get_xAxis()->set_drawMode2(JKQTPCADMcomplete);
}
void TestWidgetBarcharts::setBarchartAngele2(int angle)
{
plotBarchart->get_yAxis()->set_tickLabelAngle(angle);
plotBarchart->get_yAxis()->set_drawMode2(JKQTPCADMcomplete);
}
#include "TestWidgetBarcharts.h"
#include <QDebug>
#include <QDate>
#include <QDateTime>
#include <QApplication>
#include "jkqtplotter/jkqtpgraphsbarchart.h"
TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
QWidget(parent)
{
QVBoxLayout* barchartLayout=new QVBoxLayout(this);
setLayout(barchartLayout);
resize(1000, 800);
plotBarchart=new JKQtPlotter(true, this);
plotBarchart->set_doDrawing(false);
plotBarchart->get_plotter()->set_plotLabel(tr("\\textbf{bar charts}"));
plotBarchart->setObjectName("plotBarchart");
plotBarchart->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plot_peaks/");
plotBarchart->get_plotter()->get_xAxis()->set_labelType(JKQTPCALTdate);
plotBarchart->get_plotter()->get_xAxis()->set_tickDateFormat("dd. MMM yyyy");
barchartLayout->addWidget(plotBarchart);
QVector<double> dataBCX, dataBCXD, dataBCY1, dataBCY2, dataBCYE1, dataBCYE2;
for (int i=0; i<8; i++) {
double x=double(i);
dataBCX<<x;
QDateTime dt;
dt.setDate(QDate(2012,1+i,1));
//qDebug()<<dt<<dt.toMSecsSinceEpoch();
dataBCXD<<double(dt.toMSecsSinceEpoch());
dataBCY1<<1.0+sin(x*M_PI/6.0);
dataBCY2<<2.0+cos(x*M_PI/3.0);
dataBCYE1<<dataBCY1.last()*0.1;
dataBCYE2<<dataBCY2.last()*0.05;
}
size_t bcpx=plotBarchart->getDatastore()->addCopiedColumn(dataBCX, "x");
size_t bcpxd=plotBarchart->getDatastore()->addCopiedColumn(dataBCXD, "x_date");
size_t bcpy1=plotBarchart->getDatastore()->addCopiedColumn(dataBCY1, "y1");
size_t bcpye1=plotBarchart->getDatastore()->addCopiedColumn(dataBCYE1, "ye1");
size_t bcpy2=plotBarchart->getDatastore()->addCopiedColumn(dataBCY2, "y2");
size_t bcpye2=plotBarchart->getDatastore()->addCopiedColumn(dataBCYE2, "ye2");
JKQTPbarVerticalErrorGraph* plteBar1=new JKQTPbarVerticalErrorGraph(plotBarchart->get_plotter());
plteBar1->set_title(tr("bars 1"));
plteBar1->set_xColumn(bcpxd);
plteBar1->set_yColumn(bcpy1);
plteBar1->set_yErrorColumn(bcpye1);
plteBar1->set_width(0.45);
plteBar1->set_shift(-0.25);
plotBarchart->get_plotter()->addGraph(plteBar1);
JKQTPbarVerticalErrorGraph* plteBar2=new JKQTPbarVerticalErrorGraph(plotBarchart->get_plotter());
plteBar2->set_xColumn(bcpxd);
plteBar2->set_yColumn(bcpy2);
plteBar2->set_yErrorColumn(bcpye2);
plteBar2->set_title(tr("bars 2"));
plteBar2->set_width(0.45);
plteBar2->set_shift(0.25);
plteBar2->set_baseline(0.5);
plteBar2->set_yErrorSymmetric(false);
plotBarchart->get_plotter()->addGraph(plteBar2);
plteBar2->autoscaleBarWidthAndShift();
plotBarchart->set_doDrawing(true);
plotBarchart->zoomToFit();
plotBarchart2=new JKQtPlotter(false, this, plotBarchart->getDatastore());
plotBarchart2->set_doDrawing(false);
plotBarchart2->get_plotter()->set_plotLabel(tr("\\textbf{bar charts}"));
plotBarchart2->setObjectName("plotBarchart2");
plotBarchart2->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plot_peaks/");
barchartLayout->addWidget(plotBarchart2);
JKQTPbarHorizontalErrorGraph* plteBar3=new JKQTPbarHorizontalErrorGraph(plotBarchart2->get_plotter());
plteBar3->set_title(tr("bars 1"));
plteBar3->set_yColumn(bcpx);
plteBar3->set_xColumn(bcpy1);
plteBar3->set_xErrorColumn(bcpye1);
plteBar3->set_width(0.45);
plteBar3->set_shift(-0.25);
plotBarchart2->get_plotter()->addGraph(plteBar3);
JKQTPbarHorizontalErrorGraph* plteBar4=new JKQTPbarHorizontalErrorGraph(plotBarchart2->get_plotter());
plteBar4->set_yColumn(bcpx);
plteBar4->set_xColumn(bcpy2);
plteBar4->set_xErrorColumn(bcpye2);
plteBar4->set_title(tr("bars 2"));
plteBar4->set_width(0.45);
plteBar4->set_shift(0.25);
plteBar4->set_xErrorSymmetric(false);
plotBarchart2->get_plotter()->addGraph(plteBar4);
plteBar4->autoscaleBarWidthAndShift(0.9, 1);
plotBarchart2->set_doDrawing(true);
plotBarchart2->zoomToFit();
chkBarLog=new QCheckBox(tr("log-log plots"), this);
chkBarLog->setChecked(false);
barchartLayout->addWidget(chkBarLog);
connect(chkBarLog, SIGNAL(toggled(bool)), this, SLOT(setBarchartLogLog(bool)));
spinBarLabelAngel=new QSpinBox(this);
spinBarLabelAngel->setPrefix(tr("rotation angel: "));
spinBarLabelAngel->setSuffix(QLatin1String("°"));
spinBarLabelAngel->setRange(-180,180);
spinBarLabelAngel->setValue(0);
spinBarLabelAngel->setSingleStep(15);
barchartLayout->addWidget(spinBarLabelAngel);
connect(spinBarLabelAngel, SIGNAL(valueChanged(int)), this, SLOT(setBarchartAngele(int)));
spinBarLabelAngel2=new QSpinBox(this);
spinBarLabelAngel2->setPrefix(tr("rotation angel: "));
spinBarLabelAngel2->setSuffix(QLatin1String("°"));
spinBarLabelAngel2->setRange(-180,180);
spinBarLabelAngel2->setValue(0);
spinBarLabelAngel2->setSingleStep(15);
barchartLayout->addWidget(spinBarLabelAngel2);
connect(spinBarLabelAngel2, SIGNAL(valueChanged(int)), this, SLOT(setBarchartAngele2(int)));
}
void TestWidgetBarcharts::setBarchartLogLog(bool checked)
{
plotBarchart->get_xAxis()->set_logAxis(checked);
plotBarchart->get_yAxis()->set_logAxis(checked);
plotBarchart->zoomToFit();
plotBarchart2->get_xAxis()->set_logAxis(checked);
plotBarchart2->get_yAxis()->set_logAxis(checked);
plotBarchart2->zoomToFit();
}
void TestWidgetBarcharts::setBarchartAngele(int angle)
{
plotBarchart->get_xAxis()->set_tickLabelAngle(angle);
plotBarchart->get_xAxis()->set_drawMode2(JKQTPCADMcomplete);
}
void TestWidgetBarcharts::setBarchartAngele2(int angle)
{
plotBarchart->get_yAxis()->set_tickLabelAngle(angle);
plotBarchart->get_yAxis()->set_drawMode2(JKQTPCADMcomplete);
}

View File

@ -1,59 +1,59 @@
#ifndef TestWidgetBarcharts_H
#define TestWidgetBarcharts_H
#include <QElapsedTimer>
#include <QCheckBox>
#include <QLineEdit>
#include <QTimer>
#include <QImage>
#include <QVBoxLayout>
#include <QWidget>
#include <QTabWidget>
#include <QFormLayout>
#include <QCheckBox>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplottergui/jkqtpgraphsmodel.h"
#include "jkqtplottertools/jkqtptools.h"
#define N1 200
#define N2 50
#define N3 8
class TestWidgetBarcharts : public QWidget
{
Q_OBJECT
public:
explicit TestWidgetBarcharts(QWidget *parent = 0);
signals:
public slots:
void setBarchartLogLog(bool checked);
void setBarchartAngele(int angel);
void setBarchartAngele2(int angel);
protected:
JKQtPlotter* plotBarchart;
JKQtPlotter* plotBarchart2;
QCheckBox* chkBarLog;
QSpinBox* spinBarLabelAngel;
QSpinBox* spinBarLabelAngel2;
};
#endif // TestWidgetBarcharts_H
#ifndef TestWidgetBarcharts_H
#define TestWidgetBarcharts_H
#include <QElapsedTimer>
#include <QCheckBox>
#include <QLineEdit>
#include <QTimer>
#include <QImage>
#include <QVBoxLayout>
#include <QWidget>
#include <QTabWidget>
#include <QFormLayout>
#include <QCheckBox>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplottergui/jkqtpgraphsmodel.h"
#include "jkqtplottertools/jkqtptools.h"
#define N1 200
#define N2 50
#define N3 8
class TestWidgetBarcharts : public QWidget
{
Q_OBJECT
public:
explicit TestWidgetBarcharts(QWidget *parent = 0);
signals:
public slots:
void setBarchartLogLog(bool checked);
void setBarchartAngele(int angel);
void setBarchartAngele2(int angel);
protected:
JKQtPlotter* plotBarchart;
JKQtPlotter* plotBarchart2;
QCheckBox* chkBarLog;
QSpinBox* spinBarLabelAngel;
QSpinBox* spinBarLabelAngel2;
};
#endif // TestWidgetBarcharts_H

View File

@ -1,120 +1,120 @@
#include "TestWidgetContourPlots.h"
#include <QDebug>
#include <QDate>
#include <QDateTime>
#include <QApplication>
TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
QWidget(parent)
{
// contour plot
QHBoxLayout* layoutContour=new QHBoxLayout(this);
setLayout(layoutContour);
JKQtPlotter* plotContour=new JKQtPlotter(true, this);
plotContour->set_doDrawing(false);
plotContour->get_plotter()->set_plotLabel(tr("\\textbf{hist contour plot}"));
plotContour->setObjectName("contour");
plotContour->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "contour/");
layoutContour->addWidget(plotContour);
JKQtPlotter* plotDensity=new JKQtPlotter(true, this);
plotContour->set_doDrawing(false);
plotContour->get_plotter()->set_plotLabel(tr("\\textbf{2D histogram plot with contours}"));
plotDensity->get_plotter()->set_plotLabel(tr("\\textbf{2D histogram}"));
plotContour->setObjectName("density");
plotContour->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "density/");
layoutContour->addWidget(plotDensity);
QVector<double> histAlex;
uint histAlexNx,histAlexNy;
// choose the test data
histAlex.clear();
histAlex.resize(5);
histAlex.append(15.0);
histAlex.append(5);
histAlex.append(0);
histAlex.append(0);
histAlex.append(5);
histAlex.append(15);
histAlex.append(6);
histAlex.append(6);
histAlex.resize(16);
histAlexNx=(uint)sqrt(histAlex.size());
histAlexNy=histAlexNx;
auto ds=plotDensity->get_plotter()->getDatastore();
plotContour->get_plotter()->useExternalDatastore(ds);
// empty datastore and grid
plotDensity->get_plotter()->clearGraphs(true);
ds->clear();
plotDensity->setGrid(false);
plotDensity->get_plotter()->get_xAxis()->set_axisLabel("X");
plotDensity->get_plotter()->get_yAxis()->set_axisLabel("Y");
size_t colHist2D=ds->addCopiedImageAsColumn(histAlex.data(), histAlexNx, histAlexNy, tr("2Dhist"));
// size_t colContour=plotContour->getDatastore()->addCopiedImageAsColumnTranspose(histAlex.data(), histAlexNx, histAlexNy, tr("2Dhist"));
JKQTPColumnMathImage* densityplot=new JKQTPColumnMathImage(plotDensity->get_plotter());
densityplot->set_x(-0.1);
densityplot->set_y(-0.1);
densityplot->set_width(1.1);
densityplot->set_height(1.1);
densityplot->set_Nx(histAlexNx);
densityplot->set_Ny(histAlexNy);
densityplot->set_palette(JKQTPMathImageINVERTED_OCEAN);
densityplot->set_imageColumn(colHist2D);
densityplot->set_infColor(Qt::transparent);
densityplot->set_nanColor(Qt::transparent);
densityplot->set_title("density plot");
plotDensity->addGraph(densityplot);
densityplot=new JKQTPColumnMathImage(plotContour->get_plotter());
densityplot->set_x(-0.1);
densityplot->set_y(-0.1);
densityplot->set_width(1.1);
densityplot->set_height(1.1);
densityplot->set_Nx(histAlexNx);
densityplot->set_Ny(histAlexNy);
densityplot->set_palette(JKQTPMathImageINVERTED_OCEAN);
densityplot->set_imageColumn(colHist2D);
densityplot->set_title("density plot");
plotContour->addGraph(densityplot);
plotContour->setGrid(false);
plotDensity->zoom(-0.1,1.1,-0.1,1.1);
QList<double> levels;
// levels<<5<<10<<25; // levels<<5.1<<10.1;
levels<<4<<5<<9<<14;
JKQTPContour* cp=new JKQTPContour(plotContour->get_plotter());
cp->set_x(-0.1);
cp->set_y(-0.1);
cp->set_width(1.1);
cp->set_height(1.1);
cp->set_Nx(histAlexNx);
cp->set_Ny(histAlexNy);
cp->set_imageColumn(colHist2D);
// cp->set_palette(JKQTPMathImageINVERTED_OCEAN);
cp->set_contourLevels(levels);
cp->set_title("contour plot");
plotContour->addGraph(cp);
plotContour->zoom(-0.1,1.1,-0.1,1.1);
plotContour->set_doDrawing(true);
plotContour->update_plot();
}
#include "TestWidgetContourPlots.h"
#include <QDebug>
#include <QDate>
#include <QDateTime>
#include <QApplication>
TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
QWidget(parent)
{
// contour plot
QHBoxLayout* layoutContour=new QHBoxLayout(this);
setLayout(layoutContour);
JKQtPlotter* plotContour=new JKQtPlotter(true, this);
plotContour->set_doDrawing(false);
plotContour->get_plotter()->set_plotLabel(tr("\\textbf{hist contour plot}"));
plotContour->setObjectName("contour");
plotContour->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "contour/");
layoutContour->addWidget(plotContour);
JKQtPlotter* plotDensity=new JKQtPlotter(true, this);
plotContour->set_doDrawing(false);
plotContour->get_plotter()->set_plotLabel(tr("\\textbf{2D histogram plot with contours}"));
plotDensity->get_plotter()->set_plotLabel(tr("\\textbf{2D histogram}"));
plotContour->setObjectName("density");
plotContour->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "density/");
layoutContour->addWidget(plotDensity);
QVector<double> histAlex;
uint histAlexNx,histAlexNy;
// choose the test data
histAlex.clear();
histAlex.resize(5);
histAlex.append(15.0);
histAlex.append(5);
histAlex.append(0);
histAlex.append(0);
histAlex.append(5);
histAlex.append(15);
histAlex.append(6);
histAlex.append(6);
histAlex.resize(16);
histAlexNx=(uint)sqrt(histAlex.size());
histAlexNy=histAlexNx;
auto ds=plotDensity->get_plotter()->getDatastore();
plotContour->get_plotter()->useExternalDatastore(ds);
// empty datastore and grid
plotDensity->get_plotter()->clearGraphs(true);
ds->clear();
plotDensity->setGrid(false);
plotDensity->get_plotter()->get_xAxis()->set_axisLabel("X");
plotDensity->get_plotter()->get_yAxis()->set_axisLabel("Y");
size_t colHist2D=ds->addCopiedImageAsColumn(histAlex.data(), histAlexNx, histAlexNy, tr("2Dhist"));
// size_t colContour=plotContour->getDatastore()->addCopiedImageAsColumnTranspose(histAlex.data(), histAlexNx, histAlexNy, tr("2Dhist"));
JKQTPColumnMathImage* densityplot=new JKQTPColumnMathImage(plotDensity->get_plotter());
densityplot->set_x(-0.1);
densityplot->set_y(-0.1);
densityplot->set_width(1.1);
densityplot->set_height(1.1);
densityplot->set_Nx(histAlexNx);
densityplot->set_Ny(histAlexNy);
densityplot->set_palette(JKQTPMathImageINVERTED_OCEAN);
densityplot->set_imageColumn(colHist2D);
densityplot->set_infColor(Qt::transparent);
densityplot->set_nanColor(Qt::transparent);
densityplot->set_title("density plot");
plotDensity->addGraph(densityplot);
densityplot=new JKQTPColumnMathImage(plotContour->get_plotter());
densityplot->set_x(-0.1);
densityplot->set_y(-0.1);
densityplot->set_width(1.1);
densityplot->set_height(1.1);
densityplot->set_Nx(histAlexNx);
densityplot->set_Ny(histAlexNy);
densityplot->set_palette(JKQTPMathImageINVERTED_OCEAN);
densityplot->set_imageColumn(colHist2D);
densityplot->set_title("density plot");
plotContour->addGraph(densityplot);
plotContour->setGrid(false);
plotDensity->zoom(-0.1,1.1,-0.1,1.1);
QList<double> levels;
// levels<<5<<10<<25; // levels<<5.1<<10.1;
levels<<4<<5<<9<<14;
JKQTPContour* cp=new JKQTPContour(plotContour->get_plotter());
cp->set_x(-0.1);
cp->set_y(-0.1);
cp->set_width(1.1);
cp->set_height(1.1);
cp->set_Nx(histAlexNx);
cp->set_Ny(histAlexNy);
cp->set_imageColumn(colHist2D);
// cp->set_palette(JKQTPMathImageINVERTED_OCEAN);
cp->set_contourLevels(levels);
cp->set_title("contour plot");
plotContour->addGraph(cp);
plotContour->zoom(-0.1,1.1,-0.1,1.1);
plotContour->set_doDrawing(true);
plotContour->update_plot();
}

View File

@ -1,47 +1,47 @@
#ifndef TestWidgetContourPlots_H
#define TestWidgetContourPlots_H
#include <QElapsedTimer>
#include <QCheckBox>
#include <QLineEdit>
#include <QTimer>
#include <QImage>
#include <QVBoxLayout>
#include <QWidget>
#include <QTabWidget>
#include <QFormLayout>
#include <QCheckBox>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplottergui/jkqtpgraphsmodel.h"
#include "jkqtplottertools/jkqtptools.h"
#define N1 200
#define N2 50
#define N3 8
class TestWidgetContourPlots : public QWidget
{
Q_OBJECT
public:
explicit TestWidgetContourPlots(QWidget *parent = 0);
signals:
public slots:
protected:
};
#endif // TestWidgetContourPlots_H
#ifndef TestWidgetContourPlots_H
#define TestWidgetContourPlots_H
#include <QElapsedTimer>
#include <QCheckBox>
#include <QLineEdit>
#include <QTimer>
#include <QImage>
#include <QVBoxLayout>
#include <QWidget>
#include <QTabWidget>
#include <QFormLayout>
#include <QCheckBox>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplottergui/jkqtpgraphsmodel.h"
#include "jkqtplottertools/jkqtptools.h"
#define N1 200
#define N2 50
#define N3 8
class TestWidgetContourPlots : public QWidget
{
Q_OBJECT
public:
explicit TestWidgetContourPlots(QWidget *parent = 0);
signals:
public slots:
protected:
};
#endif // TestWidgetContourPlots_H

View File

@ -1,33 +1,33 @@
#include "TestWidgetEmptyPlot.h"
#include <QDebug>
#include <QDate>
#include <QDateTime>
#include <QApplication>
TestWidgetEmptyPlot::TestWidgetEmptyPlot(QWidget *parent) :
QWidget(parent)
{
#define NEMPTY 500
JKQtPlotter* plotEmpty=new JKQtPlotter(true, this);
JKQTPxyLineGraph* efunc=new JKQTPxyLineGraph(plotEmpty->get_plotter());
double xef[NEMPTY], efy[NEMPTY];
for (int i=0; i<NEMPTY; i++) {
xef[i]=i;
efy[i]=double(i%5)*1e-308;
}
efunc->set_xColumn(plotEmpty->getDatastore()->addCopiedColumn(xef, NEMPTY, "x"));
efunc->set_yColumn(plotEmpty->getDatastore()->addCopiedColumn(efy, NEMPTY, "y"));
plotEmpty->addGraph(efunc);
plotEmpty->get_yAxis()->set_logAxis(true);
plotEmpty->zoomToFit();
plotEmpty->setY(0,0);
}
#include "TestWidgetEmptyPlot.h"
#include <QDebug>
#include <QDate>
#include <QDateTime>
#include <QApplication>
TestWidgetEmptyPlot::TestWidgetEmptyPlot(QWidget *parent) :
QWidget(parent)
{
#define NEMPTY 500
JKQtPlotter* plotEmpty=new JKQtPlotter(true, this);
JKQTPxyLineGraph* efunc=new JKQTPxyLineGraph(plotEmpty->get_plotter());
double xef[NEMPTY], efy[NEMPTY];
for (int i=0; i<NEMPTY; i++) {
xef[i]=i;
efy[i]=double(i%5)*1e-308;
}
efunc->set_xColumn(plotEmpty->getDatastore()->addCopiedColumn(xef, NEMPTY, "x"));
efunc->set_yColumn(plotEmpty->getDatastore()->addCopiedColumn(efy, NEMPTY, "y"));
plotEmpty->addGraph(efunc);
plotEmpty->get_yAxis()->set_logAxis(true);
plotEmpty->zoomToFit();
plotEmpty->setY(0,0);
}

View File

@ -1,46 +1,46 @@
#ifndef TestWidgetEmptyPlot_H
#define TestWidgetEmptyPlot_H
#include <QElapsedTimer>
#include <QCheckBox>
#include <QLineEdit>
#include <QTimer>
#include <QImage>
#include <QVBoxLayout>
#include <QWidget>
#include <QTabWidget>
#include <QFormLayout>
#include <QCheckBox>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplottergui/jkqtpgraphsmodel.h"
#include "jkqtplottertools/jkqtptools.h"
#define N1 200
#define N2 50
#define N3 8
class TestWidgetEmptyPlot : public QWidget
{
Q_OBJECT
public:
explicit TestWidgetEmptyPlot(QWidget *parent = 0);
signals:
public slots:
protected:
};
#endif // TestWidgetEmptyPlot_H
#ifndef TestWidgetEmptyPlot_H
#define TestWidgetEmptyPlot_H
#include <QElapsedTimer>
#include <QCheckBox>
#include <QLineEdit>
#include <QTimer>
#include <QImage>
#include <QVBoxLayout>
#include <QWidget>
#include <QTabWidget>
#include <QFormLayout>
#include <QCheckBox>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplottergui/jkqtpgraphsmodel.h"
#include "jkqtplottertools/jkqtptools.h"
#define N1 200
#define N2 50
#define N3 8
class TestWidgetEmptyPlot : public QWidget
{
Q_OBJECT
public:
explicit TestWidgetEmptyPlot(QWidget *parent = 0);
signals:
public slots:
protected:
};
#endif // TestWidgetEmptyPlot_H

View File

@ -1,116 +1,116 @@
#include "TestWidgetFunctionPlots.h"
#include <QDebug>
#include <QDate>
#include <QDateTime>
#include <QApplication>
TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
QWidget(parent)
{
QVBoxLayout* plotFuncLayout=new QVBoxLayout(this);
setLayout(plotFuncLayout);
plotFuncPlt=new JKQtPlotter(true, this);
plotFuncLayout->addWidget(plotFuncPlt);
pfunc=new JKQTPxParsedFunctionLineGraph(plotFuncPlt->get_plotter());
pfunc->set_function("x^2/10+sin(x*pi*10)");
pfunc->set_errorFunction("x^2/20");
pfunc->set_drawErrorPolygons(true);
pfunc->set_style(Qt::DashLine);
plotFuncPlt->addGraph(pfunc);
plotFuncPlt->update_plot();
pfuncErrorStyle=new JKQTPerrorPlotstyleComboBox(this);
pfuncErrorStyle->setCurrentIndex(3);
plotFuncLayout->addWidget(pfuncErrorStyle);
connect(pfuncErrorStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(setPFuncStyle()));
chkPFuncDrawSamples=new QCheckBox(tr("display samples"), this);
plotFuncLayout->addWidget(chkPFuncDrawSamples);
connect(chkPFuncDrawSamples, SIGNAL(toggled(bool)), this, SLOT(setPFuncStyle()));
chkPFuncDrawLine=new QCheckBox(tr("draw line"), this);
chkPFuncDrawLine->setChecked(true);
plotFuncLayout->addWidget(chkPFuncDrawLine);
connect(chkPFuncDrawLine, SIGNAL(toggled(bool)), this, SLOT(setPFuncStyle()));
QSpinBox* spinPFunc=new QSpinBox(this);
spinPFunc->setValue(pfunc->get_minSamples());
plotFuncLayout->addWidget(new QLabel(tr("min samples:"), this));
plotFuncLayout->addWidget(spinPFunc);
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMinPoint(int)));
spinPFunc=new QSpinBox(this);
spinPFunc->setValue(pfunc->get_maxRefinementDegree());
plotFuncLayout->addWidget(new QLabel(tr("max refinement degree:"), this));
plotFuncLayout->addWidget(spinPFunc);
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMaxRefine(int)));
QComboBox* edtPFunc=new QComboBox(this);
edtPFunc->addItem(pfunc->get_function());
edtPFunc->addItem("x");
edtPFunc->addItem("x^2");
edtPFunc->addItem("x^2-x^3");
edtPFunc->addItem("sin(x)");
edtPFunc->setCurrentIndex(0);
plotFuncLayout->addWidget(new QLabel(tr("function:"), this));
plotFuncLayout->addWidget(edtPFunc);
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFunc(QString)));
edtPFunc=new QComboBox(this);
edtPFunc->addItem(pfunc->get_errorFunction());
edtPFunc->addItem("");
edtPFunc->addItem("x");
edtPFunc->addItem("cos(x)");
edtPFunc->addItem("1");
edtPFunc->setCurrentIndex(0);
plotFuncLayout->addWidget(new QLabel(tr("error function:"), this));
plotFuncLayout->addWidget(edtPFunc);
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFuncE(QString)));
QCheckBox* chkFLogX=new QCheckBox(tr("x-axis: log-scale"));
chkFLogX->setChecked(false);
connect(chkFLogX, SIGNAL(toggled(bool)), plotFuncPlt->get_xAxis(), SLOT(set_logAxis(bool)));
plotFuncLayout->addWidget(chkFLogX);
QCheckBox* chkFLogY=new QCheckBox(tr("y-axis: log-scale"));
chkFLogY->setChecked(false);
connect(chkFLogY, SIGNAL(toggled(bool)), plotFuncPlt->get_yAxis(), SLOT(set_logAxis(bool)));
plotFuncLayout->addWidget(chkFLogY);
}
void TestWidgetFunctionPlots::setPFuncStyle()
{
pfunc->set_drawErrorLines(false);
pfunc->set_drawErrorPolygons(false);
if (pfuncErrorStyle->getErrorStyle()==JKQTPerrorLines) pfunc->set_drawErrorLines(true);
if (pfuncErrorStyle->getErrorStyle()==JKQTPerrorPolygons) pfunc->set_drawErrorPolygons(true);
pfunc->set_drawLine(chkPFuncDrawLine->isChecked());
pfunc->set_displaySamplePoints(chkPFuncDrawSamples->isChecked());
plotFuncPlt->update_plot();
}
void TestWidgetFunctionPlots::setPFuncMinPoint(int value)
{
pfunc->set_minSamples(value);
plotFuncPlt->update_plot();
}
void TestWidgetFunctionPlots::setPFuncMaxRefine(int value)
{
pfunc->set_maxRefinementDegree(value);
plotFuncPlt->update_plot();
}
void TestWidgetFunctionPlots::setPFunc(const QString &expression)
{
pfunc->set_function(expression);
plotFuncPlt->update_plot();
}
void TestWidgetFunctionPlots::setPFuncE(const QString &expression)
{
pfunc->set_errorFunction(expression);
plotFuncPlt->update_plot();
}
#include "TestWidgetFunctionPlots.h"
#include <QDebug>
#include <QDate>
#include <QDateTime>
#include <QApplication>
TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
QWidget(parent)
{
QVBoxLayout* plotFuncLayout=new QVBoxLayout(this);
setLayout(plotFuncLayout);
plotFuncPlt=new JKQtPlotter(true, this);
plotFuncLayout->addWidget(plotFuncPlt);
pfunc=new JKQTPxParsedFunctionLineGraph(plotFuncPlt->get_plotter());
pfunc->set_function("x^2/10+sin(x*pi*10)");
pfunc->set_errorFunction("x^2/20");
pfunc->set_drawErrorPolygons(true);
pfunc->set_style(Qt::DashLine);
plotFuncPlt->addGraph(pfunc);
plotFuncPlt->update_plot();
pfuncErrorStyle=new JKQTPerrorPlotstyleComboBox(this);
pfuncErrorStyle->setCurrentIndex(3);
plotFuncLayout->addWidget(pfuncErrorStyle);
connect(pfuncErrorStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(setPFuncStyle()));
chkPFuncDrawSamples=new QCheckBox(tr("display samples"), this);
plotFuncLayout->addWidget(chkPFuncDrawSamples);
connect(chkPFuncDrawSamples, SIGNAL(toggled(bool)), this, SLOT(setPFuncStyle()));
chkPFuncDrawLine=new QCheckBox(tr("draw line"), this);
chkPFuncDrawLine->setChecked(true);
plotFuncLayout->addWidget(chkPFuncDrawLine);
connect(chkPFuncDrawLine, SIGNAL(toggled(bool)), this, SLOT(setPFuncStyle()));
QSpinBox* spinPFunc=new QSpinBox(this);
spinPFunc->setValue(pfunc->get_minSamples());
plotFuncLayout->addWidget(new QLabel(tr("min samples:"), this));
plotFuncLayout->addWidget(spinPFunc);
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMinPoint(int)));
spinPFunc=new QSpinBox(this);
spinPFunc->setValue(pfunc->get_maxRefinementDegree());
plotFuncLayout->addWidget(new QLabel(tr("max refinement degree:"), this));
plotFuncLayout->addWidget(spinPFunc);
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMaxRefine(int)));
QComboBox* edtPFunc=new QComboBox(this);
edtPFunc->addItem(pfunc->get_function());
edtPFunc->addItem("x");
edtPFunc->addItem("x^2");
edtPFunc->addItem("x^2-x^3");
edtPFunc->addItem("sin(x)");
edtPFunc->setCurrentIndex(0);
plotFuncLayout->addWidget(new QLabel(tr("function:"), this));
plotFuncLayout->addWidget(edtPFunc);
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFunc(QString)));
edtPFunc=new QComboBox(this);
edtPFunc->addItem(pfunc->get_errorFunction());
edtPFunc->addItem("");
edtPFunc->addItem("x");
edtPFunc->addItem("cos(x)");
edtPFunc->addItem("1");
edtPFunc->setCurrentIndex(0);
plotFuncLayout->addWidget(new QLabel(tr("error function:"), this));
plotFuncLayout->addWidget(edtPFunc);
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFuncE(QString)));
QCheckBox* chkFLogX=new QCheckBox(tr("x-axis: log-scale"));
chkFLogX->setChecked(false);
connect(chkFLogX, SIGNAL(toggled(bool)), plotFuncPlt->get_xAxis(), SLOT(set_logAxis(bool)));
plotFuncLayout->addWidget(chkFLogX);
QCheckBox* chkFLogY=new QCheckBox(tr("y-axis: log-scale"));
chkFLogY->setChecked(false);
connect(chkFLogY, SIGNAL(toggled(bool)), plotFuncPlt->get_yAxis(), SLOT(set_logAxis(bool)));
plotFuncLayout->addWidget(chkFLogY);
}
void TestWidgetFunctionPlots::setPFuncStyle()
{
pfunc->set_drawErrorLines(false);
pfunc->set_drawErrorPolygons(false);
if (pfuncErrorStyle->getErrorStyle()==JKQTPerrorLines) pfunc->set_drawErrorLines(true);
if (pfuncErrorStyle->getErrorStyle()==JKQTPerrorPolygons) pfunc->set_drawErrorPolygons(true);
pfunc->set_drawLine(chkPFuncDrawLine->isChecked());
pfunc->set_displaySamplePoints(chkPFuncDrawSamples->isChecked());
plotFuncPlt->update_plot();
}
void TestWidgetFunctionPlots::setPFuncMinPoint(int value)
{
pfunc->set_minSamples(value);
plotFuncPlt->update_plot();
}
void TestWidgetFunctionPlots::setPFuncMaxRefine(int value)
{
pfunc->set_maxRefinementDegree(value);
plotFuncPlt->update_plot();
}
void TestWidgetFunctionPlots::setPFunc(const QString &expression)
{
pfunc->set_function(expression);
plotFuncPlt->update_plot();
}
void TestWidgetFunctionPlots::setPFuncE(const QString &expression)
{
pfunc->set_errorFunction(expression);
plotFuncPlt->update_plot();
}

View File

@ -1,59 +1,59 @@
#ifndef TestWidgetFunctionPlots_H
#define TestWidgetFunctionPlots_H
#include <QElapsedTimer>
#include <QCheckBox>
#include <QLineEdit>
#include <QTimer>
#include <QImage>
#include <QVBoxLayout>
#include <QWidget>
#include <QTabWidget>
#include <QFormLayout>
#include <QCheckBox>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplottergui/jkqtpgraphsmodel.h"
#include "jkqtplottergui/jkqtpcomboboxes.h"
#include "jkqtplottertools/jkqtptools.h"
#define N1 200
#define N2 50
#define N3 8
class TestWidgetFunctionPlots : public QWidget
{
Q_OBJECT
public:
explicit TestWidgetFunctionPlots(QWidget *parent = 0);
signals:
public slots:
void setPFuncStyle();
void setPFuncMinPoint(int value);
void setPFuncMaxRefine(int value);
void setPFunc(const QString& expression);
void setPFuncE(const QString& expression);
protected:
JKQTPxParsedFunctionLineGraph* pfunc;
JKQtPlotter* plotFuncPlt;
JKQTPerrorPlotstyleComboBox* pfuncErrorStyle;
QCheckBox* chkPFuncDrawSamples;
QCheckBox* chkPFuncDrawLine;
};
#endif // TestWidgetFunctionPlots_H
#ifndef TestWidgetFunctionPlots_H
#define TestWidgetFunctionPlots_H
#include <QElapsedTimer>
#include <QCheckBox>
#include <QLineEdit>
#include <QTimer>
#include <QImage>
#include <QVBoxLayout>
#include <QWidget>
#include <QTabWidget>
#include <QFormLayout>
#include <QCheckBox>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplottergui/jkqtpgraphsmodel.h"
#include "jkqtplottergui/jkqtpcomboboxes.h"
#include "jkqtplottertools/jkqtptools.h"
#define N1 200
#define N2 50
#define N3 8
class TestWidgetFunctionPlots : public QWidget
{
Q_OBJECT
public:
explicit TestWidgetFunctionPlots(QWidget *parent = 0);
signals:
public slots:
void setPFuncStyle();
void setPFuncMinPoint(int value);
void setPFuncMaxRefine(int value);
void setPFunc(const QString& expression);
void setPFuncE(const QString& expression);
protected:
JKQTPxParsedFunctionLineGraph* pfunc;
JKQtPlotter* plotFuncPlt;
JKQTPerrorPlotstyleComboBox* pfuncErrorStyle;
QCheckBox* chkPFuncDrawSamples;
QCheckBox* chkPFuncDrawLine;
};
#endif // TestWidgetFunctionPlots_H

Some files were not shown because too many files have changed in this diff Show More