QLabel hyperlink and text-decoration
-
I have a working hyperlink using a QLabel, the link is underlined, I've tried removing the underline by setting the CSS property text-decoration to none in the style sheet.
This has no effect, is there another way to prevent the hyperlink from having an underline?
This is the CSS I have now:
QLabel { align:left,top; border:0px; color:#ff0000; font-size:40pt; format:rich; text-decoration:none;}
The alignment and font-size work, the color and text-decoration don't work.
-
Hi
This works for me.myLabel->setText("<a style= text-decoration:none; href=\"http://example.com/\">Click Here!</a>");
-
Interesting, I will try that, why doesn't it work when I call:
setText(strText); setFont(clsXMLnode::objFont()); setWindowFlag(Qt::FramelessWindowHint); // No frame if ( strText.contains(clsXMLnode::mscszAhref) == true ) { setOpenExternalLinks(true); } if ( *pstrCSS != nullptr && pstrCSS->isEmpty() != true ) { if ( pstrCSS->indexOf(clsXMLnode::mscszCSSbackgroundColour) >= -1 ) { blnBackground = true; } setStyleSheet(*pstrCSS); }
Where strText contains:
<a href="http://google.com">Google</a>
And the *pstrCSS contains:
QLabel { align:left,top; border:0; color:#ff0000; font-size:40pt format:rich; text-decoration:none;}
-
@SPlatten said in QLabel hyperlink and text-decoration:
text-decoration:none
I don't see that listed as a Qt style thing.
https://doc.qt.io/qt-5/stylesheet-reference.htmlSo im not sure it can work that way.
-
Well it is supported
https://doc.qt.io/qt-5/richtext-html-subset.html
in the HTML subset but i have not seen it for the style sheet support.
( in use i mean. it should work but seem to get ignored in CSS )Im using it in HTML style and you try with the Qt Widget stylesheet.