aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickcontrols/sanity/quickcontrolssanity.h
blob: 29bc0c7a3ac9021aa2b44ba791d75530866573d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef QUICKCONTROLSSANITY_H
#define QUICKCONTROLSSANITY_H

#include <QtCore/qplugin.h>
#include <QtQmlCompiler/private/qqmlsa_p.h>

QT_BEGIN_NAMESPACE

class QuickControlsSanityPlugin : public QObject, public QQmlSA::LintPlugin
{
    Q_OBJECT
    Q_PLUGIN_METADATA(IID QmlLintPluginInterface_iid FILE "plugin.json")
    Q_INTERFACES(QQmlSA::LintPlugin)

public:
    void registerPasses(QQmlSA::PassManager *manager, const QQmlSA::Element &rootElement) override;
};

class AnchorsElementPass : public QQmlSA::ElementPass
{
public:
    AnchorsElementPass(QQmlSA::PassManager *manager);

    bool shouldRun(const QQmlSA::Element &element) override;
    void run(const QQmlSA::Element &element) override;

private:
    QQmlSA::Element m_item;
};

class SignalHandlerPass : public QQmlSA::ElementPass
{
public:
    SignalHandlerPass(QQmlSA::PassManager *manager);

    bool shouldRun(const QQmlSA::Element &element) override;
    void run(const QQmlSA::Element &element) override;

private:
    QQmlSA::Element m_qtobject;
};

class FunctionDeclarationPass : public QQmlSA::ElementPass
{
public:
    FunctionDeclarationPass(QQmlSA::PassManager *manager);

    bool shouldRun(const QQmlSA::Element &element) override;
    void run(const QQmlSA::Element &element) override;
};

QT_END_NAMESPACE

#endif // QUICKCONTROLSSANITY_H