1 | // Copyright (C) 2016 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 | |
4 | #ifndef QHELPINDEXWIDGET_H |
5 | #define QHELPINDEXWIDGET_H |
6 | |
7 | #include <QtHelp/qhelp_global.h> |
8 | |
9 | #include <QtCore/qstringlistmodel.h> |
10 | #include <QtCore/qurl.h> |
11 | |
12 | #include <QtWidgets/qlistview.h> |
13 | |
14 | QT_BEGIN_NAMESPACE |
15 | |
16 | class QHelpEngineCore; |
17 | class QHelpEnginePrivate; |
18 | class QHelpIndexModelPrivate; |
19 | struct QHelpLink; |
20 | |
21 | class QHELP_EXPORT QHelpIndexModel : public QStringListModel |
22 | { |
23 | Q_OBJECT |
24 | |
25 | public: |
26 | void createIndexForCurrentFilter(); |
27 | void createIndex(const QString &customFilterName); |
28 | QModelIndex filter(const QString &filter, const QString &wildcard = {}); |
29 | |
30 | bool isCreatingIndex() const; |
31 | QHelpEngineCore *helpEngine() const; |
32 | |
33 | Q_SIGNALS: |
34 | void indexCreationStarted(); |
35 | void indexCreated(); |
36 | |
37 | private Q_SLOTS: |
38 | void insertIndices(); |
39 | |
40 | private: |
41 | QHelpIndexModel(QHelpEngineCore *helpEngine); |
42 | ~QHelpIndexModel(); |
43 | |
44 | QHelpIndexModelPrivate *d; |
45 | friend class QHelpEnginePrivate; |
46 | }; |
47 | |
48 | class QHELP_EXPORT QHelpIndexWidget : public QListView |
49 | { |
50 | Q_OBJECT |
51 | Q_MOC_INCLUDE(<QtHelp/qhelplink.h>) |
52 | |
53 | Q_SIGNALS: |
54 | #if QT_DEPRECATED_SINCE(5, 15) |
55 | QT_DEPRECATED_X("Use documentActivated() instead" ) |
56 | void linkActivated(const QUrl &link, const QString &keyword); |
57 | QT_DEPRECATED_X("Use documentsActivated() instead" ) |
58 | void linksActivated(const QMultiMap<QString, QUrl> &links, const QString &keyword); |
59 | #endif |
60 | void documentActivated(const QHelpLink &document, const QString &keyword); |
61 | void documentsActivated(const QList<QHelpLink> &documents, const QString &keyword); |
62 | |
63 | public Q_SLOTS: |
64 | void filterIndices(const QString &filter, const QString &wildcard = {}); |
65 | void activateCurrentItem(); |
66 | |
67 | private Q_SLOTS: |
68 | void showLink(const QModelIndex &index); |
69 | |
70 | private: |
71 | QHelpIndexWidget(); |
72 | friend class QHelpEngine; |
73 | }; |
74 | |
75 | QT_END_NAMESPACE |
76 | |
77 | #endif // QHELPINDEXWIDGET_H |
78 | |