如何使用Qt在OS文件资源管理器中添加上下文菜单条目

时间:2023-01-17 00:07:55

I want to know if is is possible to add an entry in the context menu (right click menu) of the OS file explorer (e.g. Windows Explorer) for my program developed with Qt.

我想知道是否可以在我用Qt开发的程序的操作系统文件资源管理器(例如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.

目标是当我右键单击文件或目录时,我希望我的元素出现在该菜单中,并在用户点击它时执行某些操作。

1 个解决方案

#1


4  

The context menu in Windows Explorer has nothing directly to do with 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.

Windows资源管理器中的上下文菜单与Qt没有任何直接关系。通过简单地设置几个注册表项,您可以将项添加到启动应用程序的上下文菜单中,并将参数(例如所选文件)传递给该应用程序。

If you google for "Adding to Windows Context Menu" you'll find articles which explain which registry entries you need to edit. Here's one such article

如果您谷歌搜索“添加到Windows上下文菜单”,您将找到解释您需要编辑哪些注册表项的文章。这是一篇这样的文章

Once you've made the registry entries, you can export them as files that can be run on installation of your application.

完成注册表项后,可以将它们导出为可在安装应用程序时运行的文件。

#1


4  

The context menu in Windows Explorer has nothing directly to do with 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.

Windows资源管理器中的上下文菜单与Qt没有任何直接关系。通过简单地设置几个注册表项,您可以将项添加到启动应用程序的上下文菜单中,并将参数(例如所选文件)传递给该应用程序。

If you google for "Adding to Windows Context Menu" you'll find articles which explain which registry entries you need to edit. Here's one such article

如果您谷歌搜索“添加到Windows上下文菜单”,您将找到解释您需要编辑哪些注册表项的文章。这是一篇这样的文章

Once you've made the registry entries, you can export them as files that can be run on installation of your application.

完成注册表项后,可以将它们导出为可在安装应用程序时运行的文件。