Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

[SOLVED]Multidimensional array



  • Hi guys,

    I'm trying to use a multidimensional array:

    @
    QList<QList<QVariant> > info;
    //Append QList<QVariant> works...
    info.at(0).append(query->value(0));
    @

    When I try do append same data at info (line 3) I have the error: "error: passing 'const QList<QVariant>' as 'this' argument of 'void QList<T>::append(const T&) [with T = QVariant]' discards qualifiers"

    Does anyone has a clue of how to fix this?

    Thanks.



  • Seems like the method from which do execute the code (line 3) is inside a "const" method.

    Methods with "const" keyword can read member variables (such as info), but not modify them!


  • Moderators

    at() returns const reference. Use operator [] instead to modify the list element (the append() modifies it).



  • It works!

    Thank you Krysztorf Kawa!


Log in to reply