diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-01-15 10:45:18 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-01-18 09:45:44 +0100 |
commit | 12115bbda219a651ef86a4e91fd5e52eb54ed29b (patch) | |
tree | 08c17ec1b5064603ebf3943abd3147216026aeb9 /src | |
parent | 704df6f14137d7e91cccb6f895d07fabcdb10f69 (diff) |
Quick.Layouts: Make plugin optional
This moves the Layouts types into a new library and is meant to make
them availabe to the QML compiler at some point in the future.
Change-Id: I9b2b31a78b0e9ca8b6c0db1fc9272d9941c61814
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/imports/layouts/CMakeLists.txt | 16 | ||||
-rw-r--r-- | src/imports/layouts/plugin.cpp | 6 | ||||
-rw-r--r-- | src/quicklayouts/CMakeLists.txt | 28 | ||||
-rw-r--r-- | src/quicklayouts/qquickgridlayoutengine.cpp (renamed from src/imports/layouts/qquickgridlayoutengine.cpp) | 0 | ||||
-rw-r--r-- | src/quicklayouts/qquickgridlayoutengine_p.h (renamed from src/imports/layouts/qquickgridlayoutengine_p.h) | 0 | ||||
-rw-r--r-- | src/quicklayouts/qquicklayout.cpp (renamed from src/imports/layouts/qquicklayout.cpp) | 0 | ||||
-rw-r--r-- | src/quicklayouts/qquicklayout_p.h (renamed from src/imports/layouts/qquicklayout_p.h) | 3 | ||||
-rw-r--r-- | src/quicklayouts/qquicklayoutglobal_p.h | 75 | ||||
-rw-r--r-- | src/quicklayouts/qquicklayoutstyleinfo.cpp (renamed from src/imports/layouts/qquicklayoutstyleinfo.cpp) | 0 | ||||
-rw-r--r-- | src/quicklayouts/qquicklayoutstyleinfo_p.h (renamed from src/imports/layouts/qquicklayoutstyleinfo_p.h) | 0 | ||||
-rw-r--r-- | src/quicklayouts/qquicklinearlayout.cpp (renamed from src/imports/layouts/qquicklinearlayout.cpp) | 0 | ||||
-rw-r--r-- | src/quicklayouts/qquicklinearlayout_p.h (renamed from src/imports/layouts/qquicklinearlayout_p.h) | 9 | ||||
-rw-r--r-- | src/quicklayouts/qquickstacklayout.cpp (renamed from src/imports/layouts/qquickstacklayout.cpp) | 0 | ||||
-rw-r--r-- | src/quicklayouts/qquickstacklayout_p.h (renamed from src/imports/layouts/qquickstacklayout_p.h) | 3 |
15 files changed, 119 insertions, 22 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 18c5f50c01..25c2be3648 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,7 @@ endif() if(TARGET Qt::Gui AND QT_FEATURE_qml_animation) add_subdirectory(quick) add_subdirectory(quickshapes) + add_subdirectory(quicklayouts) find_package(Qt6 ${PROJECT_VERSION} CONFIG COMPONENTS Test) # special case if(QT_FEATURE_testlib AND TARGET Qt::Test) # special case diff --git a/src/imports/layouts/CMakeLists.txt b/src/imports/layouts/CMakeLists.txt index 1beb4ee126..f0f957c024 100644 --- a/src/imports/layouts/CMakeLists.txt +++ b/src/imports/layouts/CMakeLists.txt @@ -4,30 +4,24 @@ ## qquicklayoutsplugin Plugin: ##################################################################### + qt_internal_add_qml_module(qquicklayoutsplugin URI "QtQuick.Layouts" VERSION "${CMAKE_PROJECT_VERSION}" DESIGNER_SUPPORTED CLASSNAME QtQuickLayoutsPlugin SKIP_TYPE_REGISTRATION - GENERATE_QMLTYPES - INSTALL_QMLTYPES + PLUGIN_OPTIONAL SOURCES plugin.cpp - qquickgridlayoutengine.cpp qquickgridlayoutengine_p.h - qquicklayout.cpp qquicklayout_p.h - qquicklayoutstyleinfo.cpp qquicklayoutstyleinfo_p.h - qquicklinearlayout.cpp qquicklinearlayout_p.h - qquickstacklayout.cpp qquickstacklayout_p.h PUBLIC_LIBRARIES Qt::Core - Qt::CorePrivate Qt::Gui - Qt::GuiPrivate - Qt::QmlPrivate - Qt::QuickPrivate + Qt::Qml + Qt::QuickLayoutsPrivate ) + #### Keys ignored in scope 1:.:.:layouts.pro:<TRUE>: # CXX_MODULE = "qml" # QML_IMPORT_VERSION = "$$QT_VERSION" diff --git a/src/imports/layouts/plugin.cpp b/src/imports/layouts/plugin.cpp index af270c1732..7e0c4ef053 100644 --- a/src/imports/layouts/plugin.cpp +++ b/src/imports/layouts/plugin.cpp @@ -38,11 +38,7 @@ ****************************************************************************/ #include <QtQml/qqmlextensionplugin.h> - -#include "qquicklinearlayout_p.h" -#include "qquickstacklayout_p.h" - -extern void qml_register_types_QtQuick_Layouts(); +#include <QtQuickLayouts/private/qquicklayoutglobal_p.h> QT_BEGIN_NAMESPACE diff --git a/src/quicklayouts/CMakeLists.txt b/src/quicklayouts/CMakeLists.txt new file mode 100644 index 0000000000..3524f5e4ba --- /dev/null +++ b/src/quicklayouts/CMakeLists.txt @@ -0,0 +1,28 @@ + qt_internal_add_module(QuickLayouts + GENERATE_METATYPES + SOURCES + qquickgridlayoutengine.cpp qquickgridlayoutengine_p.h + qquicklayout.cpp qquicklayout_p.h + qquicklayoutstyleinfo.cpp qquicklayoutstyleinfo_p.h + qquicklinearlayout.cpp qquicklinearlayout_p.h + qquickstacklayout.cpp qquickstacklayout_p.h + qquicklayoutglobal_p.h + DEFINES + QT_BUILD_QUICKLAYOUTS_LIB + PUBLIC_LIBRARIES + Qt::Core + Qt::GuiPrivate + Qt::QuickPrivate + Qt::Qml +) + + +set_target_properties(QuickLayouts PROPERTIES + QT_QML_MODULE_INSTALL_QMLTYPES TRUE + QT_QML_MODULE_VERSION ${CMAKE_PROJECT_VERSION} + QT_QML_MODULE_URI QtQuick.Layouts + QT_QMLTYPES_FILENAME plugins.qmltypes + QT_QML_MODULE_INSTALL_DIR "${INSTALL_QMLDIR}/QtQuick/Layouts" +) + +qt6_qml_type_registration(QuickLayouts) diff --git a/src/imports/layouts/qquickgridlayoutengine.cpp b/src/quicklayouts/qquickgridlayoutengine.cpp index 5275d70c39..5275d70c39 100644 --- a/src/imports/layouts/qquickgridlayoutengine.cpp +++ b/src/quicklayouts/qquickgridlayoutengine.cpp diff --git a/src/imports/layouts/qquickgridlayoutengine_p.h b/src/quicklayouts/qquickgridlayoutengine_p.h index ff42fa4d43..ff42fa4d43 100644 --- a/src/imports/layouts/qquickgridlayoutengine_p.h +++ b/src/quicklayouts/qquickgridlayoutengine_p.h diff --git a/src/imports/layouts/qquicklayout.cpp b/src/quicklayouts/qquicklayout.cpp index dbbd25de85..dbbd25de85 100644 --- a/src/imports/layouts/qquicklayout.cpp +++ b/src/quicklayouts/qquicklayout.cpp diff --git a/src/imports/layouts/qquicklayout_p.h b/src/quicklayouts/qquicklayout_p.h index db883245e5..773aafab0f 100644 --- a/src/imports/layouts/qquicklayout_p.h +++ b/src/quicklayouts/qquicklayout_p.h @@ -42,6 +42,7 @@ #include <QPointer> #include <QQuickItem> +#include <QtQuickLayouts/private/qquicklayoutglobal_p.h> #include <private/qquickitem_p.h> #include <QtQuick/private/qquickitemchangelistener_p.h> #include <QtGui/private/qlayoutpolicy_p.h> @@ -52,7 +53,7 @@ class QQuickLayoutAttached; Q_DECLARE_LOGGING_CATEGORY(lcQuickLayouts) class QQuickLayoutPrivate; -class QQuickLayout : public QQuickItem, public QQuickItemChangeListener +class Q_QUICKLAYOUT_PRIVATE_EXPORT QQuickLayout : public QQuickItem, public QQuickItemChangeListener { Q_OBJECT diff --git a/src/quicklayouts/qquicklayoutglobal_p.h b/src/quicklayouts/qquicklayoutglobal_p.h new file mode 100644 index 0000000000..c63169bd93 --- /dev/null +++ b/src/quicklayouts/qquicklayoutglobal_p.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick 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 QQUICKLAYOUTGLOBAL_P_H +#define QQUICKLAYOUTGLOBAL_P_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. +// + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +#if !defined(QT_STATIC) +# if defined(QT_BUILD_QUICKLAYOUTS_LIB) +# define Q_QUICKLAYOUT_EXPORT Q_DECL_EXPORT +# else +# define Q_QUICKLAYOUT_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_QUICKLAYOUT_EXPORT +#endif + + +#define Q_QUICKLAYOUT_PRIVATE_EXPORT Q_QUICKLAYOUT_EXPORT + +QT_END_NAMESPACE + +void Q_QUICKLAYOUT_PRIVATE_EXPORT qml_register_types_QtQuick_Layouts(); + +#endif // QQUICKLAYOUTGLOBAL_P_H diff --git a/src/imports/layouts/qquicklayoutstyleinfo.cpp b/src/quicklayouts/qquicklayoutstyleinfo.cpp index 1632c1ce20..1632c1ce20 100644 --- a/src/imports/layouts/qquicklayoutstyleinfo.cpp +++ b/src/quicklayouts/qquicklayoutstyleinfo.cpp diff --git a/src/imports/layouts/qquicklayoutstyleinfo_p.h b/src/quicklayouts/qquicklayoutstyleinfo_p.h index 79f4ce2962..79f4ce2962 100644 --- a/src/imports/layouts/qquicklayoutstyleinfo_p.h +++ b/src/quicklayouts/qquicklayoutstyleinfo_p.h diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/quicklayouts/qquicklinearlayout.cpp index 760700beaf..760700beaf 100644 --- a/src/imports/layouts/qquicklinearlayout.cpp +++ b/src/quicklayouts/qquicklinearlayout.cpp diff --git a/src/imports/layouts/qquicklinearlayout_p.h b/src/quicklayouts/qquicklinearlayout_p.h index 1780ba8807..803c727857 100644 --- a/src/imports/layouts/qquicklinearlayout_p.h +++ b/src/quicklayouts/qquicklinearlayout_p.h @@ -40,6 +40,7 @@ #ifndef QQUICKLINEARLAYOUT_P_H #define QQUICKLINEARLAYOUT_P_H +#include <QtQuickLayouts/private/qquicklayoutglobal_p.h> #include "qquicklayout_p.h" #include "qquickgridlayoutengine_p.h" @@ -52,7 +53,7 @@ QT_BEGIN_NAMESPACE **/ class QQuickGridLayoutBasePrivate; -class QQuickGridLayoutBase : public QQuickLayout +class Q_QUICKLAYOUT_PRIVATE_EXPORT QQuickGridLayoutBase : public QQuickLayout { Q_OBJECT @@ -136,7 +137,7 @@ public: ** **/ class QQuickGridLayoutPrivate; -class QQuickGridLayout : public QQuickGridLayoutBase +class Q_QUICKLAYOUT_PRIVATE_EXPORT QQuickGridLayout : public QQuickGridLayoutBase { Q_OBJECT @@ -227,7 +228,7 @@ public: ** QQuickRowLayout ** **/ -class QQuickRowLayout : public QQuickLinearLayout +class Q_QUICKLAYOUT_PRIVATE_EXPORT QQuickRowLayout : public QQuickLinearLayout { Q_OBJECT QML_NAMED_ELEMENT(RowLayout) @@ -244,7 +245,7 @@ public: ** QQuickColumnLayout ** **/ -class QQuickColumnLayout : public QQuickLinearLayout +class Q_QUICKLAYOUT_PRIVATE_EXPORT QQuickColumnLayout : public QQuickLinearLayout { Q_OBJECT QML_NAMED_ELEMENT(ColumnLayout) diff --git a/src/imports/layouts/qquickstacklayout.cpp b/src/quicklayouts/qquickstacklayout.cpp index 3a7e28789d..3a7e28789d 100644 --- a/src/imports/layouts/qquickstacklayout.cpp +++ b/src/quicklayouts/qquickstacklayout.cpp diff --git a/src/imports/layouts/qquickstacklayout_p.h b/src/quicklayouts/qquickstacklayout_p.h index a10f85ce43..a7d615b85b 100644 --- a/src/imports/layouts/qquickstacklayout_p.h +++ b/src/quicklayouts/qquickstacklayout_p.h @@ -40,6 +40,7 @@ #ifndef QQUICKSTACKLAYOUT_H #define QQUICKSTACKLAYOUT_H +#include <QtQuickLayouts/private/qquicklayoutglobal_p.h> #include <qquicklayout_p.h> QT_BEGIN_NAMESPACE @@ -47,7 +48,7 @@ QT_BEGIN_NAMESPACE class QQuickStackLayoutPrivate; class QQuickStackLayoutAttached; -class QQuickStackLayout : public QQuickLayout +class Q_QUICKLAYOUT_PRIVATE_EXPORT QQuickStackLayout : public QQuickLayout { Q_OBJECT Q_PROPERTY(int count READ count NOTIFY countChanged) |