注意一定要用斜杠,用反斜杠和雙反斜杠都打開失敗
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")); });