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

Inherited by: QHelpEngine
Synopsis¶
Functions¶
def
addCustomFilter
(filterName, attributes)def
autoSaveFilter
()def
collectionFile
()def
copyCollectionFile
(fileName)def
currentFilter
()def
customFilters
()def
customValue
(key[, defaultValue=None])def
documentationFileName
(namespaceName)def
error
()def
fileData
(url)def
files
(namespaceName, filterAttributes[, extensionFilter=””])def
files
(namespaceName, filterName[, extensionFilter=””])def
filterAttributeSets
(namespaceName)def
filterAttributes
()def
filterAttributes
(filterName)def
filterEngine
()def
findFile
(url)def
linksForIdentifier
(id)def
linksForKeyword
(keyword)def
registerDocumentation
(documentationFileName)def
registeredDocumentations
()def
removeCustomFilter
(filterName)def
removeCustomValue
(key)def
setAutoSaveFilter
(save)def
setCollectionFile
(fileName)def
setCurrentFilter
(filterName)def
setCustomValue
(key, value)def
setUsesFilterEngine
(uses)def
setupData
()def
unregisterDocumentation
(namespaceName)def
usesFilterEngine
()
Signals¶
def
currentFilterChanged
(newFilter)def
readersAboutToBeInvalidated
()def
setupFinished
()def
setupStarted
()def
warning
(msg)
Static functions¶
def
metaData
(documentationFileName, name)def
namespaceName
(documentationFileName)
Detailed Description¶
Before the help engine can be used, it must be initialized by calling
setupData()
. At the beginning of the setup process the signalsetupStarted()
is emitted. From this point on until the signalsetupFinished()
is emitted, is the help data in an undefined meaning unusable state.The core help engine can be used to perform different tasks. By calling
linksForIdentifier()
the engine returns URLs specifying the file locations inside the help system. The actual file data can then be retrived by callingfileData()
. In contrast to all other functions in this class,linksForIdentifier()
depends on the currently set custom filter. Depending on the filter, the function may return different results.The help engine can contain any number of custom filters. The management of the filters, including adding new filters, changing filter definitions, or removing existing filters, is done through the
QHelpFilterEngine
class, which can be accessed by thefilterEngine()
method. This replaces older filter API that is deprecated since Qt 5.13. Please callsetUsesFilterEngine()
withtrue
to enable the new functionality.The help engine also offers the possibility to set and read values in a persistant way comparable to ini files or Windows registry entries. For more information see setValue() or value().
This class does not offer any GUI components or functionality for indices or contents. If you need one of those use
QHelpEngine
instead.When creating a custom help viewer the viewer can be configured by writing a custom collection file which could contain various keywords to be used to configure the help engine. These keywords and values and their meaning can be found in the help information for creating a custom help collection file for Assistant.
-
class
QHelpEngineCore
(collectionFile[, parent=None])¶ - param parent
QObject
- param collectionFile
unicode
Constructs a new core help engine with a
parent
. The help engine uses the information stored in thecollectionFile
to provide help. If the collection file does not exist yet, it’ll be created.
-
PySide2.QtHelp.QHelpEngineCore.
addCustomFilter
(filterName, attributes)¶ - Parameters
filterName – unicode
attributes – list of strings
- Return type
bool
setFilterData()
should be used instead.Adds the new custom filter
filterName
. The filter attributes are specified byattributes
. If the filter already exists, its attribute set is replaced. The function returns true if the operation succeeded, otherwise it returns false.See also
-
PySide2.QtHelp.QHelpEngineCore.
autoSaveFilter
()¶ - Return type
bool
See also
-
PySide2.QtHelp.QHelpEngineCore.
collectionFile
()¶ - Return type
unicode
See also
-
PySide2.QtHelp.QHelpEngineCore.
copyCollectionFile
(fileName)¶ - Parameters
fileName – unicode
- Return type
bool
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.
-
PySide2.QtHelp.QHelpEngineCore.
currentFilter
()¶ - Return type
unicode
See also
-
PySide2.QtHelp.QHelpEngineCore.
currentFilterChanged
(newFilter)¶ - Parameters
newFilter – unicode
-
PySide2.QtHelp.QHelpEngineCore.
customFilters
()¶ - Return type
list of strings
filters()
should be used instead.Returns a list of custom filters.
See also
-
PySide2.QtHelp.QHelpEngineCore.
customValue
(key[, defaultValue=None])¶ - Parameters
key – unicode
defaultValue – object
- Return type
object
Returns the value assigned to the
key
. If the requested key does not exist, the specifieddefaultValue
is returned.See also
-
PySide2.QtHelp.QHelpEngineCore.
documentationFileName
(namespaceName)¶ - Parameters
namespaceName – unicode
- Return type
unicode
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
-
PySide2.QtHelp.QHelpEngineCore.
error
()¶ - Return type
unicode
Returns a description of the last error that occurred.
-
PySide2.QtHelp.QHelpEngineCore.
fileData
(url)¶ - Parameters
url –
QUrl
- Return type
QByteArray
Returns the data of the file specified by
url
. If the file does not exist, an emptyQByteArray
is returned.See also
-
PySide2.QtHelp.QHelpEngineCore.
files
(namespaceName, filterName[, extensionFilter=""])¶ - Parameters
namespaceName – unicode
filterName – unicode
extensionFilter – unicode
- Return type
Returns a list of files contained in the Qt compressed help file for
namespaceName
. The files can be filtered byfilterName
as well as by their extensionextensionFilter
(for example, ‘html’).
-
PySide2.QtHelp.QHelpEngineCore.
files
(namespaceName, filterAttributes[, extensionFilter=""]) - Parameters
namespaceName – unicode
filterAttributes – list of strings
extensionFilter – unicode
- Return type
files()
should be used instead.Returns a list of files contained in the Qt compressed help file
namespaceName
. The files can be filtered byfilterAttributes
as well as by their extensionextensionFilter
(e.g. ‘html’).
-
PySide2.QtHelp.QHelpEngineCore.
filterAttributeSets
(namespaceName)¶ - Parameters
namespaceName – unicode
- Return type
filterData()
should be used instead.Returns a list of filter attributes for the different filter sections defined in the Qt compressed help file with the given namespace
namespaceName
.
-
PySide2.QtHelp.QHelpEngineCore.
filterAttributes
()¶ - Return type
list of strings
availableComponents()
should be used instead.Returns a list of all defined filter attributes.
-
PySide2.QtHelp.QHelpEngineCore.
filterAttributes
(filterName) - Parameters
filterName – unicode
- Return type
list of strings
filterData()
should be used instead.Returns a list of filter attributes used by the custom filter
filterName
.
-
PySide2.QtHelp.QHelpEngineCore.
filterEngine
()¶ - Return type
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 totrue
.
-
PySide2.QtHelp.QHelpEngineCore.
findFile
(url)¶ - Parameters
url –
QUrl
- Return type
QUrl
Returns the corrected URL for the
url
that may refer to a different namespace defined by the virtual folder defined as a part of theurl
. If the virtual folder matches the namespace of theurl
, the method just checks if the file exists and returns the sameurl
. When the virtual folder doesn’t match the namespace of theurl
, 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.
-
PySide2.QtHelp.QHelpEngineCore.
linksForIdentifier
(id)¶ - Parameters
id – unicode
- Return type
Returns a map of the documents found for the
id
. The map contains the document titles and their URLs. The returned map contents depend on the current filter, and therefore only the identifiers registered for the current filter will be returned.
-
PySide2.QtHelp.QHelpEngineCore.
linksForKeyword
(keyword)¶ - Parameters
keyword – unicode
- Return type
Returns a map of all the documents found for the
keyword
. The map contains the document titles and URLs. The returned map contents depend on the current filter, and therefore only the keywords registered for the current filter will be returned.
-
static
PySide2.QtHelp.QHelpEngineCore.
metaData
(documentationFileName, name)¶ - Parameters
documentationFileName – unicode
name – unicode
- Return type
object
Returns the meta data for the Qt compressed help file
documentationFileName
. If there is no data available forname
, 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
PySide2.QtHelp.QHelpEngineCore.
namespaceName
(documentationFileName)¶ - Parameters
documentationFileName – unicode
- Return type
unicode
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
-
PySide2.QtHelp.QHelpEngineCore.
readersAboutToBeInvalidated
()¶
-
PySide2.QtHelp.QHelpEngineCore.
registerDocumentation
(documentationFileName)¶ - Parameters
documentationFileName – unicode
- Return type
bool
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
-
PySide2.QtHelp.QHelpEngineCore.
registeredDocumentations
()¶ - Return type
list of strings
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).
-
PySide2.QtHelp.QHelpEngineCore.
removeCustomFilter
(filterName)¶ - Parameters
filterName – unicode
- Return type
bool
removeFilter()
should be used instead.Returns true if the filter
filterName
was removed successfully, otherwise false.See also
-
PySide2.QtHelp.QHelpEngineCore.
removeCustomValue
(key)¶ - Parameters
key – unicode
- Return type
bool
Removes the
key
from the settings section in the collection file. Returns true if the value was removed successfully, otherwise false.See also
-
PySide2.QtHelp.QHelpEngineCore.
setAutoSaveFilter
(save)¶ - Parameters
save –
bool
See also
-
PySide2.QtHelp.QHelpEngineCore.
setCollectionFile
(fileName)¶ - Parameters
fileName – unicode
See also
-
PySide2.QtHelp.QHelpEngineCore.
setCurrentFilter
(filterName)¶ - Parameters
filterName – unicode
See also
-
PySide2.QtHelp.QHelpEngineCore.
setCustomValue
(key, value)¶ - Parameters
key – unicode
value – object
- Return type
bool
Save the
value
under thekey
. If the key already exist, the value will be overwritten. Returns true if the value was saved successfully, otherwise false.See also
-
PySide2.QtHelp.QHelpEngineCore.
setUsesFilterEngine
(uses)¶ - Parameters
uses –
bool
Enables or disables the new filter engine functionality inside the help engine, according to the passed
uses
parameter.See also
-
PySide2.QtHelp.QHelpEngineCore.
setupData
()¶ - Return type
bool
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.
-
PySide2.QtHelp.QHelpEngineCore.
setupFinished
()¶
-
PySide2.QtHelp.QHelpEngineCore.
setupStarted
()¶
-
PySide2.QtHelp.QHelpEngineCore.
unregisterDocumentation
(namespaceName)¶ - Parameters
namespaceName – unicode
- Return type
bool
Unregisters the Qt compressed help file (.qch) identified by its
namespaceName
from the help collection. Returns true on success, otherwise false.See also
-
PySide2.QtHelp.QHelpEngineCore.
usesFilterEngine
()¶ - Return type
bool
Returns whether the help engine uses the new filter functionality.
See also
-
PySide2.QtHelp.QHelpEngineCore.
warning
(msg)¶ - Parameters
msg – unicode