[vtkusers] vtkSTLReader and QString

Abdelkhalek Bakkari bakkari.abdelkhalek at hotmail.fr
Wed Jan 10 04:33:47 EST 2018


Hi All,


I tried to read an STL file using  vtkSTLReader  from a directory as follows:



-------------------------

QString fileName = QFileDialog::getOpenFileName( this, tr("Open File"), "C:\\", tr("Mesh (*.stl *.vtk)"));
if (fileName.isNull()) //user cancelled
return EXIT_FAILURE;

m_imagePath = fileName;
//Create an STL reader for reading the file
vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();
//reader->SetFileName(pathName.c_str());
reader->SetFileName(fileName.toStdString());
reader->Update();
-------------------------


But, I've got the following error  :

'vtkAbstractPolyDataReader::SetFileName' : cannot convert parameter 1 from 'std::string' to 'const char *'


Could you please propose a solution for this issue?





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180110/8a6576db/attachment.html>


More information about the vtkusers mailing list