Invalid write to global property QML

10,492

Try to reference InfoBanner instance by id:

InfoBanner
{
    property string infodetails: ""
    id: systemuicfgErrorBanner
    text: "Error: " + infodetails
    Connections
    {
        target: cfgScanner
        onError: systemuicfgErrorBanner.infodetails = desc
    }
}
Share:
10,492
marmistrz
Author by

marmistrz

Updated on June 24, 2022

Comments

  • marmistrz
    marmistrz about 2 years

    I have this signal

    class SystemUICfgScanner 
    {
        /*code here*/
    signals:
        void error(QString desc);
        /*more code*/
    };
    

    In QML I use an InfoBanner this way:

    InfoBanner
    {
        property string infodetails: ""
        id: systemuicfgErrorBanner
        text: "Error: " + infodetails
        Connections
        {
            target: cfgScanner
            onError: infodetails = desc
        }
    }
    

    When error(QString) signal is emitted, I'm getting this error

    Invalid write to global property "infodetails"
    

    What am I doing wrong?

    Thanks in advance