Skip to content

Instantly share code, notes, and snippets.

@lettergram
Created March 18, 2015 20:16
Show Gist options
  • Select an option

  • Save lettergram/b5ed6c596f6e018110d3 to your computer and use it in GitHub Desktop.

Select an option

Save lettergram/b5ed6c596f6e018110d3 to your computer and use it in GitHub Desktop.
// Note: javaScriptHandler * api is a variable in the MainWindow class
void MainWindow::on_webView_loadProgress(int progress){
ui->urlLineEdit->setVisible(false);
ui->progressBar->setValue(progress);
QWebFrame * frame= ui->webView->page()->mainFrame();
if(progress == 100){
// Additional Line of code below
frame->addToJavaScriptWindowObject("bridgeOperations", api);
api->injectJavaScript(frame);
ui->urlLineEdit->setVisible(true);
ui->urlLineEdit->setText(ui->webView->url().toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment