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. QList<QList<QSqlRecord>>
Forum Updated to NodeBB v4.3 + New Features

QList<QList<QSqlRecord>>

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.1k Views 2 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.
  • S Offline
    S Offline
    shahriar25
    wrote on 16 Apr 2016, 17:27 last edited by
    #1

    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 16 Apr 2016, 18:01
    0
    • S shahriar25
      16 Apr 2016, 17:27

      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 Offline
      K Offline
      koahnig
      wrote on 16 Apr 2016, 18:01 last edited by
      #2

      @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
      0
      • S Offline
        S Offline
        shahriar25
        wrote on 17 Apr 2016, 16:35 last edited by
        #3

        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
        0

        1/3

        16 Apr 2016, 17:27

        • Login

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