QT Web Engine freezes when calling any method from main.cpp
Unsolved
QtWebEngine
-
Hello,
now I have another problem. When I try to load another URL from main.cpp with the overload method, the whole application freezes and crashes. What am I doing wrong here? I have done the same like described in http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html
Code:
main.cpp#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QtQuick/QtQuick> #include <QtWebView/QtWebView> #include <QtWebEngineWidgets/QWebEngineView> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); //QtWebView::initialize(); QQuickView view; view.setSource(QUrl("qrc:/main.qml")); view.show(); QObject *object = view.rootObject(); QQuickItem *item = qobject_cast<QQuickItem*>(object); QWebEngineView* rect = item->findChild<QWebEngineView*>("view"); QVariant msg = "http://google.de"; rect->setProperty("url","http://google.de"); //or rect->load(QUrl("http://google.de")); return app.exec(); }
main.qml
import QtQuick 2.6 import QtQuick.Window 2.2 import QtWebEngine 1.0 Item { visible: true width: 1500 height: 800 // title: qsTr("CENSORED") WebEngineView { id: view anchors.fill: parent url: "CENSORED" objectName: "view" } }