PDA

View Full Version : catch download file in QWebView



MacAssembly
23rd August 2017, 19:18
I'm clicking in HTML a element programatically that on regular browser show up a download pop up. I'm tring to download that file progrmatically within my QWebView but after clicking in that HTML a element nothing happens. No pop up windows is open or downloadRequested() or unsupportedContent() is fired albeit I can see the download file url on QNetworkAccessManager::finished() event. I would download the file from there, since it give a QNetworkReply* but I also don't know if it's possible, since it fired when the requested is processed already.

I'm connecting to SLOTs like this (no assert happen, so I assume it's ok):


QWebPage *p = myQwebView->page();
p->setForwardUnsupportedContent(true);
Q_ASSERT(connect(p, SIGNAL(downloadRequested(QNetworkRequest)),this, SLOT(download(QNetworkRequest))));
Q_ASSERT(connect(p, SIGNAL(unsupportedContent(QNetworkReply*)),this, SLOT(unsupportedContent(QNetworkReply*))));