内容表

上一话题

QHelpLink

下一话题

QHelpSearchQuery

QHelpSearchEngine

QHelpSearchEngine class provides access to widgets reusable to integrate fulltext search as well as to index and search documentation. 更多

Inheritance diagram of PySide2.QtHelp.QHelpSearchEngine

详细描述

Before the search engine can be used, one has to instantiate at least a QHelpEngineCore object that needs to be passed to the search engines constructor. This is required as the search engine needs to be connected to the help engines setupFinished() signal to know when it can start to index documentation.

After starting the indexing process the signal indexingStarted() is emitted and on the end of the indexing process the indexingFinished() is emitted. To stop the indexing one can call cancelIndexing() .

When the indexing process has finished, the search engine can be used to search through the index for a given term using the search() function. When the search input is passed to the search engine, the searchingStarted() signal is emitted. When the search finishes, the searchingFinished() signal is emitted. The search process can be stopped by calling cancelSearching() .

If the search succeeds, searchingFinished() is called with the search result count to fetch the search results from the search engine. Calling the searchResults() function with a range returns a list of QHelpSearchResult objects within the range. The results consist of the document title and URL, as well as a snippet from the document that contains the best match for the search input.

To display the given search results use the QHelpSearchResultWidget or build up your own one if you need more advanced functionality. Note that the QHelpSearchResultWidget can not be instantiated directly, you must retrieve the widget from the search engine in use as all connections will be established for you by the widget itself.

class QHelpSearchEngine ( helpEngine [ , parent=None ] )
param parent

QObject

param helpEngine

QHelpEngineCore

Constructs a new search engine with the given parent . The search engine uses the given helpEngine to access the documentation that needs to be indexed. The QHelpEngine ‘s setupFinished() signal is automatically connected to the QHelpSearchEngine ‘s indexing function, so that new documentation will be indexed after the signal is emitted.

PySide2.QtHelp.QHelpSearchEngine. cancelIndexing ( )

Stops the indexing process.

PySide2.QtHelp.QHelpSearchEngine. cancelSearching ( )

Stops the search process.

PySide2.QtHelp.QHelpSearchEngine. hitCount ( )
返回类型

int

注意

此函数被弃用。

使用 searchResultCount() 代替。

PySide2.QtHelp.QHelpSearchEngine. hits ( start , end )
参数
  • start int

  • end int

返回类型

注意

此函数被弃用。

使用 searchResults() 代替。

PySide2.QtHelp.QHelpSearchEngine. hitsCount ( )
返回类型

int

注意

此函数被弃用。

使用 searchResultCount() 代替。

PySide2.QtHelp.QHelpSearchEngine. indexingFinished ( )
PySide2.QtHelp.QHelpSearchEngine. indexingStarted ( )
PySide2.QtHelp.QHelpSearchEngine. query ( )
返回类型

注意

此函数被弃用。

使用 searchInput() 代替。

PySide2.QtHelp.QHelpSearchEngine. queryWidget ( )
返回类型

QHelpSearchQueryWidget

Returns a widget to use as input widget. Depending on your search engine configuration you will get a different widget with more or less subwidgets.

PySide2.QtHelp.QHelpSearchEngine. reindexDocumentation ( )

Forces the search engine to reindex all documentation files.

PySide2.QtHelp.QHelpSearchEngine. resultWidget ( )
返回类型

QHelpSearchResultWidget

Returns a widget that can hold and display the search results.

PySide2.QtHelp.QHelpSearchEngine. scheduleIndexDocumentation ( )
PySide2.QtHelp.QHelpSearchEngine. search ( queryList )
参数

queryList

注意

此函数被弃用。

PySide2.QtHelp.QHelpSearchEngine. search ( searchInput )
参数

searchInput – unicode

PySide2.QtHelp.QHelpSearchEngine. searchInput ( )
返回类型

unicode

Returns the phrase that was last searched for.

PySide2.QtHelp.QHelpSearchEngine. searchResultCount ( )
返回类型

int

Returns the number of results the search engine found.

PySide2.QtHelp.QHelpSearchEngine. searchResults ( start , end )
参数
  • start int

  • end int

返回类型

Returns a list of search results within the range from the index specified by start to the index specified by end .

PySide2.QtHelp.QHelpSearchEngine. searchingFinished ( searchResultCount )
参数

searchResultCount int

PySide2.QtHelp.QHelpSearchEngine. searchingStarted ( )