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!

Recommended Answers

All 2 Replies

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.

@ Ravenous thanks alot!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.