Override link QUrl parsing?
Hello, I'm using Qt 4.8.7. My application needs to handle web pages with "invalid" URLs. It handles these URLs specially; for example I've already overridden QNetworkAccessManager::createRequest.
The problem is making clickable links work; the HTML <a> tags appear to function at first, but the QUrl returned by linkClicked() is empty. My code works fine with valid URL's but I can't figure out a way to force linkClicked() to return a URL that it doesn't think is valid.
Is there a way around this?
Pablo J. Rogina last edited by
spoiler alert: not that I have work with it...
have you messed around with linkDelegationPolicy as the linkClicked() documentation refers to?
This post is deleted!
@Pablo-J.-Rogina Yeah, I have it set to delegate all links, which causes it to emit linkClicked. Without that, it's not even clear to me how the links are handled. Unless there's a different way to do it by not delegating the links and overriding a different method?
What kind of "invalid" URLs do you have? If they contain some random text, your only solution is to handle clicks via JS and do processing there.
I solved my problem, in that I had neglected to encode some characters that needed to be, so they actually were valid after all. User error.
I never did find a solution for parsing truly invalid URL's.
As I said above, you can parse truly invalid URLs via custom
onclickhandler of element
@Konstantin-Tokarev Sorry, I wasn't ignoring your post. I'm sure that would work, but JS wasn't an option for this particular application.
JS handler can be added via
I've considered adding API for C++ event hadlers, but that would require some development effort