[Interest] porting Qt4 -> 5, QDesktopServices::openUrl() fails

Felix morack felixover at gmail.com
Wed Apr 8 11:21:34 CEST 2015


Hi,

I am porting code from Qt4 to Qt5 and the behavior of
QDesktopServices::openUrl() seems to have changed.

We want to open a folder/path in the default explorer shell, which was done
like so:

 QDesktopServices::openUrl(QUrl::fromLocalFile("c:/testdir/");

Even though it says "from local file" it would open the directory just
fine, and there are several forum entries online that recommend doing just
that.

However, in Qt5 the same code fails silently at runtime due to it not
pointing to a valid file. The documentation has remained the same.


Was there a silent change in behavior? Is this a regression? What is the
recommended way to open a path in the default shell?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150408/6371a5b6/attachment.html>


More information about the Interest mailing list