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
@@ -61,10 +61,10 @@ static PyObject * open(PyObject *self, PyObject *args)
|
||||
PY_TRY {
|
||||
std::string path = App::GetApplication().getHomePath();
|
||||
path += "Mod/Path/PathScripts/";
|
||||
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromAscii("*_pre.py"));
|
||||
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py"));
|
||||
std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
|
||||
->GetASCII("MacroPath",App::Application::getUserAppDataDir().c_str());
|
||||
QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromAscii("*_pre.py"));
|
||||
QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromLatin1("*_pre.py"));
|
||||
QFileInfoList list = dir1.entryInfoList();
|
||||
list << dir2.entryInfoList();
|
||||
std::vector<std::string> scripts;
|
||||
@@ -90,7 +90,7 @@ static PyObject * open(PyObject *self, PyObject *args)
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
if (fileInfo.baseName().toStdString() == selected) {
|
||||
if (fileInfo.absoluteFilePath().contains(QString::fromAscii("PathScripts"))) {
|
||||
if (fileInfo.absoluteFilePath().contains(QString::fromLatin1("PathScripts"))) {
|
||||
pre << "from PathScripts import " << selected;
|
||||
} else {
|
||||
pre << "import " << selected;
|
||||
@@ -122,10 +122,10 @@ static PyObject * importer(PyObject *self, PyObject *args)
|
||||
PY_TRY {
|
||||
std::string path = App::GetApplication().getHomePath();
|
||||
path += "Mod/Path/PathScripts/";
|
||||
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromAscii("*_pre.py"));
|
||||
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py"));
|
||||
std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
|
||||
->GetASCII("MacroPath",App::Application::getUserAppDataDir().c_str());
|
||||
QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromAscii("*_pre.py"));
|
||||
QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromLatin1("*_pre.py"));
|
||||
QFileInfoList list = dir1.entryInfoList();
|
||||
list << dir2.entryInfoList();
|
||||
std::vector<std::string> scripts;
|
||||
@@ -160,7 +160,7 @@ static PyObject * importer(PyObject *self, PyObject *args)
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
if (fileInfo.baseName().toStdString() == selected) {
|
||||
if (fileInfo.absoluteFilePath().contains(QString::fromAscii("PathScripts"))) {
|
||||
if (fileInfo.absoluteFilePath().contains(QString::fromLatin1("PathScripts"))) {
|
||||
pre << "from PathScripts import " << selected;
|
||||
} else {
|
||||
pre << "import " << selected;
|
||||
@@ -192,10 +192,10 @@ static PyObject * exporter(PyObject *self, PyObject *args)
|
||||
Py_Error(Base::BaseExceptionFreeCADError, "No object to export");
|
||||
std::string path = App::GetApplication().getHomePath();
|
||||
path += "Mod/Path/PathScripts/";
|
||||
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromAscii("*_post.py"));
|
||||
QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_post.py"));
|
||||
std::string cMacroPath = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
|
||||
->GetASCII("MacroPath",App::Application::getUserAppDataDir().c_str());
|
||||
QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromAscii("*_post.py"));
|
||||
QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromLatin1("*_post.py"));
|
||||
QFileInfoList list = dir1.entryInfoList();
|
||||
list << dir2.entryInfoList();
|
||||
std::vector<std::string> scripts;
|
||||
@@ -230,7 +230,7 @@ static PyObject * exporter(PyObject *self, PyObject *args)
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
if (fileInfo.baseName().toStdString() == selected) {
|
||||
if (fileInfo.absoluteFilePath().contains(QString::fromAscii("PathScripts"))) {
|
||||
if (fileInfo.absoluteFilePath().contains(QString::fromLatin1("PathScripts"))) {
|
||||
pre << "from PathScripts import " << selected;
|
||||
} else {
|
||||
pre << "import " << selected;
|
||||
|
||||
@@ -66,10 +66,10 @@ TaskWidgetPathCompound::TaskWidgetPathCompound(ViewProviderPathCompound *Compoun
|
||||
Path::FeatureCompound* pcCompound = static_cast<Path::FeatureCompound*>(CompoundView->getObject());
|
||||
const std::vector<App::DocumentObject*> &Paths = pcCompound->Group.getValues();
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it= Paths.begin();it!=Paths.end();++it) {
|
||||
QString name = QString::fromAscii((*it)->getNameInDocument());
|
||||
name += QString::fromAscii(" (");
|
||||
QString name = QString::fromLatin1((*it)->getNameInDocument());
|
||||
name += QString::fromLatin1(" (");
|
||||
name += QString::fromUtf8((*it)->Label.getValue());
|
||||
name += QString::fromAscii(")");
|
||||
name += QString::fromLatin1(")");
|
||||
ui->PathsList->addItem(name);
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ std::vector<std::string> TaskWidgetPathCompound::getList(void) const {
|
||||
QListWidgetItem* item = ui->PathsList->item(i);
|
||||
QString name = item->text();
|
||||
QStringList result;
|
||||
result = name.split(QRegExp(QString::fromAscii("\\s+")));
|
||||
result = name.split(QRegExp(QString::fromLatin1("\\s+")));
|
||||
std::cout << result[0].toStdString() << std::endl;
|
||||
names.push_back(result[0].toStdString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user