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)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。