Documentation Index
Fetch the complete documentation index at: https://mintlify.com/zealdocs/zeal/llms.txt
Use this file to discover all available pages before exploring further.
DocsetRegistry
The DocsetRegistry class manages a collection of docsets. It handles loading/unloading docsets, performing searches across all docsets, and emitting signals when docsets change.
#include <registry/docsetregistry.h>
Namespace
Zeal::Registry::DocsetRegistry
Inheritance
class DocsetRegistry : public QObject
Constructor
DocsetRegistry()
explicit DocsetRegistry(QObject *parent = nullptr)
Creates a new docset registry.
Parameters:
parent - Optional parent QObject
Example:
auto registry = new Zeal::Registry::DocsetRegistry();
registry->setStoragePath("/path/to/docsets");
Model Access
model()
QAbstractItemModel *model() const
Returns the item model representing the docsets in this registry. Useful for displaying docsets in Qt views.
Returns: Pointer to the abstract item model
Example:
QListView *listView = new QListView();
listView->setModel(registry->model());
Storage Path
storagePath()
QString storagePath() const
Returns the directory path where docsets are stored.
Returns: The storage path
setStoragePath()
void setStoragePath(const QString &path)
Sets the directory path where docsets are stored and loads all docsets from that location.
Parameters:
path - The directory path containing docsets
Example:
registry->setStoragePath(QDir::homePath() + "/.local/share/Zeal/docsets");
Fuzzy Search Settings
isFuzzySearchEnabled()
bool isFuzzySearchEnabled() const
Checks if fuzzy search is enabled for all docsets.
Returns: true if fuzzy search is enabled
setFuzzySearchEnabled()
void setFuzzySearchEnabled(bool enabled)
Enables or disables fuzzy search for all docsets in the registry.
Parameters:
enabled - Whether to enable fuzzy search
Example:
registry->setFuzzySearchEnabled(true);
// All searches will now be more lenient with typos
Docset Query Methods
count()
Returns the number of loaded docsets.
Returns: The docset count
contains()
bool contains(const QString &name) const
Checks if a docset with the given name is loaded.
Parameters:
name - The docset name to check
Returns: true if the docset exists
Example:
if (registry->contains("python")) {
qDebug() << "Python docset is loaded";
}
names()
QStringList names() const
Returns a list of all loaded docset names.
Returns: List of docset names
Example:
QStringList names = registry->names();
for (const QString &name : names) {
qDebug() << "Loaded:" << name;
}
Docset Management
loadDocset()
void loadDocset(const QString &path)
Loads a docset from the specified path.
Parameters:
path - File system path to the docset
Example:
registry->loadDocset("/path/to/Python.docset");
// Emits docsetLoaded("python") signal when complete
unloadDocset()
void unloadDocset(const QString &name)
Unloads a docset with the given name.
Parameters:
name - The name of the docset to unload
Example:
registry->unloadDocset("python");
// Emits docsetAboutToBeUnloaded("python") then docsetUnloaded("python")
unloadAllDocsets()
Unloads all currently loaded docsets.
Example:
registry->unloadAllDocsets();
// All docsets are removed from the registry
Docset Access
docset() (by name)
Docset *docset(const QString &name) const
Returns a pointer to the docset with the given name.
Parameters:
Returns: Pointer to the docset, or nullptr if not found
Example:
Docset *pythonDocset = registry->docset("python");
if (pythonDocset) {
qDebug() << "Version:" << pythonDocset->version();
}
docset() (by index)
Docset *docset(int index) const
Returns a pointer to the docset at the given index.
Parameters:
index - The index of the docset
Returns: Pointer to the docset, or nullptr if index is invalid
docsetForUrl()
Docset *docsetForUrl(const QUrl &url)
Finds the docset that contains documentation for the given URL.
Parameters:
url - The documentation URL
Returns: Pointer to the docset, or nullptr if not found
Example:
QUrl docUrl("file:///path/to/docsets/Python.docset/Contents/Resources/Documents/library/string.html");
Docset *docset = registry->docsetForUrl(docUrl);
if (docset) {
qDebug() << "URL belongs to:" << docset->title();
}
docsets()
QList<Docset *> docsets() const
Returns a list of all loaded docsets.
Returns: List of docset pointers
Example:
for (Docset *docset : registry->docsets()) {
qDebug() << docset->name() << "-" << docset->version();
}
Search Methods
search()
void search(const QString &query)
Performs an asynchronous search across all loaded docsets. Results are emitted via the searchCompleted signal.
Parameters:
query - The search query string (may include docset filters like “python:list”)
Example:
connect(registry, &DocsetRegistry::searchCompleted,
[](const QList<SearchResult> &results) {
qDebug() << "Found" << results.size() << "results";
});
registry->search("string");
queryResults()
const QList<SearchResult> &queryResults()
Returns the results from the most recent search.
Returns: List of search results
Example:
registry->search("list");
// Wait for searchCompleted signal...
const QList<SearchResult> &results = registry->queryResults();
Signals
docsetLoaded
void docsetLoaded(const QString &name)
Emitted when a docset has been successfully loaded.
Parameters:
name - The name of the loaded docset
Example:
connect(registry, &DocsetRegistry::docsetLoaded,
[](const QString &name) {
qDebug() << "Docset loaded:" << name;
});
docsetAboutToBeUnloaded
void docsetAboutToBeUnloaded(const QString &name)
Emitted just before a docset is unloaded. Use this to clean up any references to the docset.
Parameters:
name - The name of the docset being unloaded
docsetUnloaded
void docsetUnloaded(const QString &name)
Emitted after a docset has been unloaded.
Parameters:
name - The name of the unloaded docset
Example:
connect(registry, &DocsetRegistry::docsetAboutToBeUnloaded,
[](const QString &name) {
qDebug() << "About to unload:" << name;
});
connect(registry, &DocsetRegistry::docsetUnloaded,
[](const QString &name) {
qDebug() << "Unloaded:" << name;
});
searchCompleted
void searchCompleted(const QList<SearchResult> &results)
Emitted when an asynchronous search has completed.
Parameters:
results - The list of search results
Example:
connect(registry, &DocsetRegistry::searchCompleted,
[](const QList<SearchResult> &results) {
for (const auto &result : results) {
qDebug() << result.docset->title() << ":" << result.name;
}
});
registry->search("python:list");