Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

QML: Receive signals from C++ object in different thread

$
0
0
its gonna be a lot of code to post. but, the way it works now is: the qml window’s (window2,qml) parent is declared in main.qml (window1.qml). I then have a mainThread.cpp that connects to main.qml, so, any object running (e.g. test.cpp) in a different thread emits a signal to mainThread.cpp, and this signal is received by main.qml, then main.qml calls a function (decalred in window1.qml) to access the child window (window2.qml) and to process the signal emitted by test.cpp). so, i have main.qml, that receives any signals and passes it to the relevant window. thats what i’m not happy with. If there is a pattern to access the signal (emitted from test.cpp) directly to window2.qml, bypassing main.qml, I’d be very happy. but Window2.qml cannot receive signals directly from test.cpp. From what I could tell, I’d probably have to add something like this into the test.cpp object: QmlApplicationViewer viewer; viewer.setMainQmlFile(QLatinString(“qml/project_folder/Window2.qml”); viewer.showExpanded(); but I want to confirm that I’m on the right track, if not, can you do it, and how do you do it. Thanks!

Viewing all articles
Browse latest Browse all 4972

Trending Articles