C++之Qstring转Standard_Cstring

方法一:先转化为std::string

QString filename = QFileDialog::getOpenFileName(this, "open file dialog", "/", "step files(*.step)");
if (!filename.isEmpty()) {
    std::string stdfilename = filename.toStdString();
    const char* cstr = stdfilename.c_str();
    TopoDS_Shape stepShape = occ.Open_File(cstr);
​

方法二:直接转化

QString filename
filename.toUtf8().data()
​

你可能感兴趣的:(Open,CASCADE,C++学习与记录,c++,qt,学习,Open,CASCADE)