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

QHelpEngineCore Class

TheQHelpEngineCore class provides the core functionality of the help system.More...

Header:#include <QHelpEngineCore>
Since: Qt 4.4
Inherits:QObject
Inherited By:

QHelpEngine

Properties

Public Functions

QHelpEngineCore(const QString & collectionFile, QObject * parent = 0)
virtual~QHelpEngineCore()
booladdCustomFilter(const QString & filterName, const QStringList & attributes)
boolautoSaveFilter() const
QStringcollectionFile() const
boolcopyCollectionFile(const QString & fileName)
QStringcurrentFilter() const
QStringListcustomFilters() const
QVariantcustomValue(const QString & key, const QVariant & defaultValue = QVariant()) const
QStringdocumentationFileName(const QString & namespaceName)
QStringerror() const
QByteArrayfileData(const QUrl & url) const
QList<QUrl>files(const QString namespaceName, const QStringList & filterAttributes, const QString & extensionFilter = QString())
QList<QStringList>filterAttributeSets(const QString & namespaceName) const
QStringListfilterAttributes() const
QStringListfilterAttributes(const QString & filterName) const
QUrlfindFile(const QUrl & url) const
QMap<QString, QUrl>linksForIdentifier(const QString & id) const
boolregisterDocumentation(const QString & documentationFileName)
QStringListregisteredDocumentations() const
boolremoveCustomFilter(const QString & filterName)
boolremoveCustomValue(const QString & key)
voidsetAutoSaveFilter(bool save)
voidsetCollectionFile(const QString & fileName)
voidsetCurrentFilter(const QString & filterName)
boolsetCustomValue(const QString & key, const QVariant & value)
boolsetupData()
boolunregisterDocumentation(const QString & namespaceName)
  • 29 public functions inherited fromQObject

Signals

voidcurrentFilterChanged(const QString & newFilter)
voidreadersAboutToBeInvalidated()
voidsetupFinished()
voidsetupStarted()
voidwarning(const QString & msg)

Static Public Members

QVariantmetaData(const QString & documentationFileName, const QString & name)
QStringnamespaceName(const QString & documentationFileName)
  • 7 static public members inherited fromQObject

Additional Inherited Members

  • 1 public slot inherited fromQObject
  • 8 protected functions inherited fromQObject

Detailed Description

TheQHelpEngineCore class provides the core functionality of the help system.

Before the help engine can be used, it must be initialized by callingsetupData(). 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 callinglinksForIdentifier() 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 hits.

Every help engine can contain any number of custom filters. A custom filter is defined by a name and set of filter attributes and can be added to the help engine by callingaddCustomFilter(). Analogous, it is removed by callingremoveCustomFilter().customFilters() returns all defined filters.

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 useQHelpEngine 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 forcreating a custom help collection file for Assistant.

Property Documentation

autoSaveFilter :bool

This property holds whether QHelpEngineCore is in auto save filter mode or not.

IfQHelpEngineCore is in auto save filter mode, the current filter is automatically saved when it is changed by thesetCurrentFilter() function. The filter is saved persistently in the help collection file.

By default, this mode is on.

This property was introduced in Qt 4.5.

Access functions:

boolautoSaveFilter() const
voidsetAutoSaveFilter(bool save)

collectionFile :QString

This property holds the absolute file name of the collection file currently used.

Setting this property leaves the help engine in an invalid state. It is important to invokesetupData() or any getter function in order to setup the help engine again.

This property was introduced in Qt 4.5.

Access functions:

QStringcollectionFile() const
voidsetCollectionFile(const QString & fileName)

currentFilter :QString

This property holds the name of the custom filter currently applied.

Setting this property will save the new custom filter permanently in the help collection file. To set a custom filter without saving it permanently, disable the auto save filter mode.

This property was introduced in Qt 4.5.

Access functions:

QStringcurrentFilter() const
voidsetCurrentFilter(const QString & filterName)

See alsoautoSaveFilter().

Member Function Documentation

QHelpEngineCore::QHelpEngineCore(constQString & collectionFile,QObject * parent = 0)

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

[virtual]QHelpEngineCore::~QHelpEngineCore()

Destructs the help engine.

bool QHelpEngineCore::addCustomFilter(constQString & filterName, constQStringList & attributes)

Adds the new custom filterfilterName. 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 alsocustomFilters() andremoveCustomFilter().

bool QHelpEngineCore::copyCollectionFile(constQString & fileName)

Creates the filefileName 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.

[signal]void QHelpEngineCore::currentFilterChanged(constQString & newFilter)

This signal is emitted when the current filter is changed tonewFilter.

QStringList QHelpEngineCore::customFilters() const

Returns a list of custom filters.

See alsoaddCustomFilter() andremoveCustomFilter().

QVariant QHelpEngineCore::customValue(constQString & key, constQVariant & defaultValue = QVariant()) const

Returns the value assigned to thekey. If the requested key does not exist, the specifieddefaultValue is returned.

See alsosetCustomValue() andremoveCustomValue().

QString QHelpEngineCore::documentationFileName(constQString & namespaceName)

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

See alsonamespaceName().

QString QHelpEngineCore::error() const

Returns a description of the last error that occurred.

QByteArray QHelpEngineCore::fileData(constQUrl & url) const

Returns the data of the file specified byurl. If the file does not exist, an emptyQByteArray is returned.

See alsofindFile().

QList<QUrl> QHelpEngineCore::files(constQString namespaceName, constQStringList & filterAttributes, constQString & extensionFilter = QString())

Returns a list of files contained in the Qt compressed help filenamespaceName. The files can be filtered byfilterAttributes as well as by their extensionextensionFilter (e.g. 'html').

QList<QStringList> QHelpEngineCore::filterAttributeSets(constQString & namespaceName) const

Returns a list of filter attributes for the different filter sections defined in the Qt compressed help file with the given namespacenamespaceName.

QStringList QHelpEngineCore::filterAttributes() const

Returns a list of all defined filter attributes.

QStringList QHelpEngineCore::filterAttributes(constQString & filterName) const

Returns a list of filter attributes used by the custom filterfilterName.

QUrl QHelpEngineCore::findFile(constQUrl & url) const

Returns an invalid URL if the fileurl cannot be found. If the file exists, either the same url is returned or a different url if the file is located in a different namespace which is merged via a common virtual folder.

QMap<QString,QUrl> QHelpEngineCore::linksForIdentifier(constQString & id) const

Returns a map of hits found for theid. A hit contains the title of the document and the url where the keyword is located. The result depends on the current filter, meaning only the keywords registered for the current filter will be returned.

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

Returns the meta data for the Qt compressed help filedocumentationFileName. 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]QString QHelpEngineCore::namespaceName(constQString & documentationFileName)

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

See alsodocumentationFileName().

[signal]void QHelpEngineCore::readersAboutToBeInvalidated()

bool QHelpEngineCore::registerDocumentation(constQString & documentationFileName)

Registers the Qt compressed help file (.qch) contained in the filedocumentationFileName. 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 alsounregisterDocumentation() anderror().

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::removeCustomFilter(constQString & filterName)

Returns true if the filterfilterName was removed successfully, otherwise false.

See alsoaddCustomFilter() andcustomFilters().

bool QHelpEngineCore::removeCustomValue(constQString & key)

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

See alsocustomValue() andsetCustomValue().

bool QHelpEngineCore::setCustomValue(constQString & key, constQVariant & value)

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

See alsocustomValue() andremoveCustomValue().

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(constQString & namespaceName)

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

See alsoregisterDocumentation() anderror().

[signal]void QHelpEngineCore::warning(constQString & msg)

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

© 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