using qtquick but see nothing on browser
Unsolved
Qt for WebAssembly
-
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.. -
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.
-
@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.