2019-01-25 05:49:10 +08:00
|
|
|
#ifndef TEST_USER_INTERACTION_H
|
|
|
|
#define TEST_USER_INTERACTION_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include "jkqtplotter/jkqtplotter.h"
|
|
|
|
#include "jkqtplotter/jkqtpgraphs.h"
|
|
|
|
#include <QFormLayout>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <cmath>
|
|
|
|
#include <QToolBar>
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
|
|
|
class TestUserInteraction : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit TestUserInteraction(QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
2019-01-27 03:12:54 +08:00
|
|
|
void setLeftMouseAction(int index);
|
2019-01-25 05:49:10 +08:00
|
|
|
|
2019-01-27 03:12:54 +08:00
|
|
|
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);
|
2019-01-25 05:49:10 +08:00
|
|
|
protected:
|
|
|
|
void initPlot();
|
|
|
|
JKQTPlotter* plot;
|
|
|
|
QGridLayout* layout;
|
|
|
|
QHBoxLayout* layChk;
|
|
|
|
QFormLayout* layForm;
|
|
|
|
QCheckBox* chkPositionDisplay;
|
|
|
|
QCheckBox* chkShowToolbar;
|
|
|
|
QCheckBox* chkToolbarAlwaysOn;
|
|
|
|
QCheckBox* chkGrid;
|
2019-01-27 03:12:54 +08:00
|
|
|
QComboBox* cmbMouseAction;
|
|
|
|
QLabel* labMouseAction;
|
|
|
|
QLabel* labMouseMoved;
|
|
|
|
QLabel* labMouseClicked;
|
2019-01-25 05:49:10 +08:00
|
|
|
JKQTPXYLineGraph* graph1;
|
|
|
|
JKQTPXYLineGraph* graph2;
|
2019-01-27 03:12:54 +08:00
|
|
|
|
|
|
|
static QString MouseButton2String(Qt::MouseButton button);
|
|
|
|
static QString KeyboradMod2String(Qt::KeyboardModifiers modifiers);
|
2019-01-25 05:49:10 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TEST_USER_INTERACTION_H
|