aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <marten.nordheim@qt.io>2022-03-18 15:49:38 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-03-23 17:21:48 +0000
commitfaf637156a83613198fd8609577614f1b3c4765c (patch)
treef0971e603ad1fcb2826587ef9e588b63f22e86b8
parente7da4d1eb9910bb23492c45bdd7ffd2f12d1125a (diff)
Styled text: Remove an unneeded QString allocation and copy
QColor can take QStringView, and QStringView has a toInt function Change-Id: I2388f7fd329e817e45210fadbd8a2a3ab559707a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 2c959a83962ba373c469cab6e89f474a0b4a93e9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/util/qquickstyledtext.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp
index 13ece608be..f402172891 100644
--- a/src/quick/util/qquickstyledtext.cpp
+++ b/src/quick/util/qquickstyledtext.cpp
@@ -583,10 +583,10 @@ bool QQuickStyledTextPrivate::parseFontAttributes(const QChar *&ch, const QStrin
attr = parseAttribute(ch, textIn);
if (attr.first == QLatin1String("color")) {
valid = true;
- format.setForeground(QColor(attr.second.toString()));
+ format.setForeground(QColor(attr.second));
} else if (attr.first == QLatin1String("size")) {
valid = true;
- int size = attr.second.toString().toInt();
+ int size = attr.second.toInt();
if (attr.second.at(0) == QLatin1Char('-') || attr.second.at(0) == QLatin1Char('+'))
size += 3;
if (size >= 1 && size <= 7)