Quote Originally Posted by jpn View Post
Try this:
Qt Code:
  1. #include <QtGui>
  3. class MaskedLabel : public QLabel
  4. {
  5. protected:
  6. void resizeEvent(QResizeEvent* event)
  7. {
  8. QLabel::resizeEvent(event);
  10. QPixmap pixmap(size());
  11. pixmap.fill(Qt::transparent);
  12. QPainter::setRedirected(this, &pixmap);
  13. QPaintEvent pe(rect());
  14. paintEvent(&pe);
  15. QPainter::restoreRedirected(this);
  16. setMask(pixmap.mask());
  17. }
  18. };
  20. int main(int argc, char* argv[])
  21. {
  22. QApplication a(argc, argv);
  23. QLabel* label = new MaskedLabel();
  24. label->setText("Qt Centre!");
  25. QFont font = label->font();
  26. font.setPointSize(72);
  27. label->setFont(font);
  28. label->show();
  29. return a.exec();
  30. }
To copy to clipboard, switch view to plain text mode 

I tired this approach to create Picture In Picture(PIP) window on QWebView widget. And my goal is to create hole on QwebView so that video playing in the background is visible through PIP window.

When I first create this Masked Label its showing me the video playing in background, all is good at this point. But when I try to change the height/width of the Masked Label using setGeometry() method of QLabel, its is not showing me transparent window. But when I only(not changing the height/widht) move it around on the screen using same setGeometry(), it just work fine.

Any idea OR approach to achieve my goals.