Skip to content

Commit

Permalink
HTML encode url in ElidedLabel
Browse files Browse the repository at this point in the history
* Fix #3905 - prevent double quotes and other invalid HTML characters from impeding on display of url in ElidedLabel
  • Loading branch information
ba32107 authored and droidmonkey committed Nov 23, 2019
1 parent 5c54dfe commit 7e2aa43
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gui/widgets/ElidedLabel.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 7e2aa43

Please sign in to comment.