mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Clean qt_color_sink
This commit is contained in:
parent
a29cef5787
commit
da1e671d42
@ -157,13 +157,10 @@ private:
|
|||||||
memory_buf_t formatted;
|
memory_buf_t formatted;
|
||||||
base_sink<Mutex>::formatter_->format(msg, formatted);
|
base_sink<Mutex>::formatter_->format(msg, formatted);
|
||||||
|
|
||||||
string_view_t str = string_view_t(formatted.data(), formatted.size());
|
const string_view_t str = string_view_t(formatted.data(), formatted.size());
|
||||||
// apply the color to the color range in the formatted message.
|
// apply the color to the color range in the formatted message.
|
||||||
auto payload = QString::fromLatin1(str.data(), static_cast<int>(str.size()));
|
auto payload = QString::fromLatin1(str.data(), static_cast<int>(str.size()));
|
||||||
|
|
||||||
// if color needed, apply it as
|
|
||||||
//if (msg.color_range_end > msg.color_range_start)
|
|
||||||
{
|
|
||||||
invoke_params params {
|
invoke_params params {
|
||||||
max_lines_, // max lines
|
max_lines_, // max lines
|
||||||
qt_text_edit_, // text edit to append to
|
qt_text_edit_, // text edit to append to
|
||||||
@ -172,11 +169,12 @@ private:
|
|||||||
colors_.at(msg.level), // color to apply
|
colors_.at(msg.level), // color to apply
|
||||||
msg.color_range_start, // color range start
|
msg.color_range_start, // color range start
|
||||||
msg.color_range_end}; // color range end
|
msg.color_range_end}; // color range end
|
||||||
|
|
||||||
QMetaObject::invokeMethod(
|
QMetaObject::invokeMethod(
|
||||||
qt_text_edit_,
|
qt_text_edit_,
|
||||||
[params]() {invoke_method_(params);},
|
[params]() {invoke_method_(params);},
|
||||||
Qt::AutoConnection);
|
Qt::AutoConnection);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush_() override {}
|
void flush_() override {}
|
||||||
|
Loading…
Reference in New Issue
Block a user