[Development] Compatability break in QUrl in Qt 4.8

ext-aapo.haapanen at nokia.com ext-aapo.haapanen at nokia.com
Mon Jan 30 14:30:32 CET 2012


Hi,

The behaviour of QUrl::toLocalFile() was changed between Qt 4.7.4 and 4.8. I would like to open discussion for reverting that change for 4.8 in order to maintain backward compatibility for applications.

The change concerns how toLocalFile() handles relative urls. Before 4.8 it returned the path, but in 4.8 it returns an empty string.
  4.7: QUrl("dir/file.html").toLocalFile(); returns "dir/file.html"
  4.8: QUrl("dir/file.html").toLocalFile(); returns QString()

This change has been previously discussed in QTBUG-19827, and the conclusion was that this is an intentional break of binary and source compatibility.

The documentation doesn't specify how relative urls are handled by the function. I can see how both behaviours make some sense. A relative url can refer to a local file, but that can't be deduced from the url alone. 4.7 took a more lenient approach and returned the relative path. In 4.8 relative urls must be resolved first, and only when we know for sure that the url refers to a local file, the path is returned.

The behaviour of 4.7 gives application a bit more flexibility on how to handle the urls. I can't see a clear benefit from the new behaviour.

This is an unnecessary break of compatibility between minor versions, and this has been found to break some paid applications in Ovi Store. For that reason I would like to see the behaviour reverted for 4.8.

BR,
Aapo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120130/de16552c/attachment.html>


More information about the Development mailing list