-
Notifications
You must be signed in to change notification settings - Fork 58
Add support for WebView #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add support for WebView #351
Conversation
… since webview expects QCoreApplication to atleast have the program name as argument, otherwise aborts leading to a crash in quickshell.
|
Changing qArgC is fine but I do not want to force a dependency on qtwebview or qtwebengine. Can we avoid calling initialize? |
|
According to the docs: (https://doc.qt.io/qt-6/qml-qtwebview-webview.html#details) In https://doc.qt.io/qt-6/qtwebview.html they clarify that: I tested it both with initialize() and without on my laptop and PC, and observed no visible issues. So it might work. However, there are no guarantees, and using it could lead to hard-to-debug undefined behavior when others start using or distributing configurations with WebView enabled. Since quickshell targets Linux only, I might review the QtWebView source for initialize() and try to implement it directly in qs, assuming the implementation is not too complex. This would avoid the dependency, though we would need to manually keep the code in sync with upstream. |
|
if the initialization logic is complex, an acceptable solution would be to have a skeleton header with just that static function, and load the module dynamically if a pragma is set. |
…ng Qt6WebEngineQuick at runtime
|
Alright. I removed the cmake options and added the pragma. When set to true it now calls the init function in webengine/webengine.hpp which attempts to load the appropriate library and symbol to call QtWebEngineQuick::initialize. Since webengine.hpp is only included by launch.cpp I figured offloading the function to a .cpp was not necessary. |
|
Looks acceptable, though loading a symbol with a mangled name seems a little iffy https://doc.qt.io/qt-6/qlibrary.html#resolve. Can you add a manual test so we can make sure it still works in the future? |
Added support for webview and changed qArgc in launch.cpp from 0 to 1 since webview expects QCoreApplication to atleast have the program name as argument, otherwise aborts leading to a crash in quickshell.