QGraphicsView calls drawItems of the scene that is added to the view, thus your custom scene.
that's the problem... but it doesn't :S


Qt Code:
  1. MainWindow::MainWindow(QWidget *parent)
  2. : QMainWindow(parent)
  3. {
  4. setWindowTitle("PruebaMagnetica1");
  5.  
  6. m_pScene = new CScene();
  7. m_pView = new CView(m_pScene, this);
  8. ...
  9. }
To copy to clipboard, switch view to plain text mode 

View.h
Qt Code:
  1. class CView : public QGraphicsView
  2. {
  3. public:
  4. CView(CScene* pScene, QWidget * parent = 0);
  5. virtual ~CView();
  6.  
  7. void enableRendering(){m_bRender = true;}
  8.  
  9. protected:
  10. void drawItems ( QPainter * painter, int numItems, QGraphicsItem * items[],
  11. const QStyleOptionGraphicsItem options[] );
  12.  
  13. bool m_bRender;
  14. };
To copy to clipboard, switch view to plain text mode 


View.cpp
Qt Code:
  1. CView::CView(CScene* pScene, QWidget * parent)
  2. {
  3. setParent(parent);
  4. setScene(pScene);
  5.  
  6. m_bRender = false;
  7. }
  8.  
  9. CView::~CView()
  10. {
  11. // TODO Auto-generated destructor stub
  12. }
  13.  
  14. void CView::drawItems( QPainter * painter, int numItems, QGraphicsItem * items[], const QStyleOptionGraphicsItem options[] )
  15. {
  16. if(m_bRender)
  17. {
  18. QGraphicsView::drawItems(painter, numItems, items, options); //It calls QGraphicsScene::drawItems instead of CScene::drawItems
  19. m_bRender = false;
  20. }
  21. }
To copy to clipboard, switch view to plain text mode