1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0028353: Samples - IESample cannot write files to paths with special characters

Changed charcode conversion to UTF-8.
This commit is contained in:
Benjamin Bihler 2017-01-13 13:29:58 +01:00 committed by apn
parent 10ce324694
commit 6cfc06f00d
3 changed files with 26 additions and 8 deletions

View File

@ -128,7 +128,9 @@ void MDIWindow::dump()
if ( !QFileInfo( file ).completeSuffix().length() )
file += QString( ".bmp" );
bool res = myView->dump( (Standard_CString)file.toLatin1().constData() );
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
bool res = myView->dump( anUtf8Path.ToCString() );
QApplication::restoreOverrideCursor();
if ( !res )
{

View File

@ -1011,8 +1011,10 @@ void View::onEnvironmentMap()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
tr("All Image Files (*.bmp *.gif *.jpg *.jpeg *.png *.tga)"));
Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( fileName.toLatin1().data() );
const TCollection_AsciiString anUtf8Path (fileName.toUtf8().data());
Handle(Graphic3d_TextureEnv) aTexture = new Graphic3d_TextureEnv( anUtf8Path );
myView->SetTextureEnv (aTexture);
}

View File

@ -457,7 +457,10 @@ bool Translate::exportBREP( const QString& file, const Handle(TopTools_HSequence
return false;
TopoDS_Shape shape = shapes->Value( 1 );
return BRepTools::Write( shape, (Standard_CString)file.toLatin1().constData() );
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
return BRepTools::Write( shape, anUtf8Path.ToCString() );
}
bool Translate::exportIGES( const QString& file, const Handle(TopTools_HSequenceOfShape)& shapes )
@ -472,7 +475,10 @@ bool Translate::exportIGES( const QString& file, const Handle(TopTools_HSequence
for ( int i = 1; i <= shapes->Length(); i++ )
writer.AddShape ( shapes->Value( i ) );
writer.ComputeModel();
return writer.Write( (Standard_CString)file.toLatin1().constData() );
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
return writer.Write( anUtf8Path.ToCString() );
}
bool Translate::exportSTEP( const QString& file, const Handle(TopTools_HSequenceOfShape)& shapes )
@ -500,8 +506,10 @@ bool Translate::exportSTEP( const QString& file, const Handle(TopTools_HSequence
if ( status != IFSelect_RetDone )
return false;
}
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
status = writer.Write( (Standard_CString)file.toLatin1().constData() );
status = writer.Write( anUtf8Path.ToCString() );
switch ( status )
{
@ -539,7 +547,10 @@ bool Translate::exportSTL( const QString& file, const Handle(TopTools_HSequenceO
}
StlAPI_Writer writer;
writer.Write( res, (Standard_CString)file.toLatin1().constData() );
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
return true;
}
@ -565,7 +576,10 @@ bool Translate::exportVRML( const QString& file, const Handle(TopTools_HSequence
}
VrmlAPI_Writer writer;
writer.Write( res, (Standard_CString)file.toLatin1().constData() );
const TCollection_AsciiString anUtf8Path (file.toUtf8().data());
writer.Write( res, anUtf8Path.ToCString() );
return true;
}