Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML Connections, Cannot assign to non-existent property "onIgnoreUnknownSignalsChanged"
Qt 6.11 is out! See what's new in the release blog

QML Connections, Cannot assign to non-existent property "onIgnoreUnknownSignalsChanged"

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 3.1k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by SPlatten
    #1

    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.html

    target 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?

    Kind Regards,
    Sy

    1 Reply Last reply
    0
    • SPlattenS SPlatten

      @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)
      
      SPlattenS Offline
      SPlattenS Offline
      SPlatten
      wrote on last edited by
      #4

      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.

      Kind Regards,
      Sy

      1 Reply Last reply
      2
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #2

        model has 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.

        (Z(:^

        SPlattenS 1 Reply Last reply
        0
        • sierdzioS sierdzio

          model has 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.

          SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by
          #3

          @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)
          

          Kind Regards,
          Sy

          SPlattenS 1 Reply Last reply
          0
          • SPlattenS SPlatten

            @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)
            
            SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by
            #4

            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.

            Kind Regards,
            Sy

            1 Reply Last reply
            2

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved