15class LIBDTKWIDGETSHARED_EXPORT
DImageViewer :
public DGraphicsView,
public DCORE_NAMESPACE::DObject
19 Q_PROPERTY(QImage image READ image WRITE setImage NOTIFY imageChanged)
20 Q_PROPERTY(QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged)
21 Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged)
22 Q_PROPERTY(
int rotateAngle READ rotateAngle NOTIFY rotateAngleChanged)
26 explicit DImageViewer(
const QImage &image, QWidget *parent =
nullptr);
27 explicit DImageViewer(
const QString &fileName, QWidget *parent =
nullptr);
31 void setImage(
const QImage &image);
32 QString fileName()
const;
33 void setFileName(
const QString &fileName);
35 qreal scaleFactor()
const;
36 void setScaleFactor(qreal factor);
37 void scaleImage(qreal factor);
42 void rotateClockwise();
43 void rotateCounterclockwise();
44 int rotateAngle()
const;
45 void resetRotateAngle();
48 void centerOn(qreal x, qreal y);
49 QRect visibleImageRect()
const;
51 Q_SLOT
void scaleAtPoint(QPoint pos, qreal factor);
53 void beginCropImage();
55 void resetCropImage();
56 void setCropAspectRatio(qreal w, qreal h);
57 QRect cropImageRect()
const;
70 void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
71 void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
72 bool event(QEvent *event) Q_DECL_OVERRIDE;
78 D_PRIVATE_SLOT(
void _q_pinchAnimeFinished())