如何在 Linux 中为 Qt 应用程序制作控制台 cmd? [英] how to make a console cmd for Qt app in Linux?

查看:45
本文介绍了如何在 Linux 中为 Qt 应用程序制作控制台 cmd?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Arch Linux 上用 Qt 制作了一个基本的文本编辑器(称为Note")!所以我构建了这个项目并使用 installjammer 制作了一个安装程序.现在,当我在终端中输入 note 时,它​​会打开程序.现在这是我的问题:如果我们使用 nano 或leafpad 或鼠标垫,它会以文件的路径打开它.例如.纳米/etc/fstab我怎样才能在我的程序中做到这一点?我需要在安装程序或我的代码中编辑一些东西吗?帮我!请!~谢谢!

I made a basic text editor(called 'Note') in Qt on Arch Linux! so I built the project and made an installer using installjammer. now when I type note in terminal it opens the program. Now here is my question: if we use nano or leafpad or mousepad it take the path of the file opens it. Eg. nano /etc/fstab how can I do this in my program? do I need to edit something in the installer or in my codes? HELP ME! pls! ~Thanks!

推荐答案

您可能需要阅读 QCoreApplication 的文档.尤其:QStringList QCoreApplication::arguments()

You might want to read the docs for QCoreApplication. Especially: QStringList QCoreApplication::arguments()

从这个文件中获取文件名,打开文件.

Get the filename from this ist, open the file.

这篇关于如何在 Linux 中为 Qt 应用程序制作控制台 cmd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆