Quote Originally Posted by wysota View Post
Qt Code:
  1. QString qstr = "xxx";
  2. std::string str = qstr;
To copy to clipboard, switch view to plain text mode 
This should work fine.

If not, you can do:
Qt Code:
  1. QString qstr = "xxx";
  2. std::string str(qstr.ascii());
To copy to clipboard, switch view to plain text mode 
When I try

Qt Code:
  1. QString qstr = "xxx";
  2. std::string str = qstr;
To copy to clipboard, switch view to plain text mode 

it works fine. But when I try

Qt Code:
  1. QString qstr = "xxx";
  2. std::string str;
  3. 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?