QHelpEngineCore Class | Qt Help (original) (raw)

The QHelpEngineCore class provides the core functionality of the help system. More...

Member Function Documentation

[explicit] QHelpEngineCore::QHelpEngineCore(const QString &collectionFile, QObject *parent = nullptr)

Constructs a new core help engine with a parent. The help engine uses the information stored in the collectionFile to provide help. If the collection file does not exist yet, it'll be created.

[virtual noexcept] QHelpEngineCore::~QHelpEngineCore()

Destructs the help engine.

bool QHelpEngineCore::copyCollectionFile(const QString &fileName)

Creates the file fileName and copies all contents from the current collection file into the newly created file, and returns true if successful; otherwise returns false.

The copying process makes sure that file references to Qt Collection files (.qch) files are updated accordingly.

QVariant QHelpEngineCore::customValue(const QString &key, const QVariant &defaultValue = {}) const

Returns the value assigned to the key. If the requested key does not exist, the specified defaultValue is returned.

See also setCustomValue() and removeCustomValue().

QString QHelpEngineCore::documentationFileName(const QString &namespaceName)

Returns the absolute file name of the Qt compressed help file (.qch) identified by the namespaceName. If there is no Qt compressed help file with the specified namespace registered, an empty string is returned.

See also namespaceName().

Returns a list of all the document links found for the id. The returned list contents depend on the current filter, and therefore only the keywords registered for the current filter will be returned.

Returns a list of the document links found for the id, filtered by filterName. The returned list contents depend on the passed filter, and therefore only the keywords registered for this filter will be returned. If you want to get all results unfiltered, pass empty string as filterName.

Returns a list of all the document links found for the keyword. The returned list contents depend on the current filter, and therefore only the keywords registered for the current filter will be returned.

Returns a list of the document links found for the keyword, filtered by filterName. The returned list contents depend on the passed filter, and therefore only the keywords registered for this filter will be returned. If you want to get all results unfiltered, pass empty string as filterName.

QString QHelpEngineCore::error() const

Returns a description of the last error that occurred.

QByteArray QHelpEngineCore::fileData(const QUrl &url) const

Returns the data of the file specified by url. If the file does not exist, an empty QByteArray is returned.

See also findFile().

QList<QUrl> QHelpEngineCore::files(const QString namespaceName, const QString &filterName, const QString &extensionFilter = {})

Returns a list of files contained in the Qt compressed help file for namespaceName. The files can be filtered by filterName as well as by their extension extensionFilter (for example, 'html').

QHelpFilterEngine *QHelpEngineCore::filterEngine() const

Returns the filter engine associated with this help engine. The filter engine allows for adding, changing, and removing existing filters for this help engine. To use the engine you also have to call setUsesFilterEngine() set to true.

QUrl QHelpEngineCore::findFile(const QUrl &url) const

Returns the corrected URL for the url that may refer to a different namespace defined by the virtual folder defined as a part of the url. If the virtual folder matches the namespace of the url, the method just checks if the file exists and returns the same url. When the virtual folder doesn't match the namespace of the url, it tries to find the best matching namespace according to the active filter. When the namespace is found, it returns the corrected URL if the file exists, otherwise it returns an invalid URL.

[static] QVariant QHelpEngineCore::metaData(const QString &documentationFileName, const QString &name)

Returns the meta data for the Qt compressed help file documentationFileName. If there is no data available for name, an invalid QVariant() is returned. The meta data is defined when creating the Qt compressed help file and cannot be modified later. Common meta data includes e.g. the author of the documentation.

[static] QString QHelpEngineCore::namespaceName(const QString &documentationFileName)

Returns the namespace name defined for the Qt compressed help file (.qch) specified by its documentationFileName. If the file is not valid, an empty string is returned.

See also documentationFileName().

bool QHelpEngineCore::registerDocumentation(const QString &documentationFileName)

Registers the Qt compressed help file (.qch) contained in the file documentationFileName. One compressed help file, uniquely identified by its namespace can only be registered once. True is returned if the registration was successful, otherwise false.

See also unregisterDocumentation() and error().

QStringList QHelpEngineCore::registeredDocumentations() const

Returns a list of all registered Qt compressed help files of the current collection file. The returned names are the namespaces of the registered Qt compressed help files (.qch).

bool QHelpEngineCore::removeCustomValue(const QString &key)

Removes the key from the settings section in the collection file. Returns true if the value was removed successfully, otherwise false.

See also customValue() and setCustomValue().

bool QHelpEngineCore::setCustomValue(const QString &key, const QVariant &value)

Save the value under the key. If the key already exist, the value will be overwritten. Returns true if the value was saved successfully, otherwise false.

See also customValue() and removeCustomValue().

void QHelpEngineCore::setUsesFilterEngine(bool uses)

Enables or disables the new filter engine functionality inside the help engine, according to the passed uses parameter.

See also usesFilterEngine() and filterEngine().

bool QHelpEngineCore::setupData()

Sets up the help engine by processing the information found in the collection file and returns true if successful; otherwise returns false.

By calling the function, the help engine is forced to initialize itself immediately. Most of the times, this function does not have to be called explicitly because getter functions which depend on a correctly set up help engine do that themselves.

Note: qsqlite4.dll needs to be deployed with the application as the help system uses the sqlite driver when loading help collections.

[signal] void QHelpEngineCore::setupFinished()

This signal is emitted when the setup is complete.

[signal] void QHelpEngineCore::setupStarted()

This signal is emitted when setup is started.

bool QHelpEngineCore::unregisterDocumentation(const QString &namespaceName)

Unregisters the Qt compressed help file (.qch) identified by its namespaceName from the help collection. Returns true on success, otherwise false.

See also registerDocumentation() and error().

bool QHelpEngineCore::usesFilterEngine() const

Returns whether the help engine uses the new filter functionality.

See also setUsesFilterEngine() and filterEngine().

[signal] void QHelpEngineCore::warning(const QString &msg)

This signal is emitted when a non critical error occurs. The warning message is stored in msg.