Hello guys after googling a while and reading about references, I still can't get what's wrong with this. I'm getting two compiler error and both say:
error: passing ‘const QStringList’ as ‘this’ argument of ‘QStringList& QStringList:
perator<<(const QString&)’ discards qualifiers
The code generating this error is:
QString DBMigrator
::parsePostGISSrcFields(const TableInfo
*tableInfo,
const bool &ignore
) const {
GeometryColumnInfo *column;
foreach(field, tableInfo->fieldNames())
{
foreach(column, geometryColumns[tableInfo->name()])
{
if (field == column->columnName())
{
if (!ignore)
{
this->ignoredFields << field;
}
else
{
fields <<
QString("AsText(%1)").
arg(field
);
this->geometryFields << field;
}
}
else
{
fields << field;
}
}
}
// qDebug(QString("%1:\n %2").arg(tableInfo->name()).arg(fields.join(", ")).toAscii());
return fields.join(", ");
}
QString DBMigrator::parsePostGISSrcFields(const TableInfo *tableInfo, const bool &ignore) const
{
GeometryColumnInfo *column;
QStringList fields;
QString field;
foreach(field, tableInfo->fieldNames())
{
foreach(column, geometryColumns[tableInfo->name()])
{
if (field == column->columnName())
{
if (!ignore)
{
this->ignoredFields << field;
}
else
{
fields << QString("AsText(%1)").arg(field);
this->geometryFields << field;
}
}
else
{
fields << field;
}
}
}
// qDebug(QString("%1:\n %2").arg(tableInfo->name()).arg(fields.join(", ")).toAscii());
return fields.join(", ");
}
To copy to clipboard, switch view to plain text mode
And the lines are where appending QStrings to the QStringLists (this->geometryFields, this->ignoredFields) both QStringLists are private to the class.
I don't know what's wrong, what confuses me more, is that if I declare a QStringList local to this method and do the append operations on that QStringList, I got no error.
Can anybody explain me what's happening, what am I doing wrong? or point me to a document that explains something like this?
Thanx a lot in advance.
Cheers.
Bookmarks