QT renered html for js

voidMainWindow::on_pushButton_clicked()javascript

{
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-8import bottlefrom bottle import route, run, template,request,response,view,static_fileimport os.path,sys,shutil,osreload(sys)os.chdir(os.path.dirname(__file__))sys.setdefaultencoding('utf8')path=os.path.join(os.getcwd(),"cbd")print pathsys.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)
相關文章
相關標籤/搜索