QT renered html for js

voidMainWindow::on_pushButton_clicked()

{
QStringurl="http://www.baidu.com";
url="http://192.168.201.75/ttt";
ui->webView->setUrl(QUrl(url));
//ui->webView->load(QUrl(url));
}
voidMainWindow::on_webView_loadFinished(boolarg1)
{
QStringhtml=ui->webView->page()->mainFrame()->toHtml();
ui->plainTextEdit->setPlainText(html);
}

^C[root@wanglinan cbd]# vim zz.py

#!/usr/bin/env python
#encoding=utf-8
import bottle
from bottle import route, run, template,request,response,view,static_file
import os.path,sys,shutil,os
reload(sys)
os.chdir(os.path.dirname(__file__))
sys.setdefaultencoding('utf8')
path=os.path.join(os.getcwd(),"cbd")
print path
sys.path.append(path)
import codecs

@route("/ttt")
def ttt():
return """<html>
<title>aa</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("#zz").html("<b>aaaaa</b>");
})
</script>
<body>
<div id="zz"></div>
</body>

</html>"""


if __name__ == "__main__":
session_opts = {
"session.type": "file",
'session.cookie_expires': True,
'session.auto': True,
'session.data_dir': "cache",
}

app = bottle.default_app()
app.autojson = True
run(app = app,reloader = True,host='0.0.0.0',port = 80)


 

你可能感兴趣的:(html)