2

I need to load in a docked QWebView this html:

    < html >
< body >
< iframe width="100%" height="499" frameborder="0" 
scrolling="no" marginheight="0" 
marginwidth="0" 
src="http://dev.virtualearth.net/embeddedMap/v1/ajax/BirdseyeWithLabels?zoomLevel=10&pushpins=45.0610173308_7.64466465993&center=45.0610173308_7.64466465993&heading=123" >
< /iframe >
< /body >< /html >

I'm using this code:

class WebView(QWebView):
def __init__(self, parent=None,framed=False):
    QWebView.__init__(self, parent)
    #QObject.connect(self, SIGNAL("loadFinished(bool)"), self.onLoad)
    #QObject.connect(self.page().networkAccessManager(), SIGNAL("sslErrors(QNetworkReply *, const QList<QSslError> &)"), self.onErrors)
    self.settings().setAttribute(QWebSettings.PluginsEnabled, True)
    self.framed = framed

def load(self,url, params):
    mqurl = QUrl.fromUserInput(QString.fromAscii(url))
    p = []
    QgsMessageLog.logMessage("url="+url, "WebView")
    for k, v in params.iteritems():
        p.append( (k, v) )
        QgsMessageLog.logMessage(str(k)+'=' + str(v), "WebView")

    mqurl.setQueryItems(p)
    if self.framed==True:
        mhtml=HtmlFrame(mqurl.toString(),self.height()-20)
        qmhtml = QString.fromAscii(mhtml)
        self.setHtml(qmhtml,mqurl)
    else:
        QDesktopServices.openUrl(mqurl)

If framed is False it works, if framed is True the webpage is not loaded. With other webpages it works. Is it due to Ajax? How to solve this? Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.