diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-23 17:25:52 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-07-02 17:03:24 +0200 |
commit | 7814e1dbfd09ead88951d95f72e71f45fd27c920 (patch) | |
tree | 6bad033792bffbf03f7bb7611dace1358e8a0a10 /src/quick | |
parent | 974f52fc815f62868ddfe63f7391e3090f96b226 (diff) |
Make the qtquick and qtqml plugins optional
We can do the initialization and de-initialization as constructor and
destructor functions. Then we don't need to load the plugins.
Task-number: QTBUG-84639
Change-Id: I2aeeee7e8d028555e3af91e93518c2c2afd70dbb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/.prev_CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/quick/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/quick/qtquick2.cpp | 25 | ||||
-rw-r--r-- | src/quick/qtquick2_p.h | 67 | ||||
-rw-r--r-- | src/quick/qtquickglobal_p.h | 1 | ||||
-rw-r--r-- | src/quick/quick.pro | 3 | ||||
-rw-r--r-- | src/quick/util/qquickglobal.cpp | 7 |
7 files changed, 15 insertions, 93 deletions
diff --git a/src/quick/.prev_CMakeLists.txt b/src/quick/.prev_CMakeLists.txt index 87c2949f60..fa968dbe9d 100644 --- a/src/quick/.prev_CMakeLists.txt +++ b/src/quick/.prev_CMakeLists.txt @@ -37,6 +37,7 @@ qt_add_module(Quick items/qquickflickable_p_p.h items/qquickflickablebehavior_p.h items/qquickfocusscope.cpp items/qquickfocusscope_p.h + items/qquickgraphicsconfiguration.cpp items/qquickgraphicsconfiguration.h items/qquickgraphicsconfiguration_p.h items/qquickgraphicsdevice.cpp items/qquickgraphicsdevice.h items/qquickgraphicsdevice_p.h items/qquickgraphicsinfo.cpp items/qquickgraphicsinfo_p.h items/qquickimage.cpp items/qquickimage_p.h @@ -88,7 +89,7 @@ qt_add_module(Quick items/qquickwindowattached.cpp items/qquickwindowattached_p.h items/qquickwindowmodule.cpp items/qquickwindowmodule_p.h items/qquickwindowmodule_p_p.h - qtquick2.cpp qtquick2_p.h + qtquick2.cpp qtquickglobal.h qtquickglobal_p.h scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h scenegraph/adaptations/software/qsgsoftwareadaptation.cpp scenegraph/adaptations/software/qsgsoftwareadaptation_p.h diff --git a/src/quick/CMakeLists.txt b/src/quick/CMakeLists.txt index 3fc9110d0c..4eb0738c8d 100644 --- a/src/quick/CMakeLists.txt +++ b/src/quick/CMakeLists.txt @@ -89,7 +89,7 @@ qt_add_module(Quick items/qquickwindowattached.cpp items/qquickwindowattached_p.h items/qquickwindowmodule.cpp items/qquickwindowmodule_p.h items/qquickwindowmodule_p_p.h - qtquick2.cpp qtquick2_p.h + qtquick2.cpp qtquickglobal.h qtquickglobal_p.h scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h scenegraph/adaptations/software/qsgsoftwareadaptation.cpp scenegraph/adaptations/software/qsgsoftwareadaptation_p.h diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index f380aeed4b..1aebf70c24 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -37,7 +37,6 @@ ** ****************************************************************************/ -#include "qtquick2_p.h" #include <private/qqmlengine_p.h> #include <private/qquickvaluetypes_p.h> #include <private/qquickitemsmodule_p.h> @@ -60,11 +59,7 @@ Q_DECLARE_METATYPE(QKeySequence::StandardKey) QT_BEGIN_NAMESPACE -#if !QT_CONFIG(qml_debug) - -class QQmlQtQuick2DebugStatesDelegate : public QQmlDebugStatesDelegate {}; - -#else +#if QT_CONFIG(qml_debug) class QQmlQtQuick2DebugStatesDelegate : public QQmlDebugStatesDelegate { @@ -179,9 +174,14 @@ void QQmlQtQuick2DebugStatesDelegate::resetBindingForInvalidProperty(QObject *ob } } +static QQmlDebugStatesDelegate *statesDelegateFactory() +{ + return new QQmlQtQuick2DebugStatesDelegate; +} + #endif // QT_CONFIG(qml_debug) -void QQmlQtQuick2Module::defineModule() +static void defineQtQuickModule() { QQuick_initializeProviders(); @@ -195,15 +195,12 @@ void QQmlQtQuick2Module::defineModule() QAccessible::installFactory(&qQuickAccessibleFactory); #endif - QQmlEngineDebugService *debugService = QQmlDebugConnector::service<QQmlEngineDebugService>(); - if (debugService) - debugService->setStatesDelegate(new QQmlQtQuick2DebugStatesDelegate); +#if QT_CONFIG(qml_debug) + QQmlEngineDebugService::setStatesDelegateFactory(statesDelegateFactory); +#endif } -void QQmlQtQuick2Module::undefineModule() -{ - QQuick_deinitializeProviders(); -} +Q_CONSTRUCTOR_FUNCTION(defineQtQuickModule) QT_END_NAMESPACE diff --git a/src/quick/qtquick2_p.h b/src/quick/qtquick2_p.h deleted file mode 100644 index 9a775888ba..0000000000 --- a/src/quick/qtquick2_p.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 QTQUICK2_P_H -#define QTQUICK2_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 <private/qtquickglobal_p.h> - -QT_BEGIN_NAMESPACE - -class Q_QUICK_PRIVATE_EXPORT QQmlQtQuick2Module -{ -public: - static void defineModule(); - static void undefineModule(); -}; - -QT_END_NAMESPACE - -#endif // QTQUICK2_P_H diff --git a/src/quick/qtquickglobal_p.h b/src/quick/qtquickglobal_p.h index 80e59563c7..142e29ea83 100644 --- a/src/quick/qtquickglobal_p.h +++ b/src/quick/qtquickglobal_p.h @@ -66,7 +66,6 @@ void Q_QUICK_PRIVATE_EXPORT qml_register_types_QtQuick(); QT_BEGIN_NAMESPACE void QQuick_initializeProviders(); -void QQuick_deinitializeProviders(); Q_DECLARE_LOGGING_CATEGORY(DBG_TOUCH) Q_DECLARE_LOGGING_CATEGORY(DBG_MOUSE) diff --git a/src/quick/quick.pro b/src/quick/quick.pro index c117ed7a29..6eb6575326 100644 --- a/src/quick/quick.pro +++ b/src/quick/quick.pro @@ -44,8 +44,7 @@ qtConfig(accessibility) { HEADERS += \ qtquickglobal.h \ - qtquickglobal_p.h \ - qtquick2_p.h + qtquickglobal_p.h SOURCES += qtquick2.cpp diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 6896d3d3e4..9d97280061 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -926,11 +926,4 @@ void QQuick_initializeProviders() QQml_setGuiProvider(getGuiProvider()); } -void QQuick_deinitializeProviders() -{ - QQml_removeValueTypeProvider(getValueTypeProvider()); - QQml_setColorProvider(nullptr); // technically, another plugin may have overridden our providers - QQml_setGuiProvider(nullptr); // but we cannot handle that case in a sane way. -} - QT_END_NAMESPACE |