[Development] QUrl setPath Qt4 vs Qt5

Samuel Gaist samuel.gaist at edeltech.ch
Sun Sep 28 09:52:07 CEST 2014


> On 28 sept. 2014, at 03:26, Thiago Macieira <thiago.macieira at intel.com> wrote:
> 
>> On Sunday 28 September 2014 01:02:11 Samuel Gaist wrote:
>> Hi,
>> 
>> Following a post on the forum, I've checked and there's been a behavior
>> change in QUrl's setPath between Qt 4 and Qt 5 that is not mentioned in the
>> "C++ API changes" chapter.
>> 
>> If I understood correctly:
>> 
>> QUrl example1("http://www.example.com");
>> example1.setPath("pub/something");
>> 
>> makes example1 invalid in Qt 5 due to the fact that "pub/something" is a
>> relative path (following QUrl documentation and test) but in Qt 4 the
>> result is "http://www.example.com/pub/something".
>> 
>> Should it be considered bug in Qt 4 that needs fixing ? However fixing it
>> might break existing application that could be relying on that behavior. In
>> this case, simply add the API break in Qt 5's documentation ?
> 
> Yes, it's a bug in Qt 4, bug I won't fix it because it's not that important and 
> would require a major change.
> 
> QUrl in Qt 4 has quite a few known issues with encoding and decoding of 
> delimiters too. And its QString constructor is a completely flawed design and 
> should never be used.
> 
> QUrl changed considerably in Qt 5 to comply better with the URL specifications 
> and with brokenness out there. If we add anything to the documentation, it 
> would be the previous sentence, with no extra details.

I remember now following a discussion about that matter some time ago.

Fine for me. I'll update the API change doc to include that so future users won't be surprised.

Samuel


More information about the Development mailing list