Meshroom/meshroom/ui/qml/Utils/format.js
Yann Lanthony 5a38295184 [ui][AttributeEditor] display attribute technical name in tooltip
+ convert attribute description from plain text to html
2019-01-04 17:30:38 +01:00

15 lines
521 B
JavaScript

.pragma library
function intToString(v) {
// use EN locale to get comma separated thousands
// + remove automatically added trailing decimals
// (this 'toLocaleString' does not take any option)
return v.toLocaleString(Qt.locale('en-US')).split('.')[0]
}
// Convert a plain text to an html escaped string.
function plainToHtml(t) {
var escaped = t.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); // escape text
return escaped.replace(/\n/g, '<br>'); // replace line breaks
}