The scene object is a private member of MainWindow class (not pointer) and the view, just as I said, was replaced with the "widget" object in Qt Designer so I don't create it myself. I will provide the header files to be clear:

MainWindow.h:
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QWidget>
  5. #include <QtGui>
  6.  
  7. namespace Ui
  8. {
  9. class MainWindow;
  10. }
  11.  
  12. class MainWindow : public QWidget
  13. {
  14. Q_OBJECT
  15.  
  16. public:
  17. explicit MainWindow(QWidget *parent = 0);
  18. ~MainWindow();
  19.  
  20. public slots:
  21. void loadImage();
  22.  
  23. private:
  24. Ui::MainWindow *ui;
  25. QPixmap image;
  26. };
  27.  
  28. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 
GraphicsView.h
Qt Code:
  1. #ifndef GRAPHICSVIEW_H
  2. #define GRAPHICSVIEW_H
  3.  
  4. #include <QGraphicsView>
  5. #include <QtGui>
  6.  
  7. class GraphicsView : public QGraphicsView
  8. {
  9. Q_OBJECT
  10. public:
  11. explicit GraphicsView(QWidget *parent = 0);
  12. ~GraphicsView();
  13. void loadImage(QPixmap item);
  14. virtual void mouseReleaseEvent (QMouseEvent *event);
  15.  
  16. signals:
  17.  
  18. public slots:
  19.  
  20. private:
  21. QPixmap image;
  22. QPoint point1;
  23. QPoint point2;
  24. bool firstRect;
  25. };
  26.  
  27. #endif // GRAPHICSVIEW_H
To copy to clipboard, switch view to plain text mode 
Now you have almost all my code (only main is left).