Solved When I clicked the Hyperlink int QTextBrowser . The text of Hyperlink disappear.
-
I use the
QTextBrowser
to show some text. and There are has some hyperlinks. i use the html code liketextBrowser->setText("<a href="https://www.google.com">https://www.google.com</a>")
That looks fine. but when i run application. i use the mouse to click the hyperlink. my browser open the html page. but the text of the hyperlink is disappear in
QTextBrowser
what should i do?
I also set the attr.
ui->textBrowser->setOpenLinks(true); ui->textBrowser->setOpenExternalLinks(true);
Thanks and regards.
-
Hi
This normally just works :)
so my guess is that you do something you are not telling.Try make default project.
Add textbrowser and add
ui->textBrowser->setOpenLinks(true);
ui->textBrowser->setOpenExternalLinks(true);Then Right Click the TextBrowser. Choose "Change html" then paste
<a href="https://www.google.com">https://www.google.com</a>
into the editor.Run the project. Does the link also disappear ?
1: Yes -> Something is wrong with your Qt
2: No -> You must alter the text somehow after it was click. -
Hi,
the color of a "clicked link" is maybe identical to the text browser's background color.
-Michael. -
@mrjj
Thank u. I know the reason. Thanks your test way. The text was disappear after clicked . because, i comment the following code.//ui->textBrowser->setOpenLinks(true); ///< because the default value is true, so I comment this line. //ui->textBrowser->setOpenExternalLinks(true); ///< by the way, I also comment this line.
I was so careless. I get it.
-
@m.sue
It is not the color problem. Thanks and regards.