PDA

View Full Version : QUrl isValid always true



Talei
1st March 2011, 11:03
Hello,
I'm using QUrl to validate uri but in 4.7.0 this always return true, even for "blabla". According to this (http://bugreports.qt.nokia.com/browse/QTBUG-15799) that is correct behaviour but it doesn't really help me.
So the question: is there any equivalent in Qt4.7. to Qurl::isValid() that will works like the "old qurl::isValid()"?

Best regards

squidge
1st March 2011, 11:34
You could write it yourself, but really, the old QUrl was non-compliant - "blabla" is a perfectly valid URL.

If you require certain characteristics such as protocol or site address (ie, a fully qualified URL rather than relative), then this can easily be done and you can AND the results of that function with isValid of QUrl.

Talei
1st March 2011, 11:59
Thank you for the reply.
Yes I know that's valid uri and I don't question that.
I only ask because I don't want to "reinvent the wheel", and I know that I can write regexp for that, but I found many times in the past that Qt offers functionality that I need, so that's why I asked if they maybe moved / added that functionality "some place else".

squidge
1st March 2011, 16:24
There is no mention in the GIT repo: http://qt.gitorious.org/qt/qt/blobs/history/4.7-stable/src/corelib/io/qurl.cpp

So I can only assume it was considered a bug that needed fixing (without going through every commit, I couldn't comment in which it was that changed the functionality)