我在QML中有一个代码片段,它应该在screen.text中查找正则表达式“调用”,如果找不到,只有这样它才会更改screen.text。很抱歉,QML/QString documentation中的文档不明确。在QML中包含(regexp)什么可能是Qstring /字符串
Button{
id: call
anchors.top: seven.bottom
anchors.left: seven.left
text: "Call"
width: 40
onClicked:{
if(screen.text.toString().startsWith("Calling" , false))
return;
else
screen.text = "Calling " + screen.text
}
}
我得到的错误是:
file:///home/arnab/workspace/desktop/examples/cellphone.qml:127: TypeError: Result of expression 'screen.text.toString().startsWith' [undefined] is not a function.