Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]passing 'const QJsonArray' as 'this' argument of 'QJsonArray& QJsonArray::operator=(const QJsonArray&)'
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    k_arnaud
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        k_arnaud
        wrote on last edited by
        #3

        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
        

        @

        1 Reply Last reply
        0
        • K Offline
          K Offline
          k_arnaud
          wrote on last edited by
          #4

          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 !

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            You're welcome !

            Glad you found out

            Happy coding :)

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved