diff options
author | LordMZTE <lord@mzte.de> | 2021-03-27 16:06:42 +0100 |
---|---|---|
committer | LordMZTE <lord@mzte.de> | 2021-03-27 16:06:42 +0100 |
commit | 39ff68c6e64a711cec32329d2678dab7a4772ac9 (patch) | |
tree | a9dc24beb8390e7587875522d7450843043d9872 /src | |
parent | rainbow now works with unicode! (diff) | |
download | nheko-39ff68c6e64a711cec32329d2678dab7a4772ac9.tar.xz |
use QString to format in rainbow function
Diffstat (limited to 'src')
-rw-r--r-- | src/Utils.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp index 06df59df..5ae1776f 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -19,7 +19,6 @@ #include <bits/c++config.h> #include <cmath> -#include <fmt/core.h> #include <qtextboundaryfinder.h> #include <variant> @@ -524,8 +523,7 @@ utils::markdownToHtml(const QString &text, bool rainbowify) while ((boundaryEnd = tbf.toNextBoundary()) != -1) { // Split text to get current char auto curChar = - qNodeText.mid(boundaryStart, boundaryEnd - boundaryStart) - .toStdString(); + qNodeText.mid(boundaryStart, boundaryEnd - boundaryStart); boundaryStart = boundaryEnd; // Don't rainbowify spaces if (curChar == " ") { @@ -538,9 +536,10 @@ utils::markdownToHtml(const QString &text, bool rainbowify) // format color for HTML auto colorString = color.name(QColor::NameFormat::HexRgb); // create HTML element for current char - auto curCharColored = fmt::format("<font color=\"{}\">{}</font>", - colorString.toStdString(), - curChar); + auto curCharColored = QString("<font color=\"%0\">%1</font>") + .arg(colorString) + .arg(curChar) + .toStdString(); // append colored HTML element to buffer buf.append(curCharColored); |