Qt5 compatibility changes.
QString::fromAscii() is obsolete in Qt5. Replace it with fromLatin1(). QString::toAscii() is obsolete in Qt5. Replace it with toLatin1(). QChar::fromAscii() is obsolete in Qt5. Replace it with fromLatin1(). This change is Qt4/Qt5 neutral.
This commit is contained in:
parent
fbd6f9002c
commit
4ef8c9707f
|
@ -236,7 +236,7 @@ QStringList ExpressionCompleter::splitPath ( const QString & path ) const
|
||||||
void ExpressionCompleter::slotUpdate(const QString & prefix)
|
void ExpressionCompleter::slotUpdate(const QString & prefix)
|
||||||
{
|
{
|
||||||
using namespace boost::tuples;
|
using namespace boost::tuples;
|
||||||
int j = (prefix.size() > 0 && prefix.at(0) == QChar::fromAscii('=')) ? 1 : 0;
|
int j = (prefix.size() > 0 && prefix.at(0) == QChar::fromLatin1('=')) ? 1 : 0;
|
||||||
std::vector<boost::tuple<int, int, std::string> > tokens = ExpressionParser::tokenize(Base::Tools::toStdString(prefix.mid(j)));
|
std::vector<boost::tuple<int, int, std::string> > tokens = ExpressionParser::tokenize(Base::Tools::toStdString(prefix.mid(j)));
|
||||||
std::string completionPrefix;
|
std::string completionPrefix;
|
||||||
|
|
||||||
|
|
|
@ -991,7 +991,7 @@ bool PyResource::connect(const char* sender, const char* signal, PyObject* cb)
|
||||||
QList<QWidget*> list = myDlg->findChildren<QWidget*>();
|
QList<QWidget*> list = myDlg->findChildren<QWidget*>();
|
||||||
QList<QWidget*>::const_iterator it = list.begin();
|
QList<QWidget*>::const_iterator it = list.begin();
|
||||||
QObject *obj;
|
QObject *obj;
|
||||||
QString sigStr = QString::fromAscii("2%1").arg(QString::fromAscii(signal));
|
QString sigStr = QString::fromLatin1("2%1").arg(QString::fromLatin1(signal));
|
||||||
|
|
||||||
while ( it != list.end() ) {
|
while ( it != list.end() ) {
|
||||||
obj = *it;
|
obj = *it;
|
||||||
|
@ -1005,7 +1005,7 @@ bool PyResource::connect(const char* sender, const char* signal, PyObject* cb)
|
||||||
if (objS) {
|
if (objS) {
|
||||||
SignalConnect* sc = new SignalConnect(this, cb);
|
SignalConnect* sc = new SignalConnect(this, cb);
|
||||||
mySingals.push_back(sc);
|
mySingals.push_back(sc);
|
||||||
return QObject::connect(objS, sigStr.toAscii(), sc, SLOT ( onExecute() ) );
|
return QObject::connect(objS, sigStr.toLatin1(), sc, SLOT ( onExecute() ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
qWarning( "'%s' does not exist.\n", sender );
|
qWarning( "'%s' does not exist.\n", sender );
|
||||||
|
@ -1063,14 +1063,14 @@ Py::Object PyResource::value(const Py::Tuple& args)
|
||||||
int nSize = str.count();
|
int nSize = str.count();
|
||||||
Py::List slist(nSize);
|
Py::List slist(nSize);
|
||||||
for (int i=0; i<nSize;++i) {
|
for (int i=0; i<nSize;++i) {
|
||||||
slist.setItem(i, Py::String(str[i].toAscii()));
|
slist.setItem(i, Py::String(str[i].toLatin1()));
|
||||||
}
|
}
|
||||||
item = slist;
|
item = slist;
|
||||||
} break;
|
} break;
|
||||||
case QVariant::ByteArray:
|
case QVariant::ByteArray:
|
||||||
break;
|
break;
|
||||||
case QVariant::String:
|
case QVariant::String:
|
||||||
item = Py::String(v.toString().toAscii());
|
item = Py::String(v.toString().toLatin1());
|
||||||
break;
|
break;
|
||||||
case QVariant::Double:
|
case QVariant::Double:
|
||||||
item = Py::Float(v.toDouble());
|
item = Py::Float(v.toDouble());
|
||||||
|
@ -1107,7 +1107,7 @@ Py::Object PyResource::setValue(const Py::Tuple& args)
|
||||||
|
|
||||||
QVariant v;
|
QVariant v;
|
||||||
if (PyString_Check(psValue)) {
|
if (PyString_Check(psValue)) {
|
||||||
v = QString::fromAscii(PyString_AsString(psValue));
|
v = QString::fromLatin1(PyString_AsString(psValue));
|
||||||
}
|
}
|
||||||
else if (PyInt_Check(psValue)) {
|
else if (PyInt_Check(psValue)) {
|
||||||
int val = PyInt_AsLong(psValue);
|
int val = PyInt_AsLong(psValue);
|
||||||
|
@ -1129,7 +1129,7 @@ Py::Object PyResource::setValue(const Py::Tuple& args)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char* pItem = PyString_AsString(item);
|
char* pItem = PyString_AsString(item);
|
||||||
str.append(QString::fromAscii(pItem));
|
str.append(QString::fromLatin1(pItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
v = str;
|
v = str;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user