Qt ide gives error about"error: passing 'const QChar' as 'this' argument of 'QChar& QChar::operator=(const QChar&)' discards qualifiers"

for(int i=reqposition;;i++)

temp.at(j)=data.at(i);  // ERROR IS HERE

what do i do to solve it!

Edited 3 Years Ago by Nick Evan: Fixed formatting

If you look at the documentation for QString here you can see that QString::at is declared as:

const QChar QString::at ( int position ) const

As you can see, the at member returns a QChar by value, which means you can use this method to see the value of a a character, but not to set the value. This is in contrast to the behaviour of the at member of std::string , which returns by reference and is overloaded with const and non-const versions. See here and compare with the QString version.

This question has already been answered. Start a new discussion instead.