欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

Qt 引导

最编程 2024-09-29 22:38:20
...
#include <QDir> #include <QStandardPaths> void MainWindow::regAppBoot(bool bIs) { #ifdef WIN32 QString exePath = qApp->applicationFilePath(); QString exeName = qApp->applicationName(); QString startupPath = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation). append("/").append("Startup"); if (bIs) { QDir dir(startupPath); if (!dir.exists()) { dir.mkdir(startupPath); } if (dir.exists()) { QString exeLocation = startupPath + "/" + exeName + ".lnk"; QFile::link(exePath, exeLocation); } } else { QDir dir(startupPath);