Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid write to global property QML

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

like image 443
marmistrz Avatar asked Sep 05 '12 14:09

marmistrz


1 Answers

Try to reference InfoBanner instance by id:

InfoBanner
{
    property string infodetails: ""
    id: systemuicfgErrorBanner
    text: "Error: " + infodetails
    Connections
    {
        target: cfgScanner
        onError: systemuicfgErrorBanner.infodetails = desc
    }
}
like image 172
sergk Avatar answered Oct 21 '22 14:10

sergk