I am looking for a suitable replacement of toAscii(), since it is deprecated in Qt5.

Is
Qt Code:
  1. QString str("test");
  2. const char* ptr = (const char*) (str.utf16());
To copy to clipboard, switch view to plain text mode 

a good substitute for toAscii()?

Advise/comment is appreciated, thanks.