QString::toAscii() is obsolete in Qt5. Replace it with toLatin1().

This change is Qt4/Qt5 neutral.
This commit is contained in:
Mateusz Skowroński 2015-12-15 06:58:54 +01:00 committed by wmayer
parent e55ba2d24d
commit d5c074f80d
61 changed files with 191 additions and 191 deletions

View File

@ -82,7 +82,7 @@ Branding::XmlConfig Branding::getUserDefines() const
if (!root.isNull()) {
child = root.firstChildElement();
while (!child.isNull()) {
std::string name = (const char*)child.localName().toAscii();
std::string name = (const char*)child.localName().toLatin1();
std::string value = (const char*)child.text().toUtf8();
if (std::find(filter.begin(), filter.end(), name) != filter.end())
cfg[name] = value;

View File

@ -68,7 +68,7 @@ std::string Uuid::createUuid(void)
QString uuid = QUuid::createUuid().toString();
uuid = uuid.mid(1);
uuid.chop(1);
Uuid = (const char*)uuid.toAscii();
Uuid = (const char*)uuid.toLatin1();
return Uuid;
}
@ -82,7 +82,7 @@ void Uuid::setValue(const char* sString)
QString id = uuid.toString();
id = id.mid(1);
id.chop(1);
_uuid = (const char*)id.toAscii();
_uuid = (const char*)id.toLatin1();
}
}

View File

@ -719,7 +719,7 @@ void RecentFilesAction::activateFile(int id)
// invokes appendFile()
SelectModule::Dict dict = SelectModule::importHandler(filename);
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {
Application::Instance->open(it.key().toUtf8(), it.value().toAscii());
Application::Instance->open(it.key().toUtf8(), it.value().toLatin1());
break;
}
}
@ -773,7 +773,7 @@ void RecentFilesAction::save()
QString value = recentFiles[index]->toolTip();
if (value.isEmpty())
break;
hGrp->SetASCII(key.toAscii(), value.toUtf8());
hGrp->SetASCII(key.toLatin1(), value.toUtf8());
}
}

View File

@ -336,7 +336,7 @@ Application::Application(bool GUIenabled)
ParameterGrp::handle hPGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp");
hPGrp = hPGrp->GetGroup("Preferences")->GetGroup("General");
QString lang = QLocale::languageToString(QLocale::system().language());
Translator::instance()->activateLanguage(hPGrp->GetASCII("Language", (const char*)lang.toAscii()).c_str());
Translator::instance()->activateLanguage(hPGrp->GetASCII("Language", (const char*)lang.toLatin1()).c_str());
GetWidgetFactorySupplier();
ParameterGrp::handle hUnits = App::GetApplication().GetParameterGroupByPath
@ -1105,7 +1105,7 @@ bool Application::activateWorkbench(const char* name)
pos = rx.indexIn(msg);
}
Base::Console().Error("%s\n", (const char*)msg.toAscii());
Base::Console().Error("%s\n", (const char*)msg.toLatin1());
Base::Console().Log("%s\n", e.getStackTrace().c_str());
if (!d->startingUp) {
wc.restoreCursor();
@ -1122,7 +1122,7 @@ QPixmap Application::workbenchIcon(const QString& wb) const
{
Base::PyGILStateLocker lock;
// get the python workbench object from the dictionary
PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toAscii());
PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toLatin1());
// test if the workbench exists
if (pcWorkbench) {
// make a unique icon name
@ -1196,7 +1196,7 @@ QString Application::workbenchToolTip(const QString& wb) const
{
// get the python workbench object from the dictionary
Base::PyGILStateLocker lock;
PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toAscii());
PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toLatin1());
// test if the workbench exists
if (pcWorkbench) {
// get its ToolTip member if possible
@ -1220,7 +1220,7 @@ QString Application::workbenchMenuText(const QString& wb) const
{
// get the python workbench object from the dictionary
Base::PyGILStateLocker lock;
PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toAscii());
PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toLatin1());
// test if the workbench exists
if (pcWorkbench) {
// get its ToolTip member if possible

View File

@ -182,7 +182,7 @@ QString CallTipsList::extractContext(const QString& line) const
int index = len-1;
for (int i=0; i<len; i++) {
int pos = len-1-i;
const char ch = line.at(pos).toAscii();
const char ch = line.at(pos).toLatin1();
if ((ch >= 48 && ch <= 57) || // Numbers
(ch >= 65 && ch <= 90) || // Uppercase letters
(ch >= 97 && ch <= 122) || // Lowercase letters
@ -208,13 +208,13 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
Py::Dict dict = module.getDict();
QString modname = items.front();
items.pop_front();
if (!dict.hasKey(std::string(modname.toAscii())))
if (!dict.hasKey(std::string(modname.toLatin1())))
return tips; // unknown object
// get the Python object we need
Py::Object obj = dict.getItem(std::string(modname.toAscii()));
Py::Object obj = dict.getItem(std::string(modname.toLatin1()));
while (!items.isEmpty()) {
QByteArray name = items.front().toAscii();
QByteArray name = items.front().toLatin1();
std::string attr = name.constData();
items.pop_front();
if (obj.hasAttr(attr))

View File

@ -623,7 +623,7 @@ const char* Command::keySequenceToAccel(int sk) const
QKeySequence::StandardKey type = (QKeySequence::StandardKey)sk;
QKeySequence ks(type);
QString qs = ks.toString();
QByteArray data = qs.toAscii();
QByteArray data = qs.toLatin1();
#if defined (_MSC_VER)
return _strdup((const char*)data);
#else

View File

@ -145,7 +145,7 @@ void StdCmdOpen::activated(int iMsg)
}
else {
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {
getGuiApplication()->open(it.key().toUtf8(), it.value().toAscii());
getGuiApplication()->open(it.key().toUtf8(), it.value().toLatin1());
}
}
}
@ -215,7 +215,7 @@ void StdCmdImport::activated(int iMsg)
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {
getGuiApplication()->importFrom(it.key().toUtf8(),
getActiveGuiDocument()->getDocument()->getName(),
it.value().toAscii());
it.value().toLatin1());
}
if (emptyDoc) {
@ -288,7 +288,7 @@ void StdCmdExport::activated(int iMsg)
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {
getGuiApplication()->exportTo(it.key().toUtf8(),
getActiveGuiDocument()->getDocument()->getName(),
it.value().toAscii());
it.value().toLatin1());
}
}
}

View File

@ -90,7 +90,7 @@ void StdCmdWorkbench::activated(int i)
try {
Workbench* w = WorkbenchManager::instance()->active();
QList<QAction*> items = static_cast<WorkbenchGroup*>(_pcAction)->actions();
std::string switch_to = (const char*)items[i]->objectName().toAscii();
std::string switch_to = (const char*)items[i]->objectName().toLatin1();
if (w) {
std::string current_w = w->name();
if (switch_to == current_w)

View File

@ -287,7 +287,7 @@ void StdCmdFreezeViews::activated(int iMsg)
QList<QAction*> acts = pcAction->actions();
QString data = acts[iMsg]->toolTip();
QString send = QString::fromAscii("SetCamera %1").arg(data);
getGuiApplication()->sendMsgToActiveView(send.toAscii());
getGuiApplication()->sendMsgToActiveView(send.toLatin1());
}
}
@ -323,7 +323,7 @@ void StdCmdFreezeViews::onSaveViews()
}
}
str << " <Camera settings=\"" << viewPos.toAscii().constData() << "\"/>" << endl;
str << " <Camera settings=\"" << viewPos.toLatin1().constData() << "\"/>" << endl;
}
str << " </Views>" << endl;
@ -364,7 +364,7 @@ void StdCmdFreezeViews::onRestoreViews()
if (!xmlDocument.setContent(&file, true, &errorStr, &errorLine, &errorColumn)) {
std::cerr << "Parse error in XML content at line " << errorLine
<< ", column " << errorColumn << ": "
<< (const char*)errorStr.toAscii() << std::endl;
<< (const char*)errorStr.toLatin1() << std::endl;
return;
}
@ -1520,7 +1520,7 @@ void StdViewScreenShot::activated(int iMsg)
}
}
hExt->SetASCII("OffscreenImageFormat", (const char*)format.toAscii());
hExt->SetASCII("OffscreenImageFormat", (const char*)format.toLatin1());
// which background chosen
const char* background;

View File

@ -226,7 +226,7 @@ void DlgCustomActionsImp::on_buttonAddAction_clicked()
}
// search for the command in the manager
QByteArray actionName = newActionName().toAscii();
QByteArray actionName = newActionName().toLatin1();
CommandManager& rclMan = Application::Instance->commandManager();
MacroCommand* macro = new MacroCommand(actionName);
rclMan.addCommand( macro );
@ -260,12 +260,12 @@ void DlgCustomActionsImp::on_buttonAddAction_clicked()
actionStatus->clear();
if (!m_sPixmap.isEmpty())
macro->setPixmap(m_sPixmap.toAscii());
macro->setPixmap(m_sPixmap.toLatin1());
pixmapLabel->clear();
m_sPixmap = QString::null;
if (!actionAccel->text().isEmpty()) {
macro->setAccel(actionAccel->text().toAscii());
macro->setAccel(actionAccel->text().toLatin1());
}
actionAccel->clear();
@ -315,12 +315,12 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked()
actionStatus->clear();
if (!m_sPixmap.isEmpty())
macro->setPixmap(m_sPixmap.toAscii());
macro->setPixmap(m_sPixmap.toLatin1());
pixmapLabel->clear();
m_sPixmap = QString::null;
if (!actionAccel->text().isEmpty()) {
macro->setAccel(actionAccel->text().toAscii());
macro->setAccel(actionAccel->text().toLatin1());
}
actionAccel->clear();

View File

@ -146,7 +146,7 @@ void DlgCustomCommandsImp::onGroupActivated(QTreeWidgetItem* item)
commandTreeWidget->clear();
CommandManager & cCmdMgr = Application::Instance->commandManager();
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(group.toAscii());
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(group.toLatin1());
if (group == QLatin1String("Macros")) {
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);

View File

@ -116,7 +116,7 @@ void ButtonModel::insertButtonRows(int number)
{
QString groupName;
groupName.setNum(index);
Base::Reference<ParameterGrp> newGroup = spaceballButtonGroup()->GetGroup(groupName.toAscii());//builds the group.
Base::Reference<ParameterGrp> newGroup = spaceballButtonGroup()->GetGroup(groupName.toLatin1());//builds the group.
newGroup->SetASCII("Command", "");
}
endInsertRows();
@ -126,14 +126,14 @@ void ButtonModel::insertButtonRows(int number)
void ButtonModel::setCommand(int row, QString command)
{
GroupVector groupVector = spaceballButtonGroup()->GetGroups();
groupVector.at(row)->SetASCII("Command", command.toAscii());
groupVector.at(row)->SetASCII("Command", command.toLatin1());
}
void ButtonModel::goButtonPress(int number)
{
QString numberString;
numberString.setNum(number);
if (!spaceballButtonGroup()->HasGroup(numberString.toAscii()))
if (!spaceballButtonGroup()->HasGroup(numberString.toLatin1()))
insertButtonRows(number);
}
@ -439,7 +439,7 @@ void CommandModel::groupCommands(const QString& groupName)
CommandNode *parentNode = new CommandNode(CommandNode::GroupType);
parentNode->parent = rootNode;
rootNode->children.push_back(parentNode);
std::vector <Command*> commands = Application::Instance->commandManager().getGroupCommands(groupName.toAscii());
std::vector <Command*> commands = Application::Instance->commandManager().getGroupCommands(groupName.toLatin1());
for (std::vector <Command*>::iterator it = commands.begin(); it != commands.end(); ++it)
{
CommandNode *childNode = new CommandNode(CommandNode::CommandType);

View File

@ -274,14 +274,14 @@ void DlgDisplayPropertiesImp::on_changeMode_activated(const QString& s)
App::Property* prop = (*It)->getPropertyByName("DisplayMode");
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
App::PropertyEnumeration* Display = (App::PropertyEnumeration*)prop;
Display->setValue((const char*)s.toAscii());
Display->setValue((const char*)s.toLatin1());
}
}
}
void DlgDisplayPropertiesImp::on_changePlot_activated(const QString&s)
{
Base::Console().Log("Plot = %s\n",(const char*)s.toAscii());
Base::Console().Log("Plot = %s\n",(const char*)s.toLatin1());
}
/**

View File

@ -125,7 +125,7 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent )
this->displayItems->header()->hide();
for (QVector<QPair<QString, unsigned long> >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it) {
QTreeWidgetItem* item = new QTreeWidgetItem(this->displayItems);
item->setText(0, tr((*it).first.toAscii()));
item->setText(0, tr((*it).first.toLatin1()));
}
pythonSyntax = new PythonSyntaxHighlighter(textEdit1);
pythonSyntax->setDocument(textEdit1->document());
@ -173,10 +173,10 @@ void DlgSettingsEditorImp::saveSettings()
// Saves the color map
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor");
for (QVector<QPair<QString, unsigned long> >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it)
hGrp->SetUnsigned((*it).first.toAscii(), (*it).second);
hGrp->SetUnsigned((*it).first.toLatin1(), (*it).second);
hGrp->SetInt( "FontSize", fontSize->value() );
hGrp->SetASCII( "Font", fontFamily->currentText().toAscii() );
hGrp->SetASCII( "Font", fontFamily->currentText().toLatin1() );
}
void DlgSettingsEditorImp::loadSettings()
@ -203,7 +203,7 @@ void DlgSettingsEditorImp::loadSettings()
// Restores the color map
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor");
for (QVector<QPair<QString, unsigned long> >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it){
unsigned long col = hGrp->GetUnsigned((*it).first.toAscii(), (*it).second);
unsigned long col = hGrp->GetUnsigned((*it).first.toLatin1(), (*it).second);
(*it).second = col;
QColor color;
color.setRgb((col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff);
@ -234,7 +234,7 @@ void DlgSettingsEditorImp::changeEvent(QEvent *e)
if (e->type() == QEvent::LanguageChange) {
int index = 0;
for (QVector<QPair<QString, unsigned long> >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it)
this->displayItems->topLevelItem(index++)->setText(0, tr((*it).first.toAscii()));
this->displayItems->topLevelItem(index++)->setText(0, tr((*it).first.toLatin1()));
this->retranslateUi(this);
} else {
QWidget::changeEvent(e);

View File

@ -121,7 +121,7 @@ void DlgGeneralImp::saveSettings()
QVariant data = AutoloadModuleCombo->itemData(index);
QString startWbName = data.toString();
App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")->
SetASCII("AutoloadModule", startWbName.toAscii());
SetASCII("AutoloadModule", startWbName.toLatin1());
AutoloadTabCombo->onSave();
RecentFiles->onSave();
@ -133,7 +133,7 @@ void DlgGeneralImp::saveSettings()
setRecentFileSize();
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General");
QString lang = QLocale::languageToString(QLocale::system().language());
QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toAscii()).c_str();
QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toLatin1()).c_str();
QByteArray current = Languages->itemData(Languages->currentIndex()).toByteArray();
if (current != language)
{
@ -216,7 +216,7 @@ void DlgGeneralImp::loadSettings()
// search for the language files
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General");
QString lang = QLocale::languageToString(QLocale::system().language());
QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toAscii()).c_str();
QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toLatin1()).c_str();
int index = 1;
Languages->addItem(QString::fromAscii("English"), QByteArray("English"));
TStringMap list = Translator::instance()->supportedLocales();

View File

@ -177,7 +177,7 @@ void DlgCustomKeyboardImp::on_categoryBox_activated(int index)
editShortcut->clear();
CommandManager & cCmdMgr = Application::Instance->commandManager();
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands( group.toAscii() );
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands( group.toLatin1() );
if (group == QLatin1String("Macros")) {
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {

View File

@ -313,7 +313,7 @@ bool validateInput(QWidget* parent, const QString& input)
if (input.isEmpty())
return false;
for (int i=0; i<input.size(); i++) {
const char c = input.at(i).toAscii();
const char c = input.at(i).toLatin1();
if ((c < '0' || c > '9') && // Numbers
(c < 'A' || c > 'Z') && // Uppercase letters
(c < 'a' || c > 'z') && // Lowercase letters
@ -393,7 +393,7 @@ void ParameterGroup::onDeleteSelectedItem()
int index = parent->indexOfChild(sel);
parent->takeChild(index);
ParameterGroupItem* para = static_cast<ParameterGroupItem*>(parent);
para->_hcGrp->RemoveGrp(sel->text(0).toAscii());
para->_hcGrp->RemoveGrp(sel->text(0).toLatin1());
delete sel;
}
}
@ -425,14 +425,14 @@ void ParameterGroup::onCreateSubgroup()
ParameterGroupItem* para = static_cast<ParameterGroupItem*>(item);
Base::Reference<ParameterGrp> hGrp = para->_hcGrp;
if ( hGrp->HasGroup( name.toAscii() ) )
if ( hGrp->HasGroup( name.toLatin1() ) )
{
QMessageBox::critical( this, tr("Existing sub-group"),
tr("The sub-group '%1' already exists.").arg( name ) );
return;
}
hGrp = hGrp->GetGroup( name.toAscii() );
hGrp = hGrp->GetGroup( name.toLatin1() );
(void)new ParameterGroupItem(para,hGrp);
expandItem(para);
}
@ -822,7 +822,7 @@ void ParameterGroupItem::setData ( int column, int role, const QVariant & value
QObject::tr("The group '%1' cannot be renamed.").arg( oldName ) );
return;
}
if ( item->_hcGrp->HasGroup( newName.toAscii() ) )
if ( item->_hcGrp->HasGroup( newName.toLatin1() ) )
{
QMessageBox::critical( treeWidget(), QObject::tr("Existing group"),
QObject::tr("The group '%1' already exists.").arg( newName ) );
@ -831,10 +831,10 @@ void ParameterGroupItem::setData ( int column, int role, const QVariant & value
else
{
// rename the group by adding a new group, copy the content and remove the old group
Base::Reference<ParameterGrp> hOldGrp = item->_hcGrp->GetGroup( oldName.toAscii() );
Base::Reference<ParameterGrp> hNewGrp = item->_hcGrp->GetGroup( newName.toAscii() );
Base::Reference<ParameterGrp> hOldGrp = item->_hcGrp->GetGroup( oldName.toLatin1() );
Base::Reference<ParameterGrp> hNewGrp = item->_hcGrp->GetGroup( newName.toLatin1() );
hOldGrp->copyTo( hNewGrp );
item->_hcGrp->RemoveGrp( oldName.toAscii() );
item->_hcGrp->RemoveGrp( oldName.toLatin1() );
}
}
@ -907,25 +907,25 @@ void ParameterText::changeValue()
if ( ok )
{
setText( 2, txt );
_hcGrp->SetASCII(text(0).toAscii(), txt.toUtf8());
_hcGrp->SetASCII(text(0).toLatin1(), txt.toUtf8());
}
}
void ParameterText::removeFromGroup ()
{
_hcGrp->RemoveASCII(text(0).toAscii());
_hcGrp->RemoveASCII(text(0).toLatin1());
}
void ParameterText::replace( const QString& oldName, const QString& newName )
{
std::string val = _hcGrp->GetASCII(oldName.toAscii());
_hcGrp->RemoveASCII(oldName.toAscii());
_hcGrp->SetASCII(newName.toAscii(), val.c_str());
std::string val = _hcGrp->GetASCII(oldName.toLatin1());
_hcGrp->RemoveASCII(oldName.toLatin1());
_hcGrp->SetASCII(newName.toLatin1(), val.c_str());
}
void ParameterText::appendToGroup()
{
_hcGrp->SetASCII(text(0).toAscii(), text(2).toUtf8());
_hcGrp->SetASCII(text(0).toLatin1(), text(2).toUtf8());
}
// --------------------------------------------------------------------
@ -951,25 +951,25 @@ void ParameterInt::changeValue()
if ( ok )
{
setText(2, QString::fromAscii("%1").arg(num));
_hcGrp->SetInt(text(0).toAscii(), (long)num);
_hcGrp->SetInt(text(0).toLatin1(), (long)num);
}
}
void ParameterInt::removeFromGroup ()
{
_hcGrp->RemoveInt(text(0).toAscii());
_hcGrp->RemoveInt(text(0).toLatin1());
}
void ParameterInt::replace( const QString& oldName, const QString& newName )
{
long val = _hcGrp->GetInt(oldName.toAscii());
_hcGrp->RemoveInt(oldName.toAscii());
_hcGrp->SetInt(newName.toAscii(), val);
long val = _hcGrp->GetInt(oldName.toLatin1());
_hcGrp->RemoveInt(oldName.toLatin1());
_hcGrp->SetInt(newName.toLatin1(), val);
}
void ParameterInt::appendToGroup()
{
_hcGrp->SetInt(text(0).toAscii(), text(2).toLong());
_hcGrp->SetInt(text(0).toLatin1(), text(2).toLong());
}
// --------------------------------------------------------------------
@ -1003,26 +1003,26 @@ void ParameterUInt::changeValue()
if ( ok )
{
setText(2, QString::fromAscii("%1").arg(num));
_hcGrp->SetUnsigned(text(0).toAscii(), (unsigned long)num);
_hcGrp->SetUnsigned(text(0).toLatin1(), (unsigned long)num);
}
}
}
void ParameterUInt::removeFromGroup ()
{
_hcGrp->RemoveUnsigned(text(0).toAscii());
_hcGrp->RemoveUnsigned(text(0).toLatin1());
}
void ParameterUInt::replace( const QString& oldName, const QString& newName )
{
unsigned long val = _hcGrp->GetUnsigned(oldName.toAscii());
_hcGrp->RemoveUnsigned(oldName.toAscii());
_hcGrp->SetUnsigned(newName.toAscii(), val);
unsigned long val = _hcGrp->GetUnsigned(oldName.toLatin1());
_hcGrp->RemoveUnsigned(oldName.toLatin1());
_hcGrp->SetUnsigned(newName.toLatin1(), val);
}
void ParameterUInt::appendToGroup()
{
_hcGrp->SetUnsigned(text(0).toAscii(), text(2).toULong());
_hcGrp->SetUnsigned(text(0).toLatin1(), text(2).toULong());
}
// --------------------------------------------------------------------
@ -1048,25 +1048,25 @@ void ParameterFloat::changeValue()
if ( ok )
{
setText(2, QString::fromAscii("%1").arg(num));
_hcGrp->SetFloat(text(0).toAscii(), num);
_hcGrp->SetFloat(text(0).toLatin1(), num);
}
}
void ParameterFloat::removeFromGroup ()
{
_hcGrp->RemoveFloat(text(0).toAscii());
_hcGrp->RemoveFloat(text(0).toLatin1());
}
void ParameterFloat::replace( const QString& oldName, const QString& newName )
{
double val = _hcGrp->GetFloat(oldName.toAscii());
_hcGrp->RemoveFloat(oldName.toAscii());
_hcGrp->SetFloat(newName.toAscii(), val);
double val = _hcGrp->GetFloat(oldName.toLatin1());
_hcGrp->RemoveFloat(oldName.toLatin1());
_hcGrp->SetFloat(newName.toLatin1(), val);
}
void ParameterFloat::appendToGroup()
{
_hcGrp->SetFloat(text(0).toAscii(), text(2).toDouble());
_hcGrp->SetFloat(text(0).toLatin1(), text(2).toDouble());
}
// --------------------------------------------------------------------
@ -1096,26 +1096,26 @@ void ParameterBool::changeValue()
if ( ok )
{
setText( 2, txt );
_hcGrp->SetBool(text(0).toAscii(), (txt == list[0] ? true : false) );
_hcGrp->SetBool(text(0).toLatin1(), (txt == list[0] ? true : false) );
}
}
void ParameterBool::removeFromGroup ()
{
_hcGrp->RemoveBool(text(0).toAscii());
_hcGrp->RemoveBool(text(0).toLatin1());
}
void ParameterBool::replace( const QString& oldName, const QString& newName )
{
bool val = _hcGrp->GetBool(oldName.toAscii());
_hcGrp->RemoveBool(oldName.toAscii());
_hcGrp->SetBool(newName.toAscii(), val);
bool val = _hcGrp->GetBool(oldName.toLatin1());
_hcGrp->RemoveBool(oldName.toLatin1());
_hcGrp->SetBool(newName.toLatin1(), val);
}
void ParameterBool::appendToGroup()
{
bool val = (text(2) == QLatin1String("true") ? true : false);
_hcGrp->SetBool(text(0).toAscii(), val);
_hcGrp->SetBool(text(0).toLatin1(), val);
}
#include "moc_DlgParameterImp.cpp"

View File

@ -104,7 +104,7 @@ void DlgTipOfTheDayImp::onResponseHeaderReceived(const QHttpResponseHeader & res
{
if (responseHeader.statusCode() != 200) {
QString msg = tr("Download failed: %1\n").arg(responseHeader.reasonPhrase());
Base::Console().Log(msg.toAscii());
Base::Console().Log(msg.toLatin1());
_http->abort();
}
}
@ -143,7 +143,7 @@ void DlgTipOfTheDayImp::onStateChanged (int state)
break;
case QHttp::Closing:
case QHttp::Unconnected:
Base::Console().Log("%s\n",(const char*)_http->errorString().toAscii());
Base::Console().Log("%s\n",(const char*)_http->errorString().toLatin1());
break;
default:
break;

View File

@ -185,7 +185,7 @@ void DlgCustomToolbars::hideEvent(QHideEvent * event)
{
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
QString workbench = data.toString();
exportCustomToolbars(workbench.toAscii());
exportCustomToolbars(workbench.toLatin1());
CustomizeActionPage::hideEvent(event);
}
@ -197,7 +197,7 @@ void DlgCustomToolbars::on_categoryBox_activated(int index)
commandTreeWidget->clear();
CommandManager & cCmdMgr = Application::Instance->commandManager();
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(group.toAscii());
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(group.toLatin1());
// Create a separator item
QTreeWidgetItem* sepitem = new QTreeWidgetItem(commandTreeWidget);
@ -235,7 +235,7 @@ void DlgCustomToolbars::on_workbenchBox_activated(int index)
QString workbench = data.toString();
toolbarTreeWidget->clear();
QByteArray workbenchname = workbench.toAscii();
QByteArray workbenchname = workbench.toLatin1();
importCustomToolbars(workbenchname);
}
@ -303,7 +303,7 @@ void DlgCustomToolbars::exportCustomToolbars(const QByteArray& workbench)
QTreeWidgetItem* toplevel = toolbarTreeWidget->topLevelItem(i);
QString groupName = QString::fromAscii("Custom_%1").arg(i+1);
QByteArray toolbarName = toplevel->text(0).toUtf8();
ParameterGrp::handle hToolGrp = hGrp->GetGroup(groupName.toAscii());
ParameterGrp::handle hToolGrp = hGrp->GetGroup(groupName.toLatin1());
hToolGrp->SetASCII("Name", toolbarName.constData());
hToolGrp->SetBool("Active", toplevel->checkState(0) == Qt::Checked);
@ -352,7 +352,7 @@ void DlgCustomToolbars::on_moveActionRightButton_clicked()
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
QString workbench = data.toString();
exportCustomToolbars(workbench.toAscii());
exportCustomToolbars(workbench.toLatin1());
}
/** Removes an action */
@ -386,7 +386,7 @@ void DlgCustomToolbars::on_moveActionLeftButton_clicked()
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
QString workbench = data.toString();
exportCustomToolbars(workbench.toAscii());
exportCustomToolbars(workbench.toLatin1());
}
/** Moves up an action */
@ -424,7 +424,7 @@ void DlgCustomToolbars::on_moveActionUpButton_clicked()
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
QString workbench = data.toString();
exportCustomToolbars(workbench.toAscii());
exportCustomToolbars(workbench.toLatin1());
}
/** Moves down an action */
@ -462,7 +462,7 @@ void DlgCustomToolbars::on_moveActionDownButton_clicked()
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
QString workbench = data.toString();
exportCustomToolbars(workbench.toAscii());
exportCustomToolbars(workbench.toLatin1());
}
void DlgCustomToolbars::on_newButton_clicked()
@ -488,7 +488,7 @@ void DlgCustomToolbars::on_newButton_clicked()
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
QString workbench = data.toString();
exportCustomToolbars(workbench.toAscii());
exportCustomToolbars(workbench.toLatin1());
addCustomToolbar(text);
}
}
@ -505,7 +505,7 @@ void DlgCustomToolbars::on_deleteButton_clicked()
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
QString workbench = data.toString();
exportCustomToolbars(workbench.toAscii());
exportCustomToolbars(workbench.toLatin1());
}
void DlgCustomToolbars::on_renameButton_clicked()
@ -537,7 +537,7 @@ void DlgCustomToolbars::on_renameButton_clicked()
if (renamed) {
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
QString workbench = data.toString();
exportCustomToolbars(workbench.toAscii());
exportCustomToolbars(workbench.toLatin1());
}
}

View File

@ -245,14 +245,14 @@ void DlgWorkbenchesImp::save_workbenches()
enabled_wbs.append(name + QString::fromAscii(","));
}
}
hGrp->SetASCII("Enabled", enabled_wbs.toAscii());
hGrp->SetASCII("Enabled", enabled_wbs.toLatin1());
for (int i = 0; i < lw_disabled_workbenches->count(); i++) {
QVariant item_data = lw_disabled_workbenches->item(i)->data(Qt::UserRole);
QString name = item_data.toString();
disabled_wbs.append(name + QString::fromAscii(","));
}
hGrp->SetASCII("Disabled", disabled_wbs.toAscii());
hGrp->SetASCII("Disabled", disabled_wbs.toLatin1());
}
#include "moc_DlgWorkbenchesImp.cpp"

View File

@ -243,7 +243,7 @@ void DockWindowManager::removeDockWindow(QWidget* widget)
void DockWindowManager::retranslate()
{
for (QList<QDockWidget*>::Iterator it = d->_dockedWindows.begin(); it != d->_dockedWindows.end(); ++it) {
(*it)->setWindowTitle(QDockWidget::tr((*it)->objectName().toAscii()));
(*it)->setWindowTitle(QDockWidget::tr((*it)->objectName().toLatin1()));
}
}
@ -290,7 +290,7 @@ void DockWindowManager::setup(DockWindowItems* items)
QList<QDockWidget*> areas[4];
for (QList<DockWindowItem>::ConstIterator it = dws.begin(); it != dws.end(); ++it) {
QDockWidget* dw = findDockWidget(docked, it->name);
QByteArray dockName = it->name.toAscii();
QByteArray dockName = it->name.toLatin1();
bool visible = hPref->GetBool(dockName.constData(), it->visibility);
if (!dw) {

View File

@ -891,7 +891,7 @@ void Document::SaveDocFile (Base::Writer &writer) const
writer.incInd(); // indentation for camera settings
writer.Stream() << writer.ind() << "<Camera settings=\""
<< (const char*)viewPos.toAscii() <<"\"/>" << std::endl;
<< (const char*)viewPos.toLatin1() <<"\"/>" << std::endl;
writer.decInd(); // indentation for camera settings
writer.Stream() << "</Document>" << std::endl;
}

View File

@ -367,12 +367,12 @@ void DownloadItem::open()
if (doc) {
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {
Gui::Application::Instance->importFrom(it.key().toUtf8(),
doc->getDocument()->getName(), it.value().toAscii());
doc->getDocument()->getName(), it.value().toLatin1());
}
}
else {
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {
Gui::Application::Instance->open(it.key().toUtf8(), it.value().toAscii());
Gui::Application::Instance->open(it.key().toUtf8(), it.value().toLatin1());
}
}
}

View File

@ -799,11 +799,11 @@ SelectModule::Dict SelectModule::exportHandler(const QStringList& fileNames, con
for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) {
QFileInfo fi(*it);
QString ext = fi.completeSuffix().toLower();
std::map<std::string, std::string> filters = App::GetApplication().getExportFilters(ext.toAscii());
std::map<std::string, std::string> filters = App::GetApplication().getExportFilters(ext.toLatin1());
if (filters.empty()) {
ext = fi.suffix().toLower();
filters = App::GetApplication().getExportFilters(ext.toAscii());
filters = App::GetApplication().getExportFilters(ext.toLatin1());
}
fileExtension[ext].push_back(*it);
@ -861,11 +861,11 @@ SelectModule::Dict SelectModule::importHandler(const QStringList& fileNames, con
for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) {
QFileInfo fi(*it);
QString ext = fi.completeSuffix().toLower();
std::map<std::string, std::string> filters = App::GetApplication().getImportFilters(ext.toAscii());
std::map<std::string, std::string> filters = App::GetApplication().getImportFilters(ext.toLatin1());
if (filters.empty()) {
ext = fi.suffix().toLower();
filters = App::GetApplication().getImportFilters(ext.toAscii());
filters = App::GetApplication().getImportFilters(ext.toLatin1());
}
fileExtension[ext].push_back(*it);

View File

@ -469,7 +469,7 @@ void TextBrowser::dropEvent(QDropEvent * e)
dataStream >> action;
CommandManager& rclMan = Application::Instance->commandManager();
Command* pCmd = rclMan.getCommandByName(action.toAscii());
Command* pCmd = rclMan.getCommandByName(action.toLatin1());
if ( pCmd ) {
QString info = pCmd->getAction()->whatsThis();
if ( !info.isEmpty() ) {

View File

@ -1444,10 +1444,10 @@ void MainWindow::loadUrls(App::Document* doc, const QList<QUrl>& url)
if (info.isSymLink())
info.setFile(info.readLink());
std::vector<std::string> module = App::GetApplication()
.getImportModules(info.completeSuffix().toAscii());
.getImportModules(info.completeSuffix().toLatin1());
if (module.empty()) {
module = App::GetApplication()
.getImportModules(info.suffix().toAscii());
.getImportModules(info.suffix().toLatin1());
}
if (!module.empty()) {
// ok, we support files with this extension
@ -1483,7 +1483,7 @@ void MainWindow::loadUrls(App::Document* doc, const QList<QUrl>& url)
// load the files with the associated modules
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {
// if the passed document name doesn't exist the module should create it, if needed
Application::Instance->importFrom(it.key().toUtf8(), docName, it.value().toAscii());
Application::Instance->importFrom(it.key().toUtf8(), docName, it.value().toLatin1());
}
}
@ -1576,7 +1576,7 @@ void MainWindow::customEvent(QEvent* e)
if (d) {
ViewProviderExtern *view = new ViewProviderExtern();
try {
view->setModeByString("1",msg.toAscii().constData());
view->setModeByString("1",msg.toLatin1().constData());
d->setAnnotationViewProvider("Vdbg",view);
}
catch (...) {

View File

@ -118,7 +118,7 @@ void NetworkRetriever::testFailure()
if ( wget->state() == QProcess::Running )
{
d->fail = false;
Base::Console().Message( tr("Download started...\n").toAscii() );
Base::Console().Message( tr("Download started...\n").toLatin1() );
}
}
@ -264,7 +264,7 @@ bool NetworkRetriever::startDownload( const QString& startUrl )
{
if ( dir.mkdir( d->dir ) == false)
{
Base::Console().Error("Directory '%s' could not be created.", (const char*)d->dir.toAscii());
Base::Console().Error("Directory '%s' could not be created.", (const char*)d->dir.toLatin1());
return true; // please, no error message
}
}
@ -489,7 +489,7 @@ void StdCmdDownloadOnlineHelp::activated(int iMsg)
QString path = QString::fromUtf8(App::GetApplication().getHomePath());
path += QString::fromAscii("/doc/");
ParameterGrp::handle hURLGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/OnlineHelp");
path = QString::fromUtf8(hURLGrp->GetASCII( "DownloadLocation", path.toAscii() ).c_str());
path = QString::fromUtf8(hURLGrp->GetASCII( "DownloadLocation", path.toLatin1() ).c_str());
while (loop > 0) {
loop--;

View File

@ -146,7 +146,7 @@ QByteArray OnlineDocumentation::loadResource(const QString& filename) const
std::string path = App::GetApplication().getHomePath();
path += "/doc/docs.zip";
zipios::ZipFile zip(path);
zipios::ConstEntryPointer entry = zip.getEntry((const char*)fn.toAscii());
zipios::ConstEntryPointer entry = zip.getEntry((const char*)fn.toLatin1());
std::istream* str = zip.getInputStream(entry);
// set size of the array so that no re-allocation is needed when reading from the stream

View File

@ -230,7 +230,7 @@ void Placement::applyPlacement(const QString& data, bool incremental)
.arg(data);
}
Application::Instance->runPythonCode((const char*)cmd.toAscii());
Application::Instance->runPythonCode((const char*)cmd.toLatin1());
}
}

View File

@ -319,8 +319,8 @@ bool InteractiveInterpreter::push(const char* line)
d->buffer.append(QString::fromAscii(line));
QString source = d->buffer.join(QLatin1String("\n"));
try {
// Source is already UTF-8, so we can use toAscii()
bool more = runSource(source.toAscii());
// Source is already UTF-8, so we can use toLatin1()
bool more = runSource(source.toLatin1());
if (!more)
d->buffer.clear();
return more;

View File

@ -344,5 +344,5 @@ Py::Object PythonStdin::repr()
Py::Object PythonStdin::readline(const Py::Tuple& args)
{
return Py::String( (const char *)pyConsole->readline().toAscii() );
return Py::String( (const char *)pyConsole->readline().toLatin1() );
}

View File

@ -83,7 +83,7 @@ KeyboardP::keyEvent(QKeyEvent * qevent)
//Need to use a temporary to avoid reference becoming deleted before
//we get a hold of it.
QByteArray tmp = qevent->text().toAscii();
QByteArray tmp = qevent->text().toLatin1();
const char * printable = tmp.constData();
this->keyboard->setPrintableCharacter(*printable);
this->keyboard->setKey(sokey);

View File

@ -195,9 +195,9 @@ void SelectionView::select(QListWidgetItem* item)
elements[1] = elements[1].split(QString::fromAscii(" "))[0];
//Gui::Selection().clearSelection();
Gui::Command::runCommand(Gui::Command::Gui,"Gui.Selection.clearSelection()");
//Gui::Selection().addSelection(elements[0].toAscii(),elements[1].toAscii(),0);
//Gui::Selection().addSelection(elements[0].toLatin1(),elements[1].toLatin1(),0);
QString cmd = QString::fromAscii("Gui.Selection.addSelection(App.getDocument(\"%1\").getObject(\"%2\"))").arg(elements[0]).arg(elements[1]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toAscii());
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
void SelectionView::deselect(void)
@ -208,9 +208,9 @@ void SelectionView::deselect(void)
QStringList elements = item->text().split(QString::fromAscii("."));
// remove possible space from object name followed by label
elements[1] = elements[1].split(QString::fromAscii(" "))[0];
//Gui::Selection().rmvSelection(elements[0].toAscii(),elements[1].toAscii(),0);
//Gui::Selection().rmvSelection(elements[0].toLatin1(),elements[1].toLatin1(),0);
QString cmd = QString::fromAscii("Gui.Selection.removeSelection(App.getDocument(\"%1\").getObject(\"%2\"))").arg(elements[0]).arg(elements[1]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toAscii());
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
void SelectionView::zoom(void)
@ -235,14 +235,14 @@ void SelectionView::toPython(void)
elements[1] = elements[1].split(QString::fromAscii(" "))[0];
QString cmd = QString::fromAscii("obj = App.getDocument(\"%1\").getObject(\"%2\")").arg(elements[0]).arg(elements[1]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toAscii());
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
if (elements.length() > 2) {
elements[2] = elements[2].split(QString::fromAscii(" "))[0];
if ( elements[2].contains(QString::fromAscii("Face")) || elements[2].contains(QString::fromAscii("Edge")) ) {
cmd = QString::fromAscii("shp = App.getDocument(\"%1\").getObject(\"%2\").Shape").arg(elements[0]).arg(elements[1]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toAscii());
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
cmd = QString::fromAscii("elt = App.getDocument(\"%1\").getObject(\"%2\").Shape.%3").arg(elements[0]).arg(elements[1]).arg(elements[2]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toAscii());
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
}
}

View File

@ -286,7 +286,7 @@ std::string SoFCOffscreenRenderer::createMIBA(const SbMatrix& mat) const
com << " </View>\n" ;
com << " <Source>\n" ;
com << " <Creator>Unknown</Creator>\n" ;
com << " <CreationDate>" << QDateTime::currentDateTime().toString().toAscii().constData() << "</CreationDate>\n" ;
com << " <CreationDate>" << QDateTime::currentDateTime().toString().toLatin1().constData() << "</CreationDate>\n" ;
com << " <CreatingSystem>" << App::GetApplication().getExecutableName() << " " << major << "." << minor << "</CreatingSystem>\n" ;
com << " <PartNumber>Unknown</PartNumber>\n";
com << " <Revision>1.0</Revision>\n";

View File

@ -142,14 +142,14 @@ void TaskAppearance::on_changeMode_activated(const QString& s)
App::Property* prop = (*It)->getPropertyByName("DisplayMode");
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
App::PropertyEnumeration* Display = (App::PropertyEnumeration*)prop;
Display->setValue((const char*)s.toAscii());
Display->setValue((const char*)s.toLatin1());
}
}
}
void TaskAppearance::on_changePlot_activated(const QString&s)
{
Base::Console().Log("Plot = %s\n",(const char*)s.toAscii());
Base::Console().Log("Plot = %s\n",(const char*)s.toLatin1());
}
/**

View File

@ -263,7 +263,7 @@ ViewProviderAnnotationLabel::ViewProviderAnnotationLabel()
Justification.setEnums(JustificationEnums);
QFont fn;
ADD_PROPERTY(FontSize,(fn.pointSize()));
ADD_PROPERTY(FontName,((const char*)fn.family().toAscii()));
ADD_PROPERTY(FontName,((const char*)fn.family().toLatin1()));
ADD_PROPERTY(Frame,(true));
pColor = new SoBaseColor();

View File

@ -549,8 +549,8 @@ QWidget* UiLoader::createWidget(const QString & className, QWidget * parent,
if (this->cw.contains(className))
return QUiLoader::createWidget(className, parent, name);
QWidget* w = 0;
if (WidgetFactory().CanProduce((const char*)className.toAscii()))
w = WidgetFactory().createWidget((const char*)className.toAscii(), parent);
if (WidgetFactory().CanProduce((const char*)className.toLatin1()))
w = WidgetFactory().createWidget((const char*)className.toLatin1(), parent);
if (w) w->setObjectName(name);
return w;
}
@ -1055,7 +1055,7 @@ bool PyResource::connect(const char* sender, const char* signal, PyObject* cb)
if (objS) {
SignalConnect* sc = new SignalConnect(this, cb);
mySingals.push_back(sc);
return QObject::connect(objS, sigStr.toAscii(), sc, SLOT ( onExecute() ) );
return QObject::connect(objS, sigStr.toLatin1(), sc, SLOT ( onExecute() ) );
}
else
qWarning( "'%s' does not exist.\n", sender );
@ -1165,14 +1165,14 @@ PyObject *PyResource::value(PyObject *args)
int nSize = str.count();
PyObject* slist = PyList_New(nSize);
for (int i=0; i<nSize;++i) {
PyObject* item = PyString_FromString(str[i].toAscii());
PyObject* item = PyString_FromString(str[i].toLatin1());
PyList_SetItem(slist, i, item);
}
} break;
case QVariant::ByteArray:
break;
case QVariant::String:
pItem = PyString_FromString(v.toString().toAscii());
pItem = PyString_FromString(v.toString().toLatin1());
break;
case QVariant::Double:
pItem = PyFloat_FromDouble(v.toDouble());

View File

@ -740,7 +740,7 @@ void UrlLabel::mouseReleaseEvent (QMouseEvent *)
PyObject* dict = PyModule_GetDict(module);
PyObject* func = PyDict_GetItemString(dict, "open");
if (func) {
PyObject* args = Py_BuildValue("(s)", (const char*)this->_url.toAscii());
PyObject* args = Py_BuildValue("(s)", (const char*)this->_url.toLatin1());
PyObject* result = PyEval_CallObject(func,args);
// decrement the args and module reference
Py_XDECREF(result);

View File

@ -2428,8 +2428,8 @@ LinkSelection::~LinkSelection()
void LinkSelection::select()
{
Gui::Selection().clearSelection();
Gui::Selection().addSelection((const char*)link[0].toAscii(),
(const char*)link[1].toAscii());
Gui::Selection().addSelection((const char*)link[0].toLatin1(),
(const char*)link[1].toLatin1());
this->deleteLater();
}

View File

@ -165,7 +165,7 @@ Gui::Action * CmdDrawingNewPage::createAction(void)
if (file.open(QFile::ReadOnly)) {
QString s = QString::fromAscii("style=\"font-size:22px\">%1%2</tspan></text>").arg(paper).arg(id);
QByteArray data = file.readAll();
data.replace("style=\"font-size:22px\">A0</tspan></text>", s.toAscii());
data.replace("style=\"font-size:22px\">A0</tspan></text>", s.toLatin1());
a->setIcon(Gui::BitmapFactory().pixmapFromSvg(data, QSize(64,64)));
}

View File

@ -221,15 +221,15 @@ void VisualInspection::accept()
if (sel->checkState(0) == Qt::Checked) {
QString actualName = sel->data(0, Qt::UserRole).toString();
Gui::Application::Instance->runCommand(
true, "App_activeDocument___InspectionGroup.newObject(\"Inspection::Feature\",\"%s_Inspect\")", (const char*)actualName.toAscii());
true, "App_activeDocument___InspectionGroup.newObject(\"Inspection::Feature\",\"%s_Inspect\")", (const char*)actualName.toLatin1());
Gui::Application::Instance->runCommand(
true, "App.ActiveDocument.ActiveObject.Actual=App.ActiveDocument.%s\n"
"App_activeDocument___activeObject___Nominals=list()\n"
"App.ActiveDocument.ActiveObject.SearchRadius=%.3f\n"
"App.ActiveDocument.ActiveObject.Thickness=%.3f\n", (const char*)actualName.toAscii(), searchRadius, thickness);
"App.ActiveDocument.ActiveObject.Thickness=%.3f\n", (const char*)actualName.toLatin1(), searchRadius, thickness);
for (QStringList::Iterator it = nominalNames.begin(); it != nominalNames.end(); ++it) {
Gui::Application::Instance->runCommand(
true, "App_activeDocument___activeObject___Nominals.append(App.ActiveDocument.%s)\n", (const char*)(*it).toAscii());
true, "App_activeDocument___activeObject___Nominals.append(App.ActiveDocument.%s)\n", (const char*)(*it).toLatin1());
}
Gui::Application::Instance->runCommand(
true, "App.ActiveDocument.ActiveObject.Nominals=App_activeDocument___activeObject___Nominals\n"
@ -249,7 +249,7 @@ void VisualInspection::accept()
if (sel->checkState(0) == Qt::Checked) {
Gui::Application::Instance->runCommand(
true, "Gui.ActiveDocument.getObject(\"%s\").Visibility=False"
, (const char*)sel->data(0, Qt::UserRole).toString().toAscii());
, (const char*)sel->data(0, Qt::UserRole).toString().toLatin1());
}
}
@ -258,7 +258,7 @@ void VisualInspection::accept()
if (sel->checkState(0) == Qt::Checked) {
Gui::Application::Instance->runCommand(
true, "Gui.ActiveDocument.getObject(\"%s\").Visibility=False"
, (const char*)sel->data(0, Qt::UserRole).toString().toAscii());
, (const char*)sel->data(0, Qt::UserRole).toString().toLatin1());
}
}
}

View File

@ -468,7 +468,7 @@ void CmdMeshExport::activated(int iMsg)
QObject::tr("Export mesh"), dir, filter.join(QLatin1String(";;")), &format);
if (!fn.isEmpty()) {
QFileInfo fi(fn);
QByteArray extension = fi.suffix().toAscii();
QByteArray extension = fi.suffix().toLatin1();
for (QList<QPair<QString, QByteArray> >::iterator it = ext.begin(); it != ext.end(); ++it) {
if (it->first == format) {
extension = it->second;

View File

@ -202,7 +202,7 @@ void MeshGui::DlgRegularSolidImp::on_createSolidButton_clicked()
// Execute the Python block
QString solid = tr("Create %1").arg(comboBox1->currentText());
Gui::Application::Instance->activeDocument()->openCommand(solid.toUtf8());
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toAscii());
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toLatin1());
Gui::Application::Instance->activeDocument()->commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().recompute()");
Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");

View File

@ -450,7 +450,7 @@ public:
QStringList lines = s.split(QLatin1String("\n"));
std::vector<std::string> text;
for (QStringList::Iterator it = lines.begin(); it != lines.end(); ++it)
text.push_back((const char*)it->toAscii());
text.push_back((const char*)it->toLatin1());
anno->LabelText.setValues(text);
std::stringstream str;
str << "Curvature info (" << group->Group.getSize() << ")";

View File

@ -223,7 +223,7 @@ bool Tessellation::accept()
return false;
}
App::Document* activeDoc = App::GetApplication().getDocument((const char*)this->document.toAscii());
App::Document* activeDoc = App::GetApplication().getDocument((const char*)this->document.toLatin1());
if (!activeDoc) {
QMessageBox::critical(this, windowTitle(),
tr("No such document '%1'.").arg(this->document));

View File

@ -820,8 +820,8 @@ void CmdPartImportCurveNet::activated(int iMsg)
if (!fn.isEmpty()) {
QFileInfo fi; fi.setFile(fn);
openCommand("Part Import Curve Net");
doCommand(Doc,"f = App.activeDocument().addObject(\"Part::CurveNet\",\"%s\")", (const char*)fi.baseName().toAscii());
doCommand(Doc,"f.FileName = \"%s\"",(const char*)fn.toAscii());
doCommand(Doc,"f = App.activeDocument().addObject(\"Part::CurveNet\",\"%s\")", (const char*)fi.baseName().toLatin1());
doCommand(Doc,"f.FileName = \"%s\"",(const char*)fn.toLatin1());
commitCommand();
updateActive();
}
@ -896,7 +896,7 @@ void CmdPartMakeSolid::activated(int iMsg)
try {
if (!str.isEmpty())
doCommand(Doc, (const char*)str.toAscii());
doCommand(Doc, (const char*)str.toLatin1());
}
catch (const Base::Exception& e) {
Base::Console().Error("Cannot convert %s because %s.\n",
@ -950,7 +950,7 @@ void CmdPartReverseShape::activated(int iMsg)
try {
if (!str.isEmpty())
doCommand(Doc, (const char*)str.toAscii());
doCommand(Doc, (const char*)str.toLatin1());
}
catch (const Base::Exception& e) {
Base::Console().Error("Cannot convert %s because %s.\n",

View File

@ -244,13 +244,13 @@ void CrossSections::apply()
"wires=list()\n"
"shape=FreeCAD.getDocument(\"%1\").%2.Shape\n")
.arg(QLatin1String(doc->getName()))
.arg(QLatin1String((*it)->getNameInDocument())).toAscii());
.arg(QLatin1String((*it)->getNameInDocument())).toLatin1());
for (std::vector<double>::iterator jt = d.begin(); jt != d.end(); ++jt) {
app->runPythonCode(QString::fromAscii(
"for i in shape.slice(Base.Vector(%1,%2,%3),%4):\n"
" wires.append(i)\n"
).arg(a).arg(b).arg(c).arg(*jt).toAscii());
).arg(a).arg(b).arg(c).arg(*jt).toLatin1());
seq.next();
}
@ -261,7 +261,7 @@ void CrossSections::apply()
"slice.purgeTouched()\n"
"del slice,comp,wires,shape")
.arg(QLatin1String(doc->getName()))
.arg(QLatin1String(s.c_str())).toAscii());
.arg(QLatin1String(s.c_str())).toLatin1());
seq.next();
}

View File

@ -187,7 +187,7 @@ void DlgExtrusion::apply()
bool makeSolid = ui->makeSolid->isChecked();
// inspect geometry
App::DocumentObject* obj = activeDoc->getObject((const char*)shape.toAscii());
App::DocumentObject* obj = activeDoc->getObject((const char*)shape.toLatin1());
if (!obj || !obj->isDerivedFrom(Part::Feature::getClassTypeId())) continue;
Part::Feature* fea = static_cast<Part::Feature*>(obj);
const TopoDS_Shape& data = fea->Shape.getValue();
@ -227,9 +227,9 @@ void DlgExtrusion::apply()
.arg(makeSolid ? QLatin1String("True") : QLatin1String("False"))
.arg(angle)
.arg(label);
Gui::Application::Instance->runPythonCode((const char*)code.toAscii());
QByteArray to = name.toAscii();
QByteArray from = shape.toAscii();
Gui::Application::Instance->runPythonCode((const char*)code.toLatin1());
QByteArray to = name.toLatin1();
QByteArray from = shape.toLatin1();
Gui::Command::copyVisual(to, "ShapeColor", from);
Gui::Command::copyVisual(to, "LineColor", from);
Gui::Command::copyVisual(to, "PointColor", from);

View File

@ -413,7 +413,7 @@ void DlgFilletEdges::onSelectEdgesOfFace(const QString& subelement, int type)
Gui::SelectionChanges::MsgType msgType = Gui::SelectionChanges::MsgType(type);
if (msgType == Gui::SelectionChanges::AddSelection) {
Gui::Selection().addSelection(d->object->getDocument()->getName(),
d->object->getNameInDocument(), (const char*)name.toAscii());
d->object->getNameInDocument(), (const char*)name.toLatin1());
}
}
}
@ -483,13 +483,13 @@ void DlgFilletEdges::toggleCheckState(const QModelIndex& index)
App::Document* doc = d->object->getDocument();
Gui::Selection().addSelection(doc->getName(),
d->object->getNameInDocument(),
(const char*)name.toAscii());
(const char*)name.toLatin1());
}
else {
App::Document* doc = d->object->getDocument();
Gui::Selection().rmvSelection(doc->getName(),
d->object->getNameInDocument(),
(const char*)name.toAscii());
(const char*)name.toLatin1());
}
this->blockConnection(block);
@ -870,7 +870,7 @@ bool DlgFilletEdges::accept()
"del __fillets__\n"
"FreeCADGui.ActiveDocument.%2.Visibility = False\n")
.arg(name).arg(shape);
Gui::Application::Instance->runPythonCode((const char*)code.toAscii());
Gui::Application::Instance->runPythonCode((const char*)code.toLatin1());
activeDoc->commitTransaction();
activeDoc->recompute();
if (d->fillet) {
@ -879,8 +879,8 @@ bool DlgFilletEdges::accept()
if (vp) vp->show();
}
QByteArray to = name.toAscii();
QByteArray from = shape.toAscii();
QByteArray to = name.toLatin1();
QByteArray from = shape.toLatin1();
Gui::Command::copyVisual(to, "LineColor", from);
Gui::Command::copyVisual(to, "PointColor", from);
return true;

View File

@ -102,7 +102,7 @@ void Picker::createPrimitive(QWidget* widget, const QString& descr, Gui::Documen
// Execute the Python block
doc->openCommand(descr.toUtf8());
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toAscii());
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toLatin1());
doc->commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");

View File

@ -212,9 +212,9 @@ void DlgRevolution::accept()
.arg(ui->angle->value(),0,'f',2)
.arg(solid)
;
Gui::Application::Instance->runPythonCode((const char*)code.toAscii());
QByteArray to = name.toAscii();
QByteArray from = shape.toAscii();
Gui::Application::Instance->runPythonCode((const char*)code.toLatin1());
QByteArray to = name.toLatin1();
QByteArray from = shape.toLatin1();
Gui::Command::copyVisual(to, "ShapeColor", from);
Gui::Command::copyVisual(to, "LineColor", from);
Gui::Command::copyVisual(to, "PointColor", from);

View File

@ -123,7 +123,7 @@ bool Mirroring::accept()
return false;
}
App::Document* activeDoc = App::GetApplication().getDocument((const char*)this->document.toAscii());
App::Document* activeDoc = App::GetApplication().getDocument((const char*)this->document.toLatin1());
if (!activeDoc) {
QMessageBox::critical(this, windowTitle(),
tr("No such document '%1'.").arg(this->document));
@ -169,8 +169,8 @@ bool Mirroring::accept()
.arg(this->document).arg(shape).arg(label)
.arg(normx).arg(normy).arg(normz)
.arg(basex).arg(basey).arg(basez);
Gui::Application::Instance->runPythonCode((const char*)code.toAscii());
QByteArray from = shape.toAscii();
Gui::Application::Instance->runPythonCode((const char*)code.toLatin1());
QByteArray from = shape.toLatin1();
Gui::Command::copyVisual("ActiveObject", "ShapeColor", from);
Gui::Command::copyVisual("ActiveObject", "LineColor", from);
Gui::Command::copyVisual("ActiveObject", "PointColor", from);

View File

@ -561,7 +561,7 @@ void TaskCheckGeometryResults::buildShapeContent(const QString &baseName, const
std::ostringstream stream;
if (!shapeContentString.empty())
stream << std::endl << std::endl;
stream << baseName.toAscii().data() << ":" << std::endl;
stream << baseName.toLatin1().data() << ":" << std::endl;
BRepTools_ShapeSet set;
set.Add(shape);
@ -709,7 +709,7 @@ void TaskCheckGeometryResults::currentRowChanged (const QModelIndex &current, co
QString doc, object, sub;
if (!this->split((*stringIt), doc, object, sub))
continue;
Gui::Selection().addSelection(doc.toAscii(), object.toAscii(), sub.toAscii());
Gui::Selection().addSelection(doc.toLatin1(), object.toLatin1(), sub.toLatin1());
}
}
}

View File

@ -175,7 +175,7 @@ bool LoftWidget::accept()
Gui::Document* doc = Gui::Application::Instance->getDocument(d->document.c_str());
if (!doc) throw Base::Exception("Document doesn't exist anymore");
doc->openCommand("Loft");
Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false);
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
doc->getDocument()->recompute();
App::DocumentObject* obj = doc->getDocument()->getActiveObject();
if (obj && !obj->isValid()) {

View File

@ -201,7 +201,7 @@ void ShapeBuilderWidget::createEdgeFromVertex()
try {
Gui::Application::Instance->activeDocument()->openCommand("Edge");
Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false);
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
Gui::Application::Instance->activeDocument()->commitCommand();
}
catch (const Base::Exception&) {
@ -253,7 +253,7 @@ void ShapeBuilderWidget::createFaceFromVertex()
try {
Gui::Application::Instance->activeDocument()->openCommand("Face");
Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false);
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
Gui::Application::Instance->activeDocument()->commitCommand();
}
catch (const Base::Exception&) {
@ -305,7 +305,7 @@ void ShapeBuilderWidget::createFaceFromEdge()
try {
Gui::Application::Instance->activeDocument()->openCommand("Face");
Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false);
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
Gui::Application::Instance->activeDocument()->commitCommand();
}
catch (const Base::Exception&) {
@ -358,7 +358,7 @@ void ShapeBuilderWidget::createShellFromFace()
try {
Gui::Application::Instance->activeDocument()->openCommand("Shell");
Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false);
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
Gui::Application::Instance->activeDocument()->commitCommand();
}
catch (const Base::Exception&) {
@ -398,7 +398,7 @@ void ShapeBuilderWidget::createSolidFromShell()
try {
Gui::Application::Instance->activeDocument()->openCommand("Solid");
Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false);
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
Gui::Application::Instance->activeDocument()->commitCommand();
}
catch (const Base::Exception&) {

View File

@ -321,7 +321,7 @@ bool SweepWidget::accept()
Gui::Document* doc = Gui::Application::Instance->getDocument(d->document.c_str());
if (!doc) throw Base::Exception("Document doesn't exist anymore");
doc->openCommand("Sweep");
Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false);
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
doc->getDocument()->recompute();
App::DocumentObject* obj = doc->getDocument()->getActiveObject();
if (obj && !obj->isValid()) {

View File

@ -56,7 +56,7 @@ std::vector<App::DocumentObject*> FeaturePickDialog::getFeatures() {
std::vector<App::DocumentObject*> result;
for (std::vector<QString>::const_iterator s = features.begin(); s != features.end(); ++s)
result.push_back(App::GetApplication().getActiveDocument()->getObject(s->toAscii().data()));
result.push_back(App::GetApplication().getActiveDocument()->getObject(s->toLatin1().data()));
return result;
}

View File

@ -270,7 +270,7 @@ void CmdRobotSetDefaultValues::activated(int iMsg)
QObject::tr("speed: (e.g. 1 m/s or 3 cm/s)"), QLineEdit::Normal,
QString::fromAscii("1 m/s"), &ok);
if ( ok && !text.isEmpty() ) {
doCommand(Doc,"_DefSpeed = '%s'",text.toAscii().constData());
doCommand(Doc,"_DefSpeed = '%s'",text.toLatin1().constData());
}
QStringList items;
@ -279,7 +279,7 @@ void CmdRobotSetDefaultValues::activated(int iMsg)
QString item = QInputDialog::getItem(0, QObject::tr("set default continuity"),
QObject::tr("continuous ?"), items, 0, false, &ok);
if (ok && !item.isEmpty())
doCommand(Doc,"_DefCont = %s",item.toAscii().constData());
doCommand(Doc,"_DefCont = %s",item.toLatin1().constData());
text.clear();
@ -287,7 +287,7 @@ void CmdRobotSetDefaultValues::activated(int iMsg)
QObject::tr("acceleration: (e.g. 1 m/s^2 or 3 cm/s^2)"), QLineEdit::Normal,
QString::fromAscii("1 m/s^2"), &ok);
if ( ok && !text.isEmpty() ) {
doCommand(Doc,"_DefAccelaration = '%s'",text.toAscii().constData());
doCommand(Doc,"_DefAccelaration = '%s'",text.toLatin1().constData());
}

View File

@ -568,7 +568,7 @@ void DrawSketchHandler::renderSuggestConstraintsCursor(std::vector<AutoConstrain
}
if (!iconType.isEmpty()) {
QPixmap icon = Gui::BitmapFactory().pixmap(iconType.toAscii()).scaledToWidth(iconSize);
QPixmap icon = Gui::BitmapFactory().pixmap(iconType.toLatin1()).scaledToWidth(iconSize);
qp.drawPixmap(QPoint(baseIcon.width() + i * iconSize, baseIcon.height() - iconSize), icon);
}
}

View File

@ -2817,7 +2817,7 @@ void ViewProviderSketch::drawMergedConstraintIcons(IconQueue iconQueue)
}
edit->combinedConstrBoxes[idString] = boundingBoxes;
thisInfo->string.setValue(idString.toAscii().data());
thisInfo->string.setValue(idString.toLatin1().data());
sendConstraintIconToCoin(compositeIcon, thisDest);
}
@ -2835,7 +2835,7 @@ QImage ViewProviderSketch::renderConstrIcon(const QString &type,
// Constants to help create constraint icons
QString joinStr = QString::fromAscii(", ");
QImage icon = Gui::BitmapFactory().pixmap(type.toAscii()).toImage();
QImage icon = Gui::BitmapFactory().pixmap(type.toLatin1()).toImage();
QFont font = QApplication::font();
font.setPixelSize(11);
@ -2918,7 +2918,7 @@ void ViewProviderSketch::drawTypicalConstraintIcon(const constrIconQueueItem &i)
QList<QColor>() << color,
i.iconRotation);
i.infoPtr->string.setValue(QString::number(i.constraintId).toAscii().data());
i.infoPtr->string.setValue(QString::number(i.constraintId).toLatin1().data());
sendConstraintIconToCoin(image, i.destination);
}

View File

@ -116,7 +116,7 @@ Py::Object UnitTestDialogPy::getUnitTest(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), ""))
throw Py::Exception();
return Py::String((const char*)UnitTestDialog::instance()->getUnitTest().toAscii());
return Py::String((const char*)UnitTestDialog::instance()->getUnitTest().toLatin1());
}
Py::Object UnitTestDialogPy::setStatusText(const Py::Tuple& args)