[Interest] QUrl: changing a single query item's value
mandeepsandhu.chd at gmail.com
Mon Nov 7 11:22:21 CET 2011
Why doesn't QUrl have a 'setter' for it's
I have a url which has a lot of query parameters in it. I want to
change only _one_ of them.
While I can get the value, using the QUrl::encodedQueryItemValue(),
and change it. I found it a little surprising that there's no
QUrl::setEncodedQueryItemValue() for setting a single param!
Right now, it seems like I have to iterate through the list of query
items (got via QUrl::encodedQueryItems()) and modify the specific
param and then set it back using QUrl::setEncodedQueryItems(). While
this works, it looks quite cumbersome. I tried using
QUrl::addEncodedQueryItem(), but that 'adds' a new query parameter
(does not replace the existing one even if the param key is the same).
Any other simpler way to do this? Should we have a
More information about the Interest