HTML encode url in ElidedLabel

* Fix #3905 - prevent double quotes and other invalid HTML characters from impeding on display of url in ElidedLabel
This commit is contained in:
Balazs Gyurak 2019-11-21 22:14:57 +00:00 committed by Jonathan White
parent 5c54dfe581
commit ed60a3dcce

View File

@ -105,8 +105,10 @@ void ElidedLabel::updateElidedText()
const QFontMetrics metrix(font());
displayText = metrix.elidedText(m_rawText, m_elideMode, width() - 2);
}
setText(m_url.isEmpty() ? displayText : htmlLinkTemplate.arg(m_url, displayText));
setOpenExternalLinks(!m_url.isEmpty());
bool hasUrl = !m_url.isEmpty();
setText(hasUrl ? htmlLinkTemplate.arg(m_url.toHtmlEscaped(), displayText) : displayText);
setOpenExternalLinks(!hasUrl);
}
void ElidedLabel::resizeEvent(QResizeEvent* event)