title: Put transparent QWidget on top of QMediaView in QT5 on Ubuntu
body: <p><strong>Goal</strong></p>
  
  <p>I want the background of my QT5 based GUI to be a video file that is playing. I also want to be able to style my GUI components with transparency so that the video will show through them.</p>
  
  <p>I am not sure if this is at all possible to accomplish. It could be that i've just missed an important clue (I am after all a Qt beginner), or it could be that it just simply was not meant to work. But being an optimist, I have given it my best try.</p>
  
  <p><strong>First attempt</strong></p>
  
  <p>My minimal first attempt looked like this:</p>
  
  <pre><code>int main( int argc, char **argv ){
      QApplication app(argc, argv);
      QMediaPlayer *media=new QMediaPlayer(0);
      QVideoWidget *video=new QVideoWidget(0); //new QGLWidget()
      media-&gt;setVideoOutput(video);
      media-&gt;setMedia(QUrl::fromLocalFile("/tmp/avatar.mp4"));
      media-&gt;setPosition(3000000);
      media-&gt;play();
      QPushButton *pb=new QPushButton(video);
      pb-&gt;setText(QString("BOB"));
      //pb-&gt;setStyleSheet(QString("background:transparent;"));
      video-&gt;show();
      return app.exec();
  }
  </code></pre>
  
  <p>The button is on top of the playing video, which is good. But if you look closely, you will see some black pixels in the corners of the button indicating that it is not transparent over the video, but rendered as an opaque rectangle.</p>
  
  <p><img src="https://i.stack.imgur.com/DFQCN.png" alt="First result screenshot"></p>
  
  <p><strong>Second attempt</strong></p>
  
  <p>I tried styling the button with <code>background:transparent;</code> (see commented line in code above). This made the background of the button transparent, but the black box behind the button is now even more evident.</p>
  
  <p><img src="https://i.stack.imgur.com/BmytQ.png" alt="enter image description here"></p>
  
  <p><strong>Other attempts</strong></p>
  
  <p>I have read several tips from various sources on-line on how to do this. None have worked for me. I have tried working with QGraphicsScene and friends, different stacks of layouts, different attributes on the widgets in question and many more. My last attempt was to set the parent of the QVideoWidget to an instance of QGLWidget() in the hope that forced hardware acceleration would solve my problems (my computer has hardware 3d acceleration with binary driver). This simply stopped the window from appearing at all, while I could still hear the soundtrack of the video playing in the background indicating that the application was still running.</p>
  
  <p><strong>Request</strong></p>
  
  <p>I really hope that there are some kindhearted and smart QT5 developers out there that can help me fulfill my dream of having widgets placed atop of a playing video in QT5 on Ubuntu. </p>
  
  <p>Thank you!</p>