我想使用QTextEdit(在只读模式下)显示一个可点击的超链接,我曾经这样做过
QTextEdit *textEdit = new QTextEdit;
QTextCursor cursor(textEdit->document());
textEdit->setTextCursor(cursor);
cursor->insertHtml("<a href=\"www.google.com\" >Google</a>");
textEdit->show();
Run Code Online (Sandbox Code Playgroud)
此代码会将Google显示为超链接但无法点击.
如果我用过
QTextEdit *textEdit = new QTextEdit;
QTextCursor cursor(textEdit->document());
textEdit->setTextCursor(cursor);
QTextCharFormat linkFormat = cursor.charFormat();
linkFormat.setAnchor(true);
linkFormat.setAnchorHref("http://www.google.com");
linkFormat.setAnchorName("Google");
cursor.insertText("Google", linkFormat);
Run Code Online (Sandbox Code Playgroud)
什么都没发生 "Google"只是普通文字.
请帮我插入可点击的超链接QTextEdit.
请帮助我在 Qt 中显示来自字符串“\uD83D\uDE03”的UTF-16 表情符号“张开嘴的微笑的脸qDebug()”(也许使用或来QLabel显示它)。
我有:
QString a = "\\uD83D\\uDE03";
Run Code Online (Sandbox Code Playgroud)
我想将其打印到 my 中qDebug,我期望的结果是 . 我不知道该怎么做。