Ensure formatting tags aren't exported/put on the clipboard. Refs #2382

* When we're formatting text we want just the plain text version to be used.
This commit is contained in:
baldurk
2021-10-06 16:31:43 +01:00
parent 73f0c7681f
commit 73f78bd8a4
2 changed files with 35 additions and 6 deletions
+27 -2
View File
@@ -189,6 +189,8 @@ struct ShaderMessageLink
Q_DECLARE_METATYPE(ShaderMessageLink);
static QRegularExpression htmlRE(lit("<[^>]*>"));
// this is an opaque struct that contains the data to render, hit-test, etc for some text that
// contains links to resources. It will update and cache the names of the resources.
struct RichResourceText
@@ -242,9 +244,24 @@ struct RichResourceText
{
text += lit("EID @%1").arg(v.toUInt());
}
else if(v.userType() == qMetaTypeId<ShaderMessageLink>())
{
ShaderMessageLink link = v.value<ShaderMessageLink>();
text +=
QApplication::translate("qrenderdoc", "%n msg(s)", "Shader messages", link.numMessages);
}
else
{
text += v.toString();
if(forcehtml)
{
// strip html tags and convert any html entities
text += QUrl::fromPercentEncoding(v.toString().replace(htmlRE, QString()).toLatin1());
}
else
{
text += v.toString();
}
}
}
}
@@ -340,7 +357,15 @@ struct RichResourceText
lit("\n"),
lit("</td></tr></table><table><tr><td valign=\"middle\" style=\"line-height: 14px\">"));
text += v.toString();
if(forcehtml)
{
text += QUrl::fromPercentEncoding(v.toString().replace(htmlRE, QString()).toLatin1());
}
else
{
text += v.toString();
}
html += lit("<td valign=\"middle\" style=\"line-height: 14px\">%1</td>").arg(htmlfrag);
numLines += newlines;