Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. using qtquick but see nothing on browser

using qtquick but see nothing on browser

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
3 Posts 2 Posters 466 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 1 Offline
    1 Offline
    1XU7
    wrote on last edited by 1XU7
    #1

    hello! i'm using QtQuick for building my website with WebAssembly, but my qt quick button won't be rendered by browser...

    this is the main.cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    #include "someclass.h"
    #include <QQmlContext>
    
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
    
        SomeClass testClass;
    
        QQmlApplicationEngine engine;
        const QUrl url(u"qrc:/quickweb/Main.qml"_qs);
        QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
            &app, []() { QCoreApplication::exit(-1); },
            Qt::QueuedConnection);
        engine.load(url);
    
        QQmlContext* rootContext = engine.rootContext();
        rootContext->setContextProperty("classA", &testClass);
    
        return app.exec();
    }
    

    this is the someClass.h

    #ifndef SOMECLASS_H
    #define SOMECLASS_H
    
    #include <QObject>
    
    class SomeClass : public QObject
    {
        Q_OBJECT
    public:
        explicit SomeClass(QObject *parent = nullptr);
    
    signals:
    
    public slots:
        void callMe();
    
    };
    
    #endif // SOMECLASS_H
    

    this the source:

    #include "someclass.h"
    #include <QDebug>
    
    SomeClass::SomeClass(QObject *parent)
        : QObject{parent}
    {
    
    }
    
    void SomeClass::callMe()
    {
        qDebug() << "I am being call!";
    }
    

    here the qml

    import QtQuick
    import QtQuick.Window
    import QtQuick.Controls
    
    Window {
        width: 1024
        height: 768
        visible: true
        title: qsTr("Hola que tal mundo")
    
        Button {
            id: myButton
            anchors.centerIn: parent
            text: "Click Me"
            onClicked: classA.callMe()
    
        }
    }
    

    When i compile for Mingw desktop, the button is rendering fine..
    but when i compile for wasm, there is nothing on the browser more than a whole blank area..

    1 Reply Last reply
    0
    • lorn.potterL Offline
      lorn.potterL Offline
      lorn.potter
      wrote on last edited by
      #2

      What version of Emscripten are you using? We're currently stuck at 3.1.37 for 6.6 and dev branches, due to a bug in Emscripten.

      Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
      Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

      1 1 Reply Last reply
      0
      • lorn.potterL lorn.potter

        What version of Emscripten are you using? We're currently stuck at 3.1.37 for 6.6 and dev branches, due to a bug in Emscripten.

        1 Offline
        1 Offline
        1XU7
        wrote on last edited by
        #3

        @lorn-potter hi, my apologies for long time non responding...

        you know im Miguel Marambio, the one that have summit a bug report here:

        https://bugreports.qt.io/browse/QTBUG-119327

        Thanks.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved