Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qhelpengineplugin.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qhelpengineplugin.h"
6
7
#
include
<
algorithm
>
8
#
include
<
iterator
>
9
#
include
<
memory
>
10
11
QT_BEGIN_NAMESPACE
12
13
static
std::vector<QQmlLSHelpProvider::DocumentLink>
14
transformQHelpLink(QList<QHelpLink> &&qhelplinklist)
15
{
16
std::vector<QQmlLSHelpProvider::DocumentLink> result(qhelplinklist.size());
17
std::transform(qhelplinklist.begin(), qhelplinklist.end(), result.begin(),
18
[&](
const
auto
&item) {
19
QQmlLSHelpProvider::DocumentLink element;
20
element.title = item.title;
21
element.url = item.url;
22
return
element;
23
});
24
return
result;
25
}
26
27
QQmlLSHelpProvider::QQmlLSHelpProvider(
const
QString &qhcFilePath, QObject *parent)
28
{
29
m_helpEngine.emplace(qhcFilePath, parent);
30
m_helpEngine->setReadOnly(
false
);
31
m_helpEngine->setupData();
32
}
33
34
bool
QQmlLSHelpProvider::registerDocumentation(
const
QString &documentationFileName)
35
{
36
Q_ASSERT(m_helpEngine.has_value());
37
return
m_helpEngine->registerDocumentation(documentationFileName);
38
}
39
40
QByteArray QQmlLSHelpProvider::fileData(
const
QUrl &url)
const
41
{
42
Q_ASSERT(m_helpEngine.has_value());
43
return
m_helpEngine->fileData(url);
44
}
45
46
std::vector<QQmlLSHelpProvider::DocumentLink>
47
QQmlLSHelpProvider::documentsForIdentifier(
const
QString &id)
const
48
{
49
Q_ASSERT(m_helpEngine.has_value());
50
return
transformQHelpLink(m_helpEngine->documentsForIdentifier(id));
51
}
52
53
std::vector<QQmlLSHelpProvider::DocumentLink>
54
QQmlLSHelpProvider::documentsForIdentifier(
const
QString &id,
const
QString &filterName)
const
55
{
56
Q_ASSERT(m_helpEngine.has_value());
57
return
transformQHelpLink(m_helpEngine->documentsForIdentifier(id, filterName));
58
}
59
60
std::vector<QQmlLSHelpProvider::DocumentLink>
61
QQmlLSHelpProvider::documentsForKeyword(
const
QString &keyword)
const
62
{
63
Q_ASSERT(m_helpEngine.has_value());
64
return
transformQHelpLink(m_helpEngine->documentsForKeyword(keyword));
65
}
66
67
std::vector<QQmlLSHelpProvider::DocumentLink>
68
QQmlLSHelpProvider::documentsForKeyword(
const
QString &keyword,
const
QString &filter)
const
69
{
70
Q_ASSERT(m_helpEngine.has_value());
71
return
transformQHelpLink(m_helpEngine->documentsForKeyword(keyword, filter));
72
}
73
74
QStringList QQmlLSHelpProvider::registeredNamespaces()
const
75
{
76
Q_ASSERT(m_helpEngine.has_value());
77
return
m_helpEngine->registeredDocumentations();
78
}
79
80
QString QQmlLSHelpProvider::error()
const
81
{
82
Q_ASSERT(m_helpEngine.has_value());
83
return
m_helpEngine->error();
84
}
85
86
QHelpEnginePlugin
::QHelpEnginePlugin(QObject *parent) : QObject(parent) { }
87
88
std::unique_ptr<QQmlLSHelpProviderBase>
QHelpEnginePlugin
::initialize(
const
QString &collectionFile,
89
QObject *parent)
90
{
91
return
std
::make_unique<QQmlLSHelpProvider>(collectionFile, parent);
92
}
93
94
QT_END_NAMESPACE
95
96
#
include
"moc_qhelpengineplugin.cpp"
QHelpEnginePlugin
Definition
qhelpengineplugin.h:52
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qttools
src
assistant
plugins
help
qhelpengineplugin.cpp
Generated on
for Qt by
1.18.0