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); }