#1186 bugfix: Use QString in slots

master
Marius Kintel 2015-02-05 12:08:38 -05:00
parent a203b55205
commit 37421bbbfa
2 changed files with 11 additions and 8 deletions

View File

@ -98,7 +98,7 @@ private slots:
void setColorScheme(const QString &cs);
void showProgress();
void openCSGSettingsChanged();
void consoleOutput(const std::string &msg);
void consoleOutput(const QString &msg);
private:
void initActionIcon(QAction *action, const char *darkResource, const char *lightResource);

View File

@ -2641,18 +2641,21 @@ void MainWindow::consoleOutput(const std::string &msg, void *userdata)
// Invoke the method in the main thread in case the output
// originates in a worker thread.
MainWindow *thisp = static_cast<MainWindow*>(userdata);
QMetaObject::invokeMethod(thisp, "consoleOutput", Q_ARG(std::string, msg));
QMetaObject::invokeMethod(thisp, "consoleOutput", Q_ARG(QString, QString::fromStdString(msg)));
}
void MainWindow::consoleOutput(const std::string &msg)
void MainWindow::consoleOutput(const QString &msg)
{
QString qmsg = QString::fromUtf8(msg.c_str());
if (qmsg.startsWith("WARNING:") || qmsg.startsWith("DEPRECATED:")) {
QString qmsg;
if (msg.startsWith("WARNING:") || msg.startsWith("DEPRECATED:")) {
this->compileWarnings++;
qmsg = "<html><span style=\"color: black; background-color: #ffffb0;\">" + qmsg + "</span></html>\n";
} else if (qmsg.startsWith("ERROR:")) {
qmsg = "<html><span style=\"color: black; background-color: #ffffb0;\">" + msg + "</span></html>\n";
} else if (msg.startsWith("ERROR:")) {
this->compileErrors++;
qmsg = "<html><span style=\"color: black; background-color: #ffb0b0;\">" + qmsg + "</span></html>\n";
qmsg = "<html><span style=\"color: black; background-color: #ffb0b0;\">" + msg + "</span></html>\n";
}
else {
qmsg = msg;
}
QTextCursor c = this->console->textCursor();
c.movePosition(QTextCursor::End);