On Thu, Feb 16, 2012 at 6:24 AM, <mikko.tuo...@nokia.com> wrote:
> how to remove automatic underlining of links marked with <a href=""></a> in 
> QML Text using Text.StyledText ?
> I was able to change the font color of the link by adding extra <font 
> color=""> tag inside the anchor definition but did not yet find a working way 
> to remove the underlining.
> Appreciate any advice, I'm using Qt5...

A little code from http://voicetogoog.googlecode.com may provide some
hints on using a stylesheet to accomplish what you need.
Note that I used Text.RichText to accomplish this, not Text.StyledText
and this is for Qt 4.7.X... (ymnv).

    // when TextEdit property textFormat==Text.RichText, such as
Component.ModalTextEdit in readOnly mode, any embedded links
    // are difficult to see against dark background. Override the
defaults values, which appear to be
    // QPalette::Link --> Qt::blue and QPalette::LinkVisited -->
Qt::magenta, per
http://doc.qt.nokia.com/latest/qpalette.html#ColorRole-enum
    property string _RICHTEXT_STYLESHEET_PREAMBLE: "<html><style>a {
text-decoration: underline; color: '"
                                                   + _ACTIVE_TEXT_COLOR
                                                   + "' } </style><body>";
    property string _RICHTEXT_STYLESHEET_APPENDIX: "</body></html>";

[...]

    dialog.text = _RICHTEXT_STYLESHEET_PREAMBLE
                  + "<strong>Ok to browse URL?</strong><br\><a href='"
                  + url
                  + "'>"
                  + url
                  + "</a>"
                  + _RICHTEXT_STYLESHEET_APPENDIX;


-- Niels
http://nielsmayer.com
_______________________________________________
Qt-qml mailing list
Qt-qml@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to