We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,324 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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.

1
Contributor
0
Replies
1
View
Luckychap
Posting Pro in Training
445 posts since Aug 2006
Reputation Points: 83
Solved Threads: 61
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0820 seconds using 2.66MB