00001 #ifndef __GRAPHICWIN_H 00002 #define __GRAPHICWIN_H 00003 00004 #include <qscrollview.h> 00005 #include <qpixmap.h> 00006 #include <qimage.h> 00007 #include <qpushbutton.h> 00008 #include <qlayout.h> 00009 #include <qwmatrix.h> 00010 00011 class GraphicScroll : public QScrollView 00012 { 00013 Q_OBJECT 00014 QWidget* m_picture; 00015 protected: 00016 void hideEvent( QHideEvent * p) 00017 { 00018 m_picture->setFixedSize(1,1); 00019 } 00020 public: 00021 GraphicScroll( QWidget *parent=0, const char *name=0, WFlags f = 0) 00022 : QScrollView(parent, name, f) 00023 { 00024 m_picture = new QWidget(viewport()); 00025 addChild(m_picture); 00026 } 00027 void setPixmap(QPixmap& pm) 00028 { 00029 m_picture->setFixedSize(pm.size()); 00030 m_picture->setBackgroundPixmap(pm); 00031 } 00032 }; 00033 00034 00035 class GraphicWin : public QWidget 00036 { 00037 Q_OBJECT 00038 00039 GraphicScroll* m_scroll; 00040 QImage m_im; 00041 QImage resizeimage(int w, int h); 00042 void resetpm(); 00043 bool m_isFitted, m_isRotated; 00044 signals: 00045 void Closed(); 00046 private slots: 00047 void slotClosed() { emit Closed(); } 00048 void slotFit(); 00049 void slotRotate(); 00050 public: 00051 void setPixmap(QPixmap& pm) { m_scroll->setPixmap(pm); } 00052 void setImage(QImage& im); 00053 GraphicWin( QWidget *parent=0, const char *name=0, WFlags f = 0); 00054 }; 00055 00056 #endif
1.4.2