Important: Please read the Qt Code of Conduct -

[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 !

  • Lifetime Qt Champion


    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");
            QString matNiv2("Moyenne section");
            QString matNiv3("Grande section");
            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