I'm trying to set up a QTextBrowser where most hyperlinks work normally, but hyperlinks that begin with an arbitrary prefix will instead call a function.
@three-pineapples supplied some great instructions here for how to achieve the latter behavior, detecting a prefix on a url and calling a method based on that url.
The problem is, in order for this to work, the QTextBrowser's setOpenLinks()
method has to be set False
so that the QTextBrowser will emit the anchorClicked()
signal. Otherwise, the prefixed links are handled automatically by Qt and have no custom behavior. But if I set setOpenLinks() False
, normal links now don't work properly.
Any ideas how to re-implement link-handling manually in the environment with setOpenLinks()
set False
, or else getting the custom behavior on the prefixed links in the environment where it is set True
? Thanks for your help!