Commit c4fded9a authored by Yannick Verdie's avatar Yannick Verdie

New functions with QT GUI

Zoom function done, working on panning now (weel enable it)
Fixed mouse coordinate bugs
parent 56f17b78
This diff is collapsed.
...@@ -75,7 +75,6 @@ class CvWindow; ...@@ -75,7 +75,6 @@ class CvWindow;
class ViewPort; class ViewPort;
//class CvTrackbar; //class CvTrackbar;
class GuiReceiver : public QObject class GuiReceiver : public QObject
{ {
Q_OBJECT Q_OBJECT
...@@ -84,6 +83,7 @@ public: ...@@ -84,6 +83,7 @@ public:
GuiReceiver(); GuiReceiver();
int start(); int start();
bool _bTimeOut; bool _bTimeOut;
private: private:
...@@ -148,19 +148,12 @@ protected: ...@@ -148,19 +148,12 @@ protected:
void writeSettings(); void writeSettings();
virtual void keyPressEvent(QKeyEvent *event); virtual void keyPressEvent(QKeyEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private: private:
QPointer<ViewPort> myview; QPointer<ViewPort> myview;
int status;//0 normal, 1 fullscreen (YV) int status;//0 normal, 1 fullscreen (YV)
CvMouseCallback on_mouse;
void* on_mouse_param;
}; };
...@@ -173,14 +166,24 @@ public: ...@@ -173,14 +166,24 @@ public:
~ViewPort(); ~ViewPort();
void updateImage(void* arr); void updateImage(void* arr);
void startDisplayInfo(QString text, int delayms); void startDisplayInfo(QString text, int delayms);
void setMouseCallBack(CvMouseCallback m, void* param);
QTransform matrixWorld;
qreal scaleFactor;//for zoom int/out
public slots: public slots:
void zoomIn() { scale(1.2, 1.2); } //reference:
void zoomOut() { scale(1 / 1.2, 1 / 1.2); } //http://www.qtcentre.org/wiki/index.php?title=QGraphicsView:_Smooth_Panning_and_Zooming
void rotateLeft() { rotate(-10); } void scaleView(qreal scaleFactor, QPointF center);
void rotateRight() { rotate(10); }
private: private:
QPointF previousCenter ;
qreal previousFactor;//for zoom int/out
QPointF previousDelta;
CvMouseCallback on_mouse;
void* on_mouse_param;
int mode; int mode;
IplImage* image2Draw; IplImage* image2Draw;
bool isSameSize(IplImage* img1,IplImage* img2); bool isSameSize(IplImage* img1,IplImage* img2);
...@@ -192,6 +195,7 @@ private: ...@@ -192,6 +195,7 @@ private:
//QImage* image; //QImage* image;
void paintEvent(QPaintEvent* paintEventInfo); void paintEvent(QPaintEvent* paintEventInfo);
void wheelEvent(QWheelEvent *event);
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);
......
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