[SOLVED]QDesktopServices::openUrl() fails to open a file with spaces
General and Desktop
4
Posts
2
Posters
11.6k
Views
1
Watching
-
@
QString str="/home/ab/My Video.avi";
QDesktopServices::openUrl(QUrl::fromLocalFile(str));
@ -
If you pass QString instead of QUrl this will be automatically converted to:
@
QString str="/home/ab/My Video.avi";
QDesktopServices::openUrl(QUrl(str));
@and Qurl::QUrl(const QString &) constructor says:
bq. Constructs a URL by parsing url. url is assumed to be in human readable representation, with no percent encoding. QUrl will automatically percent encode all characters that are not allowed in a URL. The default parsing mode is TolerantMode.
Always use QUrl with right constructor or static function...
And please add "[SOLVED]" prefix left to the topic subject.