Skip to content

Qt for WebAssembly

Specific issues when using Qt for WebAssembly

444 Topics 1.8k Posts
  • Copy to clipboard or select text from canvas

    Solved
    8
    0 Votes
    8 Posts
    2k Views
    MesrineM

    @Mesrine
    I solved the chrome error by only copying the text to the clipboard. It seems that

    textEdit.copy();

    try to copy images also to the clipboard and this still is not supported on some browsers.

    so I made my own class for text-only copy to clipboard

    class TextClipboard :public QObject { Q_OBJECT Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged) QML_ELEMENT public: TextClipboard(QObject *parent = nullptr):QObject(parent),m_text(QString()),clipboard(QGuiApplication::clipboard()) { } Q_INVOKABLE void copy()const { clipboard->setText(m_text); } signals: void textChanged(); public: QString m_text; QClipboard *clipboard; };

    In the qml file where the text has to be copied on click on a Image I set

    TextClipboard { id:tclip text:root.address } Image { id:img anchors.centerIn:parent sourceSize.width: root.width-10 source: "image://qrcodeblack/"+root.address MouseArea { anchors.fill: img onClicked: { tclip.copy(); } } }

    And this solves the error

  • Application exit at start

    Solved
    2
    0 Votes
    2 Posts
    263 Views
    1

    Nevermind, this error shows when nullptr reference is being used.. thanks anyway.

  • 0 Votes
    1 Posts
    164 Views
    No one has replied
  • Qt Webassembly scale ratio

    Moved Solved
    3
    0 Votes
    3 Posts
    283 Views
    1

    @JasonWong
    probably that was the problem, Qt version.. i haven´t tested on 6.5.2, so i go through there..

    thanks.

  • 1 Votes
    1 Posts
    136 Views
    No one has replied
  • 0 Votes
    2 Posts
    304 Views
    No one has replied
  • Qt 3D Application doesn't compile for Web Assembly

    Unsolved
    4
    0 Votes
    4 Posts
    386 Views
    GilboonetG

    @JasonWong Thank you, that's promising. Apparently it misses the meta to allow cross origin requests so I couldn't test it with another file, but it's nice to know that it is possible even if I'm unsure that I could code using OpenGL that is far beyond my skills.

  • webassembly does not display picture urls from web

    Solved
    6
    0 Votes
    6 Posts
    679 Views
    J

    @Jan-Bakker Problem solved in QT 6.5.2.
    In the release notes I found this, but i couldn't find it reported in detail so far-> "QTBUG-111892 wasm: asynchronous image loading never ends"

  • QML DatePicker in Webassembly...?

    Solved
    2
    0 Votes
    2 Posts
    333 Views
    oria66O

    This was solved with DayOfWeekRow, MonthGrid, and related new components in Qt6.

  • how to display korean characters in qt/qml app on web?

    Moved Unsolved
    5
    0 Votes
    5 Posts
    355 Views
    SGaistS

    You should check what is happening using FontLoader's status

  • How to Run a Qt WebAssembly App on an Nginx Server?

    Solved
    4
    0 Votes
    4 Posts
    659 Views
    M

    @MeatBerry Hello. How did you do it? Could you explain the steps below?

  • 0 Votes
    2 Posts
    360 Views
    lorn.potterL

    Drag and drop has never worked very well in QtWebAssembly.
    But it is working in 6.6.0beta1 single threaded release.

    You need to use asyncify though:
    https://doc.qt.io/qt-6/wasm.html#asyncify

    Good news is, you no longer have to rebuild Qt to get asyncify, you just need to add a linker argument.
    cmake: target_link_options(<target> PUBLIC -sASYNCIFY -Os)
    qmake: QMAKE_LFLAGS += -sASYNCIFY -Os

  • 0 Votes
    1 Posts
    186 Views
    No one has replied
  • 0 Votes
    2 Posts
    169 Views
    Marko StankeM

    @Marko-Stanke
    The issue was that I was missing the import path since in WebAssembly the pathing is a bit different.

    Adding:

    engine.addImportPath("qrc:/");

    solved the issue.

  • internationalization support

    Solved
    15
    1 Votes
    15 Posts
    1k Views
    JonBJ

    @Gilboonet
    Nowhere did I criticize you at any point. Not once. Just tried to help. Politely, unlike your reponse.

    Since you have expressed your opinion of my time and efforts in trying to help you, could you now please get off my case and stop putting in my name in your posts to express how dissatisfied you are with my unpaid efforts to aid you. Thanks.

  • Qt WebAssembly Widget Buttons not responding

    Unsolved
    7
    0 Votes
    7 Posts
    501 Views
    R

    @SGaist said in Qt WebAssembly Widget Buttons not responding:

    Depending on what you need these files for, you can use Qt's resource system.

    I think this is the best approach.

    Other way is using QNetworkAccessManager to download the image, this has the benefit that you can download images from external websites as well, something like:

    QNetworkAccessManager *manager = new QNetworkAccessManager(this); QNetworkReply *reply = manager->get(QNetworkRequest(QUrl("https://domain/image_url.jpg"))); connect(manager, &QNetworkAccessManager::finished, [&](QNetworkReply *reply){ qWarning() << "replyFinished"; QPixmap *image = new QPixmap(this); image->loadFromData(reply->readAll()); ui->label->setPixmap(QPixmap(*image)); }); connect(reply, &QIODevice::readyRead, [](){qWarning() << "reply";}); connect(reply, &QNetworkReply::errorOccurred, [](){qWarning() << "errorOccurred";});
  • Some of my shortcuts don't work on Web Assembly

    Solved
    2
    0 Votes
    2 Posts
    238 Views
    GilboonetG

    I changed the rotation keyboard shortcut to
    / to rotate left and * to rotate right

    Alt for 15° rotation Ctrl for 5° rotation Ctrl and Shift for 1° rotation

    It works fine like that both on Desktop version and Web Assembly version. I read about gesture but didn't understand how it works so for the moment I will only use keyboard shortcuts.

  • 0 Votes
    1 Posts
    134 Views
    No one has replied
  • 0 Votes
    4 Posts
    412 Views
    lorn.potterL

    When I run it and check the browsers console output, I see the message:

    "Shadows are not yet supported for OpenGL ES2"

  • Using OpenSSL/Secure Websockets with Qt WebAssembly

    Unsolved
    4
    0 Votes
    4 Posts
    862 Views
    lorn.potterL

    @pgmQt
    WebAssmebly uses the browsers ssl stack. Just feed to https:// url