QHelpEngineCoreclass provides the core functionality of the help system. 更多 …
继承者: QHelpEngine
def
addCustomFilter
(filterName, attributes)
def
autoSaveFilter
()
def
collectionFile
()
def
copyCollectionFile
(fileName)
def
currentFilter
()
def
customFilters
()
def
customValue
(key[, defaultValue=None])
def
documentationFileName
(namespaceName)
def
documentsForIdentifier
(id)
def
documentsForIdentifier
(id, filterName)
def
documentsForKeyword
(keyword)
def
documentsForKeyword
(keyword, filterName)
def
error
()
def
fileData
(url)
def
文件
(namespaceName, filterAttributes[, extensionFilter=””])
def
文件
(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
()
def
currentFilterChanged
(newFilter)
def
readersAboutToBeInvalidated
()
def
setupFinished
()
def
setupStarted
()
def
warning
(msg)
def
metaData
(documentationFileName, name)
def
namespaceName
(documentationFileName)
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
documentsForIdentifier()the engine returns URLs specifying the file locations inside the help system. The actual file data can then be retrived by callingfileData().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
QHelpFilterEngineclass, which can be accessed by thefilterEngine()method. This replaces older filter API that is deprecated since Qt 5.13. Please callsetUsesFilterEngine()withtrueto 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 or value().
This class does not offer any GUI components or functionality for indices or contents. If you need one of those use
QHelpEngine代替。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.
QHelpEngineCore
(
collectionFile
[
,
parent=None
]
)
¶
- param parent
QObject- param collectionFile
unicode
Constructs a new core help engine with a
parent
。帮助引擎所用信息存储于
collectionFile
to provide help. If the collection file does not exist yet, it’ll be created.
PySide2.QtHelp.QHelpEngineCore.
addCustomFilter
(
filterName
,
attributes
)
¶
filterName – unicode
attributes – 字符串列表
bool
setFilterData()
should be used instead.
Adds the new custom filter
filterName
. The filter attributes are specified by
attributes
. If the filter already exists, its attribute set is replaced. The function returns true if the operation succeeded, otherwise it returns false.
PySide2.QtHelp.QHelpEngineCore.
autoSaveFilter
(
)
¶
bool
另请参阅
PySide2.QtHelp.QHelpEngineCore.
collectionFile
(
)
¶
unicode
另请参阅
PySide2.QtHelp.QHelpEngineCore.
copyCollectionFile
(
fileName
)
¶
fileName – unicode
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
(
)
¶
unicode
另请参阅
PySide2.QtHelp.QHelpEngineCore.
currentFilterChanged
(
newFilter
)
¶
newFilter – unicode
PySide2.QtHelp.QHelpEngineCore.
customFilters
(
)
¶
字符串列表
filters()
should be used instead.
Returns a list of custom filters.
PySide2.QtHelp.QHelpEngineCore.
customValue
(
key
[
,
defaultValue=None
]
)
¶
key – unicode
defaultValue – object
object
Returns the value assigned to the
key
. If the requested key does not exist, the specified
defaultValue
被返回。
PySide2.QtHelp.QHelpEngineCore.
documentationFileName
(
namespaceName
)
¶
namespaceName – unicode
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.
另请参阅
PySide2.QtHelp.QHelpEngineCore.
documentsForIdentifier
(
id
)
¶
id – unicode
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.
PySide2.QtHelp.QHelpEngineCore.
documentsForIdentifier
(
id
,
filterName
)
¶
id – unicode
filterName – unicode
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
.
PySide2.QtHelp.QHelpEngineCore.
documentsForKeyword
(
keyword
)
¶
keyword – unicode
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.
PySide2.QtHelp.QHelpEngineCore.
documentsForKeyword
(
keyword
,
filterName
)
¶
keyword – unicode
filterName – unicode
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
.
PySide2.QtHelp.QHelpEngineCore.
error
(
)
¶
unicode
Returns a description of the last error that occurred.
PySide2.QtHelp.QHelpEngineCore.
fileData
(
url
)
¶
url
–
QUrl
QByteArray
Returns the data of the file specified by
url
. If the file does not exist, an empty
QByteArray
被返回。
另请参阅
PySide2.QtHelp.QHelpEngineCore.
文件
(
namespaceName
,
filterName
[
,
extensionFilter=""
]
)
¶
namespaceName – unicode
filterName – unicode
extensionFilter – unicode
PySide2.QtHelp.QHelpEngineCore.
文件
(
namespaceName
,
filterAttributes
[
,
extensionFilter=""
]
)
¶
namespaceName – unicode
filterAttributes – 字符串列表
extensionFilter – unicode
PySide2.QtHelp.QHelpEngineCore.
filterAttributeSets
(
namespaceName
)
¶
namespaceName – unicode
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
(
)
¶
字符串列表
availableComponents()
should be used instead.
Returns a list of all defined filter attributes.
PySide2.QtHelp.QHelpEngineCore.
filterAttributes
(
filterName
)
¶
filterName – unicode
字符串列表
filterData()
should be used instead.
Returns a list of filter attributes used by the custom filter
filterName
.
PySide2.QtHelp.QHelpEngineCore.
filterEngine
(
)
¶
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()
设为
true
.
PySide2.QtHelp.QHelpEngineCore.
findFile
(
url
)
¶
url
–
QUrl
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 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.
PySide2.QtHelp.QHelpEngineCore.
linksForIdentifier
(
id
)
¶
id – unicode
注意
此函数被弃用。
使用
documentsForIdentifier()
代替。
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
)
¶
keyword – unicode
注意
此函数被弃用。
使用
documentsForKeyword()
代替。
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.
PySide2.QtHelp.QHelpEngineCore.
metaData
(
documentationFileName
,
name
)
¶
documentationFileName – unicode
name – unicode
object
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.
PySide2.QtHelp.QHelpEngineCore.
namespaceName
(
documentationFileName
)
¶
documentationFileName – unicode
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.
PySide2.QtHelp.QHelpEngineCore.
readersAboutToBeInvalidated
(
)
¶
PySide2.QtHelp.QHelpEngineCore.
registerDocumentation
(
documentationFileName
)
¶
documentationFileName – unicode
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.
PySide2.QtHelp.QHelpEngineCore.
registeredDocumentations
(
)
¶
字符串列表
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
)
¶
filterName – unicode
bool
removeFilter()
should be used instead.
Returns true if the filter
filterName
was removed successfully, otherwise false.
PySide2.QtHelp.QHelpEngineCore.
removeCustomValue
(
key
)
¶
key – unicode
bool
移除
key
from the settings section in the collection file. Returns true if the value was removed successfully, otherwise false.
PySide2.QtHelp.QHelpEngineCore.
setAutoSaveFilter
(
save
)
¶
save
–
bool
另请参阅
PySide2.QtHelp.QHelpEngineCore.
setCollectionFile
(
fileName
)
¶
fileName – unicode
另请参阅
PySide2.QtHelp.QHelpEngineCore.
setCurrentFilter
(
filterName
)
¶
filterName – unicode
另请参阅
PySide2.QtHelp.QHelpEngineCore.
setCustomValue
(
key
,
value
)
¶
key – unicode
value – object
bool
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.
PySide2.QtHelp.QHelpEngineCore.
setUsesFilterEngine
(
使用
)
¶
使用
–
bool
Enables or disables the new filter engine functionality inside the help engine, according to the passed
使用
参数。
PySide2.QtHelp.QHelpEngineCore.
setupData
(
)
¶
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.
注意
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
)
¶
namespaceName – unicode
bool
Unregisters the Qt compressed help file (.qch) identified by its
namespaceName
from the help collection. Returns true on success, otherwise false.
PySide2.QtHelp.QHelpEngineCore.
usesFilterEngine
(
)
¶
bool
Returns whether the help engine uses the new filter functionality.
PySide2.QtHelp.QHelpEngineCore.
warning
(
msg
)
¶
msg – unicode