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

This commit is contained in:
kervala 2016-01-16 15:55:56 +01:00
parent 5c0fcc5cfc
commit 45a3bf320e
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);
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 */

View file

@ -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;