qt - 我可以使用 qt 窗口内的小部件中的按钮运行外部程序吗?
问题描述
我正在使用 qt creator 在 Windows 10 上制作 ui。
我想使用按钮运行外部程序并将其放置在 qt 窗口内的小部件中。现在,当我单击按钮时,我创建了运行外部程序的代码,但程序只是出现在 qt 窗口之外。我可以使用 qt 窗口内的按钮运行外部程序并设置我想要的位置吗?我也一起上传了我的ui部分。
void MainWindow::on_pushButton_8_clicked()
{
QProcess *process = new QProcess(this);
QString file("D:\\My external file name");
process->execute(file);
QDesktopServices::openUrl(QUrl("file:///"+file,QUrl::TolerantMode));
}
解决方案
推荐阅读
- ruby-on-rails - Rails 服务器和 React 客户端:尽管来源相同,但 CORS 问题
- javascript - 元素移动不顺畅
- python - 对许多数据帧的子集求和
- javascript - 为什么我在execjs,python中使用“call”时会闪现一个窗口?
- java - 为什么实际上会发生跌倒
- python - 检查 trello 中是否存在板、列表或卡片
- html - 使用 HTML/CSS 将文本放入 3 个帖子/列
- javascript - 仅滚动 Jquery 自动完成中的溢出文本
- c++ - 内部类的可访问性
- javascript - 如何使用 JavaScript 发布到 Spotify API 令牌端点?