mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
improved user-interactions (& their example)
This commit is contained in:
parent
0e2237e92f
commit
c74e87ad31
@ -7,6 +7,7 @@
|
||||
|
||||
#include "test_user_interaction.h"
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
|
||||
TestUserInteraction::TestUserInteraction(QWidget *parent) :
|
||||
QMainWindow(parent)
|
||||
@ -65,10 +66,140 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
|
||||
connect(chkGrid, SIGNAL(toggled(bool)), plot, SLOT(setGrid(bool)));
|
||||
layChk->addWidget(chkGrid);
|
||||
|
||||
// add a QComboBox that allows to set the left mouse button action for the JKQTPlotter
|
||||
cmbMouseAction=new QComboBox(this);
|
||||
layForm->addRow("mouse action:", cmbMouseAction);
|
||||
cmbMouseAction->addItem("NoMouseAction");
|
||||
cmbMouseAction->addItem("PanPlot=DragPlotWindow");
|
||||
cmbMouseAction->addItem("ZoomRectangle");
|
||||
cmbMouseAction->addItem("RectangleEvents");
|
||||
cmbMouseAction->addItem("CircleEvents");
|
||||
cmbMouseAction->addItem("EllipseEvents");
|
||||
cmbMouseAction->addItem("LineEvents");
|
||||
cmbMouseAction->addItem("ScribbleEvents");
|
||||
cmbMouseAction->addItem("ClickEvents");
|
||||
connect(cmbMouseAction, SIGNAL(currentIndexChanged(int)), this, SLOT(setLeftMouseAction(int)));
|
||||
setLeftMouseAction(cmbMouseAction->currentIndex());
|
||||
// and add a QLabel to show the different events of the JKQTPlotter:
|
||||
labMouseMoved=new QLabel(this);
|
||||
layForm->addRow("last mouse moved:", labMouseMoved);
|
||||
labMouseClicked=new QLabel(this);
|
||||
layForm->addRow("last mouse clicked:", labMouseClicked);
|
||||
labMouseAction=new QLabel(this);
|
||||
layForm->addRow("last plotter signal:", labMouseAction);
|
||||
connect(plot, SIGNAL(plotMouseMove(double, double)), this, SLOT(plotMouseMove(double, double)));
|
||||
connect(plot, SIGNAL(plotMouseClicked(double, double, Qt::KeyboardModifiers , Qt::MouseButton)), this, SLOT(plotMouseClicked(double, double, Qt::KeyboardModifiers, Qt::MouseButton)));
|
||||
connect(plot, SIGNAL(plotMouseDoubleClicked(double, double, Qt::KeyboardModifiers, Qt::MouseButton)), this, SLOT(plotMouseDoubleClicked(double, double, Qt::KeyboardModifiers, Qt::MouseButton)));
|
||||
connect(plot, SIGNAL(plotNewZoomRectangle(double, double, double, double, Qt::KeyboardModifiers)), this, SLOT(plotNewZoomRectangle(double, double, double, double, Qt::KeyboardModifiers)));
|
||||
connect(plot, SIGNAL(contextMenuOpened(double, double, QMenu*)), this, SLOT(contextMenuOpened(double, double, QMenu*)));
|
||||
connect(plot, SIGNAL(zoomChangedLocally(double, double, double, double, JKQTPlotter*)), this, SLOT(zoomChangedLocally(double, double, double, double, JKQTPlotter*)));
|
||||
connect(plot, SIGNAL(userClickFinished(double, double, Qt::KeyboardModifiers)), this, SLOT(userClickFinished(double, double, Qt::KeyboardModifiers)));
|
||||
connect(plot, SIGNAL(userScribbleClick(double, double, Qt::KeyboardModifiers, bool, bool)), this, SLOT(userScribbleClick(double, double, Qt::KeyboardModifiers, bool, bool)));
|
||||
connect(plot, SIGNAL(userRectangleFinished(double, double, double, double, Qt::KeyboardModifiers)), this, SLOT(userRectangleFinished(double, double, double, double, Qt::KeyboardModifiers)));
|
||||
connect(plot, SIGNAL(userLineFinished(double, double, double, double, Qt::KeyboardModifiers)), this, SLOT(userLineFinished(double, double, double, double, Qt::KeyboardModifiers)));
|
||||
connect(plot, SIGNAL(userCircleFinished(double, double, double, Qt::KeyboardModifiers)), this, SLOT(userCircleFinished(double, double, double, Qt::KeyboardModifiers)));
|
||||
connect(plot, SIGNAL(userEllipseFinished(double, double, double, double, Qt::KeyboardModifiers)), this, SLOT(userEllipseFinished(double, double, double, double, Qt::KeyboardModifiers)));
|
||||
|
||||
|
||||
w->setLayout(layout);
|
||||
resize(800,600);
|
||||
}
|
||||
|
||||
void TestUserInteraction::setLeftMouseAction(int index)
|
||||
{
|
||||
plot->setMouseActionMode(static_cast<JKQTPlotter::MouseActionModes>(index));
|
||||
}
|
||||
|
||||
void TestUserInteraction::plotMouseMove(double x, double y)
|
||||
{
|
||||
labMouseMoved->setText(QString("plotMouseMove(%1, %2)").arg(x).arg(y));
|
||||
}
|
||||
|
||||
void TestUserInteraction::plotMouseClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button)
|
||||
{
|
||||
labMouseClicked->setText(QString("plotMouseClicked(%1, %2, modifiers=%3, button=%4)").arg(x).arg(y).arg(KeyboradMod2String(modifiers)).arg(MouseButton2String(button)));
|
||||
}
|
||||
|
||||
void TestUserInteraction::plotMouseDoubleClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button)
|
||||
{
|
||||
labMouseClicked->setText(QString("plotMouseDoubleClicked(%1, %2, modifiers=%3, button=%4)").arg(x).arg(y).arg(KeyboradMod2String(modifiers)).arg(MouseButton2String(button)));
|
||||
}
|
||||
|
||||
void TestUserInteraction::plotNewZoomRectangle(double mouseDragRectXStart, double mouseDragRectXEnd, double mouseDragRectYStart, double mouseDragRectYEnd, Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
labMouseAction->setText(QString("plotNewZoomRectangle(x=%1..%2, y=%3..%4, modifiers=%5)").arg(mouseDragRectXStart).arg(mouseDragRectXEnd).arg(mouseDragRectYStart).arg(mouseDragRectYEnd).arg(KeyboradMod2String(modifiers)));
|
||||
}
|
||||
|
||||
void TestUserInteraction::contextMenuOpened(double x, double y, QMenu *contextMenu)
|
||||
{
|
||||
contextMenu->addSeparator();
|
||||
QAction* act=contextMenu->addMenu(QString("contextMenuOpened(x=%1, y=%2)").arg(x).arg(y))->addAction("user-added action");
|
||||
connect(act, &QAction::triggered, [x,y]() { QMessageBox::warning(nullptr, tr("Plot Context Menu"),
|
||||
tr("Context Menu was opened at x/y=%1/%2!").arg(x).arg(y),
|
||||
QMessageBox::Ok,
|
||||
QMessageBox::Ok); });
|
||||
labMouseAction->setText(QString("contextMenuOpened(x=%1, y=%2)").arg(x).arg(y));
|
||||
}
|
||||
|
||||
void TestUserInteraction::zoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter */*sender*/)
|
||||
{
|
||||
labMouseAction->setText(QString("zoomChangedLocally(x=%1..%2, y=%3..%4)").arg(newxmin).arg(newxmax).arg(newymin).arg(newymax));
|
||||
}
|
||||
|
||||
void TestUserInteraction::userClickFinished(double x, double y, Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
labMouseAction->setText(QString("userClickFinished(%1, %2, modifiers=%3)").arg(x).arg(y).arg(KeyboradMod2String(modifiers)));
|
||||
}
|
||||
|
||||
void TestUserInteraction::userScribbleClick(double x, double y, Qt::KeyboardModifiers modifiers, bool first, bool last)
|
||||
{
|
||||
static int counter=0;
|
||||
if (first) counter=0;
|
||||
else counter++;
|
||||
labMouseAction->setText(QString("userClickFinished(%1, %2, modifiers=%3, first=%4, last=%5) -> scribble-points so far: %6").arg(x).arg(y).arg(KeyboradMod2String(modifiers)).arg(first).arg(last).arg(counter));
|
||||
}
|
||||
|
||||
void TestUserInteraction::userRectangleFinished(double x, double y, double width, double height, Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
labMouseAction->setText(QString("userRectangleFinished(x=%1, y=%2, width=%3, height=%4, modifiers=%5)").arg(x).arg(y).arg(width).arg(height).arg(KeyboradMod2String(modifiers)));
|
||||
}
|
||||
|
||||
void TestUserInteraction::userLineFinished(double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
labMouseAction->setText(QString("userLineFinished(x1=%1/%2, x2=%3/%4, modifiers=%5)").arg(x1).arg(y1).arg(x2).arg(y2).arg(KeyboradMod2String(modifiers)));
|
||||
}
|
||||
|
||||
void TestUserInteraction::userCircleFinished(double x, double y, double radius, Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
labMouseAction->setText(QString("userRectangleFinished(x=%1, y=%2, radius=%3, modifiers=%4)").arg(x).arg(y).arg(radius).arg(KeyboradMod2String(modifiers)));
|
||||
}
|
||||
|
||||
void TestUserInteraction::userEllipseFinished(double x, double y, double radiusX, double radiusY, Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
labMouseAction->setText(QString("userRectangleFinished(x=%1, y=%2, radiusX=%3, radiusY=%4, modifiers=%5)").arg(x).arg(y).arg(radiusX).arg(radiusY).arg(KeyboradMod2String(modifiers)));
|
||||
}
|
||||
|
||||
QString TestUserInteraction::KeyboradMod2String(Qt::KeyboardModifiers modifiers) {
|
||||
QString mod="";
|
||||
if ((modifiers & Qt::ShiftModifier) != 0) mod+="SHIFT ";
|
||||
if ((modifiers & Qt::ControlModifier) != 0) mod+="CTRL ";
|
||||
if ((modifiers & Qt::AltModifier) != 0) mod+="ALT ";
|
||||
if ((modifiers & Qt::MetaModifier) != 0) mod+="META ";
|
||||
if ((modifiers & Qt::KeypadModifier) != 0) mod+="KEYPAD ";
|
||||
return mod;
|
||||
}
|
||||
|
||||
QString TestUserInteraction::MouseButton2String(Qt::MouseButton button) {
|
||||
QString btn="";
|
||||
if ((button & Qt::LeftButton) != 0) btn+="LEFT ";
|
||||
if ((button & Qt::RightButton) != 0) btn+="RIGHT ";
|
||||
if ((button & Qt::MiddleButton) != 0) btn+="MID ";
|
||||
if ((button & Qt::BackButton) != 0) btn+="BACK ";
|
||||
if ((button & Qt::ForwardButton) != 0) btn+="FORWARD ";
|
||||
return btn;
|
||||
}
|
||||
|
||||
|
||||
void TestUserInteraction::initPlot()
|
||||
{
|
||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||
|
@ -21,7 +21,20 @@ class TestUserInteraction : public QMainWindow
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void setLeftMouseAction(int index);
|
||||
|
||||
void plotMouseMove(double x, double y);
|
||||
void plotMouseClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button);
|
||||
void plotMouseDoubleClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button);
|
||||
void plotNewZoomRectangle(double mouseDragRectXStart, double mouseDragRectXEnd, double mouseDragRectYStart, double mouseDragRectYEnd, Qt::KeyboardModifiers modifiers);
|
||||
void contextMenuOpened(double x, double y, QMenu* contextMenu);
|
||||
void zoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender);
|
||||
void userClickFinished(double x, double y, Qt::KeyboardModifiers modifiers);
|
||||
void userScribbleClick(double x, double y, Qt::KeyboardModifiers modifiers, bool first, bool last);
|
||||
void userRectangleFinished(double x, double y, double width, double height, Qt::KeyboardModifiers modifiers);
|
||||
void userLineFinished(double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers);
|
||||
void userCircleFinished(double x, double y, double radius, Qt::KeyboardModifiers modifiers);
|
||||
void userEllipseFinished(double x, double y, double radiusX, double radiusY, Qt::KeyboardModifiers modifiers);
|
||||
protected:
|
||||
void initPlot();
|
||||
JKQTPlotter* plot;
|
||||
@ -32,8 +45,15 @@ class TestUserInteraction : public QMainWindow
|
||||
QCheckBox* chkShowToolbar;
|
||||
QCheckBox* chkToolbarAlwaysOn;
|
||||
QCheckBox* chkGrid;
|
||||
QComboBox* cmbMouseAction;
|
||||
QLabel* labMouseAction;
|
||||
QLabel* labMouseMoved;
|
||||
QLabel* labMouseClicked;
|
||||
JKQTPXYLineGraph* graph1;
|
||||
JKQTPXYLineGraph* graph2;
|
||||
|
||||
static QString MouseButton2String(Qt::MouseButton button);
|
||||
static QString KeyboradMod2String(Qt::KeyboardModifiers modifiers);
|
||||
};
|
||||
|
||||
#endif // TEST_USER_INTERACTION_H
|
||||
|
@ -95,7 +95,7 @@ class LIB_EXPORT JKQTPPaintDeviceAdapter {
|
||||
virtual QPaintDevice* createPaintdeviceMM(const QString& filename, double widthMM, double heightMM) const;
|
||||
};
|
||||
|
||||
/** \brief base class for 2D plotter classes
|
||||
/** \brief base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
|
||||
* \ingroup jkqtpplotterclasses
|
||||
*
|
||||
* This class implements basic functionalities for the plotter classes. Those are:
|
||||
@ -109,9 +109,9 @@ class LIB_EXPORT JKQTPPaintDeviceAdapter {
|
||||
* .
|
||||
*
|
||||
* This class is NOT a widget, if you need a plotting widget, use JKQTPlotter. This class may be used to
|
||||
* plot onto any JKQTPEnhancedPainter.
|
||||
*
|
||||
* plot using a JKQTPEnhancedPainter.
|
||||
*
|
||||
* \see JKQTPlotter
|
||||
*
|
||||
* \section jkqtplotter_base_datastore Data Storage
|
||||
* As already mentioned this class does not provide means to draw graphs, but it contains a basic mechanism to associate
|
||||
|
@ -347,7 +347,7 @@ void JKQTPlotter::mouseMoveEvent ( QMouseEvent * event ) {
|
||||
event->accept();
|
||||
//std::cout<<mouseZoomingTStart<<" -- "<<mouseZoomingTEnd<<std::endl;
|
||||
if (mouseActionMode==JKQTPlotter::ZoomRectangle) {
|
||||
emit plotNewZoomRectangle(mouseDragRectXStart, mouseDragRectXEnd, mouseDragRectYStart, mouseDragRectYEnd);
|
||||
emit plotNewZoomRectangle(mouseDragRectXStart, mouseDragRectXEnd, mouseDragRectYStart, mouseDragRectYEnd, event->modifiers());
|
||||
}
|
||||
if ((mouseActionMode==JKQTPlotter::ScribbleEvents) && ((mouseDragRectXStart!=mouseDragRectXEnd) || (mouseDragRectYStart!=mouseDragRectYEnd)) ) {
|
||||
emit userScribbleClick(mouseDragRectXEnd, mouseDragRectYEnd, event->modifiers(), false, false);
|
||||
|
@ -59,7 +59,7 @@
|
||||
LIB_EXPORT void initJKQTPlotterResources();
|
||||
|
||||
|
||||
/** \brief class to plot function graphs in linear or (semi-)logarithmic scale
|
||||
/** \brief plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
|
||||
* \ingroup jkqtpplotterclasses
|
||||
*
|
||||
* This class is an implementation of JKQTBasePlotter. It uses the tools from this base class
|
||||
@ -190,14 +190,16 @@ class LIB_EXPORT JKQTPlotter: public QWidget {
|
||||
/** \brief availble user-action mode this JKQtPlotter use when mouse events occur.
|
||||
* This allows you to e.g. draw rectangles or lines over the plot and receive a signal, when the drawing finishes */
|
||||
enum MouseActionModes {
|
||||
ZoomRectangle, /*!< \brief draw a rectangle and when finish zoom to that rectangle */
|
||||
RectangleEvents, /*!< \brief draw a rectangle and when finished execute the signal userRectangleFinished() */
|
||||
CircleEvents, /*!< \brief draw a circle and when finished execute the signal userCircleFinished() */
|
||||
EllipseEvents, /*!< \brief draw an ellipse and when finished execute the signal userEllipseFinished() */
|
||||
LineEvents, /*!< \brief draw a line and when finished execute the signal userLineFinished() */
|
||||
ScribbleEvents, /*!< \brief let the user scribble on the plot (left mouse button is kept pressed) and call userScribbleClick() for each new position */
|
||||
NoMouseAction, /*!< \brief no action is to be performed */
|
||||
ClickEvents /*!< \brief sinply call userClickFinished() for every single-click of the mouse button */
|
||||
NoMouseAction=0, /*!< \brief no action is to be performed */
|
||||
DragPlotWindow=1, /*!< \brief the user can draw the current plot window while keeping the left mouse-button pushed down (=panning) */
|
||||
PanPlot=DragPlotWindow, /*!< \copydoc DragPlotWindow */
|
||||
ZoomRectangle=2, /*!< \brief draw a rectangle and when finish zoom to that rectangle */
|
||||
RectangleEvents=3, /*!< \brief draw a rectangle and when finished execute the signal userRectangleFinished() */
|
||||
CircleEvents=4, /*!< \brief draw a circle and when finished execute the signal userCircleFinished() */
|
||||
EllipseEvents=5, /*!< \brief draw an ellipse and when finished execute the signal userEllipseFinished() */
|
||||
LineEvents=6, /*!< \brief draw a line and when finished execute the signal userLineFinished() */
|
||||
ScribbleEvents=7, /*!< \brief let the user scribble on the plot (left mouse button is kept pressed) and call userScribbleClick() for each new position */
|
||||
ClickEvents=8 /*!< \brief sinply call userClickFinished() for every single-click of the mouse button */
|
||||
};
|
||||
|
||||
/** \brief options of how to react to a right mouse button click */
|
||||
@ -640,36 +642,121 @@ class LIB_EXPORT JKQTPlotter: public QWidget {
|
||||
inline void setXY(double xminn, double xmaxx, double yminn, double ymaxx) { plotter->setXY(xminn, xmaxx, yminn, ymaxx); }
|
||||
|
||||
signals:
|
||||
/** \brief signal: emitted whenever the mouse moved over the plot */
|
||||
/** \brief emitted whenever the mouse moves
|
||||
*
|
||||
* \param x x-position of the mouse (in plot coordinates)
|
||||
* \param y y-position of the mouse (in plot coordinates)
|
||||
*/
|
||||
void plotMouseMove(double x, double y);
|
||||
/** \brief signal: emitted whenever the mouse was clicked over the plot */
|
||||
/** \brief emitted when a single-click event from the mouse occurs inside the plot
|
||||
*
|
||||
* \param x x-position of the mouse (in plot coordinates)
|
||||
* \param y y-position of the mouse (in plot coordinates)
|
||||
* \param modifiers key-modifiers when the click occured
|
||||
* \param button mouse-button that was used for the click
|
||||
*/
|
||||
void plotMouseClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button);
|
||||
/** \brief signal: emitted whenever the mouse was clicked over the plot */
|
||||
/** \brief emitted when a double-click event from the mouse occurs inside the plot
|
||||
*
|
||||
* \param x x-position of the mouse (in plot coordinates)
|
||||
* \param y y-position of the mouse (in plot coordinates)
|
||||
* \param modifiers key-modifiers when the click occured
|
||||
* \param button mouse-button that was used for the click
|
||||
*/
|
||||
void plotMouseDoubleClicked(double x, double y, Qt::KeyboardModifiers modifiers, Qt::MouseButton button);
|
||||
/** \brief signal: emitted whenever a zoom rectangle is drawn (and it's size changes) */
|
||||
void plotNewZoomRectangle(double mouseDragRectXStart, double mouseDragRectXEnd, double mouseDragRectYStart, double mouseDragRectYEnd);
|
||||
/** \brief emitted when mouseActionMode==JKQTPlotter::ZoomRectangle and the drawing of the new zoom rectangle is finished (=mouse key released)
|
||||
*
|
||||
* \param mouseDragRectXStart start of the selected x-range (in plot coordinates)
|
||||
* \param mouseDragRectXEnd end of the selected x-range (in plot coordinates)
|
||||
* \param mouseDragRectYStart start of the selected x-range (in plot coordinates)
|
||||
* \param mouseDragRectYEnd end of the selected x-range (in plot coordinates)
|
||||
* \param modifiers key-modifiers when the click occured
|
||||
*/
|
||||
void plotNewZoomRectangle(double mouseDragRectXStart, double mouseDragRectXEnd, double mouseDragRectYStart, double mouseDragRectYEnd, Qt::KeyboardModifiers modifiers);
|
||||
/** \brief emitted when the plot scaling has been recalculated */
|
||||
void plotScalingRecalculated();
|
||||
/** \brief emitted before the plot scaling has been recalculated */
|
||||
void beforePlotScalingRecalculate();
|
||||
/** \brief emitted when a context-emnu was opened at the given position */
|
||||
/** \brief emitted whenever a context menu is opened. You can modify the menu via the parameter \a contextMenu!
|
||||
*
|
||||
* \param x x-position of the context-menu (in plot coordinates)
|
||||
* \param y y-position of the context-menu (in plot coordinates)
|
||||
* \param contextMenu QMenu-object of the context menu. This object may be altered to display additional items ... Here is an example:
|
||||
* \code
|
||||
* contextMenu->addSeparator();
|
||||
* QAction* act=contextMenu->addMenu(QString("contextMenuOpened(x=%1, y=%2)").arg(x).arg(y))->addAction("user-added action");
|
||||
* connect(act, &QAction::triggered, [x,y]() { QMessageBox::warning(nullptr, tr("Plot Context Menu"),
|
||||
* tr("Context Menu was opened at x/y=%1/%2!").arg(x).arg(y),
|
||||
* QMessageBox::Ok,
|
||||
* QMessageBox::Ok); });
|
||||
* \endcode
|
||||
*/
|
||||
void contextMenuOpened(double x, double y, QMenu* contextMenu);
|
||||
|
||||
|
||||
/** \brief signal: emitted whenever the user selects a new x-y zoom range (by mouse) */
|
||||
/** \brief signal: emitted whenever the user selects a new x-y zoom range (by mouse)
|
||||
*
|
||||
* \param newxmin start of the selected x-range (in plot coordinates)
|
||||
* \param newxmax end of the selected x-range (in plot coordinates)
|
||||
* \param newymin start of the selected x-range (in plot coordinates)
|
||||
* \param newymax end of the selected x-range (in plot coordinates)
|
||||
* \param sender JKQTPlotter sending this event
|
||||
*
|
||||
* This signal is designed to be connected to these slots: synchronizeXAxis(), synchronizeYAxis(), synchronizeXYAxis()
|
||||
*/
|
||||
void zoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTPlotter* sender);
|
||||
|
||||
/** \brief emitted when the user clicks the plot */
|
||||
/** \brief emitted when mouseActionMode==JKQTPlotter::ClickEvents and a click event from the mouse occurs inside the plot
|
||||
*
|
||||
* \param x x-position of the mouse (in plot coordinates)
|
||||
* \param y y-position of the mouse (in plot coordinates)
|
||||
* \param modifiers key-modifiers when the click occured
|
||||
*/
|
||||
void userClickFinished(double x, double y, Qt::KeyboardModifiers modifiers);
|
||||
/** \brief emitted when the user scribbles */
|
||||
/** \brief emitted when mouseActionMode==JKQTPlotter::ScribbleEvents and a click event from the mouse occurs inside the plot,
|
||||
* or the mouse moved while the left button is pressed down
|
||||
*
|
||||
* \param x x-position of the mouse (in plot coordinates)
|
||||
* \param y y-position of the mouse (in plot coordinates)
|
||||
* \param modifiers key-modifiers when the event was generated
|
||||
* \param first if \c true: this is the first event of a series that starts with pressing the mouse-button down, within the series, this is \c false
|
||||
* \param last if \c true: this is the last event of a series that ends when releasing the mouse-button, within the series, this is \c false
|
||||
*/
|
||||
void userScribbleClick(double x, double y, Qt::KeyboardModifiers modifiers, bool first, bool last);
|
||||
/** \brief emitted when the user draws a rectangle */
|
||||
/** \brief emitted when mouseActionMode==JKQTPlotter::RectangleEvents and the drawing of the new rectangle is finished (=mouse key released)
|
||||
*
|
||||
* \param x x-coordinate of the bottom left corner of the rectangle (in plot coordinates)
|
||||
* \param y y-coordinate of the bottom left corner of the rectangle (in plot coordinates)
|
||||
* \param width width of the rectangle (in plot coordinates)
|
||||
* \param height height of the rectangle (in plot coordinates)
|
||||
* \param modifiers key-modifiers when the rectangle was finished
|
||||
*/
|
||||
void userRectangleFinished(double x, double y, double width, double height, Qt::KeyboardModifiers modifiers);
|
||||
/** \brief emitted when the user draws a line */
|
||||
/** \brief emitted when mouseActionMode==JKQTPlotter::LineEvents and the drawing of the new line is finished (=mouse key released)
|
||||
*
|
||||
* \param x1 x-coordinate of the start of the line (in plot coordinates)
|
||||
* \param y1 y-coordinate of the start of the line (in plot coordinates)
|
||||
* \param x2 x-coordinate of the end of the line (in plot coordinates)
|
||||
* \param y2 y-coordinate of the end of the line (in plot coordinates)
|
||||
* \param modifiers key-modifiers when the rectangle was finished
|
||||
*/
|
||||
void userLineFinished(double x1, double y1, double x2, double y2, Qt::KeyboardModifiers modifiers);
|
||||
/** \brief emitted when the user draws a circle */
|
||||
/** \brief emitted when mouseActionMode==JKQTPlotter::CircleEvents and the drawing of the new circle is finished (=mouse key released)
|
||||
*
|
||||
* \param x x-coordinate of the center of the circle (in plot coordinates)
|
||||
* \param y y-coordinate of the center of the circle (in plot coordinates)
|
||||
* \param radius radius of the circle (in plot coordinates)
|
||||
* \param modifiers key-modifiers when the rectangle was finished
|
||||
*/
|
||||
void userCircleFinished(double x, double y, double radius, Qt::KeyboardModifiers modifiers);
|
||||
/** \brief emitted when the user draws an ellipse */
|
||||
/** \brief emitted when mouseActionMode==JKQTPlotter::EllipseEvents and the drawing of the new ellipse is finished (=mouse key released)
|
||||
*
|
||||
* \param x x-coordinate of the center of the ellipse (in plot coordinates)
|
||||
* \param y y-coordinate of the center of the ellipse (in plot coordinates)
|
||||
* \param radiusX half-axis in x-direction of the ellipse (in plot coordinates)
|
||||
* \param radiusY half-axis in y-direction of the ellipse (in plot coordinates)
|
||||
* \param modifiers key-modifiers when the rectangle was finished
|
||||
*/
|
||||
void userEllipseFinished(double x, double y, double radiusX, double radiusY, Qt::KeyboardModifiers modifiers);
|
||||
|
||||
|
||||
|
@ -139,11 +139,11 @@ LIB_EXPORT JKQTPCADrawMode String2JKQTPCADrawMode(const QString& pos);
|
||||
/** \brief display mode for the axis labels
|
||||
* \ingroup jkqtptools */
|
||||
enum JKQTPCALabelType {
|
||||
JKQTPCALTdefault, /*!< \brief simply print the numbers */
|
||||
JKQTPCALTexponentCharacter, /*!< \brief print the numbers and show a unit character, i.e. \c 5µ for \f$ 5\cdot 10^{-6} \f$ , \cd 3k for \f$ 3\cdot 10^3 \f$ ... */
|
||||
JKQTPCALTexponent, /*!< \brief show numbers in exponential for, e.g. \f$ 3\cdot 10^5 \f$ ... */
|
||||
JKQTPCALTdate, /*!< \brief show numbers as dates */
|
||||
JKQTPCALTtime, /*!< \brief show numbers as times */
|
||||
JKQTPCALTdefault, /*!< \brief simply print the numbers \image html JKQTPCALTdefault.png */
|
||||
JKQTPCALTexponentCharacter, /*!< \brief print the numbers and show a unit character, i.e. \c 5µ for \f$ 5\cdot 10^{-6} \f$ , \cd 3k for \f$ 3\cdot 10^3 \f$ ... */
|
||||
JKQTPCALTexponent, /*!< \brief show numbers in exponential for, e.g. \f$ 3\cdot 10^5 \f$ ... \image html JKQTPCALTexponent.png */
|
||||
JKQTPCALTdate, /*!< \brief show numbers as dates \image html JKQTPCALTdate.png */
|
||||
JKQTPCALTtime, /*!< \brief show numbers as times \image html JKQTPCALTtime.png*/
|
||||
JKQTPCALTdatetime, /*!< \brief show numbers as times */
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user