PDA

View Full Version : HyperLinks Embedded /wrapped on Flash Files not working - QT Webkit



shailesh.astute
24th December 2012, 12:41
Hi ,

We are experiencing an issue while displaying SWF/Flash in our desktop application using QWebView. Flash file is displaying properly but when we click on any URL wrapped in flash file is not getting opened. Rest other flash functions are working fine including action scripting but links are not getting opened. When we click on any url/button it does nothing.


QT Version: QT 4.7.4
Platform: Windows 7 Professional, Service Pack 1, 32 bit OS

Here is the description:

Using QWebView::load(QUrl url), we are loading content of the Flash File. Until, we are loading non animated/non moving content, clicking on the QWebview takes us to the Handler for linkclicked(QUrl) and we can open up the URL using QDesktopServices::openUrl(url).

To be able to show animated/moving content, we have to switch on the QWebSettings:: PluginsEnabled to ‘True’ for the QWebview.

As soon as this setting is switched on to ‘TRUE’, the linkclicked(QUrl) handler is not getting called and hence no webpage is opened.

Debugging the issue it was found that:

When this setting is OFF, then the mouse click is handled by WebCore::HTMLAnchorElement::defaultEventHandler. The call finally lands in QWebPage::acceptNavigationRequest. In here, as we have also set
webview->page()->setLinkDelegationPolicy(QWebPage:: DelegateExternalLinks, true) in our code, SIGNAL linkClicked is emitted.


Code for QWebPage::acceptNavigationRequest is below for ready reckoner:

bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
{
Q_UNUSED(frame)
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;
}

But in case QWebSettings:: PluginsEnabled is ‘True’ then the mouse click is handled by WebCore::HTMLPuginElement::defaultEventHandler. The call do finally lands up in QWebPage::acceptNavigationRequest, but SIGNAL linkClicked is not emitted, because the QWebPage::NavigationType type is set to ‘NavigationTypeOther’.


Issue is QWebSettings:: PluginsEnabled, if we enable it to show animated flash files, then we user cannot CLICK and if we switch it OFF, then we cannot show Animated files.


Your suggestions/workarounds are highly welcome.


Thanks

shailesh.astute
26th December 2012, 12:32
Guys, any solution?

Really appreciate your support/guidance on this issue.

Thanks