showimg.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /****************************************************************************
  2. ** $Id: qt/showimg.h 3.3.8 edited Jan 11 14:37 $
  3. **
  4. ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
  5. **
  6. ** This file is part of an example program for Qt. This example
  7. ** program may be used, distributed and modified without limitation.
  8. **
  9. *****************************************************************************/
  10. #ifndef SHOWIMG_H
  11. #define SHOWIMG_H
  12. #include <QtGui/QMainWindow>
  13. #include <QtGui/QImage>
  14. #include <EIMResult.h>
  15. class QLabel;
  16. class ImageViewer : public QMainWindow
  17. {
  18. Q_OBJECT
  19. public:
  20. ImageViewer( QWidget *parent=0, Qt::WindowFlags wFlags=0 );
  21. ~ImageViewer();
  22. bool loadImage( const QString& );
  23. protected:
  24. void paintEvent( QPaintEvent * );
  25. void resizeEvent( QResizeEvent * );
  26. void mousePressEvent( QMouseEvent * );
  27. void mouseReleaseEvent( QMouseEvent * );
  28. void mouseMoveEvent( QMouseEvent * );
  29. private:
  30. void scale();
  31. bool convertEvent( QMouseEvent* e, int& x, int& y );
  32. QString filename;
  33. QImage image; // the loaded image
  34. QPixmap pm; // the converted pixmap
  35. QPixmap pmScaled; // the scaled pixmap
  36. void updateStatus();
  37. bool reconvertImage();
  38. int pickx, picky;
  39. int clickx, clicky;
  40. void ClearResult();
  41. void updateResults();
  42. bool m_drawSegment;
  43. bool m_initialized;
  44. int m_firstPoint;
  45. QLabel *results;
  46. imt::IMTResult m_result;
  47. private slots:
  48. void openFile();
  49. };
  50. #endif // SHOWIMG_H