
Originally Posted by
wysota
std::string str = qstr;
QString qstr = "xxx";
std::string str = qstr;
To copy to clipboard, switch view to plain text mode
This should work fine.
If not, you can do:
std::string str(qstr.ascii());
QString qstr = "xxx";
std::string str(qstr.ascii());
To copy to clipboard, switch view to plain text mode
When I try
std::string str = qstr;
QString qstr = "xxx";
std::string str = qstr;
To copy to clipboard, switch view to plain text mode
it works fine. But when I try
std::string str;
str = qstr;
QString qstr = "xxx";
std::string str;
str = qstr;
To copy to clipboard, switch view to plain text mode
I get error: ambiguous overload for 'operator=' in 'str = qstr'. Why is that? Is conversion between QString and std::string well defined while assignment of a QString on an already created std::string becomes ambiguous?
Bookmarks