aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qmlcompiler/tutorials/helloworld/chapter1/helloplugin.cpp
blob: ad36e64fae989178e923f4cb9f95a094ab6fb195 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "helloplugin.h"
#include <QDebug>

using namespace Qt::StringLiterals;

static constexpr QQmlSA::LoggerWarningId helloWorld { "Plugin.HelloWorld.hello-world" };

void HelloWorldPlugin::registerPasses(QQmlSA::PassManager *manager, const QQmlSA::Element &rootElement)
{
    const bool pluginIsEnabled = manager->isCategoryEnabled(helloWorld);
    qDebug() << "Hello World plugin is" << (pluginIsEnabled ? "enabled" : "disabled");
    if (!pluginIsEnabled)
        return; // skip registration if the plugin is disabled anyway
    // here we will later register our passes
}

#include "moc_helloplugin.cpp"