Hi!

Om working on a project thats showing a mpeg-file using phonon. I would like to place a transparent QWidget over my video so i can click and paint on it. I managed to put a QWidget above the video and i can click with the mouse and paint on it but its not transparent.

Any ideas how to make it transparent?

Heres my Overlay QWidget:

Qt Code:
  1. #include <QtGui>
  2. #include "videoarea.h"
  3.  
  4. VideoArea::VideoArea(QWidget *parent) :
  5. QWidget(parent)
  6. {
  7. this->setWindowOpacity(1.0);
  8. }
  9. void VideoArea::mousePressEvent(QMouseEvent *event)
  10. {
  11. if (event->button() == Qt::LeftButton) {
  12. qDebug("Mouse click: X: %d Y: %d", event->x(), event->y());
  13. crossList.append(QPoint(event->x(), event->y()));
  14. paintCross();
  15. }
  16. }
  17.  
  18. void VideoArea::paintCross()
  19. {
  20. update();
  21. }
  22.  
  23.  
  24. void VideoArea::paintEvent(QPaintEvent *)
  25. {
  26. QPainter painter(this);
  27. painter.setPen(QPen(Qt::red, 1, Qt::DashDotLine, Qt::RoundCap));
  28.  
  29. for (int i = 0; i < crossList.size(); ++i)
  30. {
  31. painter.drawLine(crossList.at(i).x(), crossList.at(i).y()+10, crossList.at(i).x(), crossList.at(i).y()-10);
  32. painter.drawLine(crossList.at(i).x()+10, crossList.at(i).y(), crossList.at(i).x()-10, crossList.at(i).y());
  33. }
  34. }
To copy to clipboard, switch view to plain text mode