如何处理用户界面中的文件路径插口?

问题描述 投票:0回答:1

我想为我的离线Map Project(C ++)构建一个简单的界面,如何用打开文件替换传递给我的函数loadFile("G:/QT/Projects/database/city.osm.pbf");的路径,以便函数加载文件从我选择的地图文件中获取路径?

My GUI Interface

c++ qt user-interface
1个回答
0
投票
void MainWindow::on_action_Open_File_triggered()
{
    QString FileName = QFileDialog::getOpenFileName(this,tr("Open File"),"C://","OSM File (*.pbf)" );
    //cout << "File Name \t"<< FileName.toStdString() <<endl;
    string FilePath2 = FileName.toStdString();
    loadFile(FilePath2);
}
© www.soinside.com 2019 - 2024. All rights reserved.