Clickable hyperlink in QTextEdit
<p>I want to use <code>QTextEdit</code> (in read-only mode) to show a clickable hyperlink, I used to do</p>

<pre><code>QTextEdit *textEdit = new QTextEdit;
QTextCursor cursor(textEdit-&gt;document());
textEdit-&gt;setTextCursor(cursor);
cursor-&gt;insertHtml("&lt;a href=\"www.google.com\" &gt;Google&lt;/a&gt;");
textEdit-&gt;show();
</code></pre>

<p>this code will show Google as hyperlink but unable to click.<br>
And if I used</p>

<pre><code>QTextEdit *textEdit = new QTextEdit;
QTextCursor cursor(textEdit-&gt;document());
textEdit-&gt;setTextCursor(cursor);
QTextCharFormat linkFormat = cursor.charFormat();
linkFormat.setAnchor(true);
linkFormat.setAnchorHref("http://www.google.com");
linkFormat.setAnchorName("Google");
cursor.insertText("Google", linkFormat);
</code></pre>

<p>then nothing happen. "Google" is just normal text.</p>

<p>Please help me insert clickable hyperlink to <code>QTextEdit</code>.</p>