From 04306fcd346a8c03035a3cefe0d117639690575d Mon Sep 17 00:00:00 2001
From: "Vic Nguyen O.O" <vic.nguyen@qt.io>
Date: Sat, 7 Sep 2024 16:34:00 +0300
Subject: [PATCH] more testing

---
 src/designviewer.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/designviewer.cpp b/src/designviewer.cpp
index 11a9446..63f48d4 100644
--- a/src/designviewer.cpp
+++ b/src/designviewer.cpp
@@ -323,10 +323,10 @@ void DesignViewer::showAppWindow()
     qDebug() << "Setting the QML app window size";
     if (size.isEmpty()) {
         qDebug() << "Setting the QML app window size to 100%";
-        qtContainerStyle.set("width", std::string("100%"));
-        // qtContainerStyle.set("height",
-        //                      std::string(
-        //                          "100%")); // ### FIXME: 100% height gives 0px height for some reason
+        qtContainerStyle.set("width", std::string("100vw"));
+        qtContainerStyle.set("height",
+                             std::string(
+                                 "100vh")); // ### FIXME: 100% height gives 0px height for some reason
     } else {
         qDebug() << "Setting the QML app window size to "
                         + QString("%1x%2").arg(size.width()).arg(size.height());
@@ -339,15 +339,15 @@ void DesignViewer::showAppWindow()
     // Make Qt pick up the new container size by calling the resizeCanvasElement()
     // qtloader API. This needs to be done on delay after initial setup to make
     // sure qtloader is initialized.
-    QTimer::singleShot(0, [&]() {
-        emscripten::val instance = emscripten::val::global("instance");
-        if (instance.isNull()) {
-            qCritical()<<"instance is null";
-            return;
-        }
-        instance.call<void>("qtResizeContainerElement", qtContainer);
-        qDebug() << "QML app window position set";
-    });
+    // QTimer::singleShot(0, [&]() {
+    //     emscripten::val instance = emscripten::val::global("instance");
+    //     if (instance.isNull()) {
+    //         qCritical()<<"instance is null";
+    //         return;
+    //     }
+    //     instance.call<void>("qtResizeContainerElement", qtContainer);
+    //     qDebug() << "QML app window position set";
+    // });
     qDebug() << "Showing the QML app window";
     m_quickWindow->show();
 }
-- 
GitLab