Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmllsmoduleexplorer_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 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#ifndef QQMLLSMODULEEXPLORER_P_H
6#define QQMLLSMODULEEXPLORER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qhash.h>
20#include <QtCore/qobject.h>
21#include <QtCore/qmutex.h>
22#include <QtCore/qstringlist.h>
23#include <QtCore/qthread.h>
24#include <QtCore/qwaitcondition.h>
25
26#include <deque>
27#include <memory>
28#include <optional>
29
30QT_BEGIN_NAMESPACE
31
32class QQmlLSModuleExplorer : public QObject
33{
34 Q_OBJECT
35public:
36 QQmlLSModuleExplorer();
37 ~QQmlLSModuleExplorer() override;
38
39 void setEnabled(bool enabled);
40 void explore(const QStringList &importPaths);
41 void cancel();
42 QStringList modulesIn(const QStringList &importPaths) const;
43 bool isExploring() const;
44
45Q_SIGNALS:
46 void explorationStarted();
47 void explorationFinished();
48
49private:
50 void run();
51 std::optional<QString> takeNextImportPath();
52 void addModule(const QString &importPath, const QString &module);
53 bool finishExploring();
54
55 std::unique_ptr<QThread> m_thread;
56 mutable QMutex m_mutex;
57 QWaitCondition m_hasWork;
58 std::deque<QString> m_pendingImportPaths;
59 QHash<QString, QStringList> m_modulesPerImportPath;
60 bool m_enabled = true;
61 bool m_exploring = false;
62 bool m_stopRequested = false;
63 bool m_cancelRequested = false;
64};
65
67
68#endif // QQMLLSMODULEEXPLORER_P_H
Combined button and popup list for selecting options.
static std::optional< QString > moduleNameFromQmldir(const QString &qmldirPath)