#ifndef QIMAGEWIDGET_H #define QIMAGEWIDGET_H #include #include class RendererManager; enum TZoomTypes { EZoom_plus = 0x0, EZoom_minus, EZoom_fit, EZoom_orig }; class QImageWidget : public QWidget { Q_OBJECT public: QImageWidget(QWidget *parent = 0, RendererManager* thread = 0); void setAutofit(const bool Autofit = false) { autofit = Autofit; } const QImage getImage() const; protected: void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent *event); void keyPressEvent(QKeyEvent *event); void wheelEvent(QWheelEvent *event); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); private slots: void updatePixmap(const QImage &image); void zoomIntercept(const TZoomTypes type); signals: void scaleIsModified(double scale); private: void zoom(double zoomFactor); QPixmap pixmap; QPoint pixmapOffset; QPoint lastDragPos; double curScale; bool autofit; }; #endif