Skip to content

Qt for WebAssembly

Specific issues when using Qt for WebAssembly

459 Topics 1.8k Posts
  • Links for Qt for WebAssembly

    Pinned Unsolved
    6
    7 Votes
    6 Posts
    4k Views
    S
    @tansgumus said in Links for Qt for WebAssembly: Fireofox 76.0 (64-bit) Fireofox 76.0 (64-bit) nooooooooooooooooooo this very bad
  • Setting up a .pro file that works for wasm_singlethread and wasm_multithread

    Unsolved
    4
    0 Votes
    4 Posts
    362 Views
    S
    Now I understand a little better what you are asking. I am not sure if there is such a thing as querying if a module exists. I'm also not using wasm and don't know if you can actually distinguish between singlethreaded and multithreaded. Here is the easiest workaround that comes to mind: Create a CONFIG variable like singlethreaded. Then you can check for it: CONFIG(singlethreaded): { } else: { QT += concurrent } On the "command line" you just add qmake CONFIG+=singlethreaded ... to your call to qmake. In QtCreator under "Projects" for the wasm_singlethreaded kit you just add CONFIG+=singlethreaded as "Additional arguments" under the qmake build step.
  • Problem to find main.qml

    Unsolved
    3
    0 Votes
    3 Posts
    468 Views
    Q
    @Christian-Ehrlicher thank you, so the working solution is SOLVED: <!DOCTYPE RCC> <RCC> <qresource prefix="/"> <file>qml/main.qml</file> </qresource> </RCC> and #include <QGuiApplication> #include <QQmlApplicationEngine> #include <QUrl> #include <QDirIterator> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:qml/main.qml"))); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); } I am happy!!!
  • How to decode QR Code on wasm ?

    Solved
    7
    0 Votes
    7 Posts
    4k Views
    L
    @Mesrine Thanks, I also realize it is this problem and am trying to compile multi-threaded Opencv-wasm library
  • New qtloader

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    E
    check https://forum.qt.io/post/775817
  • wasm-ld: error: duplicate symbol from libqt6core

    Unsolved
    3
    0 Votes
    3 Posts
    330 Views
    KyefK
    Thank you @jsulm for the response. Here is my CMakeLists.txt below: CMakeLists.txt cmake_minimum_required(VERSION 3.16) project(demoApp VERSION 0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_AUTOMOC ON) set(QT_QML_GENERATE_QMLLS_INI ON) find_package(Qt6 6.4 REQUIRED COMPONENTS Quick Network Sql WebSockets ) # find_package(MySQL REQUIRED) qt_standard_project_setup(REQUIRES 6.4) qt_policy(SET QTP0001 NEW) qt_add_executable(appdemoApp main.cpp ) qt_add_qml_module(appdemoApp URI demoApp VERSION 1.0 RESOURCE_PREFIX / SOURCES mainworker.h mainworker.cpp applogger.h applogger.cpp icons/Resource.qrc QML_FILES Main.qml Login.qml Userreg.qml ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # If you are developing for iOS or macOS you should consider setting an # explicit, fixed bundle identifier manually though. set_target_properties(appdemoApp PROPERTIES # MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appdemoApp MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) target_link_libraries(appdemoApp PRIVATE Qt6::Quick PRIVATE Qt6::Network PRIVATE Qt6::Sql PRIVATE Qt6::WebSockets ) include(GNUInstallDirs) install(TARGETS appdemoApp BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) I was thinking I could be linking to a wrong library and mysql include directory however, Cmake runs the configurations very well and indicated MYSQL:MYSQL is found.
  • Qt Widgets Application

    Solved
    5
    0 Votes
    5 Posts
    443 Views
    SGaistS
    @davidweisgerber hi, Since you dived in already, I would encourage you to submit a patch to improve the documentation on that aspect.
  • Importing a C++ types declared using the QML_ELEMENT return module is not installed

    Unsolved
    2
    0 Votes
    2 Posts
    649 Views
    S
    I think I might have a similar problem. Any update on your original issue?
  • My Qt Quick Web Assembly app won't to pass over the loading screen

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    MesrineM
    If I remember well, this SharedArrayBuffer is needed when using wasm multithreading. If your app does not need multithreading, use Qt wasm single threading. If multithreading is needed, check https://forum.qt.io/post/765010
  • Loading external web images...

    Unsolved
    3
    0 Votes
    3 Posts
    652 Views
    1
    @mv-whw Thanks for answering Yes, that is the solution, putting inside my hosting public www folder all my resources: index.html main.wasm images/image0.png images/image1.png inside the wasm code: Image { source: "images/image0.png" } That worked well... and is very nice, this saves a lot of loading times..
  • webassembly does not display picture urls from web

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    1
    @Jan-Bakker Hey, sorry for answering an answered qustion. Justo happy to read it, so, it is possible to load external images in Your web app so your wasm file is smaller?
  • RangeMemory: could not allocate memory on startup

    Unsolved
    2
    0 Votes
    2 Posts
    493 Views
    JonBJ
    @Caro You might start by Googling webassembly memory () could not allocate memory and read through the other reports and comments.
  • Simple WASM demo source

    Unsolved
    1
    0 Votes
    1 Posts
    384 Views
    No one has replied
  • Qt 6.8.2 for wasm on android, the keyboard always auto popup ?

    Solved
    4
    0 Votes
    4 Posts
    757 Views
    L
    @SGaist said in Qt 6.8.2 for wasm on android, the keyboard always auto popup ?: Can you share the bug report ? https://bugreports.qt.io/browse/QTBUG-134917 https://bugreports.qt.io/browse/QTBUG-133781
  • Qt WebAssembly using QDialog bug

    Unsolved
    1
    1 Votes
    1 Posts
    265 Views
    No one has replied
  • Get Request Webassemply

    Solved
    2
    0 Votes
    2 Posts
    526 Views
    piervalliP
    There are two fantistic api in c++ #ifdef __EMSCRIPTEN__ #include <emscripten.h> // Required for calling JavaScript #endif #ifdef __EMSCRIPTEN__ // WebAssembly-specific code emscripten_run_script("console.log('Running in WebAssembly');"); #endif #ifdef __EMSCRIPTEN__ const char* url = emscripten_run_script_string("window.location.href"); qDebug() << "Current Page URL:" << url; #endif
  • QIcon ThemeIcons not showing up in WebAssembly apps

    Unsolved qicon themeicon
    3
    0 Votes
    3 Posts
    670 Views
    GilboonetG
    For WebAssembly you cannot use theme icons directly but must use the Qt Ressource System
  • onscreen Keyboard popup up with or without focus

    Unsolved webassembly screenkeyboard c++ wasm inputdevice
    3
    1 Votes
    3 Posts
    2k Views
    E
    This might be QTBUG-133781, which release are you using ?
  • Problem with loading WASM application on IGEL terminal

    Unsolved
    1
    0 Votes
    1 Posts
    320 Views
    No one has replied
  • Receiving QNetworkReply::ProtocolFailure to GET request

    Solved
    2
    0 Votes
    2 Posts
    581 Views
    L
    The solution to the problem is to add the header res.addHeader("Access-Control-Allow-Origin", "*"); to the HTTP server; hServer.route("/", QHttpServerRequest::Method::Get, []() { QString testAnswer = "TEST REPLY"; res.addHeader("Access-Control-Allow-Origin", "*"); // Added line QHttpServerResponse res(testAnswer, QHttpServerResponse::StatusCode::Ok); return res; }); After adding this line, the browser forwarded the reply to my application.