diff options
author | Craig Scott <[email protected]> | 2021-06-02 16:54:21 +1000 |
---|---|---|
committer | Craig Scott <[email protected]> | 2021-06-04 16:54:52 +1000 |
commit | 1c4ba17015fe99da48ce73fab75ecc60cf9cb975 (patch) | |
tree | 1311d8cebc4007d43888477045ca534404f2f7ca /src/labs/sharedimage/qsharedimageplugin.cpp | |
parent | 6432e00b954beec7d0c6bc9b70fed6191b87bd38 (diff) |
Refactor and update qml CMake API
The existing CMake API for qml modules had a number of
shortcomings. Refactor it to achieve the following:
- Clearly separate public and internal aspects.
- Re-use code from qtbase for adding plugins and module
targets rather than reimplementing close variations.
- Provide more robust and complete support for qmllint,
qmlcachegen and automatic generation of qmldir files.
- Reduce the steps needed for more common scenarios.
- Encourage the use of separate backing library and plugin
targets.
- Automatically generate the plugin class .cpp file where
possible.
- Specify .qml files directly through qml-specific API
elements rather than assuming they can be extracted
out of a set of resources.
[ChangeLog][QtQml] The qml CMake API has changed from 6.1
and is now out of Technical Preview status. The most
notable change is that .qml files should no longer be
specified as resources, there is dedicated handling for
them in the qt6_add_qml_module(). A related change is
that the qt6_target_qml_files() command has been replaced
by qt6_target_qml_sources(). More complete integration
with qmlcachegen, qmllint and qmldir generation is also
part of the CMake API.
Fixes: QTBUG-91621
Task-number: QTBUG-82598
Task-number: QTBUG-88763
Task-number: QTBUG-89274
Task-number: QTBUG-91444
Change-Id: I25aae1b0e89890394dfe2ba2824008164b2ca8d9
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'src/labs/sharedimage/qsharedimageplugin.cpp')
-rw-r--r-- | src/labs/sharedimage/qsharedimageplugin.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/labs/sharedimage/qsharedimageplugin.cpp b/src/labs/sharedimage/qsharedimageplugin.cpp new file mode 100644 index 0000000000..dab68410f3 --- /dev/null +++ b/src/labs/sharedimage/qsharedimageplugin.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtLabsSharedImage/private/qtlabssharedimageglobal_p.h> +#include <QtLabsSharedImage/private/qsharedimageprovider_p.h> + +#include <qqmlextensionplugin.h> +#include <qqmlengine.h> + +QT_BEGIN_NAMESPACE + +class QtQuickSharedImagePlugin : public QQmlEngineExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) +public: + QtQuickSharedImagePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) + { + volatile auto registration = &qml_register_types_Qt_labs_sharedimage; + Q_UNUSED(registration); + } + + void initializeEngine(QQmlEngine *engine, const char *uri) override + { + Q_UNUSED(uri); + engine->addImageProvider("shared", new SharedImageProvider); + } +}; + +QT_END_NAMESPACE + +#include "qsharedimageplugin.moc" |