diff --git a/CMakeLists.txt b/CMakeLists.txt index cc0065e899088655c2303f5951a3f89e0bdbd4b7..ab5b962cae8d8ada649c50a89c3bdbc3d229601d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ find_package( REQUIRED ) -set(QT_MINIMUM_VERSION 6.7.0) +set(QT_MINIMUM_VERSION 6.8.0) if(QT_VERSION VERSION_LESS QT_MINIMUM_VERSION) message(FATAL_ERROR "Minimum supported Qt version: ${QT_MINIMUM_VERSION}") endif() @@ -69,6 +69,14 @@ install( DESTINATION ${CMAKE_INSTALL_PREFIX} ) +if(CMAKE_PREFIX_PATH MATCHES "wasm_multithread") + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.worker.js + DESTINATION ${CMAKE_INSTALL_PREFIX} + ) +endif() + + install( DIRECTORY ${CMAKE_SOURCE_DIR}/www/ DESTINATION ${CMAKE_INSTALL_PREFIX} diff --git a/cicd/gitlab-ci.yml b/cicd/gitlab-ci.yml index 481b80377befd3e58d72c07d9f8aa28e33a36f56..054136d7f9fff3463bdbed8433985939e99f7d38 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/emsdk b/emsdk index 772828321afe0761c836bbbad3992ba392b9b708..d52c46520124845b1e0e0525f2759299d840143f 160000 --- a/emsdk +++ b/emsdk @@ -1 +1 @@ -Subproject commit 772828321afe0761c836bbbad3992ba392b9b708 +Subproject commit d52c46520124845b1e0e0525f2759299d840143f diff --git a/qtquickdesigner-components b/qtquickdesigner-components index 80b9e31a8863c9bf2a57c3d569b761d9df71cdb3..20397e26370ff073125fd19f77c7ad013276b5bd 160000 --- a/qtquickdesigner-components +++ b/qtquickdesigner-components @@ -1 +1 @@ -Subproject commit 80b9e31a8863c9bf2a57c3d569b761d9df71cdb3 +Subproject commit 20397e26370ff073125fd19f77c7ad013276b5bd diff --git a/src/designviewer.cpp b/src/designviewer.cpp index faf436447de08c51cbec5b30ad59befd5f3eb7f2..7d74b5304bece207c1fc5d5ede130e48f5fe52f1 100644 --- a/src/designviewer.cpp +++ b/src/designviewer.cpp @@ -27,24 +27,13 @@ #include <emscripten.h> #include <emscripten/val.h> -#include <functional> #include <QBuffer> -#include <QCoreApplication> #include <QDirIterator> -#include <QFile> #include <QRandomGenerator> #include <QRegularExpression> #include <QResource> -#include <QTemporaryDir> -#include <QTemporaryFile> -#include <QTimer> - -#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) #include <QtCore/private/qzipreader_p.h> -#else -#include <QtGui/private/qzipreader_p.h> -#endif DesignViewer::DesignViewer() { @@ -310,41 +299,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::to_string(size.width()) + "px"); + qtContainerStyle.set("height", std::to_string(size.height()) + "px"); + qDebug() << "Showing the QML app window"; m_quickWindow->show(); } diff --git a/www/resources/styles/default.css b/www/resources/styles/default.css index 1057815677e51afc1c536ab4176533f3ff5f4748..3dcf6bfcca59bb6955d61679a8cd731f5aeb726d 100644 --- a/www/resources/styles/default.css +++ b/www/resources/styles/default.css @@ -16,8 +16,6 @@ } html, body { - padding: 0; - margin: 0; background-color: #262525; color: #e0e0e0; font-family: Titillium; diff --git a/www/scripts/script.js b/www/scripts/script.js index d094921f79a7db66bd85df81c71bdcfee56baa5f..5807964fbd06497547322c5a0cd1d9842f621a35 100644 --- a/www/scripts/script.js +++ b/www/scripts/script.js @@ -299,6 +299,20 @@ function init() { }; } +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"; + } +} + async function loadProjector() { const spinner = document.querySelector("#qtspinner"); const container = document.querySelector('#qtcontainer'); @@ -341,17 +355,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"; - } -}