Qt WebAssembly Widget Buttons not responding
-
wrote on 21 Jun 2023, 11:40 last edited by
Hi,
I have been dealing with a problem of qt Webassembly. Firstly i have tried to debug and run qt 6.2.4 ( webassemly 2.0.4). then qt 6.4( webassemly 3.1.14
) with corresponding versions of webassembly, however, my buttons does not respond to any kind operations. Such that i simly createed button on widget.ui, then connect it to slot on which i put qDebug() << "Test" ;. Then it is not responding niether on windows nor on linux. Could you please tell me how to solve this?? -
Hi,
I have been dealing with a problem of qt Webassembly. Firstly i have tried to debug and run qt 6.2.4 ( webassemly 2.0.4). then qt 6.4( webassemly 3.1.14
) with corresponding versions of webassembly, however, my buttons does not respond to any kind operations. Such that i simly createed button on widget.ui, then connect it to slot on which i put qDebug() << "Test" ;. Then it is not responding niether on windows nor on linux. Could you please tell me how to solve this??Hi,
As silly as it may sound: did you check that it is working properly with your desktop kit ?
-
Hi,
As silly as it may sound: did you check that it is working properly with your desktop kit ?
wrote on 22 Jun 2023, 09:02 last edited by@SGaist Hi, well, i debuged code in desktop side as well as web side, finally i saw that printing statements are rendered on html page console, but not qt creator console. However, It is impossible to render local files and images to custom html page with webassembly?
-
@SGaist Hi, well, i debuged code in desktop side as well as web side, finally i saw that printing statements are rendered on html page console, but not qt creator console. However, It is impossible to render local files and images to custom html page with webassembly?
@Fikrat how are you rendering these files ?
-
@SGaist Hi, well, i debuged code in desktop side as well as web side, finally i saw that printing statements are rendered on html page console, but not qt creator console. However, It is impossible to render local files and images to custom html page with webassembly?
-
@SGaist I am rendering files from local directory to web, for example, i have direectory that container *.png or *.jpg extension files, then how to render them to page? Thank you for your kind support
To the best of my knowledge, WebAssembly does not provide support for serving server side files.
Depending on what you need these files for, you can use Qt's resource system.
-
To the best of my knowledge, WebAssembly does not provide support for serving server side files.
Depending on what you need these files for, you can use Qt's resource system.
wrote on 27 Jun 2023, 08:39 last edited by@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";});
1/7