Qt打开文件夹

注意一定要用斜杠,用反斜杠和双反斜杠都打开失败

QPushButton* openPath = new QPushButton(ui->treeWidget_2);
  openPath->setToolTip(path);
  openPath->setText("打开路径");
  QObject::connect(openPath, &QPushButton::clicked, [=](){
    QDesktopServices::openUrl(QUrl("D:/Work/QtSpace/QualityCheck/cfg"));
});

 

posted @ 2021-07-12 15:47  朱小勇  阅读(1323)  评论(0编辑  收藏  举报