Commit fd1da009 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #7129 from paroj:mousecallback-dry-code

parents 2f069c10 46bfdbaf
This diff is collapsed.
......@@ -403,10 +403,26 @@ public:
};
class OCVViewPort : public ViewPort
{
public:
explicit OCVViewPort();
~OCVViewPort() {};
void setMouseCallBack(CvMouseCallback callback, void* param);
protected:
void icvmouseEvent(QMouseEvent* event, type_mouse_event category);
void icvmouseHandler(QMouseEvent* event, type_mouse_event category, int& cv_event, int& flags);
void icvmouseProcessing(QPointF pt, int cv_event, int flags);
CvMouseCallback mouseCallback;
void* mouseData;
};
#ifdef HAVE_QT_OPENGL
class OpenGlViewPort : public QGLWidget, public ViewPort
class OpenGlViewPort : public QGLWidget, public OCVViewPort
{
public:
explicit OpenGlViewPort(QWidget* parent);
......@@ -414,8 +430,6 @@ public:
QWidget* getWidget();
void setMouseCallBack(CvMouseCallback callback, void* param);
void writeSettings(QSettings& settings);
void readSettings(QSettings& settings);
......@@ -448,20 +462,14 @@ protected:
private:
QSize size;
CvMouseCallback mouseCallback;
void* mouseData;
CvOpenGlDrawCallback glDrawCallback;
void* glDrawData;
void icvmouseHandler(QMouseEvent* event, type_mouse_event category, int& cv_event, int& flags);
void icvmouseProcessing(QPointF pt, int cv_event, int flags);
};
#endif // HAVE_QT_OPENGL
class DefaultViewPort : public QGraphicsView, public ViewPort
class DefaultViewPort : public QGraphicsView, public OCVViewPort
{
Q_OBJECT
......@@ -471,8 +479,6 @@ public:
QWidget* getWidget();
void setMouseCallBack(CvMouseCallback callback, void* param);
void writeSettings(QSettings& settings);
void readSettings(QSettings& settings);
......@@ -510,6 +516,7 @@ protected:
void contextMenuEvent(QContextMenuEvent* event);
void resizeEvent(QResizeEvent* event);
void paintEvent(QPaintEvent* paintEventInfo);
void wheelEvent(QWheelEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void mousePressEvent(QMouseEvent* event);
......@@ -526,17 +533,13 @@ private:
QImage image2Draw_qt;
int nbChannelOriginImage;
//for mouse callback
CvMouseCallback on_mouse;
void* on_mouse_param;
void scaleView(qreal scaleFactor, QPointF center);
void moveView(QPointF delta);
QPoint mouseCoordinate;
QPoint mouseCoordinate;
QPointF positionGrabbing;
QRect positionCorners;
QRect positionCorners;
QTransform matrixWorld_inv;
float ratioX, ratioY;
......@@ -555,7 +558,7 @@ private:
void draw2D(QPainter *painter);
void drawStatusBar();
void controlImagePosition();
void icvmouseHandler(QMouseEvent *event, type_mouse_event category, int &cv_event, int &flags);
void icvmouseProcessing(QPointF pt, int cv_event, int flags);
private slots:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment