我在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.