From 0bc39982df0cfb2dbd8dc61c300f61f57cd9e136 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 22 Feb 2021 16:39:26 -0600 Subject: [PATCH] [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). --- src/Gui/AboutApplication.ui | 5 ++++- src/Gui/Widgets.cpp | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Gui/AboutApplication.ui b/src/Gui/AboutApplication.ui index 2a63ef0e10..338e0eec7d 100644 --- a/src/Gui/AboutApplication.ui +++ b/src/Gui/AboutApplication.ui @@ -115,7 +115,10 @@ - <html><head/><body><p><span style=" font-family: MS Shell Dlg 2; font-weight:600; text-decoration: underline; color:#0000ff;"> Unknown Application (c) Unknown Author</span></p></body></html> + Unknown Application (c) Unknown Author + + + Qt::PlainText diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index 57ccb8c325..a60e44a61d 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -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()