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/QUrl> |
10 | #include <QtCore/QStringListModel> |
11 | #include <QtWidgets/QListView> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | |
16 | class QHelpEnginePrivate; |
17 | class QHelpEngineCore; |
18 | class QHelpIndexModelPrivate; |
19 | struct QHelpLink; |
20 | |
21 | class QHELP_EXPORT QHelpIndexModel : public QStringListModel |
22 | { |
23 | Q_OBJECT |
24 | |
25 | public: |
26 | void createIndex(const QString &customFilterName); |
27 | QModelIndex filter(const QString &filter, |
28 | const QString &wildcard = QString()); |
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(QHelpEnginePrivate *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, |
61 | const QString &keyword); |
62 | void documentsActivated(const QList<QHelpLink> &documents, |
63 | const QString &keyword); |
64 | |
65 | public Q_SLOTS: |
66 | void filterIndices(const QString &filter, |
67 | const QString &wildcard = QString()); |
68 | void activateCurrentItem(); |
69 | |
70 | private Q_SLOTS: |
71 | void showLink(const QModelIndex &index); |
72 | |
73 | private: |
74 | QHelpIndexWidget(); |
75 | friend class QHelpEngine; |
76 | }; |
77 | |
78 | QT_END_NAMESPACE |
79 | |
80 | #endif |
81 |