954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

QT: How to create PIP (Picture In Picture) on QwebView

#include <QtGui>

class MaskedLabel : public QLabel
{
protected:
	void resizeEvent(QResizeEvent* event)
	{
		QLabel::resizeEvent(event);
	
		QPixmap pixmap(size());
		pixmap.fill(Qt::transparent);
		QPainter::setRedirected(this, &pixmap);
		QPaintEvent pe(rect());
		paintEvent(&pe);
		QPainter::restoreRedirected(this);
		setMask(pixmap.mask());
	}
};

int main(int argc, char* argv[])
{
	QApplication a(argc, argv);
	QLabel* label = new MaskedLabel();
	label->setText("Qt Centre!");
	QFont font = label->font();
	font.setPointSize(72);
	label->setFont(font);
	label->show();
	return a.exec();
}


Hi,

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.

Thanks.

Luckychap
Posting Pro in Training
444 posts since Aug 2006
Reputation Points: 83
Solved Threads: 61
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: