From 06181f6cc2e5cfcce867f0242535cf5833ab32c4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 10 May 2024 02:47:09 -0500 Subject: [PATCH] wip --- system/clearpilot/tools/qt_webview.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/system/clearpilot/tools/qt_webview.cc b/system/clearpilot/tools/qt_webview.cc index 4e14bfd..ecf37eb 100644 --- a/system/clearpilot/tools/qt_webview.cc +++ b/system/clearpilot/tools/qt_webview.cc @@ -16,6 +16,18 @@ #include +class WebViewFrame : public QFrame { + Q_OBJECT +public: + explicit WebViewFrame(QWidget *parent = nullptr) : QFrame(parent) { + QVBoxLayout *layout = new QVBoxLayout(this); + // QWebEngineView *web_view = new QWebEngineView(); + // web_view->load(QUrl("http://example.com")); // Change URL as needed + // layout->addWidget(web_view); + } +}; + + int main(int argc, char *argv[]) { setenv("XDG_RUNTIME_DIR", "/var/tmp/weston", 1); @@ -78,10 +90,11 @@ int main(int argc, char *argv[]) { // Set a timer to change the background color and load the URL after 0.5 seconds QTimer::singleShot(2000, [&]() { - QWebEngineView *web_view = new QWebEngineView(); - window.setStyleSheet(""); // Remove the blue background - web_view->load(QUrl(args.first())); // Load the URL - layout->addWidget(web_view); // Add the web view to the layout + WebViewFrame *webViewFrame = new WebViewFrame(this); + layout->addWidget(webViewFrame); + // QWebEngineView *web_view = new QWebEngineView(); + // web_view->load(QUrl(args.first())); // Load the URL + // layout->addWidget(web_view); // Add the web view to the layout window.update(); // Refresh window to apply changes });