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

This change is Qt4/Qt5 neutral.
This commit is contained in:
Mateusz Skowroński 2016-08-14 16:48:57 +02:00 committed by wmayer
parent f188995e55
commit 8c6bede7b8
5 changed files with 24 additions and 24 deletions

View File

@ -212,7 +212,7 @@ App::DocumentObjectExecReturn * DrawSVGTemplate::execute(void)
outfragment = boost::regex_replace(newfragment, e3, fmt);
const QString qsOut = QString::fromStdString(outfragment);
QDomDocument doc(QString::fromAscii("mydocument"));
QDomDocument doc(QString::fromLatin1("mydocument"));
//if (!doc.setContent(&resultFile)) {
if (!doc.setContent(qsOut)) {
@ -236,13 +236,13 @@ App::DocumentObjectExecReturn * DrawSVGTemplate::execute(void)
Base::Quantity quantity;
// Obtain the width
QString str = docElem.attribute(QString::fromAscii("width"));
QString str = docElem.attribute(QString::fromLatin1("width"));
quantity = Base::Quantity::parse(str);
quantity.setUnit(Base::Unit::Length);
Width.setValue(quantity.getValue());
str = docElem.attribute(QString::fromAscii("height"));
str = docElem.attribute(QString::fromLatin1("height"));
quantity = Base::Quantity::parse(str);
quantity.setUnit(Base::Unit::Length);

View File

@ -113,28 +113,28 @@ QVariant QGIProjGroup::itemChange(GraphicsItemChange change, const QVariant &val
TechDraw::DrawView *fView = gView->getViewObject();
if(fView->getTypeId().isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) {
TechDraw::DrawProjGroupItem *projItemPtr = static_cast<TechDraw::DrawProjGroupItem *>(fView);
QString type = QString::fromAscii(projItemPtr->Type.getValueAsString());
QString type = QString::fromLatin1(projItemPtr->Type.getValueAsString());
if (type == QString::fromAscii("Front")) {
if (type == QString::fromLatin1("Front")) {
gView->setLocked(true);
installSceneEventFilter(gView);
App::DocumentObject *docObj = getViewObject();
TechDraw::DrawProjGroup *projectionGroup = dynamic_cast<TechDraw::DrawProjGroup *>(docObj);
projectionGroup->Anchor.setValue(fView);
updateView();
} else if ( type == QString::fromAscii("Top") ||
type == QString::fromAscii("Bottom")) {
gView->alignTo(origin, QString::fromAscii("Vertical"));
} else if ( type == QString::fromAscii("Left") ||
type == QString::fromAscii("Right") ||
type == QString::fromAscii("Rear") ) {
gView->alignTo(origin, QString::fromAscii("Horizontal"));
} else if ( type == QString::fromAscii("FrontTopRight") ||
type == QString::fromAscii("FrontBottomLeft") ) {
gView->alignTo(origin, QString::fromAscii("45slash"));
} else if ( type == QString::fromAscii("FrontTopLeft") ||
type == QString::fromAscii("FrontBottomRight") ) {
gView->alignTo(origin, QString::fromAscii("45backslash"));
} else if ( type == QString::fromLatin1("Top") ||
type == QString::fromLatin1("Bottom")) {
gView->alignTo(origin, QString::fromLatin1("Vertical"));
} else if ( type == QString::fromLatin1("Left") ||
type == QString::fromLatin1("Right") ||
type == QString::fromLatin1("Rear") ) {
gView->alignTo(origin, QString::fromLatin1("Horizontal"));
} else if ( type == QString::fromLatin1("FrontTopRight") ||
type == QString::fromLatin1("FrontBottomLeft") ) {
gView->alignTo(origin, QString::fromLatin1("45slash"));
} else if ( type == QString::fromLatin1("FrontTopLeft") ||
type == QString::fromLatin1("FrontBottomRight") ) {
gView->alignTo(origin, QString::fromLatin1("45backslash"));
}
}
}

View File

@ -113,17 +113,17 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
QGraphicsItem*item = alignHash.begin().value();
QString alignMode = alignHash.begin().key();
if(alignMode == QString::fromAscii("Vertical")) {
if(alignMode == QString::fromLatin1("Vertical")) {
newPos.setX(item->pos().x());
} else if(alignMode == QString::fromAscii("Horizontal")) {
} else if(alignMode == QString::fromLatin1("Horizontal")) {
newPos.setY(item->pos().y());
} else if(alignMode == QString::fromAscii("45slash")) {
} else if(alignMode == QString::fromLatin1("45slash")) {
double dist = ( (newPos.x() - item->pos().x()) +
(item->pos().y() - newPos.y()) ) / 2.0;
newPos.setX( item->pos().x() + dist);
newPos.setY( item->pos().y() - dist );
} else if(alignMode == QString::fromAscii("45backslash")) {
} else if(alignMode == QString::fromLatin1("45backslash")) {
double dist = ( (newPos.x() - item->pos().x()) +
(newPos.y() - item->pos().y()) ) / 2.0;

View File

@ -218,7 +218,7 @@ void QGIViewDimension::updateView(bool update)
dim->Font.isTouched()) {
QFont font = datumLabel->font();
font.setPointSizeF(dim->Fontsize.getValue()); //scene units (mm), not points
font.setFamily(QString::fromAscii(dim->Font.getValue()));
font.setFamily(QString::fromLatin1(dim->Font.getValue()));
datumLabel->setFont(font);
datumLabel->setLabelCenter();

View File

@ -190,7 +190,7 @@ bool ViewProviderPage::showMDIViewPage()
Gui::Document* doc = Gui::Application::Instance->getDocument
(pcObject->getDocument());
view = new MDIViewPage(this, doc, Gui::getMainWindow());
view->setWindowTitle(QObject::tr("Drawing viewer") + QString::fromAscii("[*]"));
view->setWindowTitle(QObject::tr("Drawing viewer") + QString::fromLatin1("[*]"));
view->setWindowIcon(Gui::BitmapFactory().pixmap("TechDraw_Tree_Page"));
view->updateDrawing(true);
// view->updateTemplate(true); //TODO: I don't think this is necessary? Ends up triggering a reload of SVG template, but the MDIViewPage constructor does too.