[Qt-interest] Problem with downloadRequested() from QWebView

Enrique Cuesta enriquecues at gmail.com
Mon Nov 8 22:33:41 CET 2010


I get the solution !!

view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

    view->page()->setForwardUnsupportedContent(true);

    connect(view, SIGNAL(linkClicked(QUrl)),SLOT(linkClicked(QUrl)));

    connect(view->page(), SIGNAL(downloadRequested(QNetworkRequest)),
SLOT(downloadRequested(QNetworkRequest)));

    connect(view->page(),
SIGNAL(unsupportedContent(QNetworkReply*)),SLOT(unsupportedContent(QNetworkReply*)));


2010/11/8 Enrique Cuesta <enriquecues at gmail.com>
>
> thank you for your reply...
> but...
> if you google it.... you can find that a lot of people is facing the same problem ... and no solution !!
> (i thing that maybe is a problem on windows... bacause I have seen programs in linux using downloadRequested)
>
>
> linkClicked and unsupportedContent is not what I need...
>
> thank you
>
> 2010/11/8 Mark Long <mlong at weatherdata.com>
>>
>> I'm not sure exactly what your use case is.  Perhaps you want to use the linkClicked() signal instead of downloadRequested()?  Or perhaps unsupportedContent() could trigger what you're looking for.
>>
>> As I understand it, downloadRequested() is behaving like it's supposed to.
>>
>> -Mark
>>
>>
>> On 11/08/2010 02:08 PM, Enrique Cuesta wrote:
>>>
>>> Hi!
>>>
>>> sometimes I love Qt....
>>> sometimes I hate it !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>>>
>>> I would like add to my webbrowser simple download manager option:
>>>
>>> /connect(ui->webView->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));/
>>>
>>> and sample downloading function [slot]:
>>>
>>> /void MainWindow::downloadRequested(const QNetworkRequest &request)
>>> {
>>> qDebug() << "Download Request";
>>> }
>>> /
>>>
>>> but when I click on the link with file it doesn't work, It work only when I right-click on link and choose "Save as"
>>> Any one have got any idea ?
>>>
>>>
>>> System: Windows 7 , Qt LGPL
>>>
>>> sorry for my poor english...
>>> thank you
>>>
>>
>>
>




More information about the Qt-interest-old mailing list