Solved Interact with a QQmlApplicationEngine html page.
-
@bask185 Why not just call hide()?
If you delete it and try to access it later then yes your app will crash as you're trying to access memory you freed before... -
@jsulm said in Interact with a QQmlApplicationEngine html page.:
@bask185 Why not just call hide()?
For once I am on step ahead of you, I think ;) The answer to this question:
/home/user/Dropbox/GUI/GUI_Qt/mainwindow.cpp:151: error: ‘class QQmlApplicationEngine’ has no member named ‘hide’ engine->hide(); ^
The code in the setup is now:
QtWebEngine::initialize(); engine->load(QUrl(QStringLiteral("qrc:/resources/img/webview.qml"))); engine->hide();
@jsulm said in Interact with a QQmlApplicationEngine html page.:
If you delete it and try to access it later then yes your app will crash as you're trying to access memory you freed before...
I figured something like that is why I tried to call ::initialize() again before opening. But I believe 'deleteLater()' deletes the object/member I declared in the header file -->> crash ???
-
@bask185 You cannot call anything on something what was already deleted (deleteLater() deletes the object).
-
@jsulm said in Interact with a QQmlApplicationEngine html page.:
@bask185 You cannot call anything on something what was already deleted (deleteLater() deletes the object).
Yes and I scrolled through the list of functions but I cannot find anything which simply closes the webview window
-
@bask185 QWebView is derived from QWidget and QWidget has hide() method
-
@jsulm said in Interact with a QQmlApplicationEngine html page.:
@bask185 QWebView is derived from QWidget and QWidget has hide() method
But 'member that the thing I am using:
engine = new QQmlApplicationEngine();
is not derived from a QWidget IIRC.
I am using this QML file:
import QtQuick 2.0 import QtQuick.Window 2.0 import QtWebEngine 1.0 Window { width: 1024 height: 750 visible: true WebEngineView { anchors.fill: parent url: "qrc:/resources/img/frmSSPeditor.html" } }
to open the .html
And I did this because this was recommended to me on this here forum.
@raven-worx said in Browsers and Java Script.:@bask185
QtWebkit is deprecated in the meantime and has been replaced by QtWebEngine (based on Chromium).
Try using WebEngineView instead.This + I am not seeing the QWebview widget in Qt creator.
No suggestions for hide, can only find 'handle'. I am telling you hide() isn't there -
@bask185 How did you add that engine to your GUI? Does it have a parent widget? Is it in a layout?
-
@jsulm said in Interact with a QQmlApplicationEngine html page.:
@bask185 How did you add that engine to your GUI? Does it have a parent widget? Is it in a layout?
It has no parent Widgets. In the header file I declare: QQmlApplicationEngine *engine;
In the setup I initialize it:
engine = new QQmlApplicationEngine(); //(this action is called initializing right??)
and I also perform QtWebEngine::initialize();In a function I call: engine->load(QUrl(QStringLiteral("qrc:/resources/img/webview.qml")));
And this line opens a new window with the .qml which opens the .htmlIt is not related to any .ui I also have no controll where the window appears. The reso of the target device is that small that it is just right.
But if you can tell me how to install the QWebview widget in Qt creator, that also works for me.
-
@bask185 said in Interact with a QQmlApplicationEngine html page.:
QWebview
Why don't you use http://doc.qt.io/qt-5/qwebengineview.html? QtWebKit is discontinued QWebEngine should be used instead.
-
@jsulm Becuz I sometimes have no idea of how to get my stuff to work, hence my presence on this here forum ;)
Anways my entire app works like a charm, mostly thanks to your efforts, So thank you!
Even the titleChanged() signal works out of the box, I only have to retrieve some information out of a column somewhere
-
@bask185 Glad to hear it works now :-)