title: Draw a line over a video in a QGraphicsScene
body: <p>I'm new to Qt and I'm having some troubles.</p>
  
  <p>I'm trying to draw a simple line on a video, like an overlay, when i click on a button.
  My video is from a camera, and it is displayed into a QGraphicsScene (or Qframe), it's a live video.</p>
  
  <p>I tried to modify the paintEvent, but the line emerges and disapear when a new frame comes.</p>
  
  <p>I also tried to create an Overlay class, with some attributes (WA_NoBackGround and WA_PaintOnScreen), but this time the line emerges on the video, but the video stops.</p>
  
  <p>Here is my code for the overlay ( inspired by <a href="https://stackoverflow.com/questions/19199863/draw-rectangular-overlay-on-qwidget-at-click">Draw Rectangular overlay on QWidget at click</a> ):</p>
  
  <p><strong>Overlay.h</strong></p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QWidget&gt;
  #include &lt;QPainter&gt;
  #include &lt;QPointer&gt;
  
  class Overlay : public QWidget
  {
  public:
      Overlay(QWidget * parent = 0) ;
  protected:
      void paintEvent(QPaintEvent *e );
  };
  </code></pre>
  
  <p><strong>Overlay.cpp</strong></p>
  
  <pre><code>#include "overlay.h"
  
  Overlay::Overlay(QWidget *parent): QWidget (parent)
  {
  //setAttribute(Qt::WA_NoSystemBackground);
  setAttribute(Qt::WA_NoBackground);
  
  setAttribute(Qt::WA_PaintOnScreen);
  }
  
  void Overlay::paintEvent(QPaintEvent *e)
  {
      QPainter p(this);
      p.drawLine(0,0,100,100);
  }
  </code></pre>
  
  <p>The clickDraw button slot :</p>
  
  <pre><code>QPointer&lt;Overlay&gt; m_overlay;
  w= static_cast&lt;QWidget*&gt;(ui-&gt;r_frame);
  
  if (!m_overlay)
      m_overlay =  new Overlay(w-&gt;parentWidget());
  m_overlay-&gt;setGeometry(w-&gt;geometry());
  m_overlay-&gt;show();
  update();
  </code></pre>
  
  <p>I'm on linux embedded, with Qt 4.8.6</p>
  
  <p><strong>EDIT</strong>
  I tried to create a transparent Qwidget (setOpacity), with the QGraphicsView object as parent, but it did not work, the widget appears white. I think i need a composition manager for X11 (it is what i read from various websites).</p>
  
  <p>Thanks for your help,
  Greetings    </p>