[Development] Compatability break in QUrl in Qt 4.8

Olivier Goffart olivier at woboq.com
Mon Jan 30 16:19:25 CET 2012


On Monday 30 January 2012 13:30:32 ext-aapo.haapanen at nokia.com wrote:
> 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.


+1

This actually broke sounds notification in KDE
https://bugs.kde.org/show_bug.cgi?id=291333
https://bugs.kde.org/show_bug.cgi?id=288764





More information about the Development mailing list