首页 > 代码库 > Qt webview调用JavaScript 带参函数

Qt webview调用JavaScript 带参函数

void MainWindow::on_pushButtonShowMarker_clicked(){     QString lat = "104.701681";     QString lon = "31.535617";    //ui->webViewMap->page()->mainFrame().evaluateJavaScript("addMarker()");   // double w=lat.toDouble();   // double k=lon.toDouble();    QString command = QString("addMarker(%1, %2)").arg(lat)//addMarker为JavaScript函数addMarker(lat,lon)          .arg(lon);    //ui->webViewMap->page()->mainFrame()->addToJavaScriptWindowObject("jingdu", jingdu);     qDebug()<<command;    ui->webViewMap->page()->mainFrame()->evaluateJavaScript(command);}

 

Qt webview调用JavaScript 带参函数