[GUI] Make UrlLabel in About styleable

The UrlLabel in the About FreeCAD box was not styleable because its
rich-text contents overrode any styling applied to it. This commit
converts it to a plain text label that can then be styled in a
stylesheet using the Gui--UrlLabel selector. If no stylesheet is
applied, the UrlLabel styles itself using the old-school blue text with
an underline, but any applied stylesheet completely overrides this
default.

This does not affect the "clickability" of a UrlLabel widget, which is
handled independently of the label's content (including its textual
hyperlink, which was and still is ignored).
This commit is contained in:
Chris Hennes
2021-02-22 16:39:26 -06:00
committed by wmayer
parent dfba396b4f
commit 0bc39982df
2 changed files with 8 additions and 1 deletions

View File

@@ -115,7 +115,10 @@
<item>
<widget class="Gui::UrlLabel" name="labelAuthor">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=" font-family: MS Shell Dlg 2; font-weight:600; text-decoration: underline; color:#0000ff;"&gt; Unknown Application (c) Unknown Author&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string notr="true">Unknown Application (c) Unknown Author</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>

View File

@@ -825,6 +825,10 @@ UrlLabel::UrlLabel(QWidget * parent, Qt::WindowFlags f)
{
_url = QString::fromLatin1("http://localhost");
setToolTip(this->_url);
if (qApp->styleSheet().isEmpty()) {
setStyleSheet(QString::fromLatin1("Gui--UrlLabel {color: #0000FF;text-decoration: underline;}"));
}
}
UrlLabel::~UrlLabel()