use QString to format in rainbow function
This commit is contained in:
parent
939f00c90d
commit
39ff68c6e6
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <bits/c++config.h>
|
#include <bits/c++config.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <fmt/core.h>
|
|
||||||
#include <qtextboundaryfinder.h>
|
#include <qtextboundaryfinder.h>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
|
|
||||||
@ -524,8 +523,7 @@ utils::markdownToHtml(const QString &text, bool rainbowify)
|
|||||||
while ((boundaryEnd = tbf.toNextBoundary()) != -1) {
|
while ((boundaryEnd = tbf.toNextBoundary()) != -1) {
|
||||||
// Split text to get current char
|
// Split text to get current char
|
||||||
auto curChar =
|
auto curChar =
|
||||||
qNodeText.mid(boundaryStart, boundaryEnd - boundaryStart)
|
qNodeText.mid(boundaryStart, boundaryEnd - boundaryStart);
|
||||||
.toStdString();
|
|
||||||
boundaryStart = boundaryEnd;
|
boundaryStart = boundaryEnd;
|
||||||
// Don't rainbowify spaces
|
// Don't rainbowify spaces
|
||||||
if (curChar == " ") {
|
if (curChar == " ") {
|
||||||
@ -538,9 +536,10 @@ utils::markdownToHtml(const QString &text, bool rainbowify)
|
|||||||
// format color for HTML
|
// format color for HTML
|
||||||
auto colorString = color.name(QColor::NameFormat::HexRgb);
|
auto colorString = color.name(QColor::NameFormat::HexRgb);
|
||||||
// create HTML element for current char
|
// create HTML element for current char
|
||||||
auto curCharColored = fmt::format("<font color=\"{}\">{}</font>",
|
auto curCharColored = QString("<font color=\"%0\">%1</font>")
|
||||||
colorString.toStdString(),
|
.arg(colorString)
|
||||||
curChar);
|
.arg(curChar)
|
||||||
|
.toStdString();
|
||||||
// append colored HTML element to buffer
|
// append colored HTML element to buffer
|
||||||
buf.append(curCharColored);
|
buf.append(curCharColored);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user