Skip to content

Commit

Permalink
Use the ID within WebEngineView to make it work with Qt 5.7
Browse files Browse the repository at this point in the history
I have no idea why, I think it might be some timing issues while
initializing the webengine, but when using runJavaScript() in
the WebEngineView without referencing it with the id of that
QML object it just throws the error that it doesn't know what
runJavaScript() is. When we use the ID then it just works
for some reason.
  • Loading branch information
Jeena committed Jun 29, 2016
1 parent 2f554c5 commit cca7f55
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qml/Content.qml
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ Item {

function setPost() {
if(post) {
runJavaScript("setArticle(" + post.jsonString + ")")
webView.runJavaScript("setArticle(" + post.jsonString + ")")
} else {
runJavaScript("setArticle('logout')")
webView.runJavaScript("setArticle('logout')")
}
}

function setDefaults() {
// font name needs to be enclosed in single quotes
// and this is needed for El Capitain because ".SF NS Text" won't work
var defFont = ', system, -apple-system, ".SFNSDisplay-Regular", "Helvetica Neue", "Lucida Grande"';
runJavaScript("document.body.style.fontFamily = \"'" + fontLabel.font.family + "'" + defFont + "\";");
runJavaScript("document.body.style.fontSize = '" + content.textFontSize + "pt';");
webView.runJavaScript("document.body.style.fontFamily = \"'" + fontLabel.font.family + "'" + defFont + "\";");
webView.runJavaScript("document.body.style.fontSize = '" + content.textFontSize + "pt';");
}


Expand Down

0 comments on commit cca7f55

Please sign in to comment.