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
qqmlpreviewblacklist.h
Go to the documentation of this file.
1// Copyright (C) 2018 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
4
5#ifndef QQMLPREVIEWBLACKLIST_H
6#define QQMLPREVIEWBLACKLIST_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/qchar.h>
21#include <QtCore/qstring.h>
22#include <algorithm>
23
24QT_BEGIN_NAMESPACE
25
26class QQmlPreviewBlacklist
27{
28public:
29 void blacklist(const QStringList &paths);
30 void blacklist(const QString &path);
31 void whitelist(const QStringList &path);
32 void whitelist(const QString &path);
33 bool isBlacklisted(const QString &path) const;
34 void clear();
35
36private:
37 class Node {
38 public:
39 enum PrefixResult {
40 MatchedLeaf,
41 MatchedBranch,
42 Unmatched,
43 };
44
45 Node();
46 Node(const Node &other);
47 Node(Node &&other) noexcept;
48
49 ~Node();
50
51 Node &operator=(const Node &other);
52 Node &operator=(Node &&other) noexcept;
53
54 void split(QString::iterator it, QString::iterator end);
55 void insert(const QString &path, int offset);
56 void remove(const QString &path, int offset);
57 PrefixResult findPrefix(const QString &path, int offset) const;
58
59 private:
60 Node(const QString &mine, const QHash<QChar, Node *> &next = QHash<QChar, Node *>(),
61 bool isLeaf = true);
62
63 QString m_mine;
64 QHash<QChar, Node *> m_next;
65 bool m_isLeaf = false;
66 };
67
68 Node m_root;
69};
70
72
73#endif // QQMLPREVIEWBLACKLIST_H
void load(const QUrl &url) final
void removeEngine(QQmlEngine *engine) final
void connectToService(QQmlPreviewServiceImpl *service) final
bool eventFilter(QObject *obj, QEvent *event) final
Filters events if this object has been installed as an event filter for the watched object.
std::unique_ptr< QAbstractFileEngine > create(const QString &fileName) const override
If this file handler can handle fileName, this method creates a file engine and returns it wrapped in...
QQmlPreviewFileLoader(QQmlPreviewServiceImpl *service)
Result load(const QString &file)
bool isBlacklisted(const QString &file)
void whitelist(const QUrl &url)
void disconnectWindow(QQuickWindow *window)
void fps(const QQmlPreviewHandler::FpsInfo &info)
void setCurrentRootItem(QQuickItem *item)
QList< QQmlEngine * > engines() const
void zoomWindow(QQuickWindow *window, qreal zoomFactor, QQmlPreviewPosition *position)
QQuickItem * currentRootItem() const
void setCurrentWindow(QQuickWindow *window)
void connectWindow(QQuickWindow *window)
void setAnimationSpeed(qreal newFactor)
virtual void removeEngine(QQmlEngine *engine)
virtual void load(const QUrl &url)=0
QQmlPreviewHandler(QObject *parent=nullptr)
virtual void addEngine(QQmlEngine *engine)
QQuickWindow * currentWindow() const
virtual void connectToService(QQmlPreviewServiceImpl *service)
bool operator==(const QQmlPreviewPosition::ScreenData &other) const
void loadWindowPositionSettings(const QUrl &url)
void takePosition(QWindow *window, InitializeState state=PositionInitialized)
void initLastSavedWindowPosition(QWindow *window)
void forwardRequest(const QString &file)
void drop(const QUrl &url)
void animationSpeed(qreal factor)
void engineAboutToBeRemoved(QJSEngine *engine) override
QQmlPreviewServiceImpl(QObject *parent=nullptr)
void file(const QString &file, const QByteArray &contents)
void forwardHotReloadFailure(const QString &reason)
void directory(const QString &file, const QStringList &entries)
void engineAboutToBeAdded(QJSEngine *engine) override
void forwardFps(const QQmlPreviewHandler::FpsInfo &frames)
void zoom(qreal factor)
static const QString s_key
void load(const QUrl &url)
void stateChanged(State state) override
void forwardError(const QString &error)
void messageReceived(const QByteArray &message) override
Combined button and popup list for selecting options.
static Qt::WindowFlags fixFlags(Qt::WindowFlags flags)
static void closeAllWindows()