QApplication::processEvents() doesn't works
-
Hi!
Qt 5.15.2, 6.2.2
Trying to execute function with processEvets() inside... Executing is freezing...while(!flag){ QApplication::processEvents(); }
What should I do to fix this behaviour?
Thank you!@sitesv said in QApplication::processEvents() doesn't works:
What should I do to fix this behaviour?
Get rid of the loop
-
@sitesv said in QApplication::processEvents() doesn't works:
What should I do to fix this behaviour?
Get rid of the loop
-
@jsulm I have to wait till the message parts (incoming messages from qwebsocket) will be collected. Is there another way?
-
@sitesv said in QApplication::processEvents() doesn't works:
Is there another way?
What's wrong with signals/slots mechanism?
@KroMignon
I want to create a function for sending request and receiving answer. That's why. -
@KroMignon
I want to create a function for sending request and receiving answer. That's why. -
@sitesv said in QApplication::processEvents() doesn't works:
I want to create a function for sending request and receiving answer. That's why.
Not really.
You could use a local QEventLoop and exit the loop when signal is emitted.@KroMignon
There is a problem with QEventLoop exec()
I can't exit by emitting signal. And browser console says: "Uncaught Please compile your program with async support in order to use asynchronous operations like emscripten_sleep"Made something like this:
bool myclass::func(){ .... QEventLoop el; connect(this, &myclass::mysignal, &el, &QEventLoop::exit)); el.exec(); /// unreachable string } void myclass::recieve_msg(const QByteArray &message){ ... emit mysignal(0); }
msvc compiled app works fine.
Glad to see any advice.
-
secondary event loops are not really supported in emscripten. In Qt, you can run them, but they never return, or they won't return to the place you expect, as we needed to raise a javascript exception to pop out of it and return to the main loop.
You might try Qt 6.3 and reconfiguring with asyncify ( -device-option QT_EMSCRIPTEN_ASYNCIFY=1 ), which has workarounds for Emscripten event loop.
-
secondary event loops are not really supported in emscripten. In Qt, you can run them, but they never return, or they won't return to the place you expect, as we needed to raise a javascript exception to pop out of it and return to the main loop.
You might try Qt 6.3 and reconfiguring with asyncify ( -device-option QT_EMSCRIPTEN_ASYNCIFY=1 ), which has workarounds for Emscripten event loop.
-
Trying to do next:
C:\Qt\6.3.0>\Src\configure.bat -qt-host-path C:\Qt\6.3.0\wasm_32 -no-warnings-are-errors -platform wasm-emscripten -device-option QT_EMSCRIPTEN_ASYNCIFY=1 -prefix C:\Qt\6.3.0\wasm_32_asyncifyBut there is an error message:
CMake Error at qtbase/cmake/QtToolHelpers,cmake:156 (message): The tool "Qt6::moc" was not found in the Qt6CoreTools package.
... -
Trying to do next:
C:\Qt\6.3.0>\Src\configure.bat -qt-host-path C:\Qt\6.3.0\wasm_32 -no-warnings-are-errors -platform wasm-emscripten -device-option QT_EMSCRIPTEN_ASYNCIFY=1 -prefix C:\Qt\6.3.0\wasm_32_asyncifyBut there is an error message:
CMake Error at qtbase/cmake/QtToolHelpers,cmake:156 (message): The tool "Qt6::moc" was not found in the Qt6CoreTools package.
...@sitesv said in QApplication::processEvents() doesn't works:
Trying to do next:
C:\Qt\6.3.0>\Src\configure.bat -qt-host-path C:\Qt\6.3.0\wasm_32 -no-warnings-are-errors -platform wasm-emscripten -device-option QT_EMSCRIPTEN_ASYNCIFY=1 -prefix C:\Qt\6.3.0\wasm_32_asyncify
But there is an error message:
CMake Error at qtbase/cmake/QtToolHelpers,cmake:156 (message): The tool "Qt6::moc" was not found in the Qt6CoreTools package.This Q was solved. There is an error in qt host parameter...
But problem with QEventLoop still exist...