maybe the confusion here is my semi pseudo code:

Qt Code:
  1. QString str = "Some string";
  2. const char * c_string = str.toStdString().c_str();
To copy to clipboard, switch view to plain text mode 

not

Qt Code:
  1. const char * c_string = QString().toStdString().c_str();
To copy to clipboard, switch view to plain text mode 

I agree putting the latter line into code would probably segfault or return NULL to the pointer. Sorry for the confusion.