<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QTextBrowser link opens Notepad on Windows ???]]></title><description><![CDATA[<p dir="auto">Hello everyone,</p>
<p dir="auto">I'm facing a problem with the Windows version of my MD editor / browser, using links. I am using the links to navigate between pages in a folder.</p>
<p dir="auto">On Linux, when the links are clicked, the new page simply displays in the QTextBrowser as intended. However on Windows, Notepad opens.</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/bb6478cb-8d29-4086-ac64-4d40dc85c385.png" alt="a44cdfc9-2951-4865-ae41-17dc94f6e7a8-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Here is the method I wrote to handle clicking links :</p>
<pre><code class="language-cpp">void Editor::FollowLink(const QUrl&amp; followedFile){

    QUrl resolvedURL = GetCurrentTab()-&gt;document-&gt;baseUrl().resolved(followedFile);
    qDebug() &lt;&lt; "The resolved URL is" &lt;&lt; resolvedURL.toString();

    QString filePath(resolvedURL.toString());
    qDebug() &lt;&lt; filePath;


    if(!filePath.isEmpty()) {

        QFile openedFile(filePath);

        if(!openedFile.exists()) {
            qDebug() &lt;&lt; filePath &lt;&lt; " does not exist.";
                return;
        }

        if (!(openedFile.open(QIODeviceBase::ReadWrite))) {
            qDebug() &lt;&lt; "Error : File could not be opened";
            return;
        }

        GetCurrentTab()-&gt;renderDocument-&gt;setBaseUrl(resolvedURL);
        GetCurrentTab()-&gt;document-&gt;setBaseUrl(resolvedURL);
        GetCurrentTab()-&gt;editor-&gt;setPlainText(openedFile.readAll());
        GetCurrentTab()-&gt;browser-&gt;setSource(resolvedURL);
        GetCurrentTab()-&gt;RenderDocument();

        openedFile.close();
    }
    SetTabTitle(filePath);
}
</code></pre>
<p dir="auto">My <code>browser</code> widget has <code>setOpenExternalLinks(true)</code>. Moreover, Notepad is not set as the default application for Markdown, but manages to "steal" the file opening from my app ?</p>
<p dir="auto">What could be happening here ? Thanks for your answers !</p>
]]></description><link>https://forum.qt.io/topic/164043/qtextbrowser-link-opens-notepad-on-windows</link><generator>RSS for Node</generator><lastBuildDate>Sun, 13 Sep 2026 04:06:38 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164043.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Jan 2026 09:56:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QTextBrowser link opens Notepad on Windows ??? on Mon, 05 Jan 2026 19:40:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bastiensante">@<bdi>BastienSante</bdi></a> said in <a href="/post/835201">QTextBrowser link opens Notepad on Windows ???</a>:</p>
<blockquote>
<p dir="auto">Here is the method I wrote to handle clicking links :</p>
</blockquote>
<p dir="auto">Unfortunately, based on the problem statement, this is code that isn't executed. That doesn't help clarify what is executed.</p>
<blockquote>
<p dir="auto">My <code>browser</code> widget has <code>setOpenExternalLinks(true)</code>. Moreover, Notepad is not set as the default application for Markdown, but manages to "steal" the file opening from my app ?</p>
<p dir="auto">What could be happening here ? Thanks for your answers !</p>
</blockquote>
<p dir="auto"><a href="https://doc.qt.io/qt-6/qtextbrowser.html#openExternalLinks-prop" target="_blank" rel="noopener noreferrer nofollow ugc">QTextBrowser::openExternalLinks</a>:</p>
<p dir="auto"><code>Specifies whether QTextBrowser should automatically open links to external sources using QDesktopServices::openUrl() instead of emitting the anchorClicked signal. Links are considered external if their scheme is neither file or qrc.</code></p>
<p dir="auto">Did you intend to set openExternalLinks to <code>false</code>?</p>
]]></description><link>https://forum.qt.io/post/835217</link><guid isPermaLink="true">https://forum.qt.io/post/835217</guid><dc:creator><![CDATA[jeremy_k]]></dc:creator><pubDate>Mon, 05 Jan 2026 19:40:45 GMT</pubDate></item></channel></rss>