1. 程式人生 > >Qt 獲取程式執行路徑

Qt 獲取程式執行路徑

    //在需要的地方
    QString path;
    QDir dir;
    path=dir.currentPath();
    QMessageBox::warning(0,"PATH",path,QMessageBox::Yes);//檢視路徑


//評論中的方法(eletricor) 推薦
QString currentPath = QCoreApplication::applicationDirPath();