简体   繁体   English

如何在js文件中使用qml相机?

[英]How to use qml camera in js file?

I want to capture images in new thread because this process freezes main GUI. 我想在新线程中捕获图像,因为这个过程会冻结主GUI。 How can I make new thread to use qml camera in Javascript to avoid freezing of main interface? 如何在Javascript中使用qml相机创建新线程以避免主界面冻结?

//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. QML实际上并不是为了在多个线程中工作而设计的。 The origional intention was that any threading should be handled by the layer existing in C++. 原始意图是任何线程都应该由C ++中存在的层处理。 Check this link for an example for capturing images in C++. 查看此链接以获取在C ++中捕获图像的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM