service - Qt QDesktopServices::openUrl() error 2 -


i have problem open file using qdesktopservices::openurl() function.

i have code generates absolute address of file when try run i´m getting shellexecute error 2.

this code i´m using:

void openfilemainwindow::runsong() { qaction *act = qobject_cast<qaction *>(sender());  qstring addr = "file:///"; addr.append(qstring(act->data().tostring()));  qbytearray temparray  = addr.toutf8(); const char * addrw    = temparray.data();  qmessagebox::warning(this, tr("info"), tr("you trying open file:\n%1").arg(addrw), qmessagebox::ok);  qdesktopservices::openurl(qurl(addrw, qurl::tolerantmode));  

}

when tried write path manualy "file:///.../file.mp3" working good, why generated address not? tried qstring addr only, same result.

for sure encoding problem. qurl takes qstring first parameter. no idea remained initial qstring addr after squeezed qbytearray , take const char * address , let qurl convert qstring.

any particular reason why don't pass addr qurl? without temparray? addrw?


Comments

Popular posts from this blog

Issues changing the value of an element in an array in matlab -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

vb.net - Alternative to the T-SQL AS keyword -