[Qt-creator] QML Rich Text Link Color

timmy.margo at nokia.com timmy.margo at nokia.com
Tue May 24 21:01:02 CEST 2011


Hi there,

Our QML application displays text in RichText text format. Within this text element we have a hyperlinks that are constructed using HTML <a> tag. This links are displayed in the system link color regardless of the QML Text color property. As a result links will be blue although the text color is set to black. To apply a color to these links, I append css styling to the rich text content as follows:

Text {
    text: "<style type='text/css'>a:link {color:#FF0000} a:visited {color:#0000FF}</style>" + modelData
    wrapMode: Text.Wrap
    textFormat: Text.RichText
    color: "#000000"
    onLinkActivated: { console.log(link) }
}

This code works well in displaying the links in the specified color. However, the link does not seem to change state to visited as the link colors never change. It does not change to active or visited after clicking on the link despite link is activated. This case is also in the QML twitter example below. In the example, the links do not change color even after they are visited. Is there a way to change the link color after it is visited? Thank you very much.

http://doc.qt.nokia.com/4.7-snapshot/demos-declarative-twitter-twittercore-fatdelegate-qml.html

Best Regards,


Timmy Margo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20110524/bcb5c4d7/attachment.html 


More information about the Qt-creator-old mailing list