Mac上的Qt-如何访问“搜索"在帮助菜单中 [英] Qt on Mac -- how to access "search" in help menu
问题描述
我正在将Qt应用程序移植到Mac OSX.在Windows/Linux上,我已经使用QLineEdit在帮助"菜单中提供了搜索功能.
I am porting my Qt app to Mac OS X. On Windows/Linux I've used a QLineEdit to provide a search feature in the Help menu.
在Mac OS X中,我看到了类似的内置信息:
In Mac OS X, I saw something like this is built-in:
如何使用Qt访问此搜索栏(即在其中添加自己的元素)?我在文档中查看了QMenuBar,但找不到任何相关内容.如果不可能,我是否至少可以使用我的C ++ Qt应用程序中的某些本机API?
How can I access this search bar with Qt (i.e., add my own elements to it)? I looked at QMenuBar in the docs but couldn't find anything relevant. If it's not possible, can I at least use some native API from my C++ Qt app?
非常感谢.
推荐答案
似乎不能直接通过 Qt 做到这一点,但是,您可以在 Objective-C++/Cocoa 中实现这一功能.
It seems you can't do this directly through Qt, however, you can implement this one feature in Objective-C++/Cocoa.
It is possible through the - registerUserInterfaceItemSearchHandler method of NSApplication to register a custom function for querying and returning search items.
QtHelp 似乎支持自动索引,这意味着您可以将搜索委托给它.
QtHelp seems to have support for automatic indexing, which means you can delegate search to that.
这篇关于Mac上的Qt-如何访问“搜索"在帮助菜单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!