Hi Forum,

I am using QT Creator 2.1.0 based on 4.7.2 (32 bit) the following code creating an error at build compile time!

ERROR READS : "field printer has incorrect type"

Qt Code:
  1. #ifndef IMAGEPREVIEWDIALOG_H
  2. #define IMAGEPREVIEWDIALOG_H
  3.  
  4. #include <QDialog>
  5. #include <QScrollArea>
  6. #include <QLabel>
  7. #include <QGraphicsPixmapItem>
  8. #include <QGraphicsScene>
  9. #include <QGraphicsView>
  10. #include <QPixmap>
  11. #include <QPrinter>
  12. #include <QPrintDialog>
  13. namespace Ui {
  14. class ImagePreviewDialog;
  15. }
  16.  
  17. class ImagePreviewDialog : public QDialog
  18. {
  19. Q_OBJECT
  20.  
  21. public:
  22. ImagePreviewDialog(QString file, QByteArray *imageData, QWidget *parent = 0);
  23. ~ImagePreviewDialog();
  24. bool isFileSupported();
  25.  
  26. public slots:
  27. void print();
  28. private:
  29.  
  30. Ui::ImagePreviewDialog *ui;
  31. QPixmap pixmap;
  32. QGraphicsPixmapItem *pixmapItem;
  33.  
  34. QPrinter printer; // This object variable causing problem!!!!!!!!!
  35.  
  36.  
  37. bool fileSupported;
  38. };
  39.  
  40. #endif // IMAGEPREVIEWDIALOG_H
To copy to clipboard, switch view to plain text mode 

AS you can see the class <QPrinter> included in the header file of this source along with <QPrintDialog>, which seems to enough to get compiling. But throws an error

"field printer has incorrect type"

I wonder some one could shed a light on this ... which include file missing at above in this header file, please?

Thank you in advance.

Shy