Fixed: moc doesn't use the right namespace for std::string when using STLPort, so prefer QString for slots and signals

--HG--
branch : develop
This commit is contained in:
kervala 2016-01-16 15:55:56 +01:00
parent cd021fc4ef
commit 4886da5855
2 changed files with 10 additions and 9 deletions

View file

@ -100,7 +100,7 @@ void CCommandLog::doDisplay(const CLog::TDisplayInfo& args, const char *message)
std::string str = NLMISC::CWindowDisplayer::stringifyMessage(args, 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) void CCommandLog::tSlotDisplay(const QColor &c, const QString &text)
@ -115,9 +115,8 @@ void CCommandLog::returnPressed()
if (text.isEmpty()) if (text.isEmpty())
return; return;
std::string cmd = text.toLocal8Bit().data(); emit execCommand(text);
execCommand(cmd); if (m_Func) m_Func(text.toUtf8().constData());
if (m_Func) m_Func(cmd);
m_CommandInput->clear(); m_CommandInput->clear();
} }
@ -148,10 +147,12 @@ void CCommandLogDisplayer::doDisplay(const NLMISC::CLog::TDisplayInfo& args, con
CCommandLog::doDisplay(args, message); CCommandLog::doDisplay(args, message);
} }
void CCommandLogDisplayer::execCommandLog(const std::string &cmd) void CCommandLogDisplayer::execCommandLog(const QString &cmd)
{ {
m_Log.displayRawNL("> %s", cmd.c_str()); std::string str = cmd.toUtf8().constData();
ICommand::execute(cmd, m_Log);
m_Log.displayRawNL("> %s", str.c_str());
ICommand::execute(str, m_Log);
} }
} /* namespace NLQT */ } /* namespace NLQT */

View file

@ -70,7 +70,7 @@ public:
signals: signals:
void tSigDisplay(const QColor &c, const QString &text); void tSigDisplay(const QColor &c, const QString &text);
void execCommand(const std::string &cmd); void execCommand(const QString &cmd);
private slots: private slots:
void returnPressed(); void returnPressed();
@ -99,7 +99,7 @@ protected:
virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message); virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message);
private slots: private slots:
void execCommandLog(const std::string &cmd); void execCommandLog(const QString &cmd);
private: private:
NLMISC::CLog m_Log; NLMISC::CLog m_Log;