sorry for posting what i am afraid is a pure c++-problem here, but at least it is about a qt-program:
i have a loop going through a query and a QMap where i want to store the type and name of each column that is found. so i am trying to put the result of QSqlField::type() into my QMap, but this gives an error because it is const. Why is that? after all i had expected i am actually only copying the value into my QMap so no need to care about the original being const?
the code looks like this:
Qt Code:
  1. while (query.next()) {
  2. QSqlRecord rec = query.record();
  3. for (int col=0;col<rec.count();col++) {
  4. QSqlField field = rec.field(col);
  5. if (row == 0) {
  6. QMap<QString,QVariant>* currCol = &columns.value(col);
  7. currCol->insert("type",field.type()); // first error
  8. currCol->insert("name",field.name()); // second error
  9. }
  10. qDebug() << "working on row " << row << ", column " << col;
  11. }
  12. tableData.value(row) = rec; //third error
  13. row++;
  14. }
To copy to clipboard, switch view to plain text mode 
and in the .h i have:

Qt Code:
  1. QMap<int,QSqlRecord> tableData;
  2. QMap<int,QMap<QString,QVariant> > columns;
To copy to clipboard, switch view to plain text mode 

the errors i am getting are all like this:
passing `const QString' as `this' argument of `QString& QString::operator=(char)' discards qualifiers