有没有办法在Qt的scxml实现中使用http源来获取数据?在其他实现中,这是可行的,但在我的Qt版本5.15.3中不行。
当使用简单的状态机时,它的数据src指向我正在运行的烧瓶脚本,我得到以下错误:
qrc:/main.qml:15:5: QML StateMachineLoader: :/http.scxml:5:59: error: src attribute resolves to non existing file (:/http://localhost:8080/) qrc:/main.qml: 15我不能为数据定义远程源吗?
州议员:
<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" binding="early"
xmlns:qt="http://www.qt.io/2015/02/scxml-ext" datamodel="ecmascript" name="http_test" initial="test">
<datamodel>
<data id="http_data" src="http://localhost:8080/"/>
</datamodel>
<state id="test">
<onentry>
<send event="entried" delay="2s">
<param name="eventbody" location="http_data"/>
</send>
</onentry>
</state>
</scxml>qml:
import QtScxml 5.15
id:theId
property StateMachine stateMachine: scxmlLoader.stateMachine
StateMachineLoader {
id: scxmlLoader
source: "http.scxml"
}
EventConnection {
events: ["entried"]
stateMachine: theId.stateMachine
onOccurred: {
var d=event.data
console.debug(d.eventbody)
}
}发布于 2022-05-30 18:56:12
仅适用于本地文件。

https://stackoverflow.com/questions/72016026
复制相似问题