Skip to content

Qt for WebAssembly

Specific issues when using Qt for WebAssembly

437 Topics 1.7k Posts
  • 0 Votes
    6 Posts
    1k Views
    lorn.potterL

    @DamienL
    QFileDialog::getOpenFileContent is the workaround for accessing system/local files due to the javascript sandbox that webassembly lives in.

  • How to link 3rd party libraries?

    Unsolved
    8
    0 Votes
    8 Posts
    1k Views
    lorn.potterL

    @Vadi2

    Other than adding your libs with LIBS += -lblahblah
    you shouldn't have to pass anything extra to Qt to get it to link statically, as QtWebAssembly does that anyway.

    You could try QMAKE_LFLAGS += -static in your project if there is any issues, or it tries to link dynamically.

  • Qt Design Viewer .qmlrc?

    Unsolved
    2
    1 Votes
    2 Posts
    598 Views
    K

    This thread can be closed.

    For those who are looking for an answer:
    Build Qt UI Application for .qmlproject file.

    Attention: JS doesnt work within the project if the aim is to deploy with Qt design viewer

  • 0 Votes
    3 Posts
    403 Views
    thamT

    Firefox 70.0 works again.

  • 0 Votes
    4 Posts
    426 Views
    thamT

    @lorn-potter Compile the app with 1.38.43, got error messages

    Fatal: error in validating output shared:ERROR: '/home/yyyy/Qt/3rdLibs/emsdk/fastcomp/bin/asm2wasm chinese_teacher.temp.asm.js --total-memory=16777216 --trap-mode=allow -O3 --mem-init=chinese_teacher.js.mem --mem-base=1024 --wasm-only -o chinese_teacher.wasm --mvp-features' failed (1) Makefile:316: recipe for target 'chinese_teacher.js' failed make: *** [chinese_teacher.js] Error 1
  • Qt Creator webassembly: calendar widget doesn't compile

    Unsolved
    2
    0 Votes
    2 Posts
    421 Views
    lorn.potterL

    @Vadi2 said in Qt Creator webassembly: calendar widget doesn't compile:

    I've tried compiling the calendar widget using the new webassembly support in Qt Creator 4.11 beta, and it took a really long while to print out the entire text representation of the program, and then failed with:

    Its not supposed to print out that wasm text in that way. Something qtcreator is doing is breaking the build.
    Building will still work when you do it from the commandline and using the Qt wasm binaries.

  • Sql positiotioning

    Solved
    3
    0 Votes
    3 Posts
    409 Views
    jsulmJ

    @niqt said in Sql positiotioning:

    Have i do use some "special" compilation option?

    My guess is that you did not compile those modules

  • QNetworkConfigurationManager QSharedMemory unknown

    Solved
    4
    0 Votes
    4 Posts
    485 Views
    lorn.potterL

    Hi,
    Although QNetworkAccessManager is supported, QNetworkConfigurationManager is not.

    That said, there is a patch that implements a very simple configuration plugin for wasm, but this is out of date that you could use if you really needed to know if/when your app is online.
    https://codereview.qt-project.org/c/qt/qtbase/+/235844

  • Webassembly: module QtQuick.Shapes is not installed

    Unsolved
    1
    0 Votes
    1 Posts
    520 Views
    No one has replied
  • Configure script says C++14 support is not available

    Solved
    16
    0 Votes
    16 Posts
    2k Views
    D

    I managed to get it working. I just need to know how I can get Emscripten to generate the notepad_ui.h header file from the uic file. For now I built it from within Qt Creator itself using the MSVC 2017 compiler, but I do want to know how to do it with Emscripten from the command line.

    I also created the menus in such a way that clicking them gives you a dropdown with one item with the same text as the button where you have to click the dropdown to perform the action. Is there a way to do it without needing to create the dropdown?

    Also, how do I change the configuration from Debug to Release?

    Edit: I changed it to Release mode just fine so never mind that.

    Anyway, although I can build it just fine in Qt Creator, trying it with Emscripten on the command line keeps failing. I get exceptions from the Emscripten script. If Qt developers can help with this, maybe I should open a new issue asking for help on building Qt apps to Wasm.

    And for some reason, when running the app, I have to choose a font twice from the font selection dialog box when I click on the menu button for selecting a font. I also don't understand why it won't just create an action in Action Editor the moment I create a menu item. Why do I have to click on the "Type here" that comes up when I click on that and create another menu item there for the same action for it to work?

  • 0 Votes
    10 Posts
    1k Views
    lorn.potterL

    There is a way to 'persist' files, but you need to sync them from the local system into the sandbox.
    https://emscripten.org/docs/api_reference/Filesystem-API.html

    Using the IDBFS you can copy files to a mounted IndexDB filesystem.
    In fact, QSettings on wasm uses this to attempt to persist QSettings.

  • Issues Found When Trying to Build

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    lorn.potterL

    Hi,
    Any reason why you are not using qmake?

  • Exclude SUBDIRS in .pro when compiling with WebAssembly

    Solved
    4
    0 Votes
    4 Posts
    378 Views
    V

    wasm or emscripten? I've been using the latter and it works.

  • 0 Votes
    14 Posts
    1k Views
    thamT

    @lorn-potter Thanks, tried, can show the widgets but the ui components are too small, any suggestions to solve this issue?

    By the way, do you know any way to make the QLineEdit accept non ascii input?This question is related to QTBUG-78826.

    I load the fonts already, can paste the words from text file to QLineEdit or print the non ascii characters by program, but the QLineEdit cannot type the non ascii characters on it directly.

    QFile ifile(":/fonts/wqy_compress"); if(ifile.open(QIODevice::ReadOnly)){ auto const font_id = QFontDatabase::addApplicationFontFromData(qUncompress(ifile.readAll())); qDebug()<<__func__<<"font id:"<<font_id; font_family_ = QFontDatabase::applicationFontFamilies(font_id).at(0); } QFont const monospace(font_family_ ); ui->lineEditNewChar->setFont(monospace);

    Any suggestions?Thanks

  • Issue with running configure.bat (Windows)

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    Pablo J. RoginaP

    @DragonOsman said in Issue with running configure.bat (Windows):

    Should I close this one and open a new thread for these questions or is this thread fine?

    Yes please, so other users can expect to find answers to the issue based on topic title.
    If not, the solution(s) for the new issue will be embedded within the posts.

  • 0 Votes
    4 Posts
    460 Views
    thamT

    @mrjj Thanks for your helps, post a bug at JIRA, 78825

  • Qt for WebAssembly on Windows 10

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    K

    Hi,
    first of all: Are you using a linux subsystem? Because you need to use Linux its not possible on windows.
    The secon thing is that the Qt mkspecs need to be specified in the compilers sub.
    In em and em++ both need to have "wasm-emscripten" as Qt mkspecs.

    The third thing is that actually it is still not possible to to build via Qt Creator. You need to use qmake and make.
    After running them the project is build and you are ready to go with a webserver like the simple python one. From there you just open the .html.

    If you need more help just message me, had some issues too as right now there is still the same warning on my linux system as you have with QtVersions. I'll figure that one out soon didn't deal with it until now.