I'm working on a messaging app. I use a QTextBrowser to display the message, but when it's read I change it a bit using QTextCursor.
Before I started to edit the text, I could access any hyperlink I generated, but now this option is no longer working. I still can see the <.a href="smth">smth<./a> as a hyperlink (underlined and in different colour), but I cannot access it.
Any ideas how to change this?
My QTextBrowser
config:
textBrowserReadConversation->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard | Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard);
textBrowserReadConversation->setOpenLinks(false);
textBrowserReadConversation->setOpenExternalLinks(true);
textBrowserReadConversation->setAcceptRichText(true);
textBrowserReadConversation->setReadOnly(false);
I set the QTextCursor like this:
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);