Scribus
Open source desktop publishing at your fingertips
iview.h
1 //
2 // C++ Interface: iview
3 //
4 // Description:
5 //
6 //
7 // Author: Pierre Marchand <pierremarc@oep-h.com>, (C) 2009
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12 
13 #ifndef IVIEW_H
14 #define IVIEW_H
15 
16 #include <QGraphicsView>
17 #include <QGraphicsPixmapItem>
18 #include <QGraphicsPolygonItem>
19 #include <QRect>
20 #include <QPixmap>
21 
22 class IView: public QGraphicsView
23 {
24  public:
25  IView ( QWidget* parent );
26  ~IView();
27 
28  void setImage ( const QPixmap& pixmap );
29  QPixmap getPixmap();
30 
31  void fitImage();
32  void setKeepFitted ( bool theValue ) { m_keepFitted = theValue; }
33 
34  void setZoom(double xz, double yz = 0);
35  double getZoom() const;
36 
37  protected:
38  void mouseMoveEvent ( QMouseEvent * e );
39  void mousePressEvent ( QMouseEvent * e );
40  void mouseReleaseEvent ( QMouseEvent * e );
41  void resizeEvent ( QResizeEvent * event );
42 
43  private:
44  QGraphicsPixmapItem * curImage;
45 
46  QPointF mouseStartPoint;
47  QRect theRect;
48  bool isPanning;
49 
50  bool m_keepFitted;
51 
52 
53 };
54 
55 #endif
Definition: iview.h:22