diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2021-01-20 17:23:23 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2021-01-21 10:35:52 +0100 |
commit | eb5bb9e7f547a7e222b5dbb848774639ab11f243 (patch) | |
tree | 7c4377e7b272025a4240e5707365a50b49898cc9 /src | |
parent | 3fadfb2c3fa7d4b22d0d0269c645c1086fa56619 (diff) |
Qt.labs.folderlistmodel: Make plugin optional
This moves the folderlistmodel 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: Iee84a4804a241aa1dee5f896a02ccc9f0ecc0d8d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/folderlistmodel/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/imports/folderlistmodel/plugin.cpp | 5 | ||||
-rw-r--r-- | src/labs/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/labs/folderlistmodel/CMakeLists.txt | 24 | ||||
-rw-r--r-- | src/labs/folderlistmodel/fileinfothread.cpp (renamed from src/imports/folderlistmodel/fileinfothread.cpp) | 0 | ||||
-rw-r--r-- | src/labs/folderlistmodel/fileinfothread_p.h (renamed from src/imports/folderlistmodel/fileinfothread_p.h) | 0 | ||||
-rw-r--r-- | src/labs/folderlistmodel/fileproperty_p.h (renamed from src/imports/folderlistmodel/fileproperty_p.h) | 0 | ||||
-rw-r--r-- | src/labs/folderlistmodel/qquickfolderlistmodel.cpp (renamed from src/imports/folderlistmodel/qquickfolderlistmodel.cpp) | 0 | ||||
-rw-r--r-- | src/labs/folderlistmodel/qquickfolderlistmodel.h (renamed from src/imports/folderlistmodel/qquickfolderlistmodel.h) | 4 | ||||
-rw-r--r-- | src/labs/folderlistmodel/qquickfolderlistmodelglobal_p.h | 73 |
10 files changed, 107 insertions, 9 deletions
diff --git a/src/imports/folderlistmodel/CMakeLists.txt b/src/imports/folderlistmodel/CMakeLists.txt index f1e543ad9f..85a43061f4 100644 --- a/src/imports/folderlistmodel/CMakeLists.txt +++ b/src/imports/folderlistmodel/CMakeLists.txt @@ -9,16 +9,13 @@ qt_internal_add_qml_module(qmlfolderlistmodelplugin VERSION "${CMAKE_PROJECT_VERSION}" CLASSNAME QmlFolderListModelPlugin SKIP_TYPE_REGISTRATION - GENERATE_QMLTYPES - INSTALL_QMLTYPES + PLUGIN_OPTIONAL SOURCES - fileinfothread.cpp fileinfothread_p.h - fileproperty_p.h plugin.cpp - qquickfolderlistmodel.cpp qquickfolderlistmodel.h PUBLIC_LIBRARIES Qt::CorePrivate Qt::QmlPrivate + Qt::LabsFolderListModelPrivate ) #### Keys ignored in scope 1:.:.:folderlistmodel.pro:<TRUE>: diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp index 9f8f14093e..eda8ea19d7 100644 --- a/src/imports/folderlistmodel/plugin.cpp +++ b/src/imports/folderlistmodel/plugin.cpp @@ -41,9 +41,8 @@ #include <QtQml/qqml.h> #include <QtQml/private/qqmlmetatype_p.h> -#include "qquickfolderlistmodel.h" - -extern void qml_register_types_Qt_labs_folderlistmodel(); +#include <QtLabsFolderListModel/private/qquickfolderlistmodelglobal_p.h> +#include <QtLabsFolderListModel/qquickfolderlistmodel.h> QT_BEGIN_NAMESPACE diff --git a/src/labs/CMakeLists.txt b/src/labs/CMakeLists.txt index b1f8c7c142..5dc715db60 100644 --- a/src/labs/CMakeLists.txt +++ b/src/labs/CMakeLists.txt @@ -1 +1,4 @@ add_subdirectory(settings) +if(QT_FEATURE_qml_itemmodel) + add_subdirectory(folderlistmodel) +endif() diff --git a/src/labs/folderlistmodel/CMakeLists.txt b/src/labs/folderlistmodel/CMakeLists.txt new file mode 100644 index 0000000000..bcee01629b --- /dev/null +++ b/src/labs/folderlistmodel/CMakeLists.txt @@ -0,0 +1,24 @@ +qt_internal_add_module(LabsFolderListModel + GENERATE_METATYPES + SOURCES + fileinfothread.cpp fileinfothread_p.h + fileproperty_p.h + qquickfolderlistmodel.cpp qquickfolderlistmodel.h + qquickfolderlistmodelglobal_p.h + DEFINES + QT_BUILD_LABSFOLDERMODEL_LIB + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::QmlPrivate +) + +set_target_properties(LabsFolderListModel PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION ${CMAKE_PROJECT_VERSION} + QT_QML_MODULE_URI Qt.labs.folderlistmodel + QT_QMLTYPES_FILENAME plugins.qmltypes + QT_QML_MODULE_INSTALL_DIR "${INSTALL_QMLDIR}/Qt/labs/folderlistmodel" +) + + +qt6_qml_type_registration(LabsFolderListModel) diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/labs/folderlistmodel/fileinfothread.cpp index a93edd3b1b..a93edd3b1b 100644 --- a/src/imports/folderlistmodel/fileinfothread.cpp +++ b/src/labs/folderlistmodel/fileinfothread.cpp diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/labs/folderlistmodel/fileinfothread_p.h index 923cb29e03..923cb29e03 100644 --- a/src/imports/folderlistmodel/fileinfothread_p.h +++ b/src/labs/folderlistmodel/fileinfothread_p.h diff --git a/src/imports/folderlistmodel/fileproperty_p.h b/src/labs/folderlistmodel/fileproperty_p.h index 48be4a3d85..48be4a3d85 100644 --- a/src/imports/folderlistmodel/fileproperty_p.h +++ b/src/labs/folderlistmodel/fileproperty_p.h diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/labs/folderlistmodel/qquickfolderlistmodel.cpp index ef21471c0c..ef21471c0c 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/labs/folderlistmodel/qquickfolderlistmodel.cpp diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/labs/folderlistmodel/qquickfolderlistmodel.h index e21a8d8f37..ba55ad2b92 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.h +++ b/src/labs/folderlistmodel/qquickfolderlistmodel.h @@ -40,6 +40,8 @@ #ifndef QQUICKFOLDERLISTMODEL_H #define QQUICKFOLDERLISTMODEL_H +#include "qquickfolderlistmodelglobal_p.h" + #include <qqml.h> #include <QStringList> #include <QUrl> @@ -54,7 +56,7 @@ class QModelIndex; class QQuickFolderListModelPrivate; //![class begin] -class QQuickFolderListModel : public QAbstractListModel, public QQmlParserStatus +class Q_LABSFOLDERMODEL_PRIVATE_EXPORT QQuickFolderListModel : public QAbstractListModel, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) diff --git a/src/labs/folderlistmodel/qquickfolderlistmodelglobal_p.h b/src/labs/folderlistmodel/qquickfolderlistmodelglobal_p.h new file mode 100644 index 0000000000..c8df4e9ff7 --- /dev/null +++ b/src/labs/folderlistmodel/qquickfolderlistmodelglobal_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 QTLABSFOLDERLISTMODELGLOBAL_P_H +#define QTLABSFOLDERLISTMODELGLOBAL_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_LABSFOLDERMODEL_LIB) +# define Q_LABSFOLDERMODEL_EXPORT Q_DECL_EXPORT +# else +# define Q_LABSFOLDERMODEL_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_LABSFOLDERMODEL_EXPORT +#endif +#define Q_LABSFOLDERMODEL_PRIVATE_EXPORT Q_LABSFOLDERMODEL_EXPORT + +QT_END_NAMESPACE + +void Q_LABSFOLDERMODEL_PRIVATE_EXPORT qml_register_types_Qt_labs_folderlistmodel(); + +#endif // QTLABSFOLDERLISTMODELGLOBAL_P_H |