The error message is telling you that you are attempting to use a non-const
method on a const
instance. In this case, you are trying to call QVector::replace
on a const QVector
. The main reason for this is because you are using QHashIterator
, which only returns const
references from QHashIterator::value()
.
To fix this, you could use the STL-style iterator instead of the Java-style iterator on the QHash
:
QString b("Cluster");
QHash<QString, QVector<float> >::iterator it;
for (it = qhash.begin(); it != qhash.end(); ++it)
{
if (it.key() != b)
{
for (int j=0; i<it.value().size(); j++)
{
old_value = it.value().at(j);
new_value = (old_value-min)/(max-min)*(0.99-0.01) + 0.01;
it.value().replace(j, new_value);
}
}
}
You could also use QMutableHashIterator
instead of QHashIterator
.