Open mrdev023 opened 5 years ago
Hey sorry for the late reply.
I do indeed think that not calling QtWebEngine::initialize() is the source of this bug. Since calling C++ code from a QML file doesn't work I went ahead and wrote a C++ plugin which calls the method as soon as the QML file is read. However now I get following error which crashes plasmashell completely:
QtWebEngine::initialize() must be called from the Qt gui thread
It seems like the code that loads the QML files runs in a worker thread and therefor initializing QtWebEngine is impossible. I don't know how to get the UI thread from plasmashell, if that's even possible.
I also got a warning that initializing QtWebEngine this late (after all plasmashell code ran) is deprecated and may fail.
So things aren't looking too good right now, I will look into this some more at a later point in time but right now I have no idea how to fix this. If anyone with more Qt/Plasma API knowledge can help that's appreciated.
@Marcel1202 I guess you're right. I came up with an idea:
Use QProcess to start a new application where you put the QWebEngineView and you can call QtWebEngine::initialize()
before the app object is created.
Send the QWebEngineView's winId() back to the main process, use QWindow::fromWinId()
and QWidget::createWindowContainer()
to embed it in a widget.
...
However, it seems impossible to insert a QWidget in QML and I got stuck here.
@Marcel1202 is this possible in late 2020 version of QtWebEngine?
1788845807.zip
The animation doesn't work
EDIT: I try to add in main.qml
but i get WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.