xref: /OK3568_Linux_fs/app/forlinx/flapp/src/plugins/allwinner/camera/CameraUI/src/cprojectionpicture.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #ifndef CPROJECTIONPICTURE_H
2 #define CPROJECTIONPICTURE_H
3 
4 #include <QWidget>
5 
6 class QGestureEvent;
7 class QPanGesture;
8 class QPinchGesture;
9 class QSwipeGesture;
10 class CProjectionPicture;
11 
12 class CProjectionPicture : public QWidget
13 {
14     Q_OBJECT
15 public:
16     CProjectionPicture(QWidget *parent = 0);
17 
18     void setPicture(QImage & image);
19 
20 protected:
21     // 放大/缩小
22 //    void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
23 //    void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
24 
25 
26 //    void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
27 //    // 平移
28 //    void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
29 //    void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
30 //    void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
31 
32     bool event(QEvent *event) Q_DECL_OVERRIDE;
33     void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
34     void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
35 
36 
37 public Q_SLOTS:
38     void zoomIn();  //
39     void zoomOut();  //
40     void zoom(float scale); //
41     void translate(QPointF delta);  //move
42 
43 
44 private:
45     bool gestureEvent(QGestureEvent *event);
46     void panTriggered(QPanGesture*);
47     void pinchTriggered(QPinchGesture*);
48 
49     QImage loadImage(const QString &fileName);
50 
51     QImage currentImage;
52 
53     qreal horizontalOffset;
54     qreal verticalOffset;
55 
56     qreal scaleFactor;
57     qreal currentStepScaleFactor;
58     Qt::MouseButton m_translateButton;
59     bool m_bMouseTranslate;
60     qreal m_zoomDelta;
61     QPoint m_lastMousePos;
62 
63 
64 };
65 
66 #endif // CPROJECTIONPICTURE_H
67