Important: Please read the Qt Code of Conduct -


  • Hi,
    I wanted to have a list of list of sqlRecords so I did this:

    QList<QList<QSqlRecord>> list;

    but when I do this:

    list[i].append(another list of records);

    the program crashes and when I do this: list of records);

    I get this error:

    error: passing 'const QList<QSqlRecord>' as 'this' argument discards qualifiers [-fpermissive]>records());

    What should I do?

  • @shahriar25
    That is because of const T &QList::at(int i) const. You are trying to mdify a const reference to the element.

    This should work.
    list[i].append(another list of records);

    BTW It should be a compile error and not a crash of your application.

  • Hi I did this and the problem was solved. it was really a silly mistake of mine and I,m sorry. you were right


Log in to reply