OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ImagePreview.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
11
12// Qt header
13#include <QtGui/qimage.h>
14#include <QtWidgets/qframe.h>
15
16namespace ot {
17
18 class OT_WIDGETS_API_EXPORT ImagePreview : public QFrame, public QWidgetInterface {
19 Q_OBJECT
20 public:
22 ImagePreview(const QImage& _image);
23 virtual ~ImagePreview();
24
25 virtual QWidget* getQWidget(void) override { return this; };
26 virtual const QWidget* getQWidget(void) const override { return this; };
27
28 virtual void paintEvent(QPaintEvent* _event) override;
29
30 virtual QSize sizeHint(void) const override;
31
32 virtual void wheelEvent(QWheelEvent* _event) override;
33
34 virtual void keyPressEvent(QKeyEvent* _event) override;
35
36 virtual void mousePressEvent(QMouseEvent* _event) override;
37
38 void setImage(const QImage& _image);
39 const QImage& image(void) const { return m_image; };
40
41 void setImageMargins(const QMargins& _margins);
42 const QMargins& getImageMargins(void) const { return m_imageMargins; };
43
44 void setEnableResizing(bool _enable) { m_enabledResizing = _enable; };
45 bool getEnableResizing(void) const { return m_enabledResizing; };
46
47 Q_SIGNALS:
48 void imagePixedClicked(const QPoint& _px);
49
50 private:
51 bool m_enabledResizing;
52 QSize m_size;
53 QImage m_image;
54 QMargins m_imageMargins;
55 };
56
57}
#define OT_WIDGETS_API_EXPORT
Definition OTWidgetsAPIExport.h:12
Definition ImagePreview.h:18
void setEnableResizing(bool _enable)
Definition ImagePreview.h:44
virtual QWidget * getQWidget(void) override
Returns a pointer to the root widget of this object.
Definition ImagePreview.h:25
virtual const QWidget * getQWidget(void) const override
Definition ImagePreview.h:26
const QMargins & getImageMargins(void) const
Definition ImagePreview.h:42
void imagePixedClicked(const QPoint &_px)
const QImage & image(void) const
Definition ImagePreview.h:39
bool getEnableResizing(void) const
Definition ImagePreview.h:45
Definition QWidgetInterface.h:18
Definition Connector.h:8