How to show Windows Explorer context (right click) menu?

后端 未结 4 980
无人及你
无人及你 2020-12-10 08:50

I want to show the Windows Explorer context menu.

I don\'t want to add my application to it, I just want to display it inside my application.

4条回答
  •  自闭症患者
    2020-12-10 09:36

    http://www.ffuts.org/blog/right-click-context-menus-with-qt/

    Getting right-clicks to popup a context menu is pretty straightforward in Qt. There are just a couple of things to watch out for…

     // myWidget is any QWidget-derived class
     myWidget->setContextMenuPolicy(Qt::CustomContextMenu);
     connect(myWidget, SIGNAL(customContextMenuRequested(const QPoint&)),
         this, SLOT(ShowContextMenu(const QPoint&)));
    

    If, on the other hand, you're looking for something like "Windows explorer integration" or "Windows Shell integration", here's a good (albeit non-QT specific) example:

    http://www.codeproject.com/Articles/15171/Simple-shell-context-menu

    The key is implementing these two Windows shell interfaces:

    • IContextMenu

    • IShellExtInt

提交回复
热议问题