<?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 hyperlink &quot;spreading&quot; to other text rows]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am trying to have hyperlink in my QTextBrowser that open file location when it is clicked. It works fine, but there is bug that causes hyperlink to spread other text rows. Other rows are valid hyperlinks to actual links filepath. <img src="https://ddgobkiprc33d.cloudfront.net/025d6bde-8647-4896-904c-cb05ba7c1e2d.png" alt="spreading hyperlink.png" class=" img-fluid img-markdown" /> QTextBrowser looks like that. Those &lt;CollectMission&gt; lines are not supposed to be hyperlinks.</p>
<p dir="auto">Hyperlink is written using function:</p>
<pre><code>void MainWindow::WriteHyperLink(QStringList text, QString URL ){
    QString hyperLink = QString("&lt;a href=%1&gt;%2&lt;/a&gt;%3").arg(URL, text.at(0), text.at(1));
    ui-&gt;textBrowser-&gt;append(hyperLink);
}
</code></pre>
<p dir="auto">where <a href="http://text.at" target="_blank" rel="noopener noreferrer nofollow ugc">text.at</a>(0) is path to folder and <a href="http://text.at" target="_blank" rel="noopener noreferrer nofollow ugc">text.at</a>(1) is filename (int this case "/annotation_test_with_grip_pose_estimation.json")</p>
<p dir="auto">Text is written using following function:</p>
<pre><code>void MainWindow::WriteText(QString message, QString parentName)
{
    QString textToWrite;
    if (parentName != ""){
        textToWrite = QStringLiteral("&lt;%1&gt; %2").arg(parentName, message);
    } else {
        textToWrite = str;
    }
    ui-&gt;textBrowser-&gt;append(textToWrite);

}
</code></pre>
<p dir="auto">Any ideas how to fix this?</p>
]]></description><link>https://forum.qt.io/topic/139639/qtextbrowser-hyperlink-spreading-to-other-text-rows</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Nov 2026 15:17:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139639.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 28 Sep 2022 07:45:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QTextBrowser hyperlink &quot;spreading&quot; to other text rows on Wed, 28 Sep 2022 08:21:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tantsa">@<bdi>Tantsa</bdi></a> said in <a href="/post/730473">QTextBrowser hyperlink "spreading" to other text rows</a>:</p>
<blockquote>
<p dir="auto">"&lt;a href=%1&gt;%2&lt;/a&gt;%3"</p>
</blockquote>
<p dir="auto">Shouldn't it be</p>
<pre><code>"&lt;a href=\"%1\"&gt;%2&lt;/a&gt;%3"
</code></pre>
<p dir="auto">?</p>
]]></description><link>https://forum.qt.io/post/730487</link><guid isPermaLink="true">https://forum.qt.io/post/730487</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 28 Sep 2022 08:21:52 GMT</pubDate></item><item><title><![CDATA[Reply to QTextBrowser hyperlink &quot;spreading&quot; to other text rows on Wed, 28 Sep 2022 08:33:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> said in <a href="/post/730487">QTextBrowser hyperlink "spreading" to other text rows</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tantsa">@<bdi>Tantsa</bdi></a> said in <a href="/post/730473">QTextBrowser hyperlink "spreading" to other text rows</a>:</p>
<blockquote>
<p dir="auto">"&lt;a href=%1&gt;%2&lt;/a&gt;%3"</p>
</blockquote>
<p dir="auto">Shouldn't it be</p>
<pre><code>"&lt;a href=\"%1\"&gt;%2&lt;/a&gt;%3"
</code></pre>
<p dir="auto">?</p>
</blockquote>
<p dir="auto">Thank you, this solved problem.</p>
]]></description><link>https://forum.qt.io/post/730490</link><guid isPermaLink="true">https://forum.qt.io/post/730490</guid><dc:creator><![CDATA[Tantsa]]></dc:creator><pubDate>Wed, 28 Sep 2022 08:33:29 GMT</pubDate></item><item><title><![CDATA[Reply to QTextBrowser hyperlink &quot;spreading&quot; to other text rows on Wed, 28 Sep 2022 08:21:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tantsa">@<bdi>Tantsa</bdi></a> said in <a href="/post/730473">QTextBrowser hyperlink "spreading" to other text rows</a>:</p>
<blockquote>
<p dir="auto">"&lt;a href=%1&gt;%2&lt;/a&gt;%3"</p>
</blockquote>
<p dir="auto">Shouldn't it be</p>
<pre><code>"&lt;a href=\"%1\"&gt;%2&lt;/a&gt;%3"
</code></pre>
<p dir="auto">?</p>
]]></description><link>https://forum.qt.io/post/730487</link><guid isPermaLink="true">https://forum.qt.io/post/730487</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 28 Sep 2022 08:21:52 GMT</pubDate></item><item><title><![CDATA[Reply to QTextBrowser hyperlink &quot;spreading&quot; to other text rows on Wed, 28 Sep 2022 08:19:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a><br />
No, there is one hyperlink added using WriteHyperLink() function and then added normal text using WriteText() function.<br />
However text written using WriteText() appears as hyperlink too, when it is supposed to be plain text.</p>
<p dir="auto">If you take careful look to image hyperlink is only "C:/Users/ [...] /json/annotation_test_with_grip", because that is path to folder that is supposed to open. Filename with extension (.json) is not part of hyperlink.</p>
<p dir="auto">Now every new line to added to QTextBrowser  becomes to hyperlink that have same location as original hyperlink, but different text.</p>
]]></description><link>https://forum.qt.io/post/730483</link><guid isPermaLink="true">https://forum.qt.io/post/730483</guid><dc:creator><![CDATA[Tantsa]]></dc:creator><pubDate>Wed, 28 Sep 2022 08:19:35 GMT</pubDate></item><item><title><![CDATA[Reply to QTextBrowser hyperlink &quot;spreading&quot; to other text rows on Wed, 28 Sep 2022 07:51:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tantsa">@<bdi>Tantsa</bdi></a> I'm not sure I understand your description: do you mean the hyperlink is wraped, so part of it is shown in next line?</p>
]]></description><link>https://forum.qt.io/post/730478</link><guid isPermaLink="true">https://forum.qt.io/post/730478</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 28 Sep 2022 07:51:01 GMT</pubDate></item></channel></rss>