QList<QList<QSqlRecord>>



  • 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.at(i).append(another list of records);

    I get this error:

    error: passing 'const QList<QSqlRecord>' as 'this' argument discards qualifiers [-fpermissive]
    m_records.at(i).append(m_sqlTable->records());
    ^

    What should I do?


  • Moderators

    @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

        m_records.append(QList<QSqlRecord>());
        m_records[i].append(m_sqlTable->records());

Log in to reply
 

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