Skip to content

Commit 2afbbea

Browse files
committed
Register metatypes required by logger for work with another threads
1 parent d2fa3f8 commit 2afbbea

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

qt/logger.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#include <QScrollBar>
99
#include <QObject>
1010

11+
Q_DECLARE_METATYPE(QTextCursor)
12+
Q_DECLARE_METATYPE(QtMsgType)
13+
1114
Logger *Logger::logger;
1215
QTextEdit *Logger::logTextEdit;
1316
int Logger::refCount;
@@ -59,6 +62,9 @@ void Logger::logHandler(QtMsgType type, const QMessageLogContext &context ,
5962

6063
Logger::Logger()
6164
{
65+
qRegisterMetaType<QTextCursor>();
66+
qRegisterMetaType<QtMsgType>();
67+
6268
QObject::connect(this, SIGNAL(log(QString)), this, SLOT(slotLog(QString)));
6369
qInstallMessageHandler(logHandler);
6470
oldBuf = std::cerr.rdbuf();

0 commit comments

Comments
 (0)