Id and properties not found problem



  • Dear all,

    I'm actually experimenting Qt/QML with RTMaps (a real time graphical programming tool).

    I faced with an issue a lot of time, i could turn around but i'm really asking why when I use this component (the code is just below) in my main .qml,
    the property defined using the ParamsPanel's id azert raises an error: azert id cannot be found but it is.
    I had the issue with the Rectangle called container.

    import QtQuick 2.5
    import QtQuick.Controls 1.0 /** Tab import **/
    
    /** #### SettingsTab component ### **/
    Tab {
        id : root
        title : "Settings"
        anchors.fill: parent
    
        /** ### Properties ### **/
        /** ### INPUTS ### **/
        property string ipIn: ""
        property int portIn: 0
        property int interPingIn: 0
        property int packetCountIn: 0
        /** ### OUTPUTS ### **/
        property string ipOut: azert.ipOut
        property int portOut: azert.portOut
        property int interPingOut: azert.interPingOut
        property int packetCountOut: azert.packetCountOut
    
        /** #### SubComponents ### **/
        Rectangle {
            id : container
            anchors.fill: parent
            color: "#00000000"
    
            /** #### SubComponents [LEVEL 2] ### **/
            ParamsPanel {
    
                x: 282
                y: 243
                id:azert     
                anchors.bottom: parent.bottom
                anchors.bottomMargin: 127
                anchors.right: parent.right
                anchors.rightMargin: 30
    
                /** ### INPUT PROPERTIES SET ### */
                ipIn: root.ipIn
                portIn: root.portIn
                interPingIn: root.interPingIn
                packetCountIn: root.packetCountIn
            }
        }
    }
    
    

    The error:

    SettingsTab.qml:40: ReferenceError: azert is not defined
    SettingsTab.qml:39: ReferenceError: azert is not defined
    SettingsTab.qml:38: ReferenceError: azert is not defined
    SettingsTab.qml:37: ReferenceError: azert is not defined
    

    If someone see where i am wrong, please help me ! :)

    Thanks for your help,
    Olivier


  • Qt Champions 2016

    @olivierguzziIDEOL said in Id and properties not found problem:

    property string ipOut: azert.ipOut

    probably azert isn't created at the time the ipOut string refers to azert
    try something like this:

    property string ipOut: azert? azert.ipOut : ""
    


  • I tried but it didn't work :/
    I already tried to put the property declaration under the azert (ParamsPanel) declaration but it didn't work too.

    The id is declared just after its use.

    It seems like my component's id isn't set to what i wrote after id:, is it possible ? When i launch my console, the display is nice but i can't access ipOut from my program.
    I have a big problem with id.


  • Qt Champions 2016

    @olivierguzziIDEOL sorry - have no idea. never did QtQuickControls 1.0 apps - started Qt development with QtQuickControls2



  • @olivierguzziIDEOL You can define Component.onCompleted for each item where you check if azert is available.

    Component.onCompleted: {
    console.log("Tab(/Rectangle/ParamsPanel) is now completed")
    console.log(azert)
    }
    

    It should be at least in ParamPanel's onCompleted. There you should be able to bind the Tab's properties dynamically.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.