From 156f2605d1eea27125af19cd2429c5d7d032ab9f Mon Sep 17 00:00:00 2001 From: Burak Hancerli <burak.hancerli@qt.io> Date: Mon, 14 Oct 2024 10:39:35 +0200 Subject: [PATCH] chore: update to 6.8 --- cicd/gitlab-ci.yml | 4 +-- src/designviewer.cpp | 42 +++++++++++--------------------- www/resources/styles/default.css | 12 +-------- www/scripts/script.js | 15 ------------ 4 files changed, 17 insertions(+), 56 deletions(-) diff --git a/cicd/gitlab-ci.yml b/cicd/gitlab-ci.yml index 481b803..054136d 100644 --- a/cicd/gitlab-ci.yml +++ b/cicd/gitlab-ci.yml @@ -1,8 +1,8 @@ variables: # QT version and emsdk version must be compatible. # See https://doc.qt.io/qt-6/wasm.html - QDS_CI_QT_VERSION: "6.7.1" - QDS_CI_EMSDK_VERSION: "3.1.50" + QDS_CI_QT_VERSION: "6.8.0" + QDS_CI_EMSDK_VERSION: "3.1.56" QDS_CI_ARTIFACTS_PATH: "${CI_PROJECT_DIR}/artifacts" DEBIAN_FRONTEND: non-interactive GIT_SUBMODULE_STRATEGY: recursive diff --git a/src/designviewer.cpp b/src/designviewer.cpp index faf4364..54e18db 100644 --- a/src/designviewer.cpp +++ b/src/designviewer.cpp @@ -310,41 +310,27 @@ bool DesignViewer::runProject(const QByteArray &projectData, const QString &proj void DesignViewer::showAppWindow() { qDebug() << "Resizing the QML app window"; - const QSize size; - qDebug() << "Getting the QML app window container"; + QSize size; + QQuickItem *contentItem = m_quickWindow->contentItem(); + QQuickItem *childItem{contentItem->childItems().at(0)}; + emscripten::val qtContainer = emscripten::val::global("qtcontainer"); // global from index.html - qDebug() << "Getting the QML app window style"; emscripten::val qtContainerStyle = qtContainer["style"]; - 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 + if (childItem) { + qDebug() << "Setting the QML app window size to the child item. width: " + << childItem->width() << " height: " << childItem->height(); + size = QSize(childItem->width(), childItem->height()); } else { - qDebug() << "Setting the QML app window size to " - + QString("%1x%2").arg(size.width()).arg(size.height()); - qtContainerStyle.set("width", QString("%1px").arg(size.width()).toStdString()); - qtContainerStyle.set("height", QString("%1px").arg(size.height()).toStdString()); + qDebug() << "Setting the QML app window size to the content item. width: " + << contentItem->width() << " height: " << contentItem->height(); + size = QSize(contentItem->width(), contentItem->height()); } - qDebug() << "Setting the QML app window position"; - - // 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"; - // }); + qtContainerStyle.set("width", std::format("{}px", size.width())); + qtContainerStyle.set("height", std::format("{}px", size.height())); + qDebug() << "Showing the QML app window"; m_quickWindow->show(); } diff --git a/www/resources/styles/default.css b/www/resources/styles/default.css index 1057815..7fbcc93 100644 --- a/www/resources/styles/default.css +++ b/www/resources/styles/default.css @@ -14,17 +14,7 @@ font-weight: 100; font-style: italic; } -html, -body { - padding: 0; - margin: 0; - background-color: #262525; - color: #e0e0e0; - font-family: Titillium; - font-size: 1.1em; - font-weight: 100; - font-style: italic; -} + a { color: #e0e0e0; } diff --git a/www/scripts/script.js b/www/scripts/script.js index d094921..11b2c27 100644 --- a/www/scripts/script.js +++ b/www/scripts/script.js @@ -319,7 +319,6 @@ async function loadProjector() { qt: { onLoaded: () => { launchstatus.style.display = "none"; - setContainerSize(container, window.innerWidth, window.innerHeight); showUi(container); }, onExit: exitData => { @@ -341,17 +340,3 @@ async function loadProjector() { logError(e); } } - -function setContainerSize(container, width, height) { - if (width > 1 && height > 1) { - container.style.width = `${width}px`; - container.style.height = `${height}px`; - } else { - // undefined root size - container.style.width = container.style.height = "100%"; - document.documentElement.style.height = document.body.style.height = - "100%"; - document.documentElement.style.overflow = - document.body.style.overflow = "hidden"; - } -} -- GitLab