QML Connections, Cannot assign to non-existent property "onIgnoreUnknownSignalsChanged"
-
I'm getting this message:
PlantInputs.qml:149:21: QML Connections: Cannot assign to non-existent property "onIgnoreChanged"Line 149 is the Connections:
Connections { target: model onIgnoreChanged: { if ( typeof ignoreState == "object" ) { console.log("modelIgnore: " + (typeof modelIgnore)); ignoreState.switchState = modelIgnore ? constants.off : constants.on; } } }I've searched around online for help and found:
https://doc.qt.io/qt-5/qtqml-syntax-signals.htmltarget would appear to be assigned the id of the item that has the property "Ignore", I cannot see any item with the id "model" in the QML file. Would this explain the error?
-
@sierdzio , thank you, this is from the original Qt 4.8 project which as far as I'm aware was working, although I cannot say for certain:
From the QML:
RoundedSwitch { id: ignoreState onTextColor: "white" offTextColor: "grey" offSwitchBackgroundColor: "white" fillColor: Utils.buttonGradientLightColor() switchState: model.ignore anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: 35 onButtonPushed: { //if switchstate = off, ignore ioSensorModel.setIgnoreValue(model.id, switchState == constants.off) } Component.onCompleted: { ignoreState.switchState = model.ignore ? constants.off : constants.on; } Connections { target:model onIgnoreChanged: { ignoreState.switchState = model.ignore ? constants.off : constants.on } } }model I'm assuming is the model in the parent ListView container which is set as follows:
ListView { id: inputListView anchors.fill: parent model:ioSensorModel.getMachineSensorListModel(constants.machineInputType)I've fixed this now by writing functions that check the C++ function returns:
model: { var machineSensorListModel; if ( typeof ioSensorModel === "object" ) { var fn = ioSensorModel.getMachineSensorListModel; if ( typeof fn === "function" ) { machineSensorListModel = fn(constants.machineInputType); } } return machineSensorListModel; }I no longer get the messages.
-
modelhas to come from somewhere. It can be a property of one of your items (like ListView, Repeater, GridView, ComboBox etc.), or an object set as context property on QML engine (in your C++ code). Hard to say anything more without more data.Purely guessing based on names, I'd say the slot name should rather be
onIgnoreStateChanged. But it's only a guess.Use Ctrl+Shift+F (in Qt Creator) to look for:
"model"model:ignoreChanged(ignoreStateChanged(
One of these should yield some results.
-
modelhas to come from somewhere. It can be a property of one of your items (like ListView, Repeater, GridView, ComboBox etc.), or an object set as context property on QML engine (in your C++ code). Hard to say anything more without more data.Purely guessing based on names, I'd say the slot name should rather be
onIgnoreStateChanged. But it's only a guess.Use Ctrl+Shift+F (in Qt Creator) to look for:
"model"model:ignoreChanged(ignoreStateChanged(
One of these should yield some results.
@sierdzio , thank you, this is from the original Qt 4.8 project which as far as I'm aware was working, although I cannot say for certain:
From the QML:
RoundedSwitch { id: ignoreState onTextColor: "white" offTextColor: "grey" offSwitchBackgroundColor: "white" fillColor: Utils.buttonGradientLightColor() switchState: model.ignore anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: 35 onButtonPushed: { //if switchstate = off, ignore ioSensorModel.setIgnoreValue(model.id, switchState == constants.off) } Component.onCompleted: { ignoreState.switchState = model.ignore ? constants.off : constants.on; } Connections { target:model onIgnoreChanged: { ignoreState.switchState = model.ignore ? constants.off : constants.on } } }model I'm assuming is the model in the parent ListView container which is set as follows:
ListView { id: inputListView anchors.fill: parent model:ioSensorModel.getMachineSensorListModel(constants.machineInputType) -
@sierdzio , thank you, this is from the original Qt 4.8 project which as far as I'm aware was working, although I cannot say for certain:
From the QML:
RoundedSwitch { id: ignoreState onTextColor: "white" offTextColor: "grey" offSwitchBackgroundColor: "white" fillColor: Utils.buttonGradientLightColor() switchState: model.ignore anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: 35 onButtonPushed: { //if switchstate = off, ignore ioSensorModel.setIgnoreValue(model.id, switchState == constants.off) } Component.onCompleted: { ignoreState.switchState = model.ignore ? constants.off : constants.on; } Connections { target:model onIgnoreChanged: { ignoreState.switchState = model.ignore ? constants.off : constants.on } } }model I'm assuming is the model in the parent ListView container which is set as follows:
ListView { id: inputListView anchors.fill: parent model:ioSensorModel.getMachineSensorListModel(constants.machineInputType)I've fixed this now by writing functions that check the C++ function returns:
model: { var machineSensorListModel; if ( typeof ioSensorModel === "object" ) { var fn = ioSensorModel.getMachineSensorListModel; if ( typeof fn === "function" ) { machineSensorListModel = fn(constants.machineInputType); } } return machineSensorListModel; }I no longer get the messages.