Hi,

I want to draw a QRectF on my graphicsScene, but I don't know why it doesn't work.

Qt Code:
  1. void myScene::drawBackground ( QPainter * painter, const QRectF & rect )
  2. {
  3. QRectF rec(m_startRectPoint, getCursorScenePos/*this function works perfectly*/());
  4. painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
  5. painter->drawRect(rec);
  6. update();
  7.  
  8. //QGraphicsScene::drawForeground(painter, rect);
  9. QGraphicsScene::drawBackground(painter, rect);
  10. }
To copy to clipboard, switch view to plain text mode 

I want to draw a rectangle which starts in "m_startREctPoint" and finishes in the mouse pointer, at each moment (I did similar things using paint event in the QGraphicsItems).
Am I doing something wrong there?

EDIT: I forgot to say something, if you minimize and maximize the widow it paints it well, as expected.

thanks!