And to add a little more information, if I take out the “this->show()”, no image is created at all and this is put in the std out.
plugins\win\PluginViewWin.cpp(875) : WebCore::PluginView::setNPWindowRect -Jason //------------------------------// Jason R. Kretzer Lead Application Developer ja...@gocodigo.com<mailto:ja...@gocodigo.com> //-----------------------------// From: "Jason R. Kretzer" <ja...@gocodigo.com<mailto:ja...@gocodigo.com>> To: "interest@qt-project.org<mailto:interest@qt-project.org>" <interest@qt-project.org<mailto:interest@qt-project.org>> Subject: [Interest] Widget Screenshot Question Hey everyone, I am trying to create a small app that opens a web view, waits a few seconds, and then takes a capture of the widget. I don’t want it to open a window as I want to send it a bunch of URLs and have it generate a png of each url. It works just fine if it is just a web site — for example, http://www.google.com Below is the code and below the code is what is currently happening. urlStr — goes to an url that is just an html file with a flash file embedded in it. savePathStr — where to save the png delay — how long to wait before taking the picture height/width — dimensions of the content void MainWindow::takeShot(QString urlStr, QString savePathStr, int delay, int height, int width) { QWebView *mWidget = new QWebView(this); mWidget->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); mWidget->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); mWidget->settings()->setAttribute(QWebSettings::PluginsEnabled, true); mWidget->setGeometry(0, 0, width, height); mWidget->setUrl(QUrl(urlStr)); mWidget->setWindowFlags(Qt::FramelessWindowHint); this->setWindowFlags(Qt::FramelessWindowHint); this->setGeometry(0,0,width,height); mWidget->load(QUrl(urlStr)); this->show(); //a delay to allow the flash to play through a bit QEventLoop delayloop; QTimer::singleShot(delay, &delayloop, SLOT(quit())); delayloop.exec(); QRect rectangle = mWidget->geometry(); QPixmap pixmap(rectangle.size()); //I have tried this to no avail //pixmap = mWidget->grab(rectangle); //I have tried this also to no avail Pixmap = this->grab(rectangle); //I have tried this also to no avail mWidget->render(&pixmap, QPoint(), QRegion(rectangle)); pixmap.save(savePathStr); …….//REST OF THE CODE OMITTED } What happens is that the image is created. However, there is a big blank spot where the embedded flash is supposed to be. Has anyone else run into this or have any other pointers? I am using Qt 5.3.1 andWin7. -Jason //------------------------------// Jason R. Kretzer Lead Application Developer ja...@gocodigo.com<mailto:ja...@gocodigo.com> //-----------------------------// ________________________________ No virus found in this message. Checked by AVG - www.avg.com<http://www.avg.com> Version: 2015.0.5645 / Virus Database: 4299/9221 - Release Date: 03/03/15
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest