[SOLVED]passing 'const QJsonArray' as 'this' argument of 'QJsonArray& QJsonArray::operator=(const QJsonArray&)'



  • Hello everybody,
    I do not know why i get an error when trying to do this:
    @
    QJsonArray myArray;
    //fill myArray with data
    QJsonArray anOtherArray;
    anOtherArray = myArray;

    @
    QJsonArray is not my own class, so i did not make any mistake in its implementaion.

    the error message is : "passing 'const QJsonArray' as 'this' argument of 'QJsonArray& QJsonArray::operator=(const QJsonArray&)'"

    Any help will be appreciated !
    Thanks


  • Lifetime Qt Champion

    Hi,

    You should post the complete code of the function including its signature. What you posted here works just fine.



  • OK, no problem

    @
    //liste des niveaux;
    QJsonArray listeNiveauMat;

            QString matNiv1("Petite section");
            listeNiveauMat.append(QJsonValue(matNiv1).toString());
            QString matNiv2("Moyenne section");
            listeNiveauMat.append(QJsonValue(matNiv2).toString());
            QString matNiv3("Grande section");
            listeNiveauMat.append(QJsonValue(matNiv3).toString());
    
            listeNiveau = listeNiveauMat;//listeNiveau is member of my own class
    

    @



  • Sorry, the problem was not that line, but the signature of my function... But the compiler notify the problem was from that line (i understand now)
    Thank you SGaist ! for you disponibility !


  • Lifetime Qt Champion

    You're welcome !

    Glad you found out

    Happy coding :)


Log in to reply
 

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