M_strCurrentDir=GetCurrentDir ();
M_strTargetFile. The Format (_T (" % s \ \ sound \ \ target \ \ 1. Wav "), m_strCurrentDir);
M_strNontargetFile. The Format (_T (" % s \ \ sound \ \ nontarget \ \ 1. Wav "), m_strCurrentDir);
I said so is that ok? (user. Pro file and in the same directory (folder)
M_strTargetFile=":/sound/target/1. Wav";
M_strNonTargetFile=":/sound/nontarget/1. Wav";
CodePudding user response:
Purpose is to take to the resource path, can be placed in an executable program folder, according to the QApplication: : applicationDirPath () to the executable path, according to the relative path can find want resource file, subsequent packaging also like this is okCodePudding user response:
If you want to play this file, I can write like this?M_strCurrentDir=QApplication: : applicationDirPath ();
M_strTargetFile=m_strCurrentDir. Append ("/sound/target/1. Wav ");
Player=new QSound (m_strTargetFile);
Player - & gt; Play ();
Don't know how to write the relative path,,,