如何运行Qt应用程序在启动时运行? [英] How to run a Qt application run at startup?

查看:324
本文介绍了如何运行Qt应用程序在启动时运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

在启动时运行qt应用程序

如何我在启动时运行一个qt程序,以便用户根本看不到桌面?
我在linux中构建我的程序,我想把它分发给linux用户。
我想将该代码添加到我的应用程序,因为客户对linux没有任何理解。
我发现 QSettings 可以做到,是真的吗? QService ?我们可以使用这样的简单代码吗?

How can I run a qt program at startup so that the user won't see the desktop at all? I am building my program in linux and I want to distribute it to linux users. I want to add that code to my app, because the customers don't have any understanding about linux. I found that QSettings can do that, is it true? What about QService? Can we use a simple code like this?

QSettings  a;
A.setpath(IniFormat,SystemScope,/etc/xdg)


推荐答案

QSettings与此零相关,QService适用于Symbian设备。事实上,你的问题与Qt无关。

QSettings has zero relevance to this and QService is for Symbian devices. In fact, your question has nothing to do with Qt.

你需要做的是在用户的启动文件夹中放置一个* .desktop快捷方式或链接到应用程序。请参阅:

What you need to do is place a *.desktop shortcut or link to the application in the user's startup folder. See:

http://标准.freedesktop.org / autostart-spec / autostart-spec-latest.html

例如,如果我要启动应用程序 / opt / myapp / myapp_executable 在登录时,我将创建一个 myapp.desktop 文件,包含以下内容:

For example, if I want to start the application /opt/myapp/myapp_executable at login, I would create a myapp.desktop file with the following contents:


[Desktop Entry]
Exec=/opt/myapp/myapp_executable


$ b b

并将其放在我的〜/ .config / autostart目录中。

and put it in my ~/.config/autostart directory.

如果你想要在登录时为每个用户执行,它在/ etc / xdg / autostart /中。但是,再次检查XDG网站,因为如果设置了覆盖默认值的XDG环境变量,目录可能不同。

If you want it to be executed for every user at login, then you'd put it in /etc/xdg/autostart/. But again, check the XDG site because the directory can be different if an XDG environment variable is set that overrides the default.

您的问题真的属于 http://superuser.com

这篇关于如何运行Qt应用程序在启动时运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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