summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-21 02:02:20 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-21 02:02:20 (GMT)
commitf92518f6de1a13b591fb2c2037714b213bdcff89 (patch)
tree95649cb045f4b926d2ee214beaad5627b0ef7c53
parente79202be457298c48b13eef4f8c35df186216aea (diff)
downloadQt-f92518f6de1a13b591fb2c2037714b213bdcff89.zip
Qt-f92518f6de1a13b591fb2c2037714b213bdcff89.tar.gz
Qt-f92518f6de1a13b591fb2c2037714b213bdcff89.tar.bz2
Make logger widget thread safe.
-rw-r--r--tools/qml/loggerwidget.cpp4
-rw-r--r--tools/qml/loggerwidget.h3
-rw-r--r--tools/qml/main.cpp3
3 files changed, 6 insertions, 4 deletions
diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp
index c5548b7..015d1b0 100644
--- a/tools/qml/loggerwidget.cpp
+++ b/tools/qml/loggerwidget.cpp
@@ -53,9 +53,9 @@ LoggerWidget::LoggerWidget(QWidget *parent) :
setWindowTitle(tr("Qt Declarative UI Viewer - Logger"));
}
-void LoggerWidget::append(QtMsgType /*type*/, const char *msg)
+void LoggerWidget::append(const QString &msg)
{
- appendPlainText(QString::fromAscii(msg));
+ appendPlainText(msg);
if (!m_keepClosed && !isVisible())
setVisible(true);
diff --git a/tools/qml/loggerwidget.h b/tools/qml/loggerwidget.h
index 938431c..5c4a701 100644
--- a/tools/qml/loggerwidget.h
+++ b/tools/qml/loggerwidget.h
@@ -50,7 +50,8 @@ class LoggerWidget : public QPlainTextEdit {
Q_OBJECT
public:
LoggerWidget(QWidget *parent=0);
- void append(QtMsgType type, const char *msg);
+public slots:
+ void append(const QString &msg);
protected:
void closeEvent(QCloseEvent *event);
private:
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index a79e1b1..e90d729 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -93,7 +93,8 @@ void showWarnings()
void myMessageOutput(QtMsgType type, const char *msg)
{
if (!logger.isNull()) {
- logger.data()->append(type, msg);
+ QString strMsg = QString::fromAscii(msg);
+ QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
} else {
warnings += msg;
warnings += QLatin1Char('\n');