KUrl or QUrl bug?

Sebastian Trüg trueg at kde.org
Fri Jun 18 16:09:37 BST 2010

On 06/18/2010 04:47 PM, Hans Meine wrote:
> On Friday 18 June 2010 16:38:15 Sebastian Trüg wrote:
>> On 06/18/2010 03:45 PM, David Faure wrote:
>>> Yes, because "no query" isn't the same as "an empty query", IIRC.
>>> So after removing the query, you have a url with "an empty query".
>>> Did you try calling .url() on both urls? I suppose url3 will have a
>>> trailing '?'.
>> exactly. I just think it is unwanted behavior. What exactly is this good
>> for? Who would ever want to have an empty query?
> Famous last words.. ;-)
> Answer: "Broken" (unusual) websites?

OK, I can see that. But still this is a special case that should IMHO
not be the default. It should require a dedicated method call or
something. As you state yourself it is a corner case for "broken" und
"unusual" web sites.

I doubt that any user of QUrl would not think that removing all query
items results in a URL without a query.

The only place where the behavior is stated in the QUrl documentation is
setEncodedQuery(), a method very rarely used I assume. So IMHO that
should be enough to set "the empty query" while removing query items
should always result in no query at all.


More information about the kde-core-devel mailing list