简体   繁体   English

如何使用Qt在OS文件浏览器中添加上下文菜单项

[英]How to add a context menu entry in OS file explorer using Qt

I want to know if is is possible to add an entry in the context menu (right click menu) of the OS file explorer (eg Windows Explorer) for my program developed with Qt. 我想知道是否可以在使用Qt开发的程序的OS文件浏览器(例如Windows资源管理器)的上下文菜单(右键单击菜单)中添加条目。

The objective is that when I right click on a file or a directory, I'd like my element to appear in that menu and do something when the user clicks on it. 目的是当我右键单击文件或目录时,我希望我的元素出现在该菜单中并在用户单击它时执行某些操作。

The context menu in Windows Explorer has nothing directly to do with Qt. Windows资源管理器中的上下文菜单与Qt没有直接关系。 By simply setting a few registry entries, you can add items to the context menu that launch an application and pass parameters, such as the selected file(s) to that application. 通过简单地设置一些注册表项,您可以将项目添加到上下文菜单中,以启动应用程序并将参数(例如所选文件)传递给该应用程序。

If you google for "Adding to Windows Context Menu" you'll find articles which explain which registry entries you need to edit. 如果您在Google中搜索“添加到Windows上下文菜单”,则会找到说明您需要编辑哪些注册表项的文章。 Here's one such article 这是一篇这样的文章

Once you've made the registry entries, you can export them as files that can be run on installation of your application. 完成注册表项后,可以将它们导出为可以在安装应用程序时运行的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM