void AssetEditor_Script::frameLoaded(bool ok) { QWebFrame* frame = ui->webView->page()->mainFrame(); frame->addToJavaScriptWindowObject("bridge",this); frame->evaluateJavaScript("editor.setValue(bridge.js_get_script_text())"); //Tell editor to set its text to te script text frame->evaluateJavaScript("editor.setShowPrintMargin(false);"); frame->evaluateJavaScript("editor.selection.moveCursorFileStart();"); }
void MainWindow::manageCommand(QString cmdId, QAction* action) { QWebFrame* pMainFrame = webView()->page()->mainFrame(); action->setVisible(pMainFrame->evaluateJavaScript( QString::fromAscii("window.desktopHooks.isCommandVisible('") + cmdId + QString::fromAscii("')")).toBool()); action->setEnabled(pMainFrame->evaluateJavaScript( QString::fromAscii("window.desktopHooks.isCommandEnabled('") + cmdId + QString::fromAscii("')")).toBool()); action->setText(pMainFrame->evaluateJavaScript( QString::fromAscii("window.desktopHooks.getCommandLabel('") + cmdId + QString::fromAscii("')")).toString()); }
/** * Called when the webview finished loading a new page */ void PhoneGap::loadFinished( bool ok ) { Q_UNUSED(ok) // Change into the xml-directory QDir xmlDir( m_workingDir ); xmlDir.cd( "xml" ); // Try to open the plugins configuration QFile pluginsXml( xmlDir.filePath("plugins.xml") ); if( !pluginsXml.open( QIODevice::ReadOnly | QIODevice::Text ) ) { qDebug() << "Error loading plugins config!"; return; } // Start reading the file as a stream QXmlStreamReader plugins; plugins.setDevice( &pluginsXml ); // Get a reference to the current main-frame QWebFrame *webFrame = m_webView->page()->mainFrame(); // Iterate over plugins-configuration and load all according plugins while(!plugins.atEnd()) { if( plugins.readNext() == QXmlStreamReader::StartElement ) { // Check if we have a plugin element if( plugins.name() == "plugin" ) { QXmlStreamAttributes attribs = plugins.attributes(); // Check for name & value attributes if( attribs.hasAttribute("name") && attribs.hasAttribute("value") ) { // Construct object & attribute names QString attribName = attribs.value( "name" ).toString(); QString attribValue = attribs.value( "value" ).toString(); QString objectName = attribName + "_native"; qDebug() << "Adding Plugin " << attribName << " with " << attribValue; // Check for such a plugin PGPlugin *currPlugin = PluginRegistry::getRegistry()->getPlugin( attribValue ); if( currPlugin != NULL ) { currPlugin->setWebFrame( webFrame ); webFrame->addToJavaScriptWindowObject( objectName, currPlugin ); webFrame->evaluateJavaScript( "PhoneGap.Qt.registerObject( '" + attribValue + "', " + objectName + " )" ); webFrame->evaluateJavaScript( "PhoneGap.enablePlugin( '" + attribValue + "' )" ); } else { qDebug() << "Unknown Plugin " << attribName; } } } } } // Device is now ready to rumble webFrame->evaluateJavaScript( "PhoneGap.deviceready();" ); }
/** * When file finished, execute JavaScript functions */ void Qasmine::finishLoading(bool isFinished) { if (!isFinished) { this->log("ERROR: cannot load file : '" + fileName + "'"); exitConditionally(255); } QWebFrame *frame = webView->page()->mainFrame(); frame->evaluateJavaScript(readFileContent(":/qasmine.js")); frame->addToJavaScriptWindowObject(QString("qasmine"), this); frame->evaluateJavaScript(getQasmineJsCommand()); }
void WebMapFlight::setVarioList(const FlightPointList::VarioListType &varioList, uint begin, uint end) { QString code = "fl_setVario([%1]);"; QWebFrame *pFrame; QString value = "%1"; QString strVario = ""; uint itemNr; uint listSize; bool first = true; listSize = std::min((uint)varioList.size(), end); if(listSize > 0) { for(itemNr=begin; itemNr<listSize; itemNr++) { if(!first) { strVario += ","; } first = false; // sog strVario += value.arg(round(varioList.at(itemNr) * 10.0) / 10.0); } pFrame = m_pWebMap->page()->mainFrame(); pFrame->evaluateJavaScript(code.arg(strVario)); } }
void WebMapFlight::setPhotoList(const Photo::PhotoListType &photoList) { QString code = "fl_pushPhoto({lat: %1, lng: %2, path: '%3'});"; QWebFrame *pFrame; uint listSize; uint itemNr; QString path; double lat; double lon; listSize = photoList.size(); if(listSize > 0) { pFrame = m_pWebMap->page()->mainFrame(); for(itemNr=0; itemNr<listSize; itemNr++) { lat = photoList.at(itemNr).pos().lat(); lon = photoList.at(itemNr).pos().lon(); path = photoList.at(itemNr).path(); pFrame->evaluateJavaScript(code.arg(lat).arg(lon).arg(path)); } } }
void MainWindow::setGraphPosition(float lon, float lat) { qDebug()<<lon<<lat; QWebFrame *frame = ui->webView_map->page()->mainFrame(); QString method = QString("SetPosition(%1,%2)").arg(lon).arg(lat); frame->evaluateJavaScript(method); }
QString MainWindow::getSumatraPdfExePath() { QWebFrame* pMainFrame = webView()->page()->mainFrame(); QString sumatraPath = pMainFrame->evaluateJavaScript(QString::fromAscii( "window.desktopHooks.getSumatraPdfExePath()")).toString(); return sumatraPath; }
bool HtmlEditor::queryCommandState(const QString &cmd) { QWebFrame *frame = ui->webView->page()->mainFrame(); QString js = QString("document.queryCommandState(\"%1\", false, null)").arg(cmd); QVariant result = frame->evaluateJavaScript(js); return result.toString().simplified().toLower() == "true"; }
QObject *CSVFactory::create(const QString &mimeType, const QUrl &url, const QStringList &argumentNames, const QStringList &argumentValues) const { if (mimeType != "text/csv") return 0; QHash<QString, QString> arguments; for (int i = 0; i < argumentNames.count(); ++i) arguments[argumentNames[i]] = argumentValues[i]; CSVView *view = new CSVView(arguments["type"], arguments["related"]); QWebFrame *frame = webView->page()->mainFrame(); frame->addToJavaScriptWindowObject(arguments["related"] + "_input", view); frame->evaluateJavaScript( arguments["related"] + "_input.rowSelected.connect(fillInForm);\n"); QNetworkRequest request(url); QNetworkReply *reply = manager->get(request); connect(reply, SIGNAL(finished()), view, SLOT(updateModel())); connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater())); return view; }
void tst_QWebPluginDatabase::installedPlugins() { QWebPage page; page.settings()->setAttribute(QWebSettings::PluginsEnabled, true); QWebFrame* frame = page.mainFrame(); QVariantMap jsPluginsMap = frame->evaluateJavaScript("window.navigator.plugins").toMap(); QList<QWebPluginInfo> plugins = QWebSettings::pluginDatabase()->plugins(); QCOMPARE(plugins, QWebSettings::pluginDatabase()->plugins()); int length = jsPluginsMap["length"].toInt(); QCOMPARE(length, plugins.count()); for (int i = 0; i < length; ++i) { QWebPluginInfo plugin = plugins.at(i); QVariantMap jsPlugin = frame->evaluateJavaScript(QString("window.navigator.plugins[%1]").arg(i)).toMap(); QString name = jsPlugin["name"].toString(); QString description = jsPlugin["description"].toString(); QString fileName = jsPlugin["filename"].toString(); QCOMPARE(plugin.name(), name); QCOMPARE(plugin.description(), description); QCOMPARE(QFileInfo(plugin.path()).fileName(), fileName); QList<MimeType> mimeTypes; int mimeTypesCount = jsPlugin["length"].toInt(); for (int j = 0; j < mimeTypesCount; ++j) { QVariantMap jsMimeType = frame->evaluateJavaScript(QString("window.navigator.plugins[%1][%2]").arg(i).arg(j)).toMap(); MimeType mimeType; mimeType.name = jsMimeType["type"].toString(); mimeType.description = jsMimeType["description"].toString(); mimeType.fileExtensions = jsMimeType["suffixes"].toString().split(',', QString::SkipEmptyParts); mimeTypes.append(mimeType); QVERIFY(plugin.supportsMimeType(mimeType.name)); } QCOMPARE(plugin.mimeTypes(), mimeTypes); QVERIFY(!plugin.isNull()); QVERIFY(plugin.isEnabled()); } }
// Public slots. QVariant QWebFrameProto::evaluateJavaScript(const QString& scriptSource) { scriptDeprecated("QWebFrame will not be available in future versions"); QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject()); if (item) return item->evaluateJavaScript(scriptSource); return QVariant(); }
void WebMapFlight::init() { QString code = "fl_init();"; QWebFrame *pFrame; pFrame = m_pWebMap->page()->mainFrame(); pFrame->evaluateJavaScript(code); }
void HelpBrowser::evaluateSelection() { static const QString javaScript("selectLine()"); QWebFrame *frame = mWebView->page()->currentFrame(); if( frame ) frame->evaluateJavaScript( javaScript ); QString code( mWebView->selectedText() ); if (!code.isEmpty()) Main::scProcess()->evaluateCode(code); }
void WebMapFlight::showPlot() { QString code = "fl_showPlot();"; QWebFrame *pFrame; if(m_plotEn) { pFrame = m_pWebMap->page()->mainFrame(); pFrame->evaluateJavaScript(code); } }
static QPoint scrollOffset(QWebView *webView) { int x = 0; int y = 0; QWebFrame *frame = webView->page()->mainFrame(); x = frame->evaluateJavaScript("window.scrollX").toInt(); y = frame->evaluateJavaScript("window.scrollY").toInt(); return QPoint(x,y); }
void MainWindow::onCloseWindowShortcut() { QWebFrame* pMainFrame = webView()->page()->mainFrame(); bool closeSourceDocEnabled = pMainFrame->evaluateJavaScript( QString::fromAscii( "window.desktopHooks.isCommandEnabled('closeSourceDoc')")).toBool(); if (!closeSourceDocEnabled) close(); }
QString NoteItem::getContent() { if(m_rich) { QWebFrame* mainFrame = m_webView->page()->mainFrame(); m_content = mainFrame->evaluateJavaScript("editor.updateTextArea();editor.$area.val();").toString(); m_content = m_content.replace(QRegExp("<!--StartFragment-->"),""); m_content = m_content.replace(QRegExp("<!--EndFragment-->"),""); } else m_content = m_textEdit->toPlainText(); return m_content; }
void WebTabPanel::handleLoadFinished(bool) { QWebFrame *frame = web->page()->mainFrame(); QString url=frame->url().toString(); //QMessageBox::information (0,"assdf",tr("Handle load finished, state: ")+QString::number(state)+tr(", url: ")+frame->url().toString()); infoArea->hide(); progress->hide(); loadingText->hide(); if (url=="http://twitter.com/login") { if (!tweets->getAuthenticatingFetcher()) { state=-1; return; } QString user = tweets->getAuthenticatingFetcher()->getUsername(); QString pass = tweets->getAuthenticatingFetcher()->getPassword(); // Homepage login //frame->evaluateJavaScript(tr("var f=document.getElementById('signin');document.getElementById('username').value=\"")+user+tr("\";document.getElementById('password').value=\"")+pass+tr("\";f.submit();")); // redirect page login loadingText->setText("Please wait, signing in to twitter..."); frame->evaluateJavaScript(tr("var f=document.forms[1];f['username_or_email'].value=\"")+user+tr("\";f['session[password]'].value=\"")+pass+tr("\";f.submit();")); state=1;//loggin in } else if (url=="http://twitter.com/invitations/find_on_twitter") { // Now at being passed to twitter state state=2;//Searching web->show(); frame->evaluateJavaScript(tr("function $(s){return document.getElementById(s);}function __yasstlinks() {var i=['home_link','profile_link','settings_link','help_link','sign_out_link'];for (var b in i) {b=$(i[b]);b.style.display='none';}i=$('footer').firstChild.nextSibling.nextSibling.nextSibling.firstChild.nextSibling;while(i.nextSibling){i.parentNode.removeChild(i.nextSibling);}}__yasstlinks();")); frame->setScrollPosition(QPoint(0,0)); //QTimer::singleShot(1000,this,SLOT(resetScroll())); web->setEnabled(true); handleTimeout(); } else if (url.startsWith(tr("http://twitter.com/"))) { state=3;//Search results or user info. frame->evaluateJavaScript(tr("function $(s){return document.getElementById(s);}function __yasstlinks() {var i=['home_link','profile_link','settings_link','help_link','sign_out_link'];for (var b in i) {b=$(i[b]);b.style.display='none';}i=$('footer').firstChild.nextSibling.nextSibling.nextSibling.firstChild.nextSibling;while(i.nextSibling){i.parentNode.removeChild(i.nextSibling);}}__yasstlinks();")); frame->evaluateJavaScript(tr("function __yasst() {i=$('timeline');i.innerHTML='<style>.follow-actions input{display:none;} a.__yasst-followsingle {text-decoration:none; visibility:visible !important; -webkit-appearance: none; -webkit-border-bottom-left-radius: 5px; -webkit-border-bottom-right-radius: 5px; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -webkit-box-align: center; -webkit-box-sizing: border-box; -webkit-rtl-ordering: logical; -webkit-user-select: text; background-color: rgb(230, 230, 230); border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: black; cursor: pointer; display: inline-block; font-family: \\'Lucida Grande\\'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; height: 23px; letter-spacing: normal; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 4px; padding-left: 8px; padding-right: 8px; padding-top: 4px; text-align: center; text-indent: 0px; text-shadow: none; text-transform: none; vertical-align: top; white-space: pre; width: 48px; word-spacing: 0px;} a:hover.__yasst-follow,a:hover.__yasst-followsingle{background-color: rgb(204, 204, 204);} a.__yasst-follow{visibility: visible !important; -webkit-appearance: none; -webkit-border-bottom-left-radius: 5px; -webkit-border-bottom-right-radius: 5px; -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px; -webkit-box-align: center; -webkit-box-sizing: border-box; -webkit-rtl-ordering: logical; -webkit-user-select: text; background-color: rgb(230, 230, 230); border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: black; cursor: pointer; display: none; font-family: \\'Lucida Grande\\'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; height: auto; letter-spacing: normal; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 4px; padding-left: 8px; padding-right: 8px; padding-top: 4px; text-align: center; text-indent: 0px; text-shadow: none; text-transform: none; vertical-align: top; white-space: pre; width: 80px; word-spacing: 0px;}</style>'+$('timeline').innerHTML;var e=document.getElementById('follow_control');if (e!=null) {var u=e.parentNode.parentNode.className;u=u.substr(u.lastIndexOf(' ')+1);var l=document.createElement('div');l.innerHTML='<a class=\\\"__yasst-followsingle\\\" href=\\\"twitter:/follow/'+u+'\\\">Follow</a>';e.parentNode.parentNode.insertBefore(l,e.parentNode);} else { e=i.getElementsByClassName('follow-actions');for(b=0;b<e.length;b++) {var u=e[b].parentNode.parentNode.className;u=u.substr(u.lastIndexOf(' ')+6);var l=document.createElement('div');var c=e[b].childNodes;for(var x=0;x<c.length;x++) {if (c[x].nodeName=='FORM') {var d=c[x].action.substr(c[x].action.lastIndexOf('/')+1);var f=c[x].firstChild.childNodes;l.innerHTML='<a class=\\\"__yasst-follow\\\" href=\\\"twitter:/follow/'+u+'\\\">Follow</a>';for(var y=0;y<f.length;y++) {if(f[y].nodeName=='INPUT'&&f[y].type=='submit') {f[y].parentNode.insertBefore(l,f[y]);}}}}}}}__yasst();")); web->setEnabled(true); //frame->setScrollPosition(QPoint(0,0)); //QTimer::singleShot(1000,this,SLOT(resetScroll())); } }
void QtStageWebView::registerEventbus() { QWebFrame* frame = page()->mainFrame(); frame->addToJavaScriptWindowObject(QString("eventbus2"), new BlackBerryBus(this, frame)); frame->evaluateJavaScript(BlackBerry::Ripple::eventbusSource); // check for iframes, if found add to window object for(int i = 0; i < frame->childFrames().length(); i++) { frame->childFrames()[i]->addToJavaScriptWindowObject(QString("eventbus2"), new BlackBerryBus(this, frame->childFrames()[i])); frame->childFrames()[i]->evaluateJavaScript(BlackBerry::Ripple::eventbusSource); } }
void HtmlEditor::formatFontSize() { bool ok = false; int size = QInputDialog::getInt(this, tr("Font Size"), tr("Size in points:"), 48, 0, 1000, 1, &ok); if (ok) { QWebFrame *frame = ui->webView->page()->mainFrame(); QString js; if (size) js = QString("setFontSize('%1pt')").arg(size); else js = QString("setFontSize('')"); frame->evaluateJavaScript(js); } }
void MainWindow::closeEvent(QCloseEvent* pEvent) { QWebFrame* pFrame = webView()->page()->mainFrame(); if (!pFrame) { pEvent->accept(); return; } QVariant hasQuitR = pFrame->evaluateJavaScript(QString::fromAscii("!!window.desktopHooks")); if (quitConfirmed_ || !hasQuitR.toBool() || pCurrentSessionProcess_ == NULL || pCurrentSessionProcess_->state() != QProcess::Running) { pEvent->accept(); } else { pFrame->evaluateJavaScript(QString::fromAscii("window.desktopHooks.quitR()")); pEvent->ignore(); } }
void YaMap::addPlace(const QString& ll, const QString description) { QWebFrame* frame = page()->mainFrame(); QStringList llist = ll.split(" "); if (llist.count() != 2) { // qWarning("error: '%s';'%s'", qPrintable(ll), qPrintable(description)); return; } QString js = QString("addPlace('%1', '%2', '%3');") .arg(llist[0]) .arg(llist[1]) .arg(description); // qWarning("js: '%s'", qPrintable(js)); frame->evaluateJavaScript(js); }
void LinkFetcher::fetchLinks(bool ok) { if (!ok) { emit finished(false); return; } QString javaScript = scriptOrScriptName; if (scriptOrScriptName.endsWith(".js")) { QFile file(scriptOrScriptName); if (!file.open(QIODevice::ReadOnly)) { emit finished(false); return; } javaScript = QString::fromUtf8(file.readAll()); } QWebFrame *frame = page.mainFrame(); frame->evaluateJavaScript(javaScript); emit finished(true); }
void MainWindow::arduinoExec(const QString &action) { QStringList arguments; // Check if temp path exists QDir dir(settings->tmpDirName()); if (dir.exists() == false) { dir.mkdir(settings->tmpDirName()); } // Check if tmp file exists QFile tmpFile(settings->tmpFileName()); if (tmpFile.exists()) { tmpFile.remove(); } tmpFile.open(QIODevice::WriteOnly); // Read code QWebFrame *mainFrame = ui->webView->page()->mainFrame(); QVariant codeVariant = mainFrame->evaluateJavaScript( "Blockly.Arduino.workspaceToCode();"); QString codeString = codeVariant.toString(); // Write code to tmp file tmpFile.write(codeString.toLocal8Bit()); tmpFile.close(); // Verify code arguments << action; // Board parameter if (ui->boardBox->count() > 0) { arguments << "--board" << ui->boardBox->currentText(); } // Port parameter if (ui->serialPortBox->count() > 0) { arguments << "--port" << ui->serialPortBox->currentText(); } arguments << settings->tmpFileName(); process->start(settings->arduinoIdePath(), arguments); // Show messages ui->messagesWidget->show(); }
void OdfView::slotLoadFinished(bool ok) { if (!ok) return; loaded = true; QWebFrame *frame = page()->mainFrame(); QString js = "var originalReadFileSync = runtime.readFileSync;" "runtime.readFileSync = function (path, encoding) {" " if (path.substr(path.length - 3) === '.js') {" " return originalReadFileSync.apply(runtime," " [path, encoding]);" " }" " return nativeio.readFileSync(path, encoding);" "};" "runtime.read = function (path, offset, length, callback) {" " var data = nativeio.read(path, offset, length);" " data = runtime.byteArrayFromString(data, 'binary');" " callback(nativeio.error()||null, data);" "};"; frame->evaluateJavaScript(js); }
void MainWindow::actionNew() { // Check whether source was changed if (checkSourceChanged() == QMessageBox::Cancel) { return; } // Unset file name setXmlFileName(""); // Disable save as ui->actionSave_as->setEnabled(false); // Reset source change status webHelper->resetSourceChanged(); // Clear workspace QWebFrame *frame = ui->webView->page()->mainFrame(); frame->evaluateJavaScript("resetWorkspace();"); // Reset history documentHistoryReset(); }
void SpeedDial::thumbnailCreated(const QPixmap &image) { PageThumbnailer* thumbnailer = qobject_cast<PageThumbnailer*>(sender()); if (!thumbnailer) { return; } QString url = thumbnailer->url().toString(); QString fileName = m_thumbnailsDir + QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png"; if (image.isNull()) { fileName = "qrc:/html/broken-page.png"; } else { if (!image.save(fileName)) { qWarning() << "SpeedDial::thumbnailCreated Cannot save thumbnail to " << fileName; } fileName = QUrl::fromLocalFile(fileName).toString(); } m_regenerateScript = true; for (int i = 0; i < m_webFrames.count(); i++) { QWebFrame* frame = m_webFrames.at(i).data(); if (!frame) { m_webFrames.removeAt(i); i--; continue; } frame->evaluateJavaScript(QString("setImageToUrl('%1', '%2');").arg(url, fileName)); } thumbnailer->deleteLater(); }
void WebMapFlight::setFlightPointList(const QDate &date, const FlightPointList *pFpList) { QString code; QWebFrame *pFrame; QString value = "%1"; QString latLonArg = "[%1,%2]"; QString strTime = ""; QString strAlt = ""; QString strElevation = ""; QString strLatLon = ""; QTime time; uint fpNr; uint begin; uint end; uint start; uint duration; double alt; double minAlt; double maxAlt; int epochDate; int epochTime; int secsOfDay; int prevSecsOfDay; bool first = true; begin = pFpList->firstValidFlightData(); end = pFpList->lastValidFlightData(); if(end > 0) { minAlt = pFpList->at(begin)->alt(); maxAlt = minAlt; time = pFpList->at(begin)->time(); start = time.hour() * 3600 + time.minute() * 60 + time.second(); time = pFpList->at(end - 1)->time(); duration = time.hour() * 3600 + time.minute() * 60 + time.second() - start; epochDate = QDateTime(date).toTime_t(); prevSecsOfDay = start; for(fpNr=begin; fpNr<end; fpNr++) { if(!first) { strTime += ","; strAlt += ","; strElevation += ","; strLatLon += ","; } first = false; // time time = pFpList->at(fpNr)->time(); secsOfDay = time.hour() * 3600 + time.minute() * 60 + time.second(); if(secsOfDay < prevSecsOfDay) { epochDate += 86400; // next day } epochTime = (epochDate + secsOfDay); prevSecsOfDay = secsOfDay; strTime += value.arg(epochTime); // altitude alt = pFpList->at(fpNr)->alt(); minAlt = qMin(alt, minAlt); maxAlt = qMax(alt, maxAlt); strAlt += value.arg(alt); // elevation strElevation += value.arg(pFpList->at(fpNr)->elevation()); // lat, lon strLatLon += latLonArg.arg(pFpList->at(fpNr)->pos().lat()).arg(pFpList->at(fpNr)->pos().lon()); } minAlt = floor(minAlt / 100.0) * 100; maxAlt = ceil(maxAlt / 100.0) * 100; pFrame = m_pWebMap->page()->mainFrame(); code = "fl_setFlightTime([%1], %2, %3);"; pFrame->evaluateJavaScript(code.arg(strTime).arg(start).arg(duration)); code = "fl_setFlightAlt([%1], %2, %3);"; pFrame->evaluateJavaScript(code.arg(strAlt).arg(minAlt).arg(maxAlt)); code = "fl_setFlightElevation([%1]);"; pFrame->evaluateJavaScript(code.arg(strElevation)); code = "fl_setFlightLatLon([%1]);"; pFrame->evaluateJavaScript(code.arg(strLatLon)); } }
void WebPage::injectJavascriptHelpers() { QWebFrame* frame = qobject_cast<QWebFrame *>(QObject::sender()); frame->evaluateJavaScript(m_capybaraJavascript); }