Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QList<QList<QSqlRecord>>

    General and Desktop
    2
    3
    899
    Loading More Posts
    • 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.
    • S
      shahriar25 last edited by

      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?

      K 1 Reply Last reply Reply Quote 0
      • K
        koahnig @shahriar25 last edited by

        @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.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply Reply Quote 0
        • S
          shahriar25 last edited by

          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());
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post