def fill_from_response(self, url, headers, body, content_type = None): if not url: url = 'about:blank' if not content_type: content_type = ContentHelper.getContentTypeFromHeaders(headers) charset = ContentHelper.getCharSet(content_type) qurl = QUrl.fromEncoded(url) # TODO: improve setting for non-html content, especially css self.setContent(body, content_type, qurl)