QWebFrame *frame = form.WebView->page()->mainFrame(); QString code = getScanCode (); // 调用扫描条形码的功能,需要自己实现 QString js = QString ("document.getElementById('code').value =\"%1\";" ).arg(code) ); frame->evaluateJavaScript ( js ); |
QWebFrame *frame = form.WebView->page()->mainFrame(); QString js = QString ( "document.getElementById('query').submit();" ); frame -> evaluateJavaScript ( js ); |
QWebFrame *frame = form.WebView->page()->mainFrame(); QString s1 = frame->evaluateJavaScript ("document.getElementById ('code').name" ); |
class MyObject : public QObject { Q_OBJECT // 定义属性和函数的关联 Q_PROPERTY ( QString ip READ ip WRITE setIp ) public: MyObject (){} QString ip () { // 以字符串方式返回 IP 地址的实现 }; void setIp( QString ) { // 设置 IP 地址的实现 }; }; // 通过如下的代码来生成对象实例: MyObject* myObject = new MyObject; |
Global* global = new Global (); RefPtr<Interpreter> interp = new Interpreter ( global ); ExecState* exec = interp->globalExec (); // 实现 C++ 对象和 JavaScript 对象的关联 global->put ( exec, Identifier("myInterface" ), Instance::createRuntimeObject ( Instance:tLanguage, (void*)myObject) ); |
< object data="yahtzee.gif" type="image/gif" title="A Yahtzee animation" width=200 height=100 > |
if ( mimeType == "application/x-qt-plugin" || mimeType == "application/x-qt-styled-widget" ) { object = m_WebFrame->page()->createPlugin( classid, qurl, params, values ); |
QObject *QWebPage::createPlugin ( const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues ); |
<object type="application/x-qt-plugin" classid="VideoPlayer" width=800 height=600 file="kfc.avi" ></object> |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |