Closed nuttyartist closed 1 year ago
It's not really a bug, but a missing feature. ;-)
Thing is, the code currently does not care at all whether you're above a URL. It simply changes the cursor on the press and release of Ctrl:
Is there no way to do this purely with native Qt stuff?
After a short search, I came across this: https://doc.qt.io/qt-6/qt.html#TextInteractionFlag-enum. Might be worth looking into?
Yes, the challenge with making those links clickable, is to actually make them links rather than just highlighted text. And that without disrupting normal text editing operations. At least, when we'd want to rely on that Qt functionality.
Do you mean the markdownhighlighter would interfere with the native Qt functionality for this?
Do you mean the markdownhighlighter would interfere with the native Qt functionality for this?
No, I mean that the native Qt functionality is based on parsing markup (like HTML or Markdown) to create links that are stored in the document as QTextCharFormat::anchorHref
. But since our links are plain text to Qt and just styled as a link through the syntax highlighter, we can't rely on that functionality.
I've tried using QSyntaxHighlighter::setFormat
to set a format with an anchor in the highlighter, but couldn't get it to work. I think this functionality is not supported through the syntax highlighter, since it does not modify the document. And actually modifying the document is likely going to interfere with the user's edits, though there may be ways to avoid that.
Personally I expect the easiest thing would be to fix the code that sets the mouse cursor to actually check whether there's a link below the cursor.
The cursor icon should change only upon hovering a link. This bug causes the cursor icon to change every time control is pressed.