mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 10:05:47 +08:00
finished mouse interaction example + improved documentation
This commit is contained in:
parent
08932f2863
commit
6082010c98
2
.gitignore
vendored
2
.gitignore
vendored
@ -92,3 +92,5 @@ moc_predefs.h
|
||||
/doc/*.tmp
|
||||
/staticlib/debug/*.prl
|
||||
/staticlib/release/*.prl
|
||||
/sharedlib/debug/jkqtplotterlib_debug.prl
|
||||
/sharedlib/release/jkqtplotterlib.prl
|
||||
|
109
doc/dox/buildinstructions.dox
Normal file
109
doc/dox/buildinstructions.dox
Normal file
@ -0,0 +1,109 @@
|
||||
/*!
|
||||
|
||||
\page BUILDINSTRUCTIONS How to Build
|
||||
This page explains how to use JKQTPlotter in your own Projects
|
||||
|
||||
\tableofcontents
|
||||
|
||||
\section BUILDINSTRUCTIONS_QMAKE Build using QMake
|
||||
\subsection BUILDINSTRUCTIONS_QMAKEINCLUDE QMake Include Project
|
||||
If you want to simply include the JKQTPlotter Source code into your projects, without build a shared or static library and linking against it, you can use one of these QMake-Include files:
|
||||
- <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/lib/jkqtplotter.pri">lib/jkqtplotter.pri</a> includes the complete library (JKQTPlotter, JKQTFastPlotter, JKQTMathText)
|
||||
- <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/lib/jkqtmathtext.pri">lib/jkqtmathtext.pri</a> includes only JKQTMathText
|
||||
- <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/lib/jkqtfastplotter.pri">lib/jkqtfastplotter.pri</a> includes only JKQTFastPlotter
|
||||
.
|
||||
|
||||
In your QMake-projects it is then sufficient to add a line like:
|
||||
\code{.qmake}
|
||||
include(<PATHTOJKQTPLOTTERDIR>/lib/jkqtplotter.pri)
|
||||
\endcode
|
||||
|
||||
\subsection BUILDINSTRUCTIONS_QMAKESTATIC QMake Static Library
|
||||
|
||||
There are several `.PRO`-files, that can be used to build the full library, or a limited subsets of it as static link library:
|
||||
- <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/staticlib/jkqtplotterlib.pro">staticlib/jkqtplotterlib.pro</a> builds the complete library (JKQTPlotter, JKQTFastPlotter, JKQTMathText) as static link library
|
||||
- <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/staticlib/jkqtmathtextlib.pro">staticlib/jkqtmathtextlib.pro</a> builds only JKQTMathText as static link library
|
||||
- <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/staticlib/jkqtfastplotterlib.pro">staticlib/jkqtfastplotterlib.pro</a> builds only JKQTFastPlotter as static link library
|
||||
.
|
||||
They will produce a static link library that you can include into your projects, e.g. with the following QMake-snippet:
|
||||
|
||||
\code{.qmake}
|
||||
# include JKQTPlotter library
|
||||
DEPENDPATH += <PATHTOJKQTPLOTTERDIR>/lib
|
||||
INCLUDEPATH += <PATHTOJKQTPLOTTERDIR>/lib
|
||||
CONFIG (debug, debug|release) {
|
||||
LIBS += -L<PATHTOJKQTPLOTTERDIR>/staticlib/debug -ljkqtplotterlib_debug
|
||||
} else {
|
||||
LIBS += -L<PATHTOJKQTPLOTTERDIR>/staticlib/release -ljkqtplotterlib
|
||||
}
|
||||
\endcode
|
||||
|
||||
This snippet assumes that you built the libraries with the provided `.PRO`-files. You can also add a second `.pro`-file to your projects, which integrates both as subdirs. Such files are used for all examples in this project. Here is an example:
|
||||
\code{.qmake}
|
||||
TEMPLATE = subdirs
|
||||
|
||||
# the (static library version) of JKQTPlotter
|
||||
jkqtplotterlib_static.file = ../../staticlib/jkqtplotterlib.pro
|
||||
|
||||
# your project file, with declared dependencies on jkqtplotterlib_static
|
||||
test_styling.file=$$PWD/test_styling.pro
|
||||
test_styling.depends = jkqtplotterlib_static
|
||||
|
||||
# add the two entries to SUBDIRS
|
||||
SUBDIRS += jkqtplotterlib_static test_styling
|
||||
\endcode
|
||||
|
||||
|
||||
|
||||
\subsection BUILDINSTRUCTIONS_QMAKEDYNAMIC QMake Dynamic Library
|
||||
|
||||
There are several `.PRO`-files, that can be used to build the full library, or a limited subsets of it as shred library:
|
||||
- <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/sharedlib/jkqtplotterlib_sharedlib.pro">sharedlib/jkqtplotterlib_sharedlib.pro</a> builds the complete library (JKQTPlotter, JKQTFastPlotter, JKQTMathText) as shared library
|
||||
- <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/sharedlib/jkqtmathtextlib_sharedlib.pro">sharedlib/jkqtmathtextlib_sharedlib.pro</a> builds only JKQTMathText as shared library
|
||||
- <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/sharedlib/jkqtfastplotterlib_sharedlib.pro">sharedlib/jkqtfastplotterlib_sharedlib.pro</a> builds only JKQTFastPlotter as shared library
|
||||
.
|
||||
They will produce a dynamic link library that you can include into your projects, e.g. with the following QMake-snippet:
|
||||
|
||||
\code{.qmake}
|
||||
# include JKQTPlotter library
|
||||
DEPENDPATH += <PATHTOJKQTPLOTTERDIR>/lib
|
||||
INCLUDEPATH += <PATHTOJKQTPLOTTERDIR>/lib
|
||||
CONFIG (debug, debug|release) {
|
||||
# ensure that DLLs are copied to the output directory
|
||||
install_jkqtplotter_dll.files = <PATHTOJKQTPLOTTERDIR>/sharedlib/debu/jkqtplotterlib_debug.*
|
||||
install_jkqtplotter_dll.path = $$OUT_PWD
|
||||
INSTALLS += install_jkqtplotter_dll
|
||||
# link agains DLLs
|
||||
LIBS += -L<PATHTOJKQTPLOTTERDIR>/sharedlib/debug -ljkqtplotterlib_debug
|
||||
} else {
|
||||
# ensure that DLLs are copied to the output directory
|
||||
install_jkqtplotter_dll.files = <PATHTOJKQTPLOTTERDIR>/sharedlib/release/jkqtplotterlib.*
|
||||
install_jkqtplotter_dll.path = $$OUT_PWD
|
||||
INSTALLS += install_jkqtplotter_dll
|
||||
# link agains DLLs
|
||||
LIBS += -L<PATHTOJKQTPLOTTERDIR>/sharedlib/release -ljkqtplotterlib
|
||||
}
|
||||
\endcode
|
||||
|
||||
This snippet assumes that you built the libraries with the provided `.PRO`-files. You can also add a second `.pro`-file to your projects, which integrates both as subdirs. Such files are used for all examples in this project. Here is an example:
|
||||
\code{.qmake}
|
||||
TEMPLATE = subdirs
|
||||
|
||||
# the (shared library version) of JKQTPlotter
|
||||
jkqtplotterlib_shared.file = ../../sharedlib/jkqtplotterlib_sharedlib.pro
|
||||
|
||||
# your project file, with declared dependencies on jkqtplotterlib_shared
|
||||
test_styling.file=$$PWD/test_styling.pro
|
||||
test_styling.depends = jkqtplotterlib_shared
|
||||
|
||||
# add the two entries to SUBDIRS
|
||||
SUBDIRS += jkqtplotterlib_shared test_styling
|
||||
\endcode
|
||||
|
||||
\note You will have to run a deployment step `make install` before running your executable, so the shared libararies are actually copied to the output directory (see `INSTALLS + ...` above).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
@ -112,7 +112,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
||||
<tr><td> \image html jkqtplotter_simpletest_ui_small.png
|
||||
<td> \subpage JKQTPlotterQtCreator
|
||||
<td> using Qt Form Designer <br> parsed function plots (`JKQTPXParsedFunctionLineGraph`)
|
||||
<tr><td> \image html jkqtplotter_test_user_interaction_small.png
|
||||
<tr><td> \image html jkqtplotter_test_user_interaction_small.gif
|
||||
<td> \subpage JKQTPlotterUserInteraction
|
||||
<td> different possibilities of user-interaction in JKQtPlotter
|
||||
</table>
|
||||
@ -125,6 +125,9 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
||||
<tr><td> \image html test_multiplot_small.png
|
||||
<td> \subpage JKQTPlotterMultiPlotLayout
|
||||
<td> Combining plots in Qt Layouts <br> linking plot axes <br> copy data from a `std::map` int the datastore <br> print plots/print preview
|
||||
<tr><td> \image html test_styling_small.png
|
||||
<td> \subpage JKQTPlotterStyling
|
||||
<td> Modifying different Aspects of the Styling of JKQTPlotter
|
||||
</table>
|
||||
|
||||
|
||||
|
86
doc/dox/whatsnew.dox
Normal file
86
doc/dox/whatsnew.dox
Normal file
@ -0,0 +1,86 @@
|
||||
/*!
|
||||
|
||||
\page WHATSNEW What's New (Release Notes/Versions)
|
||||
This page lists release notes for the diferent version of JKQTPlotter
|
||||
|
||||
\tableofcontents
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\section WHATSNEW_TRUNK trunk: Major Update/Refactoring
|
||||
|
||||
\subsection WHATSNEW_TRUNK_OVERVIEW trunk: Overview
|
||||
Starting in summer 2018, JKQTPlotter received some major workover. During this, it lost compatibility to the <a href="https://github.com/jkriege2/QuickFit3">QuickFit 3.0</a> code base.
|
||||
|
||||
Changes, compared to \ref WHATSNEW_V2018_08 "v2018.08" include:
|
||||
<ul>
|
||||
<li> update: refactoring of the library's directory structure </li>
|
||||
<li> new: added QMake-Projects for static and for shared library builds </li>
|
||||
<li> update: refactoring/renaming of API, including the function anming scheme and class names </li>
|
||||
<li> new: \ref exampleTutorialProjects "extensive set of Examples and Tutorials" </li>
|
||||
<li> update: massively improved (doxygen-generated) <a href="http://jkriege2.github.io/JKQtPlotter/index.html">Online-Documentation (http://jkriege2.github.io/JKQtPlotter/index.html)</a> (automatically generated after each commit using ravis CI) </li>
|
||||
<li> new: checked builds with continuous integration from AppVeyor: <a href="https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master">https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master</a> </li>
|
||||
<li> new/update: support for building with Microsoft Visual Studio (Win), MinGW (Win), GCC (Linux/MacOS) </li>
|
||||
<li> Updates to JKQTPlotter:
|
||||
<ul>
|
||||
<li> update: \ref JKQTPLOTTER_USERINTERACTION "reworked user interactions API" </li>
|
||||
<li> new: added JKQTPSingleColumnSymbolsGraph for single-column data, e.g. drawn as (random) scatter or bee-swar plots </li>
|
||||
<li> new: stacked barcharts with JKQTPBarVerticalStackableGraph, JKQTPBarHorizontalStackableGraph </li>
|
||||
<li> deprecated: Removed datarange-feature </li>
|
||||
<li> new: use/support of C++11 features (e.g. \c std::function<> in JKQTPXFunctionLineGraph / JKQTPYFunctionLineGraph </li>
|
||||
<li> new: \ref jkqtpopencvinterface "optional OpenCV interface" </li>
|
||||
</ul></li>
|
||||
<li> update/fix: several improvements and bugfixes to JKQTMathText </li>
|
||||
</ul>
|
||||
|
||||
\subsection WHATSNEW_TRUNK_DOWNLOAD trunk: Download
|
||||
|
||||
This release is available from:
|
||||
- Source code branch: <a href="https://github.com/jkriege2/JKQtPlotter/tree/v2018.08">https://github.com/jkriege2/JKQtPlotter/tree/v2018.08</a>
|
||||
- Latest Release/Tag: <a href="https://github.com/jkriege2/JKQtPlotter/releases/tag/v2018.08">https://github.com/jkriege2/JKQtPlotter/releases/tag/v2018.08</a> (2018-Aug-19)
|
||||
.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\section WHATSNEW_V2018_08 v2018.08: Minor Modifications (Final QuickFit3-compatible Version)
|
||||
|
||||
\subsection WHATSNEW_V2018_08_OVERVIEW v2018.08: Overview
|
||||
This is the final version of JKQTPlotter, which is still compatible with the <a href="https://github.com/jkriege2/QuickFit3">QuickFit 3.0</a> code base. It contains minor changes as compared to \ref WHATSNEW_V2015_10 "v2015.10":
|
||||
- new: added Qt data model to switch graphs on/off
|
||||
- update: some improvements to test programs
|
||||
.
|
||||
|
||||
\subsection WHATSNEW_V2018_08_DOWNLOAD v2018.08: Download
|
||||
|
||||
This release is available from:
|
||||
- Source code branch: <a href="https://github.com/jkriege2/JKQtPlotter/tree/v2018.08">https://github.com/jkriege2/JKQtPlotter/tree/v2018.08</a>
|
||||
- Latest Release/Tag: <a href="https://github.com/jkriege2/JKQtPlotter/releases/tag/v2018.08">https://github.com/jkriege2/JKQtPlotter/releases/tag/v2018.08</a> (2018-Aug-19)
|
||||
.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\section WHATSNEW_V2015_10 v2015.10: Initial Release
|
||||
|
||||
\subsection WHATSNEW_V2015_10_OVERVIEW v2015.10: Overview
|
||||
This is the initial release of the library. It was developed initially as part of <a href="https://github.com/jkriege2/QuickFit3">QuickFit 3.0</a> and then separated out into a separate repository.
|
||||
|
||||
\subsection WHATSNEW_V2015_10_DOWNLOAD v2015.10: Download
|
||||
|
||||
This release is available from:
|
||||
- Source code branch: <a href="https://github.com/jkriege2/JKQtPlotter/tree/v2015.10">https://github.com/jkriege2/JKQtPlotter/tree/v2015.10</a>
|
||||
- Latest Release/Tag: <a href="https://github.com/jkriege2/JKQtPlotter/releases/tag/v2015.10">https://github.com/jkriege2/JKQtPlotter/releases/tag/v2015.10</a> (2015-Oct-20)
|
||||
.
|
||||
|
||||
|
||||
*/
|
@ -71,17 +71,18 @@ h2.memtitle {
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-left: -5pt;
|
||||
margin-bottom: 32px;
|
||||
margin-bottom: 16px;
|
||||
margin-right: 15px;
|
||||
padding: 4px;
|
||||
background: #eeeeee;
|
||||
width: 75%;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
h1 {
|
||||
border-bottom: 2px solid black;
|
||||
border-left: 2px solid black;
|
||||
font-size: 22pt;
|
||||
margin-top: 64pt;
|
||||
}
|
||||
|
||||
h2 {
|
||||
|
@ -51,7 +51,7 @@ 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_simpletest_ui_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_ui) | [Placing JKQTPlotter into a Qt User-Interface-XML-file (`*.ui`)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_ui) | using Qt Form Designer <br> parsed function plots (`JKQTPXParsedFunctionLineGraph`) |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_test_user_interaction_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_user_interaction) | [User Interaction](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_user_interaction) | different possibilities of user-interaction in JKQtPlotter |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_test_user_interaction_small.gif)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_user_interaction) | [User Interaction](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_user_interaction) | different possibilities of user-interaction in JKQtPlotter |
|
||||
|
||||
|
||||
|
||||
@ -60,6 +60,7 @@ 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/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 |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_styling_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling) | [Styling of JKQTPlotter](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling) | Modifying different Aspects of the Styling of JKQTPlotter |
|
||||
|
||||
|
||||
|
||||
|
@ -1,30 +1,118 @@
|
||||
# Tutorial (JKQTPlotter): User-Interactions in JKQtPlotter {#JKQTPlotterUserInteraction}
|
||||
|
||||
## Basic Description
|
||||
This project (see `./examples/test_user_interaction/`) demonstrates different types of user-interactions in JKQTPlotter.
|
||||
|
||||
It contains a simple plot with two graphs and provides several widgets that allow to bind different user interactions to different events:
|
||||
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_user_interaction.png)
|
||||
|
||||
|
||||
## Inner Workings
|
||||
|
||||
The source code of the main application can be found in [`test_user_interaction.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_user_interaction/test_user_interaction.cpp).
|
||||
|
||||
The menu at the top of the window contains several of the QActions provided for user-interaction by JKQTBasePlotter:
|
||||
```.cpp
|
||||
// add some of the default QActions from the JKQTPlotter to the window menu
|
||||
// Some of the are also available in the context menu and toolbar of the JKQTPlotter
|
||||
// others are not
|
||||
QMenu* menuPlot=menuBar()->addMenu("Plot-Menu");
|
||||
menuPlot->addAction(plot->getPlotter()->getActionPrint());
|
||||
QMenu* menuPlotS=menuPlot->addMenu("Save ...");
|
||||
menuPlotS->addAction(plot->getPlotter()->getActionSaveData());
|
||||
menuPlotS->addAction(plot->getPlotter()->getActionSavePDF()); // not available from JKQTPlotter by default
|
||||
menuPlotS->addAction(plot->getPlotter()->getActionSavePlot());
|
||||
QMenu* menuPlotZ=menuPlot->addMenu("Zoom ...");
|
||||
menuPlotZ->addAction(plot->getPlotter()->getActionZoomAll());
|
||||
menuPlotZ->addAction(plot->getPlotter()->getActionZoomIn());
|
||||
menuPlotZ->addAction(plot->getPlotter()->getActionZoomOut());
|
||||
```
|
||||
|
||||
The rest of the form contains several Qt widgets which switch diverse aspects of the plot style (log-axes, grid on/off ...) and allow to bind different actions to several defined events, e.g.
|
||||
```.cpp
|
||||
// add a QComboBox that allows to set the left mouse button action for the JKQTPlotter
|
||||
cmbLeftNoModMouseAction=new QComboBox(this);
|
||||
layForm->addRow("mouse action: left-click, no modifiers", cmbLeftNoModMouseAction);
|
||||
cmbLeftNoModMouseAction->addItem("PanPlotOnMove");
|
||||
cmbLeftNoModMouseAction->addItem("PanPlotOnRelease");
|
||||
cmbLeftNoModMouseAction->addItem("ZoomRectangle");
|
||||
cmbLeftNoModMouseAction->addItem("DrawRectangleForEvent");
|
||||
cmbLeftNoModMouseAction->addItem("DrawCircleForEvent");
|
||||
cmbLeftNoModMouseAction->addItem("DrawEllipseForEvent");
|
||||
cmbLeftNoModMouseAction->addItem("DrawLineForEvent");
|
||||
cmbLeftNoModMouseAction->addItem("ScribbleForEvents");
|
||||
cmbLeftNoModMouseAction->addItem("NoMouseAction");
|
||||
cmbLeftNoModMouseAction->setCurrentIndex(2);
|
||||
connect(cmbLeftNoModMouseAction, SIGNAL(currentIndexChanged(int)), this, SLOT(setLeftMouseAction(int)));
|
||||
setLeftMouseAction(cmbLeftNoModMouseAction->currentIndex());
|
||||
|
||||
// ......
|
||||
|
||||
void TestUserInteraction::setLeftMouseAction(int index)
|
||||
{
|
||||
if (index==cmbLeftNoModMouseAction->count()-1) plot->deregisterMouseDragAction(Qt::LeftButton, Qt::NoModifier);
|
||||
else plot->registerMouseDragAction(Qt::LeftButton, Qt::NoModifier, static_cast<JKQTPlotter::MouseDragActions>(index));
|
||||
}
|
||||
```
|
||||
|
||||
As you can see, this QComboBox registers one of the available actions to the event of a left-button single mouse click without having modifiers pressed at the same time. The slot that actually reconfigures the JKQTPlotter uses the methods JKQTPlotter::deregisterMouseDragAction() and JKQTPlotter::registerMouseDragAction() to achieve this effect.
|
||||
|
||||
|
||||
|
||||
## Available User-Interactions
|
||||
|
||||
You can play around with this example to find out about different types of user interactions. SOm of them are illustrated with animations below.
|
||||
|
||||
### Switching Graph Visibility via Context Menu
|
||||
|
||||
the default context menu contains a sub-menu that allows to switch every graph and and off:
|
||||
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/contextmenu_graphvisibility.gif)
|
||||
|
||||
|
||||
### Toolbar at the top of the Plot
|
||||
Each JKQTPlotter contains a toolbar that is by default invisible and appears, when the mouse moves over a designated area at the top of the plot:
|
||||
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/jkqtvanishtoolbar.gif)
|
||||
|
||||
You can also use the checkboxes "enable toolbar" to disable this toolbar alltogether and "toolbar 'always on'" to switch the vanishing feature off and make it visible all the time.
|
||||
|
||||
### Mouse Position Display
|
||||
|
||||
The JKQTPlotter contains a small text display for the current mouse position (in plot coordinates) at the top of the graph:
|
||||
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/mousepositiondisplay.gif)
|
||||
|
||||
|
||||
### Drag the Plot Viewport
|
||||
You can move the viewport of the graph using the mouse ("PanPlotOnMove"-action). If you drag inside the plot window, you can move in both directions, if you drag over one of the coordinate axes, you can change the range of this axis only:
|
||||
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/drag_viewport.gif)
|
||||
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/zoomin_mouse_contextmenu.gif)
|
||||
### Zooming with the Mouse
|
||||
|
||||
There are several options to zoom, using the mouse:
|
||||
* using the mouse wheel
|
||||
* with double-click actions ClickZoomsOut, ClickZoomsIn
|
||||
* using the context menu (or the toolbar)<br>
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/zoomin_mouse_contextmenu.gif)
|
||||
|
||||
Again these actions are limited to a single axis, if the mouse is above that axis (and not inside the actual plot rectangle).
|
||||
|
||||
### Drawing Geometrical Forms
|
||||
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/draw_circle.gif)
|
||||
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/draw_ellipse.gif)
|
||||
You can also use the mouse to draw various geometricals forms. When you finish drawing, a single event is emitted for that form, which contains its size and position:
|
||||
|
||||
#### Lines
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/draw_line.gif)
|
||||
|
||||
#### Rectangles
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/draw_rectangle.gif)
|
||||
|
||||
#### Circles
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/draw_circle.gif)
|
||||
|
||||
#### Ellipses
|
||||
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/draw_ellipse.gif)
|
||||
|
||||
|
||||
|
@ -571,8 +571,17 @@ void JKQTPlotter::wheelEvent ( QWheelEvent * event ) {
|
||||
}
|
||||
plotter->setXY(xmin, xmax, ymin, ymax);
|
||||
} else if (itAction.value()==MouseWheelActions::PanByWheel) {
|
||||
QPoint d=event->pixelDelta();
|
||||
QRectF zoomRect= QRectF(QPointF(plotter->x2p(getXAxis()->getMin()),plotter->y2p(getYAxis()->getMax())), QPointF(plotter->x2p(getXAxis()->getMax()),plotter->y2p(getYAxis()->getMin())));
|
||||
QPointF d=QPointF(event->angleDelta().x()/120.0*zoomRect.width()/10.0,
|
||||
event->angleDelta().y()/120.0*zoomRect.height()/10.0);
|
||||
if (d.x()<-100) d.setX(-100);
|
||||
if (d.x()>100) d.setX(100);
|
||||
if (d.y()<-100) d.setY(-100);
|
||||
if (d.y()>100) d.setY(100);
|
||||
if (d.x()>=0 && d.x()<10) d.setX(10);
|
||||
if (d.x()<0 && d.x()>-10) d.setX(-10);
|
||||
if (d.y()>=0 && d.y()<10) d.setY(10);
|
||||
if (d.y()<0 && d.y()>-10) d.setY(-10);
|
||||
if ( (event->x()/magnification<plotter->getInternalPlotBorderLeft()) || (event->x()/magnification>plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) ) {
|
||||
zoomRect.translate(0, d.y());
|
||||
} else if (((event->y()-getPlotYOffset())/magnification<plotter->getInternalPlotBorderTop()) || ((event->y()-getPlotYOffset())/magnification>plotter->getPlotHeight()+plotter->getInternalPlotBorderTop()) ) {
|
||||
|
@ -19,10 +19,6 @@
|
||||
|
||||
|
||||
|
||||
/** \file jkqtpopencvinterface.h
|
||||
* \ingroup jkqtpopencvinterface
|
||||
*/
|
||||
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtplotter/jkqtpdatastore.h"
|
||||
#include <opencv/cv.h>
|
||||
|
BIN
screenshots/jkqtplotter_test_user_interaction_small.gif
Normal file
BIN
screenshots/jkqtplotter_test_user_interaction_small.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
screenshots/test_user_interaction.png
Normal file
BIN
screenshots/test_user_interaction.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
@ -12,13 +12,25 @@ There are several `.PRO`-files, that can be used to build the full library, or a
|
||||
DEPENDPATH += <PATHTOJKQTPLOTTERDIR>/lib
|
||||
INCLUDEPATH += <PATHTOJKQTPLOTTERDIR>/lib
|
||||
CONFIG (debug, debug|release) {
|
||||
# ensure that DLLs are copied to the output directory
|
||||
install_jkqtplotter_dll.files = <PATHTOJKQTPLOTTERDIR>/sharedlib/debu/jkqtplotterlib_debug.*
|
||||
install_jkqtplotter_dll.path = $$OUT_PWD
|
||||
INSTALLS += install_jkqtplotter_dll
|
||||
# link agains DLLs
|
||||
LIBS += -L<PATHTOJKQTPLOTTERDIR>/sharedlib/debug -ljkqtplotterlib_debug
|
||||
} else {
|
||||
# ensure that DLLs are copied to the output directory
|
||||
install_jkqtplotter_dll.files = <PATHTOJKQTPLOTTERDIR>/sharedlib/release/jkqtplotterlib.*
|
||||
install_jkqtplotter_dll.path = $$OUT_PWD
|
||||
INSTALLS += install_jkqtplotter_dll
|
||||
# link agains DLLs
|
||||
LIBS += -L<PATHTOJKQTPLOTTERDIR>/sharedlib/release -ljkqtplotterlib
|
||||
}
|
||||
```
|
||||
|
||||
This snippet assumes that you built the libraries with the provided `.PRO`-files.
|
||||
|
||||
*Note* that you will have to run a deployment step `make install` before running your executable, so the shared libararies are actually copied to the output directory (see `INSTALLS + ...` above).
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user