问题描述:

I want to capture images in new thread because this process freezes main GUI. How can I make new thread to use qml camera in Javascript to avoid freezing of main interface?

//main.qml MouseArea

{

anchors.fill: parent

onClicked:

myWorker.sendMessage("Capture Image")

}

WorkerScript

{

id: myWorker

source: "qrc:/images/threader.js"

onMessage:console.log("Captured")

} //threader.js WorkerScript.onMessage=function(message) {

WorkerScript.sendMessage({'reply': camera.ImageCapture.Capture()}) }

网友答案:

QML is not really designed with the intention of working within more than one thread. The origional intention was that any threading should be handled by the layer existing in C++. Check this link for an example for capturing images in C++.

相关阅读:
Top