003_QT获取文件夹
qDebug() << "选择文件路径"; QString path = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(NULL,tr("保存路径"),QDir::currentPath())); if(path.isEmpty()) { return; } else { path += "\\"; // ui->lineEdit->setText(path); }
此视频查看ecxel前半段,需添加头文件:
QT += widgets #include <QDebug> #include <QDir> #include <QFileDialog>