0

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

for(int i=reqposition;;i++)
{
if(data.at(i)==',')
break;


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

what do i do to solve it!

Edited by Nick Evan: Fixed formatting

2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by nine9hours
Featured Replies
  • If you look at the documentation for [icode]QString[/icode] [URL="http://qt-project.org/doc/qt-4.8/qstring.html#at"]here[/URL] you can see that [icode]QString::at[/icode] is declared as: [code] const QChar QString::at ( int position ) const [/code] As you can see, the [icode]at[/icode] member returns a [icode]QChar[/icode] by [i]value[/i], which means you can use this method to see the value … Read More

1

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.