kwave  18.07.70
ImageView.h
Go to the documentation of this file.
1 /***************************************************************************
2  ImageView.h - simple widget class for displaying a QImage
3  -------------------
4  begin : 1999
5  copyright : (C) 1999 by Martin Wilz
6  email : Martin Wilz <mwilz@ernie.mi.uni-koeln.de>
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef IMAGEVIEW_H
19 #define IMAGEVIEW_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QImage>
25 #include <QPainter>
26 #include <QWidget>
27 
28 namespace Kwave
29 {
33  class Q_DECL_EXPORT ImageView: public QWidget
34  {
35  Q_OBJECT
36  public:
47  explicit ImageView(QWidget *parent = Q_NULLPTR,
48  bool fit_width = true,
49  bool fit_height = true);
50 
54  virtual ~ImageView() Q_DECL_OVERRIDE;
55 
61  QRect imageRect();
62 
63  public slots:
64 
69  void setImage(QImage image);
70 
72  void setHorizOffset(int offset);
73 
75  void setVertOffset(int offset);
76 
77  signals:
78 
79  void viewInfo(int, int, int);
80  void sigCursorPos(const QPoint pos);
81 
82  protected:
83 
84  virtual void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
85 
86  virtual void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
87 
88  virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
89 
90  private:
95  QPoint m_offset;
96 
102  QRect m_last_rect;
103 
105  QImage m_image;
106 
109 
112 
118  double m_scale_x;
119 
125  double m_scale_y;
126 
127  };
128 }
129 
130 #endif // _IMAGEVIEW_H_
131 
132 //***************************************************************************
133 //***************************************************************************
double m_scale_x
Definition: ImageView.h:118
Definition: App.h:33
QPoint m_offset
Definition: ImageView.h:95
double m_scale_y
Definition: ImageView.h:125