Use the ID within WebEngineView to make it work with Qt 5.7
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.
This commit is contained in:
parent
2f554c5274
commit
cca7f55760
1 changed files with 4 additions and 4 deletions
|
@ -48,9 +48,9 @@ Item {
|
|||
|
||||
function setPost() {
|
||||
if(post) {
|
||||
runJavaScript("setArticle(" + post.jsonString + ")")
|
||||
webView.runJavaScript("setArticle(" + post.jsonString + ")")
|
||||
} else {
|
||||
runJavaScript("setArticle('logout')")
|
||||
webView.runJavaScript("setArticle('logout')")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,8 @@ Item {
|
|||
// 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';");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue