Overriding acceptNavigationRequest

Hi, I wrote a minimum viable program demonstrating how to override acceptNavigationRequest. I used this tutorial as a guide, which was immensely helpful in learning how to do this.

I was able to successfully demonstrate what I was hoping to do in one particular way. However, to do so you have to open a URL to a local resource to make the program work. See line 25, which use the method load.

I tried the setHtml method on line 23, which is currently commented out. However, when I commented out line 25 in favor of line 23, the program doesn’t work. CustomPage’s acceptNavigationRequest’s code was no longer triggered, and instead the program tries to take me to a new page, which I prohibited in the acceptNavigationRequest method I wrote. I don’t know why this way doesn’t work, and it may be crucial to the project I am working on. I feel that I need to use .toHtml when translating markdown into something that the program can render.

My intent for this program was to learn how to write code that override the QWebEnginePage’s default behavior so that I can use the html elements as UI interface rather than as an internal web browser. I don’t need the links to go anywhere but internally, maybe with the exception of opening links in an external browser should that be needed.