From 45a3bf320e2c5a4f4177102284570147bd217699 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 16 Jan 2016 15:55:56 +0100 Subject: [PATCH] Fixed: moc doesn't use the right namespace for std::string when using STLPort, so prefer QString for slots and signals --- code/nel/tools/3d/shared_widgets/command_log.cpp | 15 ++++++++------- code/nel/tools/3d/shared_widgets/command_log.h | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/code/nel/tools/3d/shared_widgets/command_log.cpp b/code/nel/tools/3d/shared_widgets/command_log.cpp index d7b9ee735..fda28dd2a 100644 --- a/code/nel/tools/3d/shared_widgets/command_log.cpp +++ b/code/nel/tools/3d/shared_widgets/command_log.cpp @@ -100,7 +100,7 @@ void CCommandLog::doDisplay(const CLog::TDisplayInfo& args, const char *message) std::string str = NLMISC::CWindowDisplayer::stringifyMessage(args, message); - tSigDisplay(color, str.substr(0, str.size() - 1).c_str()); + emit tSigDisplay(color, QString::fromUtf8(str.substr(0, str.size() - 1).c_str())); } void CCommandLog::tSlotDisplay(const QColor &c, const QString &text) @@ -115,9 +115,8 @@ void CCommandLog::returnPressed() if (text.isEmpty()) return; - std::string cmd = text.toLocal8Bit().data(); - execCommand(cmd); - if (m_Func) m_Func(cmd); + emit execCommand(text); + if (m_Func) m_Func(text.toUtf8().constData()); m_CommandInput->clear(); } @@ -148,10 +147,12 @@ void CCommandLogDisplayer::doDisplay(const NLMISC::CLog::TDisplayInfo& args, con CCommandLog::doDisplay(args, message); } -void CCommandLogDisplayer::execCommandLog(const std::string &cmd) +void CCommandLogDisplayer::execCommandLog(const QString &cmd) { - m_Log.displayRawNL("> %s", cmd.c_str()); - ICommand::execute(cmd, m_Log); + std::string str = cmd.toUtf8().constData(); + + m_Log.displayRawNL("> %s", str.c_str()); + ICommand::execute(str, m_Log); } } /* namespace NLQT */ diff --git a/code/nel/tools/3d/shared_widgets/command_log.h b/code/nel/tools/3d/shared_widgets/command_log.h index a496095d2..16bc21c9d 100644 --- a/code/nel/tools/3d/shared_widgets/command_log.h +++ b/code/nel/tools/3d/shared_widgets/command_log.h @@ -70,7 +70,7 @@ public: signals: void tSigDisplay(const QColor &c, const QString &text); - void execCommand(const std::string &cmd); + void execCommand(const QString &cmd); private slots: void returnPressed(); @@ -99,7 +99,7 @@ protected: virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message); private slots: - void execCommandLog(const std::string &cmd); + void execCommandLog(const QString &cmd); private: NLMISC::CLog m_Log;