0
当上下文变量发生变化时,isOn属性是否也会在代码的下面进行修改?QML属性绑定
property bool isOn: {
if(context === undefined)
return false;
return true
}
当上下文变量发生变化时,isOn属性是否也会在代码的下面进行修改?QML属性绑定
property bool isOn: {
if(context === undefined)
return false;
return true
}
诀窍是,尝试一下:
import QtQuick 2.7
import QtQuick.Controls 2.0
ApplicationWindow {
id: appWindow
width: 500
height: 800
visible: true
property bool isOn: {
if(context === undefined)
return false;
return true
}
property var context
Button {
text: isOn
onClicked: (context ? context = undefined : context = 1)
}
}
提示:是
非常感谢你,我来试试 – yonutix