diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-01-21 13:55:52 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-01-22 10:26:23 +0100 |
commit | 0e80f902923a38cfdbcc1a6eb67d0cdceec4abb1 (patch) | |
tree | 425499b025c7b49c7306a68fb2fc3745e6b2f0c0 | |
parent | 75437f824d4c3a608af9eb1afddcb4d8c1a25944 (diff) |
Qt.labs.qmlmodels: Make plugin optional
This moves the qmlmodels 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: Ib76d1f0b592cc52f6396864fb4be3bb41c4df27b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | src/imports/labsmodels/CMakeLists.txt | 16 | ||||
-rw-r--r-- | src/imports/labsmodels/plugin.cpp | 10 | ||||
-rw-r--r-- | src/labs/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/labs/models/CMakeLists.txt | 32 | ||||
-rw-r--r-- | src/labs/models/qqmldelegatecomponent.cpp (renamed from src/imports/labsmodels/qqmldelegatecomponent.cpp) | 0 | ||||
-rw-r--r-- | src/labs/models/qqmldelegatecomponent_p.h (renamed from src/imports/labsmodels/qqmldelegatecomponent_p.h) | 6 | ||||
-rw-r--r-- | src/labs/models/qqmlmodelsglobal_p.h | 73 | ||||
-rw-r--r-- | src/labs/models/qqmltablemodel.cpp (renamed from src/imports/labsmodels/qqmltablemodel.cpp) | 0 | ||||
-rw-r--r-- | src/labs/models/qqmltablemodel_p.h (renamed from src/imports/labsmodels/qqmltablemodel_p.h) | 3 | ||||
-rw-r--r-- | src/labs/models/qqmltablemodelcolumn.cpp (renamed from src/imports/labsmodels/qqmltablemodelcolumn.cpp) | 0 | ||||
-rw-r--r-- | src/labs/models/qqmltablemodelcolumn_p.h (renamed from src/imports/labsmodels/qqmltablemodelcolumn_p.h) | 4 | ||||
-rw-r--r-- | sync.profile | 3 |
12 files changed, 120 insertions, 28 deletions
diff --git a/src/imports/labsmodels/CMakeLists.txt b/src/imports/labsmodels/CMakeLists.txt index e859f75fa9..0c59a15a20 100644 --- a/src/imports/labsmodels/CMakeLists.txt +++ b/src/imports/labsmodels/CMakeLists.txt @@ -9,13 +9,12 @@ qt_internal_add_qml_module(labsmodelsplugin VERSION "${CMAKE_PROJECT_VERSION}" CLASSNAME QtQmlLabsModelsPlugin SKIP_TYPE_REGISTRATION - GENERATE_QMLTYPES - INSTALL_QMLTYPES + PLUGIN_OPTIONAL SOURCES plugin.cpp PUBLIC_LIBRARIES - Qt::QmlModelsPrivate Qt::QmlPrivate + Qt::LabsQmlModelsPrivate ) #### Keys ignored in scope 1:.:.:labsmodels.pro:<TRUE>: @@ -25,14 +24,3 @@ qt_internal_add_qml_module(labsmodelsplugin ## Scopes: ##################################################################### - -qt_internal_extend_target(labsmodelsplugin CONDITION QT_FEATURE_qml_table_model - SOURCES - qqmltablemodel.cpp qqmltablemodel_p.h - qqmltablemodelcolumn.cpp qqmltablemodelcolumn_p.h -) - -qt_internal_extend_target(labsmodelsplugin CONDITION QT_FEATURE_qml_delegate_model - SOURCES - qqmldelegatecomponent.cpp qqmldelegatecomponent_p.h -) diff --git a/src/imports/labsmodels/plugin.cpp b/src/imports/labsmodels/plugin.cpp index be26e5c8da..4735fe3583 100644 --- a/src/imports/labsmodels/plugin.cpp +++ b/src/imports/labsmodels/plugin.cpp @@ -42,15 +42,7 @@ #include <private/qqmlmodelsmodule_p.h> -#if QT_CONFIG(qml_table_model) -#include "qqmltablemodel_p.h" -#include "qqmltablemodelcolumn_p.h" -#endif -#if QT_CONFIG(qml_delegate_model) -#include "qqmldelegatecomponent_p.h" -#endif - -extern void qml_register_types_Qt_labs_qmlmodels(); +#include <QtLabsQmlModels/private/qqmlmodelsglobal_p.h> QT_BEGIN_NAMESPACE diff --git a/src/labs/CMakeLists.txt b/src/labs/CMakeLists.txt index 4170bdf621..2680ae8d11 100644 --- a/src/labs/CMakeLists.txt +++ b/src/labs/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory(settings) +add_subdirectory(models) if(QT_FEATURE_qml_itemmodel) add_subdirectory(folderlistmodel) diff --git a/src/labs/models/CMakeLists.txt b/src/labs/models/CMakeLists.txt new file mode 100644 index 0000000000..bfd7109bca --- /dev/null +++ b/src/labs/models/CMakeLists.txt @@ -0,0 +1,32 @@ +qt_internal_add_module(LabsQmlModels + GENERATE_METATYPES + SOURCES + qqmlmodelsglobal_p.h + DEFINES + QT_BUILD_LABSQMLMODELS_LIB + PUBLIC_LIBRARIES + Qt::QmlModelsPrivate + Qt::QmlPrivate + ) + +qt_internal_extend_target(LabsQmlModels CONDITION QT_FEATURE_qml_table_model + SOURCES + qqmltablemodel.cpp qqmltablemodel_p.h + qqmltablemodelcolumn.cpp qqmltablemodelcolumn_p.h +) + +qt_internal_extend_target(LabsQmlModels CONDITION QT_FEATURE_qml_delegate_model + SOURCES + qqmldelegatecomponent.cpp qqmldelegatecomponent_p.h +) + +set_target_properties(LabsQmlModels PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION ${CMAKE_PROJECT_VERSION} + QT_QML_MODULE_URI Qt.labs.qmlmodels + QT_QMLTYPES_FILENAME plugins.qmltypes + QT_QML_MODULE_INSTALL_DIR "${INSTALL_QMLDIR}/Qt/labs/qmlmodels" + +) + +qt6_qml_type_registration(LabsQmlModels) diff --git a/src/imports/labsmodels/qqmldelegatecomponent.cpp b/src/labs/models/qqmldelegatecomponent.cpp index c920d7c294..c920d7c294 100644 --- a/src/imports/labsmodels/qqmldelegatecomponent.cpp +++ b/src/labs/models/qqmldelegatecomponent.cpp diff --git a/src/imports/labsmodels/qqmldelegatecomponent_p.h b/src/labs/models/qqmldelegatecomponent_p.h index ed29f37809..1fa7694980 100644 --- a/src/imports/labsmodels/qqmldelegatecomponent_p.h +++ b/src/labs/models/qqmldelegatecomponent_p.h @@ -40,6 +40,8 @@ #ifndef QQMLDELEGATECOMPONENT_P_H #define QQMLDELEGATECOMPONENT_P_H +#include "qqmlmodelsglobal_p.h" + // // W A R N I N G // ------------- @@ -59,7 +61,7 @@ QT_REQUIRE_CONFIG(qml_delegate_model); QT_BEGIN_NAMESPACE -class QQmlDelegateChoice : public QObject +class Q_LABSQMLMODELS_PRIVATE_EXPORT QQmlDelegateChoice : public QObject { Q_OBJECT Q_PROPERTY(QVariant roleValue READ roleValue WRITE setRoleValue NOTIFY roleValueChanged) @@ -101,7 +103,7 @@ private: QQmlComponent *m_delegate = nullptr; }; -class QQmlDelegateChooser : public QQmlAbstractDelegateComponent +class Q_LABSQMLMODELS_PRIVATE_EXPORT QQmlDelegateChooser : public QQmlAbstractDelegateComponent { Q_OBJECT Q_PROPERTY(QString role READ role WRITE setRole NOTIFY roleChanged) diff --git a/src/labs/models/qqmlmodelsglobal_p.h b/src/labs/models/qqmlmodelsglobal_p.h new file mode 100644 index 0000000000..ceb7ac1f55 --- /dev/null +++ b/src/labs/models/qqmlmodelsglobal_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 QTLABSQMLMODELSGLOBAL_P_H +#define QTLABSQMLMODELSGLOBAL_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_LABSQMLMODELS_LIB) +# define Q_LABSQMLMODELS_EXPORT Q_DECL_EXPORT +# else +# define Q_LABSQMLMODELS_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_LABSQMLMODELS_EXPORT +#endif +#define Q_LABSQMLMODELS_PRIVATE_EXPORT Q_LABSQMLMODELS_EXPORT + +QT_END_NAMESPACE + +void Q_LABSQMLMODELS_PRIVATE_EXPORT qml_register_types_Qt_labs_qmlmodels(); + +#endif // QTLABSQMLMODELSGLOBAL_P_H diff --git a/src/imports/labsmodels/qqmltablemodel.cpp b/src/labs/models/qqmltablemodel.cpp index e60c525b0d..e60c525b0d 100644 --- a/src/imports/labsmodels/qqmltablemodel.cpp +++ b/src/labs/models/qqmltablemodel.cpp diff --git a/src/imports/labsmodels/qqmltablemodel_p.h b/src/labs/models/qqmltablemodel_p.h index b1a8c90837..60897fe007 100644 --- a/src/imports/labsmodels/qqmltablemodel_p.h +++ b/src/labs/models/qqmltablemodel_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include "qqmlmodelsglobal_p.h" #include "qqmltablemodelcolumn_p.h" #include <QtCore/QObject> @@ -64,7 +65,7 @@ QT_REQUIRE_CONFIG(qml_table_model); QT_BEGIN_NAMESPACE -class QQmlTableModel : public QAbstractTableModel, public QQmlParserStatus +class Q_LABSQMLMODELS_PRIVATE_EXPORT QQmlTableModel : public QAbstractTableModel, public QQmlParserStatus { Q_OBJECT Q_PROPERTY(int columnCount READ columnCount NOTIFY columnCountChanged FINAL) diff --git a/src/imports/labsmodels/qqmltablemodelcolumn.cpp b/src/labs/models/qqmltablemodelcolumn.cpp index 93da0642de..93da0642de 100644 --- a/src/imports/labsmodels/qqmltablemodelcolumn.cpp +++ b/src/labs/models/qqmltablemodelcolumn.cpp diff --git a/src/imports/labsmodels/qqmltablemodelcolumn_p.h b/src/labs/models/qqmltablemodelcolumn_p.h index 2860a915cc..7da31c9e2a 100644 --- a/src/imports/labsmodels/qqmltablemodelcolumn_p.h +++ b/src/labs/models/qqmltablemodelcolumn_p.h @@ -51,6 +51,8 @@ // We mean it. // +#include "qqmlmodelsglobal_p.h" + #include <QtCore/QObject> #include <QtQml/qqml.h> #include <QtQmlModels/private/qtqmlmodelsglobal_p.h> @@ -60,7 +62,7 @@ QT_REQUIRE_CONFIG(qml_table_model); QT_BEGIN_NAMESPACE -class QQmlTableModelColumn : public QObject +class Q_LABSQMLMODELS_PRIVATE_EXPORT QQmlTableModelColumn : public QObject { Q_OBJECT Q_PROPERTY(QJSValue display READ display WRITE setDisplay NOTIFY displayChanged FINAL) diff --git a/sync.profile b/sync.profile index 46c8a5a285..5d256dd647 100644 --- a/sync.profile +++ b/sync.profile @@ -16,7 +16,8 @@ "QtLabsSettings" => "$basedir/src/labs/settings", "QtLabsFolderListModel" => "$basedir/src/labs/folderlistmodel", "QtLabsAnimation" => "$basedir/src/labs/animation", - "QtLabsWavefrontMesh" => "$basedir/src/labs/wavefrontmesh" + "QtLabsWavefrontMesh" => "$basedir/src/labs/wavefrontmesh", + "QtLabsQmlModels" => "$basedir/src/labs/models" ); %inject_headers = ( "$basedir/src/qml" => [ "^qqmljsgrammar_p.h", "^qqmljsparser_p.h", "^qml_compile_hash_p.h" ], |