diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-01-20 14:48:05 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-01-20 17:28:10 +0100 |
commit | 0fb373c9a2ebc31f76b27bfa5c2e59dadefeaf08 (patch) | |
tree | 8df5099729d1e7fd9a973b4caf8fa1db7ca31de0 /src | |
parent | a738c3566790c6e9abeea3c4c3dacfceaa82f66a (diff) |
Qt.labs.settings: Make plugin optional
This moves the settings types into a new library and is meant to make
them availabe to the QML compiler at some point in the future.
Task-number: QTBUG-90487
Change-Id: I986615b08ea8c1a7312b9d9c6ae0b13c03fb5497
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/imports/settings/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/imports/settings/plugin.cpp | 4 | ||||
-rw-r--r-- | src/labs/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/labs/settings/CMakeLists.txt | 21 | ||||
-rw-r--r-- | src/labs/settings/qqmlsettings.cpp (renamed from src/imports/settings/qqmlsettings.cpp) | 0 | ||||
-rw-r--r-- | src/labs/settings/qqmlsettings_p.h (renamed from src/imports/settings/qqmlsettings_p.h) | 4 | ||||
-rw-r--r-- | src/labs/settings/qqmlsettingsglobal_p.h | 73 |
8 files changed, 102 insertions, 7 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 41efafb6d8..54de0ba58b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,7 @@ endif() add_subdirectory(qmltyperegistrar) add_subdirectory(qml) add_subdirectory(qmlmodels) +add_subdirectory(labs) if(QT_FEATURE_qml_worker_script) add_subdirectory(qmlworkerscript) diff --git a/src/imports/settings/CMakeLists.txt b/src/imports/settings/CMakeLists.txt index c5c76135ba..f49e741106 100644 --- a/src/imports/settings/CMakeLists.txt +++ b/src/imports/settings/CMakeLists.txt @@ -9,14 +9,13 @@ qt_internal_add_qml_module(qmlsettingsplugin VERSION "${CMAKE_PROJECT_VERSION}" CLASSNAME QmlSettingsPlugin SKIP_TYPE_REGISTRATION - GENERATE_QMLTYPES - INSTALL_QMLTYPES + PLUGIN_OPTIONAL SOURCES plugin.cpp - qqmlsettings.cpp qqmlsettings_p.h PUBLIC_LIBRARIES Qt::Core Qt::Qml + Qt::LabsSettingsPrivate ) #### Keys ignored in scope 1:.:.:settings.pro:<TRUE>: diff --git a/src/imports/settings/plugin.cpp b/src/imports/settings/plugin.cpp index e8e640412b..428bd27198 100644 --- a/src/imports/settings/plugin.cpp +++ b/src/imports/settings/plugin.cpp @@ -40,9 +40,7 @@ #include <QtQml/qqmlextensionplugin.h> #include <QtQml/qqml.h> -#include "qqmlsettings_p.h" - -extern void qml_register_types_Qt_labs_settings(); +#include <QtLabsSettings/private/qqmlsettingsglobal_p.h> QT_BEGIN_NAMESPACE diff --git a/src/labs/CMakeLists.txt b/src/labs/CMakeLists.txt new file mode 100644 index 0000000000..b1f8c7c142 --- /dev/null +++ b/src/labs/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(settings) diff --git a/src/labs/settings/CMakeLists.txt b/src/labs/settings/CMakeLists.txt new file mode 100644 index 0000000000..23b5018dd5 --- /dev/null +++ b/src/labs/settings/CMakeLists.txt @@ -0,0 +1,21 @@ +qt_internal_add_module(LabsSettings + GENERATE_METATYPES + SOURCES + qqmlsettings.cpp qqmlsettings_p.h + qqmlsettingsglobal_p.h + DEFINES + QT_BUILD_LABSSETTINGS_LIB + PUBLIC_LIBRARIES + Qt::Core + Qt::Qml +) + +set_target_properties(LabsSettings PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION ${CMAKE_PROJECT_VERSION} + QT_QML_MODULE_URI Qt.labs.settings + QT_QMLTYPES_FILENAME plugins.qmltypes + QT_QML_MODULE_INSTALL_DIR "${INSTALL_QMLDIR}/Qt/labs/settings" +) + +qt6_qml_type_registration(LabsSettings) diff --git a/src/imports/settings/qqmlsettings.cpp b/src/labs/settings/qqmlsettings.cpp index ff8ec5e065..ff8ec5e065 100644 --- a/src/imports/settings/qqmlsettings.cpp +++ b/src/labs/settings/qqmlsettings.cpp diff --git a/src/imports/settings/qqmlsettings_p.h b/src/labs/settings/qqmlsettings_p.h index 100d0136ff..1739f3934a 100644 --- a/src/imports/settings/qqmlsettings_p.h +++ b/src/labs/settings/qqmlsettings_p.h @@ -40,6 +40,8 @@ #ifndef QQMLSETTINGS_P_H #define QQMLSETTINGS_P_H +#include "qqmlsettingsglobal_p.h" + // // W A R N I N G // ------------- @@ -60,7 +62,7 @@ QT_BEGIN_NAMESPACE class QQmlSettingsPrivate; -class QQmlSettings : public QObject, public QQmlParserStatus +class Q_LABSSETTINGS_PRIVATE_EXPORT QQmlSettings : public QObject, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) diff --git a/src/labs/settings/qqmlsettingsglobal_p.h b/src/labs/settings/qqmlsettingsglobal_p.h new file mode 100644 index 0000000000..c0bea2585e --- /dev/null +++ b/src/labs/settings/qqmlsettingsglobal_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module 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$ +** +****************************************************************************/ + +#ifndef QTLABSSETTINGSGLOBAL_P_H +#define QTLABSSETTINGSGLOBAL_P_H + +#include <QtCore/qglobal.h> + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +#if !defined(QT_STATIC) +# if defined(QT_BUILD_LABSSETTINGS_LIB) +# define Q_LABSSETTINGS_EXPORT Q_DECL_EXPORT +# else +# define Q_LABSSETTINGS_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_LABSSETTINGS_EXPORT +#endif +#define Q_LABSSETTINGS_PRIVATE_EXPORT Q_LABSSETTINGS_EXPORT + +QT_END_NAMESPACE + +void Q_LABSSETTINGS_PRIVATE_EXPORT qml_register_types_Qt_labs_settings(); + +#endif // QTLABSSETTINGSGLOBAL_P_H |