QString::fromAscii() is obsolete in Qt5. Replace it with fromLatin1().

This change is Qt4/Qt5 neutral.
This commit is contained in:
Mateusz Skowroński
2015-12-15 07:00:20 +01:00
committed by wmayer
parent d5c074f80d
commit cd2db00f22
154 changed files with 836 additions and 836 deletions

View File

@@ -67,7 +67,7 @@ SelectionView::SelectionView(Gui::Document* pcDocument, QWidget *parent)
QToolButton* clearButton = new QToolButton(this);
clearButton->setFixedSize(18, 21);
clearButton->setCursor(Qt::ArrowCursor);
clearButton->setStyleSheet(QString::fromAscii("QToolButton {margin-bottom:6px}"));
clearButton->setStyleSheet(QString::fromLatin1("QToolButton {margin-bottom:6px}"));
clearButton->setIcon(BitmapFactory().pixmap(":/icons/edit-cleartext.svg"));
clearButton->setToolTip(tr("Clears the search field"));
hLayout->addWidget(searchBox);
@@ -190,13 +190,13 @@ void SelectionView::select(QListWidgetItem* item)
item = selectionView->currentItem();
if (!item)
return;
QStringList elements = item->text().split(QString::fromAscii("."));
QStringList elements = item->text().split(QString::fromLatin1("."));
// remove possible space from object name followed by label
elements[1] = elements[1].split(QString::fromAscii(" "))[0];
elements[1] = elements[1].split(QString::fromLatin1(" "))[0];
//Gui::Selection().clearSelection();
Gui::Command::runCommand(Gui::Command::Gui,"Gui.Selection.clearSelection()");
//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]);
QString cmd = QString::fromLatin1("Gui.Selection.addSelection(App.getDocument(\"%1\").getObject(\"%2\"))").arg(elements[0]).arg(elements[1]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
@@ -205,11 +205,11 @@ void SelectionView::deselect(void)
QListWidgetItem *item = selectionView->currentItem();
if (!item)
return;
QStringList elements = item->text().split(QString::fromAscii("."));
QStringList elements = item->text().split(QString::fromLatin1("."));
// remove possible space from object name followed by label
elements[1] = elements[1].split(QString::fromAscii(" "))[0];
elements[1] = elements[1].split(QString::fromLatin1(" "))[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]);
QString cmd = QString::fromLatin1("Gui.Selection.removeSelection(App.getDocument(\"%1\").getObject(\"%2\"))").arg(elements[0]).arg(elements[1]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
@@ -230,18 +230,18 @@ void SelectionView::toPython(void)
QListWidgetItem *item = selectionView->currentItem();
if (!item)
return;
QStringList elements = item->text().split(QString::fromAscii("."));
QStringList elements = item->text().split(QString::fromLatin1("."));
// remove possible space from object name followed by label
elements[1] = elements[1].split(QString::fromAscii(" "))[0];
elements[1] = elements[1].split(QString::fromLatin1(" "))[0];
QString cmd = QString::fromAscii("obj = App.getDocument(\"%1\").getObject(\"%2\")").arg(elements[0]).arg(elements[1]);
QString cmd = QString::fromLatin1("obj = App.getDocument(\"%1\").getObject(\"%2\")").arg(elements[0]).arg(elements[1]);
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]);
elements[2] = elements[2].split(QString::fromLatin1(" "))[0];
if ( elements[2].contains(QString::fromLatin1("Face")) || elements[2].contains(QString::fromLatin1("Edge")) ) {
cmd = QString::fromLatin1("shp = App.getDocument(\"%1\").getObject(\"%2\").Shape").arg(elements[0]).arg(elements[1]);
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]);
cmd = QString::fromLatin1("elt = App.getDocument(\"%1\").getObject(\"%2\").Shape.%3").arg(elements[0]).arg(elements[1]).arg(elements[2]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
}
@@ -254,18 +254,18 @@ void SelectionView::onItemContextMenu(const QPoint& point)
return;
QMenu menu;
QAction *selectAction = menu.addAction(tr("Select only"),this,SLOT(select()));
selectAction->setIcon(QIcon::fromTheme(QString::fromAscii("view-select")));
selectAction->setIcon(QIcon::fromTheme(QString::fromLatin1("view-select")));
selectAction->setToolTip(tr("Selects only this object"));
QAction *deselectAction = menu.addAction(tr("Deselect"),this,SLOT(deselect()));
deselectAction->setIcon(QIcon::fromTheme(QString::fromAscii("view-unselectable")));
deselectAction->setIcon(QIcon::fromTheme(QString::fromLatin1("view-unselectable")));
deselectAction->setToolTip(tr("Deselects this object"));
QAction *zoomAction = menu.addAction(tr("Zoom fit"),this,SLOT(zoom()));
zoomAction->setIcon(QIcon::fromTheme(QString::fromAscii("zoom-fit-best")));
zoomAction->setIcon(QIcon::fromTheme(QString::fromLatin1("zoom-fit-best")));
zoomAction->setToolTip(tr("Selects and fits this object in the 3D window"));
QAction *gotoAction = menu.addAction(tr("Go to selection"),this,SLOT(treeSelect()));
gotoAction->setToolTip(tr("Selects and locates this object in the tree view"));
QAction *toPythonAction = menu.addAction(tr("To python console"),this,SLOT(toPython()));
toPythonAction->setIcon(QIcon::fromTheme(QString::fromAscii("applications-python")));
toPythonAction->setIcon(QIcon::fromTheme(QString::fromLatin1("applications-python")));
toPythonAction->setToolTip(tr("Reveals this object and its subelements in the python console."));
menu.exec(selectionView->mapToGlobal(point));
}