Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PyQt6 QWebEngineView unintended content replacement with index of location
Qt 6.11 is out! See what's new in the release blog

PyQt6 QWebEngineView unintended content replacement with index of location

Scheduled Pinned Locked Moved Unsolved Qt for Python
qt for python
1 Posts 1 Posters 15 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wayfarer
    wrote last edited by
    #1

    I'm working on a notetaking tool where notes are written in Markdown and then displayed in HTML via QWebEngineView using a template HTML file.

    I've run into a problem where, after being successfully displayed for a split second, the view's contents are replaced by something saying 'Index of LOCATION', followed by a horizontal line and a row of nonfunctional links titled Name, Size, Date, and Modified. I presume this is some kind of blank directory index.

    This is the relevant code that I'm using to display individual note pages:

    def readPageNew(path):
    	markdownPage = Path(path).read_text()
    	htmlTemplate = Path(f'{openNotebook}/templates/Main.html').read_text()
    	htmlPage = convertToHTML(markdownPage)
    	htmlPage = re.sub(r'\<main\>(.|\n)*\<\/main\>', f'<main>\n{htmlPage}</main>', htmlTemplate, flags=re.MULTILINE)
    
    	contentDirectory = QUrl.fromLocalFile(f'{openNotebook}/')
    	window.viewPanel.setHtml(htmlPage, baseUrl=contentDirectory)
    

    How can I fix this so the contents are never replaced after I explicitly set them?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved