I am trying to create a rich text editor that will insert HTML links to websites etc. It is working fine except for when I select the text again and try to change the URL, I am not able to. Is there a way we can tell what is the HTML anchor at the current cursor location?

For e.g.

if the (text) cursor is currently anywhere between the Google word, or any part or whole of Google text is selected I want to get the existing URL so that it can be edited, instead of inserting a new URL altogether.


Qt Code:
  1. <a href="http://www.google.com/">Google</a>
To copy to clipboard, switch view to plain text mode