Quark  0.1
ImageView.h++
Go to the documentation of this file.
1 #ifndef __libquark_gui_ImageView_hxx
2 #define __libquark_gui_ImageView_hxx
3 
4 #include <QPaintEvent>
5 #include <QPixmap>
6 #include <QResizeEvent>
7 #include <QWidget>
8 
9 #include <quark/Quark.h++>
10 
11 namespace quark {
12 namespace gui {
13 
20 class LIBQUARK_API ImageView : public QWidget
21 {
22  public:
23 
25  explicit ImageView(QWidget *parent = NULL);
26 
28  virtual ~ImageView();
29 
31  void setPixmap(QPixmap pixmap);
32 
34  void setAlignment(Qt::Alignment alignment);
35 
36  protected:
37 
38  virtual void paintEvent(QPaintEvent *event);
39  virtual void resizeEvent(QResizeEvent *event);
40 
41  private:
42 
43  void scalePixmap(const QSize &size);
44  void alignPixmap();
45 
46  QPixmap _pixmap;
47  QPixmap _scaledPixmap;
48  Qt::Alignment _alignment;
49  int _xOffset;
50  int _yOffset;
51 };
52 
53 } // namespace gui
54 } // namespace quark
55 
56 #endif // __libquark_gui_ImageView_hxx
A simple widget that displays an image.
Definition: ImageView.h++:20
Definition: BarChartView.h++:6
#define LIBQUARK_API
Definition: Quark.h++:18