0

私はメッセージングアプリに取り組んでいます。私は QTextBrowser を使用してメッセージを表示しますが、メッセージが読み取られたら、QTextCursor を使用して少し変更します。

テキストの編集を開始する前は、生成したハイパーリンクにアクセスできましたが、このオプションは機能しなくなりました。<.a href="smth">smth</./a> がハイパーリンク (下線と別の色) として表示されますが、アクセスできません。

これを変更する方法はありますか?

私のQTextBrowser設定:

textBrowserReadConversation->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard | Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard);
textBrowserReadConversation->setOpenLinks(false);
textBrowserReadConversation->setOpenExternalLinks(true);
textBrowserReadConversation->setAcceptRichText(true);
textBrowserReadConversation->setReadOnly(false);

QTextCursor を次のように設定します。

QTextDocument *document(textBrowserReadConversation->document());
QTextCursor cursor(document);
//then I move it to position, delete the previous text and paste the new text:
cursor.insertHtml(html);
4

1 に答える 1