maddog_fr
2nd August 2009, 20:10
Hello everybody. :D
I am creating a new class to subclass QWebView
To manage link navigation i used :
view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks ); and connected
and then
connect( view->page(), SIGNAL(linkClicked(const QUrl&)),this, SLOT(OnLinkClicked(const QUrl&)));
it work for all kind of links but when a form is submitted I dont receive the signal and the submitted page is loaded in the QWebPage
I read that form submit call the function acceptNavigationRequest
and when I check in the sourcecode of Qwebpage and i get
#if QT_VERSION >= 0x040400
bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
#else
bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type)
#endif
{
if (type == NavigationTypeLinkClicked) {
switch (d->linkPolicy) {
case DontDelegateLinks:
return true;
case DelegateExternalLinks:
if (WebCore::SecurityOrigin::shouldTreatURLSchemeAsLo cal(request.url().scheme()))
return true;
emit linkClicked(request.url());
return false;
case DelegateAllLinks:
emit linkClicked(request.url());
return false;
}
}
return true;
}
any navigation request should emit linkclicked when DelegateAllLinks is set
Where is the problem :confused: ? I am using Qt 4.5
thx for your help.
[EDIT:] I am beginning at Qt
I am creating a new class to subclass QWebView
To manage link navigation i used :
view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks ); and connected
and then
connect( view->page(), SIGNAL(linkClicked(const QUrl&)),this, SLOT(OnLinkClicked(const QUrl&)));
it work for all kind of links but when a form is submitted I dont receive the signal and the submitted page is loaded in the QWebPage
I read that form submit call the function acceptNavigationRequest
and when I check in the sourcecode of Qwebpage and i get
#if QT_VERSION >= 0x040400
bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
#else
bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type)
#endif
{
if (type == NavigationTypeLinkClicked) {
switch (d->linkPolicy) {
case DontDelegateLinks:
return true;
case DelegateExternalLinks:
if (WebCore::SecurityOrigin::shouldTreatURLSchemeAsLo cal(request.url().scheme()))
return true;
emit linkClicked(request.url());
return false;
case DelegateAllLinks:
emit linkClicked(request.url());
return false;
}
}
return true;
}
any navigation request should emit linkclicked when DelegateAllLinks is set
Where is the problem :confused: ? I am using Qt 4.5
thx for your help.
[EDIT:] I am beginning at Qt