QString::fromAscii() is obsolete in Qt5. Replace it with fromLatin1().
This change is Qt4/Qt5 neutral.
This commit is contained in:
committed by
wmayer
parent
d5c074f80d
commit
cd2db00f22
@@ -316,7 +316,7 @@ void InteractiveInterpreter::runCode(PyCodeObject* code) const
|
||||
*/
|
||||
bool InteractiveInterpreter::push(const char* line)
|
||||
{
|
||||
d->buffer.append(QString::fromAscii(line));
|
||||
d->buffer.append(QString::fromLatin1(line));
|
||||
QString source = d->buffer.join(QLatin1String("\n"));
|
||||
try {
|
||||
// Source is already UTF-8, so we can use toLatin1()
|
||||
@@ -373,7 +373,7 @@ PythonConsole::PythonConsole(QWidget *parent)
|
||||
try {
|
||||
d->interpreter = new InteractiveInterpreter();
|
||||
} catch (const Base::Exception& e) {
|
||||
setPlainText(QString::fromAscii(e.what()));
|
||||
setPlainText(QString::fromLatin1(e.what()));
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
@@ -412,9 +412,9 @@ PythonConsole::PythonConsole(QWidget *parent)
|
||||
|
||||
const char* version = PyString_AsString(PySys_GetObject("version"));
|
||||
const char* platform = PyString_AsString(PySys_GetObject("platform"));
|
||||
d->info = QString::fromAscii("Python %1 on %2\n"
|
||||
d->info = QString::fromLatin1("Python %1 on %2\n"
|
||||
"Type 'help', 'copyright', 'credits' or 'license' for more information.")
|
||||
.arg(QString::fromAscii(version)).arg(QString::fromAscii(platform));
|
||||
.arg(QString::fromLatin1(version)).arg(QString::fromLatin1(platform));
|
||||
d->output = d->info;
|
||||
printPrompt(PythonConsole::Complete);
|
||||
}
|
||||
@@ -439,7 +439,7 @@ void PythonConsole::OnChange( Base::Subject<const char*> &rCaller,const char* sR
|
||||
|
||||
if (strcmp(sReason, "FontSize") == 0 || strcmp(sReason, "Font") == 0) {
|
||||
int fontSize = hPrefGrp->GetInt("FontSize", 10);
|
||||
QString fontFamily = QString::fromAscii(hPrefGrp->GetASCII("Font", "Courier").c_str());
|
||||
QString fontFamily = QString::fromLatin1(hPrefGrp->GetASCII("Font", "Courier").c_str());
|
||||
|
||||
QFont font(fontFamily, fontSize);
|
||||
setFont(font);
|
||||
@@ -447,13 +447,13 @@ void PythonConsole::OnChange( Base::Subject<const char*> &rCaller,const char* sR
|
||||
int width = metric.width(QLatin1String("0000"));
|
||||
setTabStopWidth(width);
|
||||
} else {
|
||||
QMap<QString, QColor>::ConstIterator it = d->colormap.find(QString::fromAscii(sReason));
|
||||
QMap<QString, QColor>::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason));
|
||||
if (it != d->colormap.end()) {
|
||||
QColor color = it.value();
|
||||
unsigned long col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
|
||||
col = hPrefGrp->GetUnsigned( sReason, col);
|
||||
color.setRgb((col>>24)&0xff, (col>>16)&0xff, (col>>8)&0xff);
|
||||
pythonSyntax->setColor(QString::fromAscii(sReason), color);
|
||||
pythonSyntax->setColor(QString::fromLatin1(sReason), color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -523,7 +523,7 @@ void PythonConsole::keyPressEvent(QKeyEvent * e)
|
||||
if (!inputStrg.isEmpty())
|
||||
{
|
||||
d->history.append( QLatin1String("# ") + inputStrg ); //< put commented string to history ...
|
||||
inputLineBegin.insertText( QString::fromAscii("# ") ); //< and comment it on console
|
||||
inputLineBegin.insertText( QString::fromLatin1("# ") ); //< and comment it on console
|
||||
setTextCursor( inputLineBegin );
|
||||
printPrompt(d->interpreter->hasPendingInput() //< print adequate prompt
|
||||
? PythonConsole::Incomplete
|
||||
@@ -677,10 +677,10 @@ void PythonConsole::printPrompt(PythonConsole::Prompt mode)
|
||||
switch (mode)
|
||||
{
|
||||
case PythonConsole::Incomplete:
|
||||
cursor.insertText(QString::fromAscii("... "));
|
||||
cursor.insertText(QString::fromLatin1("... "));
|
||||
break;
|
||||
case PythonConsole::Complete:
|
||||
cursor.insertText(QString::fromAscii(">>> "));
|
||||
cursor.insertText(QString::fromLatin1(">>> "));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -893,7 +893,7 @@ void PythonConsole::dropEvent (QDropEvent * e)
|
||||
for (int i=0; i<ctActions; i++) {
|
||||
QString action;
|
||||
dataStream >> action;
|
||||
printStatement(QString::fromAscii("Gui.runCommand(\"%1\")").arg(action));
|
||||
printStatement(QString::fromLatin1("Gui.runCommand(\"%1\")").arg(action));
|
||||
}
|
||||
|
||||
e->setDropAction(Qt::CopyAction);
|
||||
@@ -1259,7 +1259,7 @@ QString PythonConsole::readline( void )
|
||||
if (loop.exec() != 0)
|
||||
{ PyErr_SetInterrupt(); } //< send SIGINT to python
|
||||
this->_sourceDrain = NULL; //< disable source drain
|
||||
return inputBuffer.append(QChar::fromAscii('\n')); //< pass a newline here, since the readline-caller may need it!
|
||||
return inputBuffer.append(QChar::fromLatin1('\n')); //< pass a newline here, since the readline-caller may need it!
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user