Yeah sure, couldn't find the edit button, if there is any. so I'll post it here instead of editing main post


Qt Code:
  1. #include <QApplication>
  2. #include <QWebEngineView>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6.  
  7. class Webkit: public QWebEngineView{
  8. public:
  9. Webkit() {
  10. connect(this->page(), &QWebEnginePage::loadFinished, this, &Webkit::onFinishedLoading);
  11. }
  12. public slots:
  13. void onFinishedLoading(bool ok);
  14. };
  15.  
  16.  
  17. void Webkit::onFinishedLoading(bool ok){
  18. this->page()->runJavaScript("document.body;", [](const QVariant &v) { cout << "JS Result:" << v.toString().toStdString() << endl; });
  19. }
  20.  
  21. int main(int argc, char *argv[])
  22. {
  23. QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
  24. QApplication app(argc, argv);
  25.  
  26. Webkit kit;
  27. kit.show();
  28. kit.setUrl(QUrl("http://google.com"));
  29.  
  30. return app.exec();
  31. }
To copy to clipboard, switch view to plain text mode 

One would expect the following code to have some output on the JS result, however it's empty. (Qt 5.8)