[SOLVED] Sending data from one delegate to another not working properly



  • i have an image listview that i want to pass the name from the model to another delegate
    via the property string iName

    in main.qml
    @
    Common.MenuModel { id: menuModel }
    Common.MenuDelegate { id: menuDetails }//-- HERE

         Rectangle {
             id: menuCont
             color: "black"
             width: 350; height: 290; x: -(parent.width * 500); y: 445;
    
             ListView {
                 id: menuListView; model: menuModel; delegate: menuDetails
                 width: 344; height: 275; x:  -(parent.width * 500); cacheBuffer: 100;
                 anchors.fill:parent; clip: true
                 anchors.leftMargin: 6
             }
         }
    

    @

    in IconModel.qml
    @
    import QtQuick 1.0

    Component {
    Item {
    id: wrapper; width: 135; height: 207

        function iconClicked() {
            menuDetails.iName = iName;    //-- HERE
        }
    
        Item {
            id: moveMe
            Rectangle {
                id:icon
                width: 135; height: 207; color: "#00000000"; smooth: true
                Image { source: "/TouchTaxiMedia/Client/" + iImagePath;  }
    
                MouseArea { anchors.fill: parent; onClicked: if (screen.inMenuListView == true) screen.inMenuListView = false; else screen.inMenuListView = true }
            }
            Column {
                x: 35; y: 209; width: wrapper.ListView.view.width
                Text { text: iName; color: "white"; width: parent.width;  font.pixelSize: 14; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
            }
        }
          MouseArea { anchors.fill: wrapper; onClicked: iconClicked() }
    }
    

    }
    @

    in MenuDelegate.gml

    @
    import QtQuick 1.0

    Component {
    Item {
    id: wrapper1; width: 344; height: 57
    property string iName //-- HERE
    Item {
    id: moveMe

            Rectangle {
                id:fadingByBehavior
                width: 344; height: 57; color: "#00000000"; smooth: true
                Image { source: "../Logic/images/textbox/directory.png"}
    
                Behavior on opacity { PropertyAnimation { duration: 1000 } }
                MouseArea { anchors.fill: parent; onClicked: fadingByBehavior.opacity = 0.2 }
            }
            Column {
                x: 15; y: 15; width: wrapper1.ListView.view.width
                Text { text: iName; color: "white"; width: parent.width;  font.pixelSize: 20; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
    

    // Text { text: sName; color: "white"; width: parent.width; font.pixelSize: 14; elide: Text.ElideLeft; style: Text.Raised; styleColor: "black" }
    }
    }
    }
    }
    @

    i get error

    Error: Cannot assign to non-existent property "iName"



  • I solved this issue by putting the information in the model and searching the string from

    iName from
    @
    function iconClicked() {
    menuDetails.iName = iName; //-- HERE
    }
    @

    Thanks


Log in to reply
 

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