QString::toWCharArray可以拷贝到宽字符串里

wchar_t * sourcepath=new wchar_t[MAX_PATH];
int s1=str.toWCharArray(sourcepath);
sourcepath[s1]=0;

原文地址:https://www.cnblogs.com/findumars/p/6005471.html