From 362fdc6ceb648f83f4df8e10b7c3a45faed08c97 Mon Sep 17 00:00:00 2001 From: Muhammed Galib Uludag Date: Tue, 27 Jul 2021 23:42:00 +0300 Subject: [PATCH] trim newline chars instead of remove 2 chars --- include/spdlog/sinks/qt_sinks.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/spdlog/sinks/qt_sinks.h b/include/spdlog/sinks/qt_sinks.h index 1389b87b..8cddec72 100644 --- a/include/spdlog/sinks/qt_sinks.h +++ b/include/spdlog/sinks/qt_sinks.h @@ -41,7 +41,7 @@ protected: memory_buf_t formatted; base_sink::formatter_->format(msg, formatted); string_view_t str = string_view_t(formatted.data(), formatted.size()); - QMetaObject::invokeMethod(qtextedit,"append", Qt::AutoConnection, Q_ARG(QString, QString::fromUtf8(str.data(), static_cast(str.size() - 2)))); + QMetaObject::invokeMethod(qtextedit,"append", Qt::AutoConnection, Q_ARG(QString, QString::fromUtf8(str.data(), static_cast(str.size())).trimmed())); } void flush_() override {} @@ -73,7 +73,7 @@ protected: memory_buf_t formatted; base_sink::formatter_->format(msg, formatted); string_view_t str = string_view_t(formatted.data(), formatted.size()); - QMetaObject::invokeMethod(qplaintextedit, "appendPlainText", Qt::AutoConnection, Q_ARG(QString, QString::fromUtf8(str.data(), static_cast(str.size() - 2)))); + QMetaObject::invokeMethod(qplaintextedit, "appendPlainText", Qt::AutoConnection, Q_ARG(QString, QString::fromUtf8(str.data(), static_cast(str.size())).trimmed())); } void flush_() override {}