Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QHelpSearchEngine Class

TheQHelpSearchEngine class provides access to widgets reusable to integrate fulltext search as well as to index and search documentation.More...

Header:#include <QHelpSearchEngine>
Since: Qt 4.4
Inherits:QObject

Public Types

typedefSearchHit

Public Functions

QHelpSearchEngine(QHelpEngineCore * helpEngine, QObject * parent = 0)
~QHelpSearchEngine()
inthitCount() const
QList<SearchHit>hits(int start, int end) const
QList<QHelpSearchQuery>query() const
QHelpSearchQueryWidget *queryWidget()
QHelpSearchResultWidget *resultWidget()
  • 29 public functions inherited fromQObject

Public Slots

voidcancelIndexing()
voidcancelSearching()
voidreindexDocumentation()
voidsearch(const QList<QHelpSearchQuery> & queryList)
  • 1 public slot inherited fromQObject

Signals

Additional Inherited Members

  • 1 property inherited fromQObject
  • 7 static public members inherited fromQObject
  • 8 protected functions inherited fromQObject

Detailed Description

TheQHelpSearchEngine class provides access to widgets reusable to integrate fulltext search as well as to index and search documentation.

Before the search engine can be used, one has to instantiate at least aQHelpEngineCore 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 signalindexingStarted() is emitted and on the end of the indexing process theindexingFinished() is emitted. To stop the indexing one can callcancelIndexing().

While the indexing process has finished, the search engine can now be used to search thru its index for a given term. To do this one may use the possibility of creating theQHelpSearchQuery list by self or reuse theQHelpSearchQueryWidget which has the inbuild functionality to set up a proper search queries list that get's passed to the search enginessearch() function.

After the list of queries have been passed to the search engine, the signalsearchingStarted() is emitted and after the search has finished thesearchingFinished() signal is emitted. The search process can be stopped by callingcancelSearching().

If the search succeeds, thesearchingFinished() will be called with the search hits count, which can be reused to fetch the search hits from the search engine. Calling thehits() function with the range of hits you would like to get will return a list of the requested SearchHits. They basically constist at the moment of a pair of strings where the values of that pair are the documentation file path and the page title.

To display the given hits use theQHelpSearchResultWidget or build up your own one if you need more advanced functionality. Note that theQHelpSearchResultWidget 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.

Member Type Documentation

typedef QHelpSearchEngine::SearchHit

Typedef forQPair<QString,QString>. The values of that pair are the documentation file path and the page title.

See alsohits().

Member Function Documentation

QHelpSearchEngine::QHelpSearchEngine(QHelpEngineCore * helpEngine,QObject * parent = 0)

Constructs a new search engine with the givenparent. The search engine uses the givenhelpEngine to access the documentation that needs to be indexed. TheQHelpEngine's setupFinished() signal is automatically connected to theQHelpSearchEngine's indexing function, so that new documentation will be indexed after the signal is emitted.

QHelpSearchEngine::~QHelpSearchEngine()

Destructs the search engine.

[slot]void QHelpSearchEngine::cancelIndexing()

Stops the indexing process.

[slot]void QHelpSearchEngine::cancelSearching()

Stops the search process.

int QHelpSearchEngine::hitCount() const

Returns the amount of hits the search engine found.

This function was introduced in Qt 4.6.

QList<SearchHit> QHelpSearchEngine::hits(int start,int end) const

Returns a list of search hits within the range ofstartend.

[signal]void QHelpSearchEngine::indexingFinished()

This signal is emitted when the indexing process is complete.

[signal]void QHelpSearchEngine::indexingStarted()

This signal is emitted when indexing process is started.

QList<QHelpSearchQuery> QHelpSearchEngine::query() const

Returns the list of queries last searched for.

This function was introduced in Qt 4.5.

QHelpSearchQueryWidget * QHelpSearchEngine::queryWidget()

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.

[slot]void QHelpSearchEngine::reindexDocumentation()

Forces the search engine to reindex all documentation files.

QHelpSearchResultWidget * QHelpSearchEngine::resultWidget()

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

[slot]void QHelpSearchEngine::search(constQList<QHelpSearchQuery> & queryList)

Starts the search process using the given list of queriesqueryList build by the search field name and the values to search for.

[signal]void QHelpSearchEngine::searchingFinished(int hits)

This signal is emitted when the search process is complete. The hit count is stored inhits.

[signal]void QHelpSearchEngine::searchingStarted()

This signal is emitted when the search process is started.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp